1
1
Fork 0

Log function

implement log() function.
This commit is contained in:
Adam Magness 2018-10-29 17:20:46 -04:00
commit 14fde5dc9b
122 changed files with 1280 additions and 1161 deletions

View file

@ -7,6 +7,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -29,7 +30,7 @@ function notification($params)
// Temporary logging for finding the origin
if (!isset($params['language']) || !isset($params['uid'])) {
logger('Missing parameters.' . System::callstack());
Logger::log('Missing parameters.' . System::callstack());
}
// Ensure that the important fields are set at any time
@ -37,7 +38,7 @@ function notification($params)
$user = DBA::selectFirst('user', $fields, ['uid' => $params['uid']]);
if (!DBA::isResult($user)) {
logger('Unknown user ' . $params['uid']);
Logger::log('Unknown user ' . $params['uid']);
return;
}
@ -133,7 +134,7 @@ function notification($params)
if ($params['type'] == NOTIFY_COMMENT) {
$thread = Item::selectFirstThreadForUser($params['uid'] ,['ignored'], ['iid' => $parent_id]);
if (DBA::isResult($thread) && $thread["ignored"]) {
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
Logger::log("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
L10n::popLang();
return;
}
@ -452,7 +453,7 @@ function notification($params)
$itemlink = $h['itemlink'];
if ($show_in_notification_page) {
logger("adding notification entry", LOGGER_DEBUG);
Logger::log("adding notification entry", LOGGER_DEBUG);
do {
$dups = false;
$hash = random_string();
@ -529,14 +530,14 @@ function notification($params)
|| $params['type'] == NOTIFY_SYSTEM
|| $params['type'] == SYSTEM_EMAIL) {
logger('sending notification email');
Logger::log('sending notification email');
if (isset($params['parent']) && (intval($params['parent']) != 0)) {
$id_for_parent = $params['parent']."@".$hostname;
// Is this the first email notification for this parent item and user?
if (!DBA::exists('notify-threads', ['master-parent-item' => $params['parent'], 'receiver-uid' => $params['uid']])) {
logger("notify_id:".intval($notify_id).", parent: ".intval($params['parent'])."uid: ".intval($params['uid']), LOGGER_DEBUG);
Logger::log("notify_id:".intval($notify_id).", parent: ".intval($params['parent'])."uid: ".intval($params['uid']), LOGGER_DEBUG);
$fields = ['notify-id' => $notify_id, 'master-parent-item' => $params['parent'],
'receiver-uid' => $params['uid'], 'parent-item' => 0];
@ -545,11 +546,11 @@ function notification($params)
$additional_mail_header .= "Message-ID: <${id_for_parent}>\n";
$log_msg = "include/enotify: No previous notification found for this parent:\n".
" parent: ${params['parent']}\n"." uid : ${params['uid']}\n";
logger($log_msg, LOGGER_DEBUG);
Logger::log($log_msg, LOGGER_DEBUG);
} else {
// If not, just "follow" the thread.
$additional_mail_header .= "References: <${id_for_parent}>\nIn-Reply-To: <${id_for_parent}>\n";
logger("There's already a notification for this parent.", LOGGER_DEBUG);
Logger::log("There's already a notification for this parent.", LOGGER_DEBUG);
}
}