Browse Source

Logger Levels

update logger levels in calls
tags/2019.01
Adam Magness 2 years ago
parent
commit
50da89d861
86 changed files with 673 additions and 673 deletions
  1. +6
    -6
      bin/daemon.php
  2. +29
    -29
      include/api.php
  3. +1
    -1
      include/conversation.php
  4. +5
    -5
      include/enotify.php
  5. +6
    -6
      include/items.php
  6. +1
    -1
      mod/acl.php
  7. +8
    -8
      mod/admin.php
  8. +3
    -3
      mod/dfrn_confirm.php
  9. +10
    -10
      mod/dfrn_notify.php
  10. +6
    -6
      mod/dfrn_poll.php
  11. +1
    -1
      mod/dfrn_request.php
  12. +1
    -1
      mod/display.php
  13. +1
    -1
      mod/events.php
  14. +4
    -4
      mod/item.php
  15. +5
    -5
      mod/nodeinfo.php
  16. +1
    -1
      mod/openid.php
  17. +8
    -8
      mod/photos.php
  18. +5
    -5
      mod/poco.php
  19. +1
    -1
      mod/poke.php
  20. +1
    -1
      mod/profile.php
  21. +2
    -2
      mod/pubsub.php
  22. +7
    -7
      mod/receive.php
  23. +4
    -4
      mod/redir.php
  24. +2
    -2
      mod/salmon.php
  25. +4
    -4
      mod/search.php
  26. +1
    -1
      mod/statistics_json.php
  27. +5
    -5
      mod/wall_upload.php
  28. +11
    -11
      src/App.php
  29. +2
    -2
      src/BaseModule.php
  30. +7
    -7
      src/Content/Text/BBCode.php
  31. +2
    -2
      src/Core/Authentication.php
  32. +2
    -2
      src/Core/Cache/MemcachedCacheDriver.php
  33. +1
    -1
      src/Core/NotificationsManager.php
  34. +1
    -1
      src/Core/Session/CacheSessionHandler.php
  35. +1
    -1
      src/Core/Session/DatabaseSessionHandler.php
  36. +9
    -9
      src/Core/UserImport.php
  37. +32
    -32
      src/Core/Worker.php
  38. +3
    -3
      src/Database/DBA.php
  39. +3
    -3
      src/Database/DBStructure.php
  40. +17
    -17
      src/Database/PostUpdate.php
  41. +1
    -1
      src/Model/APContact.php
  42. +2
    -2
      src/Model/Contact.php
  43. +2
    -2
      src/Model/Conversation.php
  44. +1
    -1
      src/Model/Event.php
  45. +12
    -12
      src/Model/GContact.php
  46. +38
    -38
      src/Model/Item.php
  47. +9
    -9
      src/Model/Profile.php
  48. +5
    -5
      src/Model/PushSubscriber.php
  49. +1
    -1
      src/Model/User.php
  50. +4
    -4
      src/Module/Magic.php
  51. +4
    -4
      src/Module/Owa.php
  52. +3
    -3
      src/Network/CurlResult.php
  53. +1
    -1
      src/Network/FKOAuth1.php
  54. +22
    -22
      src/Network/Probe.php
  55. +9
    -9
      src/Object/Image.php
  56. +5
    -5
      src/Object/Post.php
  57. +6
    -6
      src/Object/Thread.php
  58. +15
    -15
      src/Protocol/ActivityPub/Processor.php
  59. +32
    -32
      src/Protocol/ActivityPub/Receiver.php
  60. +7
    -7
      src/Protocol/ActivityPub/Transmitter.php
  61. +40
    -40
      src/Protocol/DFRN.php
  62. +70
    -70
      src/Protocol/Diaspora.php
  63. +3
    -3
      src/Protocol/Email.php
  64. +6
    -6
      src/Protocol/Feed.php
  65. +34
    -34
      src/Protocol/OStatus.php
  66. +33
    -33
      src/Protocol/PortableContact.php
  67. +2
    -2
      src/Util/Emailer.php
  68. +3
    -3
      src/Util/HTTPSignature.php
  69. +2
    -2
      src/Util/JsonLD.php
  70. +5
    -5
      src/Util/Network.php
  71. +3
    -3
      src/Util/ParseUrl.php
  72. +4
    -4
      src/Util/XML.php
  73. +1
    -1
      src/Worker/APDelivery.php
  74. +2
    -2
      src/Worker/CheckVersion.php
  75. +5
    -5
      src/Worker/CronJobs.php
  76. +3
    -3
      src/Worker/Delivery.php
  77. +1
    -1
      src/Worker/Directory.php
  78. +10
    -10
      src/Worker/DiscoverPoCo.php
  79. +11
    -11
      src/Worker/Expire.php
  80. +3
    -3
      src/Worker/GProbe.php
  81. +17
    -17
      src/Worker/Notifier.php
  82. +12
    -12
      src/Worker/OnePoll.php
  83. +1
    -1
      src/Worker/ProfileUpdate.php
  84. +2
    -2
      src/Worker/PubSubPublish.php
  85. +1
    -1
      src/Worker/SpoolPost.php
  86. +1
    -1
      view/theme/vier/style.php

+ 6
- 6
bin/daemon.php View File

@@ -98,7 +98,7 @@ if ($mode == "stop") {

unlink($pidfile);

Logger::log("Worker daemon process $pid was killed.", LOGGER_DEBUG);
Logger::log("Worker daemon process $pid was killed.", Logger::DEBUG);

Config::set('system', 'worker_daemon_mode', false);
die("Worker daemon process $pid was killed.\n");
@@ -108,7 +108,7 @@ if (!empty($pid) && posix_kill($pid, 0)) {
die("Daemon process $pid is already running.\n");
}

Logger::log('Starting worker daemon.', LOGGER_DEBUG);
Logger::log('Starting worker daemon.', Logger::DEBUG);

if (!$foreground) {
echo "Starting worker daemon.\n";
@@ -156,7 +156,7 @@ $last_cron = 0;
// Now running as a daemon.
while (true) {
if (!$do_cron && ($last_cron + $wait_interval) < time()) {
Logger::log('Forcing cron worker call.', LOGGER_DEBUG);
Logger::log('Forcing cron worker call.', Logger::DEBUG);
$do_cron = true;
}

@@ -170,7 +170,7 @@ while (true) {
$last_cron = time();
}

Logger::log("Sleeping", LOGGER_DEBUG);
Logger::log("Sleeping", Logger::DEBUG);
$start = time();
do {
$seconds = (time() - $start);
@@ -187,10 +187,10 @@ while (true) {

if ($timeout) {
$do_cron = true;
Logger::log("Woke up after $wait_interval seconds.", LOGGER_DEBUG);
Logger::log("Woke up after $wait_interval seconds.", Logger::DEBUG);
} else {
$do_cron = false;
Logger::log("Worker jobs are calling to be forked.", LOGGER_DEBUG);
Logger::log("Worker jobs are calling to be forked.", Logger::DEBUG);
}
}



+ 29
- 29
include/api.php View File

@@ -97,9 +97,9 @@ function api_source()
return "Twidere";
}

Logger::log("Unrecognized user-agent ".$_SERVER['HTTP_USER_AGENT'], LOGGER_DEBUG);
Logger::log("Unrecognized user-agent ".$_SERVER['HTTP_USER_AGENT'], Logger::DEBUG);
} else {
Logger::log("Empty user-agent", LOGGER_DEBUG);
Logger::log("Empty user-agent", Logger::DEBUG);
}

return "api";
@@ -195,7 +195,7 @@ function api_login(App $a)
}

if (!x($_SERVER, 'PHP_AUTH_USER')) {
Logger::log('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG);
Logger::log('API_login: ' . print_r($_SERVER, true), Logger::DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
throw new UnauthorizedException("This API requires login");
}
@@ -236,7 +236,7 @@ function api_login(App $a)
}

if (!DBA::isResult($record)) {
Logger::log('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
Logger::log('API_login failure: ' . print_r($_SERVER, true), Logger::DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
//header('HTTP/1.0 401 Unauthorized');
//die('This api requires login');
@@ -315,7 +315,7 @@ function api_call(App $a)
$stamp = microtime(true);
$return = call_user_func($info['func'], $type);
$duration = (float) (microtime(true) - $stamp);
Logger::log("API call duration: " . round($duration, 2) . "\t" . $a->query_string, LOGGER_DEBUG);
Logger::log("API call duration: " . round($duration, 2) . "\t" . $a->query_string, Logger::DEBUG);

if (Config::get("system", "profiler")) {
$duration = microtime(true)-$a->performance["start"];
@@ -335,7 +335,7 @@ function api_call(App $a)
+ $a->performance["network"] + $a->performance["file"]), 2),
round($duration, 2)
),
LOGGER_DEBUG
Logger::DEBUG
);

if (Config::get("rendertime", "callstack")) {
@@ -376,7 +376,7 @@ function api_call(App $a)
$o .= $func . ": " . $time . "\n";
}
}
Logger::log($o, LOGGER_DEBUG);
Logger::log($o, Logger::DEBUG);
}
}

@@ -522,7 +522,7 @@ function api_get_user(App $a, $contact_id = null)
$extra_query = "";
$url = "";

Logger::log("api_get_user: Fetching user data for user ".$contact_id, LOGGER_DEBUG);
Logger::log("api_get_user: Fetching user data for user ".$contact_id, Logger::DEBUG);

// Searching for contact URL
if (!is_null($contact_id) && (intval($contact_id) == 0)) {
@@ -606,7 +606,7 @@ function api_get_user(App $a, $contact_id = null)
}
}

Logger::log("api_get_user: user ".$user, LOGGER_DEBUG);
Logger::log("api_get_user: user ".$user, Logger::DEBUG);

if (!$user) {
if (api_user() === false) {
@@ -1136,7 +1136,7 @@ function api_statuses_update($type)
$posts_day = DBA::count('thread', $condition);

if ($posts_day > $throttle_day) {
Logger::log('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
Logger::log('Daily posting limit reached for user '.api_user(), Logger::DEBUG);
// die(api_error($type, L10n::t("Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
throw new TooManyRequestsException(L10n::tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
}
@@ -1150,7 +1150,7 @@ function api_statuses_update($type)
$posts_week = DBA::count('thread', $condition);

if ($posts_week > $throttle_week) {
Logger::log('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
Logger::log('Weekly posting limit reached for user '.api_user(), Logger::DEBUG);
// die(api_error($type, L10n::t("Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week)));
throw new TooManyRequestsException(L10n::tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week));
}
@@ -1164,7 +1164,7 @@ function api_statuses_update($type)
$posts_month = DBA::count('thread', $condition);

if ($posts_month > $throttle_month) {
Logger::log('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
Logger::log('Monthly posting limit reached for user '.api_user(), Logger::DEBUG);
// die(api_error($type, L10n::t("Monthly posting limit of %d posts reached. The post was rejected.", $throttle_month));
throw new TooManyRequestsException(L10n::t("Monthly posting limit of %d post reached. The post was rejected.", "Monthly posting limit of %d posts reached. The post was rejected.", $throttle_month));
}
@@ -1249,7 +1249,7 @@ function api_media_upload()
"h" => $media["height"],
"image_type" => $media["type"]];

Logger::log("Media uploaded: " . print_r($returndata, true), LOGGER_DEBUG);
Logger::log("Media uploaded: " . print_r($returndata, true), Logger::DEBUG);

return ["media" => $returndata];
}
@@ -1269,7 +1269,7 @@ function api_status_show($type, $item_id = 0)

$user_info = api_get_user($a);

Logger::log('api_status_show: user_info: '.print_r($user_info, true), LOGGER_DEBUG);
Logger::log('api_status_show: user_info: '.print_r($user_info, true), Logger::DEBUG);

if ($type == "raw") {
$privacy_sql = "AND NOT `private`";
@@ -1345,7 +1345,7 @@ function api_status_show($type, $item_id = 0)
unset($status_info["user"]["uid"]);
unset($status_info["user"]["self"]);

Logger::log('status_info: '.print_r($status_info, true), LOGGER_DEBUG);
Logger::log('status_info: '.print_r($status_info, true), Logger::DEBUG);

if ($type == "raw") {
return $status_info;
@@ -2142,7 +2142,7 @@ function api_statuses_user_timeline($type)
"api_statuses_user_timeline: api_user: ". api_user() .
"\nuser_info: ".print_r($user_info, true) .
"\n_REQUEST: ".print_r($_REQUEST, true),
LOGGER_DEBUG
Logger::DEBUG
);

$since_id = x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0;
@@ -3650,7 +3650,7 @@ function api_friendships_destroy($type)
$contact_id = defaults($_REQUEST, 'user_id');

if (empty($contact_id)) {
Logger::log("No user_id specified", LOGGER_DEBUG);
Logger::log("No user_id specified", Logger::DEBUG);
throw new BadRequestException("no user_id specified");
}

@@ -3658,7 +3658,7 @@ function api_friendships_destroy($type)
$contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id, 'uid' => 0, 'self' => false]);

if(!DBA::isResult($contact)) {
Logger::log("No contact found for ID" . $contact_id, LOGGER_DEBUG);
Logger::log("No contact found for ID" . $contact_id, Logger::DEBUG);
throw new NotFoundException("no contact found to given ID");
}

@@ -3670,12 +3670,12 @@ function api_friendships_destroy($type)
$contact = DBA::selectFirst('contact', [], $condition);

if (!DBA::isResult($contact)) {
Logger::log("Not following Contact", LOGGER_DEBUG);
Logger::log("Not following Contact", Logger::DEBUG);
throw new NotFoundException("Not following Contact");
}

if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
Logger::log("Not supported", LOGGER_DEBUG);
Logger::log("Not supported", Logger::DEBUG);
throw new ExpectationFailedException("Not supported");
}

@@ -3686,7 +3686,7 @@ function api_friendships_destroy($type)
Contact::terminateFriendship($owner, $contact, $dissolve);
}
else {
Logger::log("No owner found", LOGGER_DEBUG);
Logger::log("No owner found", Logger::DEBUG);
throw new NotFoundException("Error Processing Request");
}

@@ -4489,7 +4489,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
Logger::log(
"File upload src: " . $src . " - filename: " . $filename .
" - size: " . $filesize . " - type: " . $filetype,
LOGGER_DEBUG
Logger::DEBUG
);

// check if there was a php upload error
@@ -4521,7 +4521,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
Logger::log("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
Logger::log("File upload: Scaling picture to new size " . $max_length, Logger::DEBUG);
}
$width = $Image->getWidth();
$height = $Image->getHeight();
@@ -4531,7 +4531,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $

if ($mediatype == "photo") {
// upload normal image (scales 0, 1, 2)
Logger::log("photo upload: starting new photo upload", LOGGER_DEBUG);
Logger::log("photo upload: starting new photo upload", Logger::DEBUG);

$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
@@ -4552,10 +4552,10 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
Logger::log("photo upload: image upload with scale 2 (320x320) failed");
}
}
Logger::log("photo upload: new photo upload ended", LOGGER_DEBUG);
Logger::log("photo upload: new photo upload ended", Logger::DEBUG);
} elseif ($mediatype == "profileimage") {
// upload profile image (scales 4, 5, 6)
Logger::log("photo upload: starting new profile image upload", LOGGER_DEBUG);
Logger::log("photo upload: starting new profile image upload", Logger::DEBUG);

if ($width > 300 || $height > 300) {
$Image->scaleDown(300);
@@ -4581,7 +4581,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
}
}
$Image->__destruct();
Logger::log("photo upload: new profile image upload ended", LOGGER_DEBUG);
Logger::log("photo upload: new profile image upload ended", Logger::DEBUG);
}

if (isset($r) && $r) {
@@ -4808,7 +4808,7 @@ function api_friendica_remoteauth()
'sec' => $sec, 'expire' => time() + 45];
DBA::insert('profile_check', $fields);

Logger::log($contact['name'] . ' ' . $sec, LOGGER_DEBUG);
Logger::log($contact['name'] . ' ' . $sec, Logger::DEBUG);
$dest = ($url ? '&destination_url=' . $url : '');

System::externalRedirect(
@@ -5056,7 +5056,7 @@ function api_in_reply_to($item)
// https://github.com/friendica/friendica/issues/1010
// This is a bugfix for that.
if (intval($in_reply_to['status_id']) == intval($item['id'])) {
Logger::log('this message should never appear: id: '.$item['id'].' similar to reply-to: '.$in_reply_to['status_id'], LOGGER_DEBUG);
Logger::log('this message should never appear: id: '.$item['id'].' similar to reply-to: '.$in_reply_to['status_id'], Logger::DEBUG);
$in_reply_to['status_id'] = null;
$in_reply_to['user_id'] = null;
$in_reply_to['status_id_str'] = null;


+ 1
- 1
include/conversation.php View File

@@ -752,7 +752,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ

$threads = $conv->getTemplateData($conv_responses);
if (!$threads) {
Logger::log('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
Logger::log('[ERROR] conversation : Failed to get template data.', Logger::DEBUG);
$threads = [];
}
}


+ 5
- 5
include/enotify.php View File

@@ -134,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::log("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
Logger::log("Thread ".$parent_id." will be ignored", Logger::DEBUG);
L10n::popLang();
return;
}
@@ -453,7 +453,7 @@ function notification($params)
$itemlink = $h['itemlink'];

if ($show_in_notification_page) {
Logger::log("adding notification entry", LOGGER_DEBUG);
Logger::log("adding notification entry", Logger::DEBUG);
do {
$dups = false;
$hash = random_string();
@@ -537,7 +537,7 @@ function notification($params)

// 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::log("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];
@@ -546,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($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::log("There's already a notification for this parent.", LOGGER_DEBUG);
Logger::log("There's already a notification for this parent.", Logger::DEBUG);
}
}



+ 6
- 6
include/items.php View File

@@ -110,7 +110,7 @@ function query_page_info($url, $photo = "", $keywords = false, $keyword_blacklis
$data["images"][0]["src"] = $photo;
}

Logger::log('fetch page info for ' . $url . ' ' . print_r($data, true), LOGGER_DEBUG);
Logger::log('fetch page info for ' . $url . ' ' . print_r($data, true), Logger::DEBUG);

if (!$keywords && isset($data["keywords"])) {
unset($data["keywords"]);
@@ -168,7 +168,7 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false,

function add_page_info_to_body($body, $texturl = false, $no_photos = false)
{
Logger::log('add_page_info_to_body: fetch page info for body ' . $body, LOGGER_DEBUG);
Logger::log('add_page_info_to_body: fetch page info for body ' . $body, Logger::DEBUG);

$URLSearchString = "^\[\]";

@@ -252,7 +252,7 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0
// Test - remove before flight
//$tempfile = tempnam(get_temppath(), "ostatus2");
//file_put_contents($tempfile, $xml);
Logger::log("Consume OStatus messages ", LOGGER_DEBUG);
Logger::log("Consume OStatus messages ", Logger::DEBUG);
OStatus::import($xml, $importer, $contact, $hub);
}

@@ -261,7 +261,7 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0

if ($contact['network'] === Protocol::FEED) {
if ($pass < 2) {
Logger::log("Consume feeds", LOGGER_DEBUG);
Logger::log("Consume feeds", Logger::DEBUG);
Feed::import($xml, $importer, $contact, $hub);
}

@@ -269,7 +269,7 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0
}

if ($contact['network'] === Protocol::DFRN) {
Logger::log("Consume DFRN messages", LOGGER_DEBUG);
Logger::log("Consume DFRN messages", Logger::DEBUG);
$dfrn_importer = DFRN::getImporter($contact["id"], $importer["uid"]);
if (!empty($dfrn_importer)) {
Logger::log("Now import the DFRN feed");
@@ -319,7 +319,7 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub

$postResult = Network::post($url, $params);

Logger::log('subscribe_to_hub: returns: ' . $postResult->getReturnCode(), LOGGER_DEBUG);
Logger::log('subscribe_to_hub: returns: ' . $postResult->getReturnCode(), Logger::DEBUG);

return;



+ 1
- 1
mod/acl.php View File

@@ -35,7 +35,7 @@ function acl_content(App $a)
$search = $_REQUEST['query'];
}

Logger::log("Searching for ".$search." - type ".$type." conversation ".$conv_id, LOGGER_DEBUG);
Logger::log("Searching for ".$search." - type ".$type." conversation ".$conv_id, Logger::DEBUG);

if ($search != '') {
$sql_extra = "AND `name` LIKE '%%" . DBA::escape($search) . "%%'";


+ 8
- 8
mod/admin.php View File

@@ -911,7 +911,7 @@ function admin_page_summary(App $a)
$users+= $u['count'];
}

Logger::log('accounts: ' . print_r($accounts, true), LOGGER_DATA);
Logger::log('accounts: ' . print_r($accounts, true), Logger::DATA);

$pending = Register::getPendingCount();

@@ -2400,12 +2400,12 @@ function admin_page_logs_post(App $a)
function admin_page_logs(App $a)
{
$log_choices = [
LOGGER_WARNING => 'Warning',
LOGGER_INFO => 'Info',
LOGGER_TRACE => 'Trace',
LOGGER_DEBUG => 'Debug',
LOGGER_DATA => 'Data',
LOGGER_ALL => 'All'
Logger::WARNING => 'Warning',
Logger::INFO => 'Info',
Logger::TRACE => 'Trace',
Logger::DEBUG => 'Debug',
Logger::DATA => 'Data',
Logger::ALL => 'All'
];

if (ini_get('log_errors')) {
@@ -2500,7 +2500,7 @@ function admin_page_features_post(App $a)
{
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features');

Logger::log('postvars: ' . print_r($_POST, true), LOGGER_DATA);
Logger::log('postvars: ' . print_r($_POST, true), Logger::DATA);

$features = Feature::get(false);



+ 3
- 3
mod/dfrn_confirm.php View File

@@ -212,7 +212,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$params['page'] = 2;
}

Logger::log('Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params, true), LOGGER_DATA);
Logger::log('Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params, true), Logger::DATA);

/*
*
@@ -224,7 +224,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)

$res = Network::post($dfrn_confirm, $params, null, $redirects, 120)->getBody();

Logger::log(' Confirm: received data: ' . $res, LOGGER_DATA);
Logger::log(' Confirm: received data: ' . $res, Logger::DATA);

// Now figure out what they responded. Try to be robust if the remote site is
// having difficulty and throwing up errors of some kind.
@@ -430,7 +430,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)

Logger::log('dfrn_confirm: requestee contacted: ' . $node);

Logger::log('dfrn_confirm: request: POST=' . print_r($_POST, true), LOGGER_DATA);
Logger::log('dfrn_confirm: request: POST=' . print_r($_POST, true), Logger::DATA);

// If $aes_key is set, both of these items require unpacking from the hex transport encoding.



+ 10
- 10
mod/dfrn_notify.php View File

@@ -18,7 +18,7 @@ use Friendica\Protocol\Diaspora;
require_once 'include/items.php';

function dfrn_notify_post(App $a) {
Logger::log(__function__, LOGGER_TRACE);
Logger::log(__function__, Logger::TRACE);

$postdata = file_get_contents('php://input');

@@ -118,7 +118,7 @@ function dfrn_notify_post(App $a) {

$importer = Contact::updateSslPolicy($importer, $ssl_policy);

Logger::log('data: ' . $data, LOGGER_DATA);
Logger::log('data: ' . $data, Logger::DATA);

if ($dissolve == 1) {
// Relationship is dissolved permanently
@@ -140,7 +140,7 @@ function dfrn_notify_post(App $a) {
}

$rawkey = hex2bin(trim($key));
Logger::log('rino: md5 raw key: ' . md5($rawkey), LOGGER_DATA);
Logger::log('rino: md5 raw key: ' . md5($rawkey), Logger::DATA);

$final_key = '';

@@ -170,10 +170,10 @@ function dfrn_notify_post(App $a) {
System::xmlExit(0, "Invalid sent version '$rino_remote'");
}

Logger::log('rino: decrypted data: ' . $data, LOGGER_DATA);
Logger::log('rino: decrypted data: ' . $data, Logger::DATA);
}

Logger::log('Importing post from ' . $importer['addr'] . ' to ' . $importer['nickname'] . ' with the RINO ' . $rino_remote . ' encryption.', LOGGER_DEBUG);
Logger::log('Importing post from ' . $importer['addr'] . ' to ' . $importer['nickname'] . ' with the RINO ' . $rino_remote . ' encryption.', Logger::DEBUG);

$ret = DFRN::import($data, $importer);
System::xmlExit($ret, 'Processed');
@@ -204,7 +204,7 @@ function dfrn_dispatch_public($postdata)
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}

Logger::log('Importing post from ' . $msg['author'] . ' with the public envelope.', LOGGER_DEBUG);
Logger::log('Importing post from ' . $msg['author'] . ' with the public envelope.', Logger::DEBUG);

// Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer);
@@ -237,7 +237,7 @@ function dfrn_dispatch_private($user, $postdata)
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}

Logger::log('Importing post from ' . $msg['author'] . ' to ' . $user['nickname'] . ' with the private envelope.', LOGGER_DEBUG);
Logger::log('Importing post from ' . $msg['author'] . ' to ' . $user['nickname'] . ' with the private envelope.', Logger::DEBUG);

// Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer);
@@ -277,7 +277,7 @@ function dfrn_notify_content(App $a) {
'type' => $type, 'last_update' => $last_update];
DBA::insert('challenge', $fields);

Logger::log('challenge=' . $hash, LOGGER_DATA);
Logger::log('challenge=' . $hash, Logger::DATA);

$user = DBA::selectFirst('user', ['uid'], ['nickname' => $a->argv[1]]);
if (!DBA::isResult($user)) {
@@ -317,7 +317,7 @@ function dfrn_notify_content(App $a) {
killme();
}

Logger::log("Remote rino version: ".$rino_remote." for ".$importer["url"], LOGGER_DATA);
Logger::log("Remote rino version: ".$rino_remote." for ".$importer["url"], Logger::DATA);

$challenge = '';
$encrypted_id = '';
@@ -345,7 +345,7 @@ function dfrn_notify_content(App $a) {
$rino = Config::get('system', 'rino_encrypt');
$rino = intval($rino);

Logger::log("Local rino version: ". $rino, LOGGER_DATA);
Logger::log("Local rino version: ". $rino, Logger::DATA);

// if requested rino is lower than enabled local rino, lower local rino version
// if requested rino is higher than enabled local rino, reply with local rino


+ 6
- 6
mod/dfrn_poll.php View File

@@ -105,7 +105,7 @@ function dfrn_poll_init(App $a)
if (DBA::isResult($r)) {
$s = Network::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');

Logger::log("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
Logger::log("dfrn_poll: old profile returns " . $s, Logger::DATA);

if (strlen($s)) {
$xml = XML::parseString($s);
@@ -192,7 +192,7 @@ function dfrn_poll_init(App $a)
}

if ($final_dfrn_id != $orig_id) {
Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, Logger::DEBUG);
// did not decode properly - cannot trust this site
System::xmlExit(3, 'Bad decryption');
}
@@ -284,7 +284,7 @@ function dfrn_poll_post(App $a)
}

if ($final_dfrn_id != $orig_id) {
Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, Logger::DEBUG);
// did not decode properly - cannot trust this site
System::xmlExit(3, 'Bad decryption');
}
@@ -373,7 +373,7 @@ function dfrn_poll_post(App $a)
// NOTREACHED
} else {
// Update the writable flag if it changed
Logger::log('dfrn_poll: post request feed: ' . print_r($_POST, true), LOGGER_DATA);
Logger::log('dfrn_poll: post request feed: ' . print_r($_POST, true), Logger::DATA);
if ($dfrn_version >= 2.21) {
if ($perm === 'rw') {
$writable = 1;
@@ -511,12 +511,12 @@ function dfrn_poll_content(App $a)
])->getBody();
}

Logger::log("dfrn_poll: sec profile: " . $s, LOGGER_DATA);
Logger::log("dfrn_poll: sec profile: " . $s, Logger::DATA);

if (strlen($s) && strstr($s, '<?xml')) {
$xml = XML::parseString($s);

Logger::log('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), LOGGER_DATA);
Logger::log('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), Logger::DATA);

Logger::log('dfrn_poll: secure profile: challenge: ' . $xml->challenge . ' expecting ' . $hash);
Logger::log('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec);


+ 1
- 1
mod/dfrn_request.php View File

@@ -298,7 +298,7 @@ function dfrn_request_post(App $a)
$network = Protocol::DFRN;
}

Logger::log('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
Logger::log('dfrn_request: url: ' . $url . ',network=' . $network, Logger::DEBUG);

if ($network === Protocol::DFRN) {
$ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",


+ 1
- 1
mod/display.php View File

@@ -75,7 +75,7 @@ function display_init(App $a)
}

if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
Logger::log('Directly serving XML for id '.$item["id"], LOGGER_DEBUG);
Logger::log('Directly serving XML for id '.$item["id"], Logger::DEBUG);
displayShowFeed($item["id"], false);
}



+ 1
- 1
mod/events.php View File

@@ -48,7 +48,7 @@ function events_init(App $a)
function events_post(App $a)
{

Logger::log('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
Logger::log('post: ' . print_r($_REQUEST, true), Logger::DATA);

if (!local_user()) {
return;


+ 4
- 4
mod/item.php View File

@@ -57,7 +57,7 @@ function item_post(App $a) {

Addon::callHooks('post_local_start', $_REQUEST);

Logger::log('postvars ' . print_r($_REQUEST, true), LOGGER_DATA);
Logger::log('postvars ' . print_r($_REQUEST, true), Logger::DATA);

$api_source = defaults($_REQUEST, 'api_source', false);

@@ -73,7 +73,7 @@ function item_post(App $a) {
*/
if (!$preview && !empty($_REQUEST['post_id_random'])) {
if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
Logger::log("item post: duplicate post", LOGGER_DEBUG);
Logger::log("item post: duplicate post", Logger::DEBUG);
item_post_return(System::baseUrl(), $api_source, $return_path);
} else {
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
@@ -154,7 +154,7 @@ function item_post(App $a) {
// Check for multiple posts with the same message id (when the post was created via API)
if (($message_id != '') && ($profile_uid != 0)) {
if (Item::exists(['uri' => $message_id, 'uid' => $profile_uid])) {
Logger::log("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
Logger::log("Message with URI ".$message_id." already exists for user ".$profile_uid, Logger::DEBUG);
return 0;
}
}
@@ -862,7 +862,7 @@ function item_post_return($baseurl, $api_source, $return_path)
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
}

Logger::log('post_json: ' . print_r($json, true), LOGGER_DEBUG);
Logger::log('post_json: ' . print_r($json, true), Logger::DEBUG);

echo json_encode($json);
killme();


+ 5
- 5
mod/nodeinfo.php View File

@@ -204,22 +204,22 @@ function nodeinfo_cron() {
Config::set('nodeinfo', 'active_users_halfyear', $active_users_halfyear);
Config::set('nodeinfo', 'active_users_monthly', $active_users_monthly);

Logger::log('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
Logger::log('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, Logger::DEBUG);
}

$local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_posts', $local_posts);
Logger::log('local_posts: ' . $local_posts, LOGGER_DEBUG);
Logger::log('local_posts: ' . $local_posts, Logger::DEBUG);

$local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_comments', $local_comments);
Logger::log('local_comments: ' . $local_comments, LOGGER_DEBUG);
Logger::log('local_comments: ' . $local_comments, Logger::DEBUG);

// Now trying to register
$url = 'http://the-federation.info/register/'.$a->getHostName();
Logger::log('registering url: '.$url, LOGGER_DEBUG);
Logger::log('registering url: '.$url, Logger::DEBUG);
$ret = Network::fetchUrl($url);
Logger::log('registering answer: '.$ret, LOGGER_DEBUG);
Logger::log('registering answer: '.$ret, Logger::DEBUG);

Logger::log('cron_end');
}

+ 1
- 1
mod/openid.php View File

@@ -17,7 +17,7 @@ function openid_content(App $a) {
if($noid)
$a->internalRedirect();

Logger::log('mod_openid ' . print_r($_REQUEST,true), LOGGER_DATA);
Logger::log('mod_openid ' . print_r($_REQUEST,true), Logger::DATA);

if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {



+ 8
- 8
mod/photos.php View File

@@ -142,9 +142,9 @@ function photos_init(App $a) {

function photos_post(App $a)
{
Logger::log('mod-photos: photos_post: begin' , LOGGER_DEBUG);
Logger::log('mod_photos: REQUEST ' . print_r($_REQUEST, true), LOGGER_DATA);
Logger::log('mod_photos: FILES ' . print_r($_FILES, true), LOGGER_DATA);
Logger::log('mod-photos: photos_post: begin' , Logger::DEBUG);
Logger::log('mod_photos: REQUEST ' . print_r($_REQUEST, true), Logger::DATA);
Logger::log('mod_photos: FILES ' . print_r($_FILES, true), Logger::DATA);

$phototypes = Image::supportedTypes();

@@ -707,7 +707,7 @@ function photos_post(App $a)
$album = !empty($_REQUEST['album']) ? notags(trim($_REQUEST['album'])) : '';
$newalbum = !empty($_REQUEST['newalbum']) ? notags(trim($_REQUEST['newalbum'])) : '';

Logger::log('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , LOGGER_DEBUG);
Logger::log('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , Logger::DEBUG);

if (!strlen($album)) {
if (strlen($newalbum)) {
@@ -800,7 +800,7 @@ function photos_post(App $a)
$type = Image::guessType($filename);
}

Logger::log('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
Logger::log('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', Logger::DEBUG);

$maximagesize = Config::get('system', 'maximagesize');

@@ -820,14 +820,14 @@ function photos_post(App $a)
return;
}

Logger::log('mod/photos.php: photos_post(): loading the contents of ' . $src , LOGGER_DEBUG);
Logger::log('mod/photos.php: photos_post(): loading the contents of ' . $src , Logger::DEBUG);

$imagedata = @file_get_contents($src);

$image = new Image($imagedata, $type);

if (!$image->isValid()) {
Logger::log('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
Logger::log('mod/photos.php: photos_post(): unable to process image' , Logger::DEBUG);
notice(L10n::t('Unable to process image.') . EOL);
@unlink($src);
$foo = 0;
@@ -856,7 +856,7 @@ function photos_post(App $a)
$r = Photo::store($image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);

if (!$r) {
Logger::log('mod/photos.php: photos_post(): image store failed', LOGGER_DEBUG);
Logger::log('mod/photos.php: photos_post(): image store failed', Logger::DEBUG);
notice(L10n::t('Image upload failed.') . EOL);
killme();
}


+ 5
- 5
mod/poco.php View File

@@ -122,7 +122,7 @@ function poco_init(App $a) {
$itemsPerPage = ((x($_GET, 'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);

if ($global) {
Logger::log("Start global query", LOGGER_DEBUG);
Logger::log("Start global query", Logger::DEBUG);
$contacts = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
ORDER BY `updated` DESC LIMIT %d, %d",
DBA::escape($update_limit),
@@ -133,7 +133,7 @@ function poco_init(App $a) {
intval($itemsPerPage)
);
} elseif ($system_mode) {
Logger::log("Start system mode query", LOGGER_DEBUG);
Logger::log("Start system mode query", Logger::DEBUG);
$contacts = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`,
`profile`.`gender` AS `pgender`, `profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`,
`profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type`
@@ -145,7 +145,7 @@ function poco_init(App $a) {
intval($itemsPerPage)
);
} else {
Logger::log("Start query for user " . $user['nickname'], LOGGER_DEBUG);
Logger::log("Start query for user " . $user['nickname'], Logger::DEBUG);
$contacts = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d",
@@ -158,7 +158,7 @@ function poco_init(App $a) {
intval($itemsPerPage)
);
}
Logger::log("Query done", LOGGER_DEBUG);
Logger::log("Query done", Logger::DEBUG);

$ret = [];
if (x($_GET, 'sorted')) {
@@ -370,7 +370,7 @@ function poco_init(App $a) {
} else {
System::httpExit(500);
}
Logger::log("End of poco", LOGGER_DEBUG);
Logger::log("End of poco", Logger::DEBUG);

if ($format === 'xml') {
header('Content-type: text/xml');


+ 1
- 1
mod/poke.php View File

@@ -54,7 +54,7 @@ function poke_init(App $a)
$parent = (x($_GET,'parent') ? intval($_GET['parent']) : 0);


Logger::log('poke: verb ' . $verb . ' contact ' . $contact_id, LOGGER_DEBUG);
Logger::log('poke: verb ' . $verb . ' contact ' . $contact_id, Logger::DEBUG);


$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",


+ 1
- 1
mod/profile.php View File

@@ -38,7 +38,7 @@ function profile_init(App $a)
if (DBA::isResult($r)) {
$a->internalRedirect('profile/' . $r[0]['nickname']);
} else {
Logger::log('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
Logger::log('profile error: mod_profile ' . $a->query_string, Logger::DEBUG);
notice(L10n::t('Requested profile is not available.') . EOL);
$a->error = 404;
return;


+ 2
- 2
mod/pubsub.php View File

@@ -41,7 +41,7 @@ function pubsub_init(App $a)
$hub_verify = notags(trim(defaults($_GET, 'hub_verify_token', '')));

Logger::log('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);
Logger::log('Data: ' . print_r($_GET,true), LOGGER_DATA);
Logger::log('Data: ' . print_r($_GET,true), Logger::DATA);

$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);

@@ -89,7 +89,7 @@ function pubsub_post(App $a)
$xml = file_get_contents('php://input');

Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $a->cmd . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
Logger::log('Data: ' . $xml, LOGGER_DATA);
Logger::log('Data: ' . $xml, Logger::DATA);

$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );


+ 7
- 7
mod/receive.php View File

@@ -42,7 +42,7 @@ function receive_post(App $a)

// It is an application/x-www-form-urlencoded

Logger::log('mod-diaspora: receiving post', LOGGER_DEBUG);
Logger::log('mod-diaspora: receiving post', Logger::DEBUG);

if (empty($_POST['xml'])) {
$postdata = file_get_contents("php://input");
@@ -50,29 +50,29 @@ function receive_post(App $a)
System::httpExit(500);
}

Logger::log('mod-diaspora: message is in the new format', LOGGER_DEBUG);
Logger::log('mod-diaspora: message is in the new format', Logger::DEBUG);
$msg = Diaspora::decodeRaw($importer, $postdata);
} else {
$xml = urldecode($_POST['xml']);

Logger::log('mod-diaspora: decode message in the old format', LOGGER_DEBUG);
Logger::log('mod-diaspora: decode message in the old format', Logger::DEBUG);
$msg = Diaspora::decode($importer, $xml);

if ($public && !$msg) {
Logger::log('mod-diaspora: decode message in the new format', LOGGER_DEBUG);
Logger::log('mod-diaspora: decode message in the new format', Logger::DEBUG);
$msg = Diaspora::decodeRaw($importer, $xml);
}
}

Logger::log('mod-diaspora: decoded', LOGGER_DEBUG);
Logger::log('mod-diaspora: decoded', Logger::DEBUG);

Logger::log('mod-diaspora: decoded msg: ' . print_r($msg, true), LOGGER_DATA);
Logger::log('mod-diaspora: decoded msg: ' . print_r($msg, true), Logger::DATA);

if (!is_array($msg)) {
System::httpExit(500);
}

Logger::log('mod-diaspora: dispatching', LOGGER_DEBUG);
Logger::log('mod-diaspora: dispatching', Logger::DEBUG);

$ret = true;
if ($public) {


+ 4
- 4
mod/redir.php View File

@@ -52,7 +52,7 @@ function redir_init(App $a) {
if (!empty($a->contact['id']) && $a->contact['id'] == $cid) {
// Local user is already authenticated.
$target_url = defaults($url, $contact_url);
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
$a->redirect($target_url);
}
}
@@ -73,7 +73,7 @@ function redir_init(App $a) {
if ($v['uid'] == $_SESSION['visitor_visiting'] && $v['cid'] == $_SESSION['visitor_id']) {
// Remote user is already authenticated.
$target_url = defaults($url, $contact_url);
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
$a->redirect($target_url);
}
}
@@ -99,7 +99,7 @@ function redir_init(App $a) {
'sec' => $sec, 'expire' => time() + 45];
DBA::insert('profile_check', $fields);

Logger::log('mod_redir: ' . $contact['name'] . ' ' . $sec, LOGGER_DEBUG);
Logger::log('mod_redir: ' . $contact['name'] . ' ' . $sec, Logger::DEBUG);

$dest = (!empty($url) ? '&destination_url=' . $url : '');

@@ -121,7 +121,7 @@ function redir_init(App $a) {
$url .= $separator . 'zrl=' . urlencode($my_profile);
}

Logger::log('redirecting to ' . $url, LOGGER_DEBUG);
Logger::log('redirecting to ' . $url, Logger::DEBUG);
$a->redirect($url);
}



+ 2
- 2
mod/salmon.php View File

@@ -21,7 +21,7 @@ function salmon_post(App $a, $xml = '') {
$xml = file_get_contents('php://input');
}

Logger::log('new salmon ' . $xml, LOGGER_DATA);
Logger::log('new salmon ' . $xml, Logger::DATA);

$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false);
@@ -108,7 +108,7 @@ function salmon_post(App $a, $xml = '') {
$m = base64url_decode($key_info[1]);
$e = base64url_decode($key_info[2]);

Logger::log('key details: ' . print_r($key_info,true), LOGGER_DEBUG);
Logger::log('key details: ' . print_r($key_info,true), Logger::DEBUG);

$pubkey = Crypto::meToPem($m, $e);



+ 4
- 4
mod/search.php View File

@@ -205,7 +205,7 @@ function search_content(App $a) {
$pager = new Pager($a->query_string);

if ($tag) {
Logger::log("Start tag search for '".$search."'", LOGGER_DEBUG);
Logger::log("Start tag search for '".$search."'", Logger::DEBUG);

$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `otype` = ? AND `type` = ? AND `term` = ?",
@@ -228,7 +228,7 @@ function search_content(App $a) {
$r = [];
}
} else {
Logger::log("Start fulltext search for '".$search."'", LOGGER_DEBUG);
Logger::log("Start fulltext search for '".$search."'", Logger::DEBUG);

$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `body` LIKE CONCAT('%',?,'%')",
@@ -255,12 +255,12 @@ function search_content(App $a) {
'$title' => $title
]);

Logger::log("Start Conversation for '".$search."'", LOGGER_DEBUG);
Logger::log("Start Conversation for '".$search."'", Logger::DEBUG);
$o .= conversation($a, $r, $pager, 'search', false, false, 'commented', local_user());

$o .= $pager->renderMinimal(count($r));

Logger::log("Done '".$search."'", LOGGER_DEBUG);
Logger::log("Done '".$search."'", Logger::DEBUG);

return $o;
}

+ 1
- 1
mod/statistics_json.php View File

@@ -57,6 +57,6 @@ function statistics_json_init(App $a) {

header("Content-Type: application/json");
echo json_encode($statistics, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
Logger::log("statistics_init: printed " . print_r($statistics, true), LOGGER_DATA);
Logger::log("statistics_init: printed " . print_r($statistics, true), Logger::DATA);
killme();
}

+ 5
- 5
mod/wall_upload.php View File

@@ -20,7 +20,7 @@ use Friendica\Object\Image;

function wall_upload_post(App $a, $desktopmode = true)
{
Logger::log("wall upload: starting new upload", LOGGER_DEBUG);
Logger::log("wall upload: starting new upload", Logger::DEBUG);

$r_json = (x($_GET, 'response') && $_GET['response'] == 'json');
$album = (x($_GET, 'album') ? notags(trim($_GET['album'])) : '');
@@ -188,7 +188,7 @@ function wall_upload_post(App $a, $desktopmode = true)
}

Logger::log("File upload src: " . $src . " - filename: " . $filename .
" - size: " . $filesize . " - type: " . $filetype, LOGGER_DEBUG);
" - size: " . $filesize . " - type: " . $filetype, Logger::DEBUG);

$maximagesize = Config::get('system', 'maximagesize');

@@ -226,7 +226,7 @@ function wall_upload_post(App $a, $desktopmode = true)
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
Logger::log("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
Logger::log("File upload: Scaling picture to new size " . $max_length, Logger::DEBUG);
}

$width = $Image->getWidth();
@@ -301,11 +301,11 @@ function wall_upload_post(App $a, $desktopmode = true)
echo json_encode(['picture' => $picture]);
killme();
}
Logger::log("upload done", LOGGER_DEBUG);
Logger::log("upload done", Logger::DEBUG);
return $picture;
}

Logger::log("upload done", LOGGER_DEBUG);
Logger::log("upload done", Logger::DEBUG);

if ($r_json) {
echo json_encode(['ok' => true]);


+ 11
- 11
src/App.php View File

@@ -1101,10 +1101,10 @@ class App

$processlist = DBA::processlist();
if ($processlist['list'] != '') {
Core\Logger::log('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], LOGGER_DEBUG);
Core\Logger::log('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], Logger::DEBUG);

if ($processlist['amount'] > $max_processes) {
Core\Logger::log('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.', LOGGER_DEBUG);
Core\Logger::log('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.', Logger::DEBUG);
return true;
}
}
@@ -1150,7 +1150,7 @@ class App
$reached = ($free < $min_memory);

if ($reached) {
Core\Logger::log('Minimal memory reached: ' . $free . '/' . $meminfo['MemTotal'] . ' - limit ' . $min_memory, LOGGER_DEBUG);
Core\Logger::log('Minimal memory reached: ' . $free . '/' . $meminfo['MemTotal'] . ' - limit ' . $min_memory, Logger::DEBUG);
}

return $reached;
@@ -1222,7 +1222,7 @@ class App
$resource = proc_open($cmdline . ' &', [], $foo, $this->getBasePath());
}
if (!is_resource($resource)) {
Core\Logger::log('We got no resource for command ' . $cmdline, LOGGER_DEBUG);
Core\Logger::log('We got no resource for command ' . $cmdline, Logger::DEBUG);
return;
}
proc_close($resource);
@@ -1253,27 +1253,27 @@ class App
public static function isDirectoryUsable($directory, $check_writable = true)
{
if ($directory == '') {
Core\Logger::log('Directory is empty. This shouldn\'t happen.', LOGGER_DEBUG);
Core\Logger::log('Directory is empty. This shouldn\'t happen.', Logger::DEBUG);
return false;
}

if (!file_exists($directory)) {
Core\Logger::log('Path "' . $directory . '" does not exist for user ' . self::getSystemUser(), LOGGER_DEBUG);
Core\Logger::log('Path "' . $directory . '" does not exist for user ' . self::getSystemUser(), Logger::DEBUG);
return false;
}

if (is_file($directory)) {
Core\Logger::log('Path "' . $directory . '" is a file for user ' . self::getSystemUser(), LOGGER_DEBUG);
Core\Logger::log('Path "' . $directory . '" is a file for user ' . self::getSystemUser(), Logger::DEBUG);
return false;
}

if (!is_dir($directory)) {
Core\Logger::log('Path "' . $directory . '" is not a directory for user ' . self::getSystemUser(), LOGGER_DEBUG);
Core\Logger::log('Path "' . $directory . '" is not a directory for user ' . self::getSystemUser(), Logger::DEBUG);
return false;
}

if ($check_writable && !is_writable($directory)) {
Core\Logger::log('Path "' . $directory . '" is not writable for user ' . self::getSystemUser(), LOGGER_DEBUG);
Core\Logger::log('Path "' . $directory . '" is not writable for user ' . self::getSystemUser(), Logger::DEBUG);
return false;
}

@@ -1646,7 +1646,7 @@ class App
} else {
// Someone came with an invalid parameter, maybe as a DDoS attempt
// We simply stop processing here
Core\Logger::log("Invalid ZRL parameter " . $_GET['zrl'], LOGGER_DEBUG);
Core\Logger::log("Invalid ZRL parameter " . $_GET['zrl'], Logger::DEBUG);
Core\System::httpExit(403, ['title' => '403 Forbidden']);
}
}
@@ -1789,7 +1789,7 @@ class App
$this->internalRedirect($_SERVER['REQUEST_URI']);
}

Core\Logger::log('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
Core\Logger::log('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], Logger::DEBUG);

header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . Core\L10n::t('Not Found'));
$tpl = get_markup_template("404.tpl");


+ 2
- 2
src/BaseModule.php View File

@@ -138,7 +138,7 @@ abstract class BaseModule extends BaseObject
if (!self::checkFormSecurityToken($typename, $formname)) {
$a = get_app();
Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
notice(self::getFormSecurityStandardErrorMessage());
$a->internalRedirect($err_redirect);
}
@@ -149,7 +149,7 @@ abstract class BaseModule extends BaseObject
if (!self::checkFormSecurityToken($typename, $formname)) {
$a = get_app();
Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
header('HTTP/1.1 403 Forbidden');
killme();
}


+ 7
- 7
src/Content/Text/BBCode.php View File

@@ -415,7 +415,7 @@ class BBCode extends BaseObject
$Image->scaleDown(640);
$new_width = $Image->getWidth();
$new_height = $Image->getHeight();
Logger::log('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
Logger::log('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], Logger::DEBUG);
$s = str_replace(
$mtch[0],
'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]'
@@ -424,7 +424,7 @@ class BBCode extends BaseObject
: ''),
$s
);
Logger::log('scale_external_images: new string: ' . $s, LOGGER_DEBUG);
Logger::log('scale_external_images: new string: ' . $s, Logger::DEBUG);
}
}
}
@@ -452,7 +452,7 @@ class BBCode extends BaseObject
// than the maximum, then don't waste time looking for the images
if ($maxlen && (strlen($body) > $maxlen)) {

Logger::log('the total body length exceeds the limit', LOGGER_DEBUG);
Logger::log('the total body length exceeds the limit', Logger::DEBUG);

$orig_body = $body;
$new_body = '';
@@ -472,7 +472,7 @@ class BBCode extends BaseObject

if (($textlen + $img_start) > $maxlen) {
if ($textlen < $maxlen) {
Logger::log('the limit happens before an embedded image', LOGGER_DEBUG);
Logger::log('the limit happens before an embedded image', Logger::DEBUG);
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
$textlen = $maxlen;
}
@@ -486,7 +486,7 @@ class BBCode extends BaseObject

if (($textlen + $img_end) > $maxlen) {
if ($textlen < $maxlen) {
Logger::log('the limit happens before the end of a non-embedded image', LOGGER_DEBUG);
Logger::log('the limit happens before the end of a non-embedded image', Logger::DEBUG);
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
$textlen = $maxlen;
}
@@ -509,11 +509,11 @@ class BBCode extends BaseObject

if (($textlen + strlen($orig_body)) > $maxlen) {
if ($textlen < $maxlen) {
Logger::log('the limit happens after the end of the last image', LOGGER_DEBUG);
Logger::log('the limit happens after the end of the last image', Logger::DEBUG);
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
}
} else {
Logger::log('the text size with embedded images extracted did not violate the limit', LOGGER_DEBUG);
Logger::log('the text size with embedded images extracted did not violate the limit', Logger::DEBUG);
$new_body = $new_body . $orig_body;
}



+ 2
- 2
src/Core/Authentication.php View File

@@ -154,10 +154,10 @@ class Authentication extends BaseObject
}

if ($login_initial) {
Logger::log('auth_identities: ' . print_r($a->identities, true), LOGGER_DEBUG);
Logger::log('auth_identities: ' . print_r($a->identities, true), Logger::DEBUG);
}
if ($login_refresh) {
Logger::log('auth_identities refresh: ' . print_r($a->identities, true), LOGGER_DEBUG);
Logger::log('auth_identities refresh: ' . print_r($a->identities, true), Logger::DEBUG);
}

$contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);


+ 2
- 2
src/Core/Cache/MemcachedCacheDriver.php View File

@@ -65,7 +65,7 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
if ($this->memcached->getResultCode() == Memcached::RES_SUCCESS) {
return $this->filterArrayKeysByPrefix($keys, $prefix);
} else {
Logger::log('Memcached \'getAllKeys\' failed with ' . $this->memcached->getResultMessage(), LOGGER_ALL);
Logger::log('Memcached \'getAllKeys\' failed with ' . $this->memcached->getResultMessage(), Logger::ALL);
return [];
}
}
@@ -84,7 +84,7 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
if ($this->memcached->getResultCode() === Memcached::RES_SUCCESS) {
$return = $value;
} else {
Logger::log('Memcached \'get\' failed with ' . $this->memcached->getResultMessage(), LOGGER_ALL);
Logger::log('Memcached \'get\' failed with ' . $this->memcached->getResultMessage(), Logger::ALL);
}

return $return;


+ 1
- 1
src/Core/NotificationsManager.php View File

@@ -359,7 +359,7 @@ class NotificationsManager extends BaseObject
break;
}
/// @todo Check if this part here is used at all
Logger::log('Complete data: ' . json_encode($it) . ' - ' . System::callstack(20), LOGGER_DEBUG);
Logger::log('Complete data: ' . json_encode($it) . ' - ' . System::callstack(20), Logger::DEBUG);

$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
$obj = XML::parseString($xmlhead . $it['object']);


+ 1
- 1
src/Core/Session/CacheSessionHandler.php View File

@@ -34,7 +34,7 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface
Session::$exists = true;
return $data;
}
Logger::log("no data for session $session_id", LOGGER_TRACE);
Logger::log("no data for session $session_id", Logger::TRACE);
return '';
}



+ 1
- 1
src/Core/Session/DatabaseSessionHandler.php View File

@@ -35,7 +35,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
Session::$exists = true;
return $session['data'];
}
Logger::log("no data for session $session_id", LOGGER_TRACE);
Logger::log("no data for session $session_id", Logger::TRACE);

return '';
}


+ 9
- 9
src/Core/UserImport.php View File

@@ -38,7 +38,7 @@ class UserImport
private static function checkCols($table, &$arr)
{
$query = sprintf("SHOW COLUMNS IN `%s`", DBA::escape($table));
Logger::log("uimport: $query", LOGGER_DEBUG);
Logger::log("uimport: $query", Logger::DEBUG);
$r = q($query);
$tcols = [];
// get a plain array of column names
@@ -69,7 +69,7 @@ class UserImport
$cols = implode("`,`", array_map(['Friendica\Database\DBA', 'escape'], array_keys($arr)));
$vals = implode("','", array_map(['Friendica\Database\DBA', 'escape'], array_values($arr)));
$query = "INSERT INTO `$table` (`$cols`) VALUES ('$vals')";
Logger::log("uimport: $query", LOGGER_TRACE);
Logger::log("uimport: $query", Logger::TRACE);

if (self::IMPORT_DEBUG) {
return true;
@@ -144,7 +144,7 @@ class UserImport
// import user
$r = self::dbImportAssoc('user', $account['user']);
if ($r === false) {
Logger::log("uimport:insert user : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
Logger::log("uimport:insert user : ERROR : " . DBA::errorMessage(), Logger::INFO);
notice(L10n::t("User creation error"));
return;
}
@@ -162,7 +162,7 @@ class UserImport
$profile['uid'] = $newuid;
$r = self::dbImportAssoc('profile', $profile);
if ($r === false) {
Logger::log("uimport:insert profile " . $profile['profile-name'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
Logger::log("uimport:insert profile " . $profile['profile-name'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
info(L10n::t("User profile creation error"));
DBA::delete('user', ['uid' => $newuid]);
return;
@@ -200,7 +200,7 @@ class UserImport
$contact['uid'] = $newuid;
$r = self::dbImportAssoc('contact', $contact);
if ($r === false) {
Logger::log("uimport:insert contact " . $contact['nick'] . "," . $contact['network'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
Logger::log("uimport:insert contact " . $contact['nick'] . "," . $contact['network'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
$errorcount++;
} else {
$contact['newid'] = self::lastInsertId();
@@ -214,7 +214,7 @@ class UserImport
$group['uid'] = $newuid;
$r = self::dbImportAssoc('group', $group);
if ($r === false) {
Logger::log("uimport:insert group " . $group['name'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
Logger::log("uimport:insert group " . $group['name'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
} else {
$group['newid'] = self::lastInsertId();
}
@@ -239,7 +239,7 @@ class UserImport
if ($import == 2) {
$r = self::dbImportAssoc('group_member', $group_member);
if ($r === false) {
Logger::log("uimport:insert group member " . $group_member['id'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
Logger::log("uimport:insert group member " . $group_member['id'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
}
}
}
@@ -257,7 +257,7 @@ class UserImport
);

if ($r === false) {
Logger::log("uimport:insert photo " . $photo['resource-id'] . "," . $photo['scale'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
Logger::log("uimport:insert photo " . $photo['resource-id'] . "," . $photo['scale'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
}
}

@@ -265,7 +265,7 @@ class UserImport
$pconfig['uid'] = $newuid;
$r = self::dbImportAssoc('pconfig', $pconfig);
if ($r === false) {
Logger::log("uimport:insert pconfig " . $pconfig['id'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
Logger::log("uimport:insert pconfig " . $pconfig['id'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
}
}



+ 32
- 32
src/Core/Worker.php View File

@@ -43,7 +43,7 @@ class Worker

// At first check the maximum load. We shouldn't continue with a high load
if ($a->isMaxLoadReached()) {
Logger::log('Pre check: maximum load reached, quitting.', LOGGER_DEBUG);
Logger::log('Pre check: maximum load reached, quitting.', Logger::DEBUG);
return;
}

@@ -59,25 +59,25 @@ class Worker

// Count active workers and compare them with a maximum value that depends on the load
if (self::tooMuchWorkers()) {
Logger::log('Pre check: Active worker limit reached, quitting.', LOGGER_DEBUG);
Logger::log('Pre check: Active worker limit reached, quitting.', Logger::DEBUG);
return;
}

// Do we have too few memory?
if ($a->isMinMemoryReached()) {
Logger::log('Pre check: Memory limit reached, quitting.', LOGGER_DEBUG);
Logger::log('Pre check: Memory limit reached, quitting.', Logger::DEBUG);
return;
}

// Possibly there are too much database connections
if (self::maxConnectionsReached()) {
Logger::log('Pre check: maximum connections reached, quitting.', LOGGER_DEBUG);
Logger::log('Pre check: maximum connections reached, quitting.', Logger::DEBUG);
return;
}

// Possibly there are too much database processes that block the system
if ($a->isMaxProcessesReached()) {
Logger::log('Pre check: maximum processes reached, quitting.', LOGGER_DEBUG);
Logger::log('Pre check: maximum processes reached, quitting.', Logger::DEBUG);
return;
}

@@ -100,7 +100,7 @@ class Worker

// The work will be done
if (!self::execute($entry)) {
Logger::log('Process execution failed, quitting.', LOGGER_DEBUG);
Logger::log('Process execution failed, quitting.', Logger::DEBUG);
return;
}

@@ -118,14 +118,14 @@ class Worker
$stamp = (float)microtime(true);
// Count active workers and compare them with a maximum value that depends on the load
if (self::tooMuchWorkers()) {
Logger::log('Active worker limit reached, quitting.', LOGGER_DEBUG);
Logger::log('Active worker limit reached, quitting.', Logger::DEBUG);
Lock::release('worker');
return;
}

// Check free memory
if ($a->isMinMemoryReached()) {
Logger::log('Memory limit reached, quitting.', LOGGER_DEBUG);
Logger::log('Memory limit reached, quitting.', Logger::DEBUG);
Lock::release('worker');
return;
}
@@ -135,7 +135,7 @@ class Worker

// Quit the worker once every 5 minutes
if (time() > ($starttime + 300)) {
Logger::log('Process lifetime reached, quitting.', LOGGER_DEBUG);
Logger::log('Process lifetime reached, quitting.', Logger::DEBUG);
return;
}
}
@@ -144,7 +144,7 @@ class Worker
if (Config::get('system', 'worker_daemon_mode', false)) {
self::IPCSetJobState(false);
}
Logger::log("Couldn't select a workerqueue entry, quitting process " . getmypid() . ".", LOGGER_DEBUG);
Logger::log("Couldn't select a workerqueue entry, quitting process " . getmypid() . ".", Logger::DEBUG);
}

/**
@@ -214,19 +214,19 @@ class Worker

// Quit when in maintenance
if (Config::get('system', 'maintenance', false, true)) {
Logger::log("Maintenance mode - quit process ".$mypid, LOGGER_DEBUG);
Logger::log("Maintenance mode - quit process ".$mypid, Logger::DEBUG);
return false;
}

// Constantly check the number of parallel database processes
if ($a->isMaxProcessesReached()) {
Logger::log("Max processes reached for process ".$mypid, LOGGER_DEBUG);
Logger::log("Max processes reached for process ".$mypid, Logger::DEBUG);
return false;
}

// Constantly check the number of available database connections to let the frontend be accessible at any time
if (self::maxConnectionsReached()) {
Logger::log("Max connection reached for process ".$mypid, LOGGER_DEBUG);
Logger::log("Max connection reached for process ".$mypid, Logger::DEBUG);
return false;
}

@@ -384,19 +384,19 @@ class Worker
' - Lock: '.number_format(self::$lock_duration, 2).
' - Rest: '.number_format($up_duration - self::$db_duration - self::$lock_duration, 2).
' - Execution: '.number_format($duration, 2),
LOGGER_DEBUG
Logger::DEBUG
);

self::$lock_duration = 0;

if ($duration > 3600) {
Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 1 hour (".round($duration/60, 3).")", LOGGER_DEBUG);
Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 1 hour (".round($duration/60, 3).")", Logger::DEBUG);
} elseif ($duration > 600) {
Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 10 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 10 minutes (".round($duration/60, 3).")", Logger::DEBUG);
} elseif ($duration > 300) {
Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 5 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 5 minutes (".round($duration/60, 3).")", Logger::DEBUG);
} elseif ($duration > 120) {
Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 2 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 2 minutes (".round($duration/60, 3).")", Logger::DEBUG);
}

Logger::log("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - done in ".$duration." seconds. Process PID: ".$new_process_id);
@@ -468,7 +468,7 @@ class Worker
+ $a->performance["network"] + $a->performance["file"]), 2),
number_format($duration, 2)
),
LOGGER_DEBUG
Logger::DEBUG
);
}

@@ -519,7 +519,7 @@ class Worker
$used = DBA::numRows($r);
DBA::close($r);

Logger::log("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
Logger::log("Connection usage (user values): ".$used."/".$max, Logger::DEBUG);

$level = ($used / $max) * 100;

@@ -547,7 +547,7 @@ class Worker
if ($used == 0) {
return false;
}
Logger::log("Connection usage (system values): ".$used."/".$max, LOGGER_DEBUG);
Logger::log("Connection usage (system values): ".$used."/".$max, Logger::DEBUG);

$level = $used / $max * 100;

@@ -615,7 +615,7 @@ class Worker
['id' => $entry["id"]]
);
} else {
Logger::log("Worker process ".$entry["pid"]." (".substr(json_encode($argv), 0, 50).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
Logger::log("Worker process ".$entry["pid"]." (".substr(json_encode($argv), 0, 50).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", Logger::DEBUG);
}
}
}
@@ -698,16 +698,16 @@ class Worker
$high_running = self::processWithPriorityActive($top_priority);

if (!$high_running && ($top_priority > PRIORITY_UNDEFINED) && ($top_priority < PRIORITY_NEGLIGIBLE)) {
Logger::log("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", LOGGER_DEBUG);
Logger::log("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", Logger::DEBUG);
$queues = $active + 1;
}
}

Logger::log("Load: " . $load ."/" . $maxsysload . " - processes: " . $deferred . "/" . $active . "/" . $entries . $processlist . " - maximum: " . $queues . "/" . $maxqueues, LOGGER_DEBUG);
Logger::log("Load: " . $load ."/" . $maxsysload . " - processes: " . $deferred . "/" . $active . "/" . $entries . $processlist . " - maximum: " . $queues . "/" . $maxqueues, Logger::DEBUG);

// Are there fewer workers running as possible? Then fork a new one.
if (!Config::get("system", "worker_dont_fork", false) && ($queues > ($active + 1)) && ($entries > 1)) {
Logger::log("Active workers: ".$active."/".$queues." Fork a new worker.", LOGGER_DEBUG);
Logger::log("Active workers: ".$active."/".$queues." Fork a new worker.", Logger::DEBUG);
if (Config::get('system', 'worker_daemon_mode', false)) {
self::IPCSetJobState(true);
} else {
@@ -780,11 +780,11 @@ class Worker
++$high;
}
}
Logger::log("Highest priority: ".$highest_priority." Total processes: ".count($priorities)." Count high priority processes: ".$high, LOGGER_DEBUG);
Logger::log("Highest priority: ".$highest_priority." Total processes: ".count($priorities)." Count high priority processes: ".$high, Logger::DEBUG);
$passing_slow = (($high/count($priorities)) > (2/3));

if ($passing_slow) {
Logger::log("Passing slower processes than priority ".$highest_priority, LOGGER_DEBUG);
Logger::log("Passing slower processes than priority ".$highest_priority, Logger::DEBUG);
}
return $passing_slow;
}
@@ -817,7 +817,7 @@ class Worker
$slope = $queue_length / pow($lower_job_limit, $exponent);
$limit = min($queue_length, ceil($slope * pow($jobs, $exponent)));

Logger::log('Deferred: ' . $deferred . ' - Total: ' . $jobs . ' - Maximum: ' . $queue_length . ' - jobs per queue: ' . $limit, LOGGER_DEBUG);
Logger::log('Deferred: ' . $deferred . ' - Total: ' . $jobs . ' - Maximum: ' . $queue_length . ' - jobs per queue: ' . $limit, Logger::DEBUG);
$ids = [];
if (self::passingSlow($highest_priority)) {
// Are there waiting processes with a higher priority than the currently highest?
@@ -976,7 +976,7 @@ class Worker

self::runCron();

Logger::log('Call worker', LOGGER_DEBUG);
Logger::log('Call worker', Logger::DEBUG);
self::spawnWorker();
return;
}
@@ -1015,7 +1015,7 @@ class Worker
*/
private static function runCron()
{
Logger::log('Add cron entries', LOGGER_DEBUG);
Logger::log('Add cron entries', Logger::DEBUG);

// Check for spooled items
self::add(PRIORITY_HIGH, "SpoolPost");
@@ -1153,7 +1153,7 @@ class Worker
$id = $queue['id'];

if ($retrial > 14) {
Logger::log('Id ' . $id . ' had been tried 14 times. We stop now.', LOGGER_DEBUG);
Logger::log('Id ' . $id . ' had been tried 14 times. We stop now.', Logger::DEBUG);
return;
}

@@ -1161,7 +1161,7 @@ class Worker
$delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');

Logger::log('Defer execution ' . $retrial . ' of id ' . $id . ' to ' . $next, LOGGER_DEBUG);
Logger::log('Defer execution ' . $retrial . ' of id ' . $id . ' to ' . $next, Logger::DEBUG);

$fields = ['retrial' => $retrial + 1, 'next_try' => $next, 'executed' => DBA::NULL_DATETIME, 'pid' => 0];
DBA::update('workerqueue', $fields, ['id' => $id]);


+ 3
- 3
src/Database/DBA.php View File

@@ -413,7 +413,7 @@ class DBA

if ((substr_count($sql, '?') != count($args)) && (count($args) > 0)) {
// Question: Should we continue or stop the query here?
Logger::log('Parameter mismatch. Query "'.$sql.'" - Parameters '.print_r($args, true), LOGGER_DEBUG);
Logger::log('Parameter mismatch. Query "'.$sql.'" - Parameters '.print_r($args, true), Logger::DEBUG);
}

$sql = self::cleanQuery($sql);
@@ -1143,7 +1143,7 @@ class DBA

if ((count($command['conditions']) > 1) || is_int($first_key)) {
$sql = "DELETE FROM `" . $command['table'] . "`" . $condition_string;
Logger::log(self::replaceParameters($sql, $conditions), LOGGER_DATA);
Logger::log(self::replaceParameters($sql, $conditions), Logger::DATA);

if (!self::e($sql, $conditions)) {
if ($do_transaction) {
@@ -1173,7 +1173,7 @@ class DBA
$sql = "DELETE FROM `" . $table . "` WHERE `" . $field . "` IN (" .
substr(str_repeat("?, ", count($field_values)), 0, -2) . ");";

Logger::log(self::replaceParameters($sql, $field_values), LOGGER_DATA);
Logger::log(self::replaceParameters($sql, $field_values), Logger::DATA);

if (!self::e($sql, $field_values)) {
if ($do_transaction) {


+ 3
- 3
src/Database/DBStructure.php View File

@@ -70,7 +70,7 @@ class DBStructure

// No valid result?
if (!DBA::isResult($adminlist)) {
Logger::log(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_INFO);
Logger::log(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), Logger::INFO);

// Don't continue
return;
@@ -222,7 +222,7 @@ class DBStructure

$errors = '';

Logger::log('updating structure', LOGGER_DEBUG);
Logger::log('updating structure', Logger::DEBUG);

// Get the current structure
$database = [];