From 50da89d861dce3b648c8f9e5c1e4c480ee320a43 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Tue, 30 Oct 2018 09:58:45 -0400 Subject: [PATCH] Logger Levels update logger levels in calls --- bin/daemon.php | 12 +- include/api.php | 58 ++++---- include/conversation.php | 2 +- include/enotify.php | 10 +- include/items.php | 12 +- mod/acl.php | 2 +- mod/admin.php | 16 +-- mod/dfrn_confirm.php | 6 +- mod/dfrn_notify.php | 20 +-- mod/dfrn_poll.php | 12 +- mod/dfrn_request.php | 2 +- mod/display.php | 2 +- mod/events.php | 2 +- mod/item.php | 8 +- mod/nodeinfo.php | 10 +- mod/openid.php | 2 +- mod/photos.php | 16 +-- mod/poco.php | 10 +- mod/poke.php | 2 +- mod/profile.php | 2 +- mod/pubsub.php | 4 +- mod/receive.php | 14 +- mod/redir.php | 8 +- mod/salmon.php | 4 +- mod/search.php | 8 +- mod/statistics_json.php | 2 +- mod/wall_upload.php | 10 +- src/App.php | 22 +-- src/BaseModule.php | 4 +- src/Content/Text/BBCode.php | 14 +- src/Core/Authentication.php | 4 +- src/Core/Cache/MemcachedCacheDriver.php | 4 +- src/Core/NotificationsManager.php | 2 +- src/Core/Session/CacheSessionHandler.php | 2 +- src/Core/Session/DatabaseSessionHandler.php | 2 +- src/Core/UserImport.php | 18 +-- src/Core/Worker.php | 64 ++++----- src/Database/DBA.php | 6 +- src/Database/DBStructure.php | 6 +- src/Database/PostUpdate.php | 34 ++--- src/Model/APContact.php | 2 +- src/Model/Contact.php | 4 +- src/Model/Conversation.php | 4 +- src/Model/Event.php | 2 +- src/Model/GContact.php | 24 ++-- src/Model/Item.php | 76 +++++------ src/Model/Profile.php | 18 +-- src/Model/PushSubscriber.php | 10 +- src/Model/User.php | 2 +- src/Module/Magic.php | 8 +- src/Module/Owa.php | 8 +- src/Network/CurlResult.php | 6 +- src/Network/FKOAuth1.php | 2 +- src/Network/Probe.php | 44 +++--- src/Object/Image.php | 18 +-- src/Object/Post.php | 10 +- src/Object/Thread.php | 12 +- src/Protocol/ActivityPub/Processor.php | 30 ++--- src/Protocol/ActivityPub/Receiver.php | 64 ++++----- src/Protocol/ActivityPub/Transmitter.php | 14 +- src/Protocol/DFRN.php | 80 +++++------ src/Protocol/Diaspora.php | 140 ++++++++++---------- src/Protocol/Email.php | 6 +- src/Protocol/Feed.php | 12 +- src/Protocol/OStatus.php | 68 +++++----- src/Protocol/PortableContact.php | 66 ++++----- src/Util/Emailer.php | 4 +- src/Util/HTTPSignature.php | 6 +- src/Util/JsonLD.php | 4 +- src/Util/Network.php | 10 +- src/Util/ParseUrl.php | 6 +- src/Util/XML.php | 8 +- src/Worker/APDelivery.php | 2 +- src/Worker/CheckVersion.php | 4 +- src/Worker/CronJobs.php | 10 +- src/Worker/Delivery.php | 6 +- src/Worker/Directory.php | 2 +- src/Worker/DiscoverPoCo.php | 20 +-- src/Worker/Expire.php | 22 +-- src/Worker/GProbe.php | 6 +- src/Worker/Notifier.php | 34 ++--- src/Worker/OnePoll.php | 24 ++-- src/Worker/ProfileUpdate.php | 2 +- src/Worker/PubSubPublish.php | 4 +- src/Worker/SpoolPost.php | 2 +- view/theme/vier/style.php | 2 +- 86 files changed, 673 insertions(+), 673 deletions(-) diff --git a/bin/daemon.php b/bin/daemon.php index 1ae55be78f..f628031c35 100755 --- a/bin/daemon.php +++ b/bin/daemon.php @@ -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); } } diff --git a/include/api.php b/include/api.php index b2a91097d9..246a716fac 100644 --- a/include/api.php +++ b/include/api.php @@ -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; diff --git a/include/conversation.php b/include/conversation.php index 47adfc0dfb..8317746dd3 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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 = []; } } diff --git a/include/enotify.php b/include/enotify.php index fe2cc1f333..bc9a7b9b0e 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -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); } } diff --git a/include/items.php b/include/items.php index 72ae3a8e87..104547ab83 100644 --- a/include/items.php +++ b/include/items.php @@ -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; diff --git a/mod/acl.php b/mod/acl.php index 36cfd42e71..a63cd83ae0 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -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) . "%%'"; diff --git a/mod/admin.php b/mod/admin.php index 8d19f01e32..d4cbafe54b 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -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); diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 8c897c76d6..0403085f85 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -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. diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index a0090f4921..b14c71fb86 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -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 diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 814bd555c4..a961506d17 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -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, 'challenge . ' expecting ' . $hash); Logger::log('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec); diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index d49975a1f0..674248be22 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -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", diff --git a/mod/display.php b/mod/display.php index aeab0aae51..d95404a5b1 100644 --- a/mod/display.php +++ b/mod/display.php @@ -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); } diff --git a/mod/events.php b/mod/events.php index 0e582c52de..a13080a8e3 100644 --- a/mod/events.php +++ b/mod/events.php @@ -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; diff --git a/mod/item.php b/mod/item.php index ce00562a8f..6e7e86fe7a 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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(); diff --git a/mod/nodeinfo.php b/mod/nodeinfo.php index 7b747be21e..ca4a622fbb 100644 --- a/mod/nodeinfo.php +++ b/mod/nodeinfo.php @@ -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'); } diff --git a/mod/openid.php b/mod/openid.php index e97607304f..d1404ba804 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -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'))) { diff --git a/mod/photos.php b/mod/photos.php index ad6922c1ea..8ddb0010d1 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -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(); } diff --git a/mod/poco.php b/mod/poco.php index 9150299547..7a33a69d0b 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -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'); diff --git a/mod/poke.php b/mod/poke.php index bf5b7e72dc..3eefeb9aba 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -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", diff --git a/mod/profile.php b/mod/profile.php index e56f7085ef..f2df82849e 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -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; diff --git a/mod/pubsub.php b/mod/pubsub.php index 2b3752358e..e14d500865 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -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 ); diff --git a/mod/receive.php b/mod/receive.php index af90007e3c..690abea159 100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -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) { diff --git a/mod/redir.php b/mod/redir.php index 6cdbc94dcf..088a5f55e3 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -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); } diff --git a/mod/salmon.php b/mod/salmon.php index bb44199dc4..23e4e88846 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -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); diff --git a/mod/search.php b/mod/search.php index 852043f300..4be378ba9a 100644 --- a/mod/search.php +++ b/mod/search.php @@ -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; } diff --git a/mod/statistics_json.php b/mod/statistics_json.php index 173f6db13f..d1d957076f 100644 --- a/mod/statistics_json.php +++ b/mod/statistics_json.php @@ -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(); } diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 63c7d8278a..84e40d3b56 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -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]); diff --git a/src/App.php b/src/App.php index e0513be04e..92eb9409ca 100644 --- a/src/App.php +++ b/src/App.php @@ -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"); diff --git a/src/BaseModule.php b/src/BaseModule.php index 2f46883edf..fe09693b3b 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -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(); } diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 9426677c29..22ce4ea3ae 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -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; } diff --git a/src/Core/Authentication.php b/src/Core/Authentication.php index 83effcb01b..4d227c2710 100644 --- a/src/Core/Authentication.php +++ b/src/Core/Authentication.php @@ -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]); diff --git a/src/Core/Cache/MemcachedCacheDriver.php b/src/Core/Cache/MemcachedCacheDriver.php index 5f2556deba..6453c307ce 100644 --- a/src/Core/Cache/MemcachedCacheDriver.php +++ b/src/Core/Cache/MemcachedCacheDriver.php @@ -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; diff --git a/src/Core/NotificationsManager.php b/src/Core/NotificationsManager.php index d75dd18d97..19aae2b823 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Core/NotificationsManager.php @@ -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']); diff --git a/src/Core/Session/CacheSessionHandler.php b/src/Core/Session/CacheSessionHandler.php index a819702b36..1baf111e93 100644 --- a/src/Core/Session/CacheSessionHandler.php +++ b/src/Core/Session/CacheSessionHandler.php @@ -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 ''; } diff --git a/src/Core/Session/DatabaseSessionHandler.php b/src/Core/Session/DatabaseSessionHandler.php index ba01dddd95..91788588fa 100644 --- a/src/Core/Session/DatabaseSessionHandler.php +++ b/src/Core/Session/DatabaseSessionHandler.php @@ -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 ''; } diff --git a/src/Core/UserImport.php b/src/Core/UserImport.php index fa9f05e2d6..7ccb6f80cb 100644 --- a/src/Core/UserImport.php +++ b/src/Core/UserImport.php @@ -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); } } diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 77e38532c8..c053e32bc8 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -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]); diff --git a/src/Database/DBA.php b/src/Database/DBA.php index 618415142e..bf3004ead4 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -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) { diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 1297979ead..9a14114de1 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -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 = []; @@ -235,7 +235,7 @@ class DBStructure foreach ($tables AS $table) { $table = current($table); - Logger::log(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG); + Logger::log(sprintf('updating structure for table %s ...', $table), Logger::DEBUG); $database[$table] = self::tableStructure($table); } } diff --git a/src/Database/PostUpdate.php b/src/Database/PostUpdate.php index 00e95fa2f4..94c02013e7 100644 --- a/src/Database/PostUpdate.php +++ b/src/Database/PostUpdate.php @@ -53,7 +53,7 @@ class PostUpdate return true; } - Logger::log("Start", LOGGER_DEBUG); + Logger::log("Start", Logger::DEBUG); $end_id = Config::get("system", "post_update_1194_end"); if (!$end_id) { @@ -64,7 +64,7 @@ class PostUpdate } } - Logger::log("End ID: ".$end_id, LOGGER_DEBUG); + Logger::log("End ID: ".$end_id, Logger::DEBUG); $start_id = Config::get("system", "post_update_1194_start"); @@ -83,14 +83,14 @@ class PostUpdate DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS)); if (!$r) { Config::set("system", "post_update_version", 1194); - Logger::log("Update is done", LOGGER_DEBUG); + Logger::log("Update is done", Logger::DEBUG); return true; } else { Config::set("system", "post_update_1194_start", $r[0]["id"]); $start_id = Config::get("system", "post_update_1194_start"); } - Logger::log("Start ID: ".$start_id, LOGGER_DEBUG); + Logger::log("Start ID: ".$start_id, Logger::DEBUG); $r = q($query1.$query2.$query3." ORDER BY `item`.`id` LIMIT 1000,1", intval($start_id), intval($end_id), @@ -100,13 +100,13 @@ class PostUpdate } else { $pos_id = $end_id; } - Logger::log("Progress: Start: ".$start_id." position: ".$pos_id." end: ".$end_id, LOGGER_DEBUG); + Logger::log("Progress: Start: ".$start_id." position: ".$pos_id." end: ".$end_id, Logger::DEBUG); q("UPDATE `item` ".$query2." SET `item`.`global` = 1 ".$query3, intval($start_id), intval($pos_id), DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS)); - Logger::log("Done", LOGGER_DEBUG); + Logger::log("Done", Logger::DEBUG); } /** @@ -123,7 +123,7 @@ class PostUpdate return true; } - Logger::log("Start", LOGGER_DEBUG); + Logger::log("Start", Logger::DEBUG); $r = q("SELECT `contact`.`id`, `contact`.`last-item`, (SELECT MAX(`changed`) FROM `item` USE INDEX (`uid_wall_changed`) WHERE `wall` AND `uid` = `user`.`uid`) AS `lastitem_date` FROM `user` @@ -139,7 +139,7 @@ class PostUpdate } Config::set("system", "post_update_version", 1206); - Logger::log("Done", LOGGER_DEBUG); + Logger::log("Done", Logger::DEBUG); return true; } @@ -157,7 +157,7 @@ class PostUpdate $id = Config::get("system", "post_update_version_1279_id", 0); - Logger::log("Start from item " . $id, LOGGER_DEBUG); + Logger::log("Start from item " . $id, Logger::DEBUG); $fields = array_merge(Item::MIXED_CONTENT_FIELDLIST, ['network', 'author-id', 'owner-id', 'tag', 'file', 'author-name', 'author-avatar', 'author-link', 'owner-name', 'owner-avatar', 'owner-link', 'id', @@ -226,7 +226,7 @@ class PostUpdate Config::set("system", "post_update_version_1279_id", $id); - Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, LOGGER_DEBUG); + Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG); if ($start_id == $id) { // Set all deprecated fields to "null" if they contain an empty string @@ -238,13 +238,13 @@ class PostUpdate foreach ($nullfields as $field) { $fields = [$field => null]; $condition = [$field => '']; - Logger::log("Setting '" . $field . "' to null if empty.", LOGGER_DEBUG); + Logger::log("Setting '" . $field . "' to null if empty.", Logger::DEBUG); // Important: This has to be a "DBA::update", not a "Item::update" DBA::update('item', $fields, $condition); } Config::set("system", "post_update_version", 1279); - Logger::log("Done", LOGGER_DEBUG); + Logger::log("Done", Logger::DEBUG); return true; } @@ -307,7 +307,7 @@ class PostUpdate $id = Config::get("system", "post_update_version_1281_id", 0); - Logger::log("Start from item " . $id, LOGGER_DEBUG); + Logger::log("Start from item " . $id, Logger::DEBUG); $fields = ['id', 'guid', 'uri', 'uri-id', 'parent-uri', 'parent-uri-id', 'thr-parent', 'thr-parent-id']; @@ -359,17 +359,17 @@ class PostUpdate Config::set("system", "post_update_version_1281_id", $id); - Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, LOGGER_DEBUG); + Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG); if ($start_id == $id) { - Logger::log("Updating item-uri in item-activity", LOGGER_DEBUG); + Logger::log("Updating item-uri in item-activity", Logger::DEBUG); DBA::e("UPDATE `item-activity` INNER JOIN `item-uri` ON `item-uri`.`uri` = `item-activity`.`uri` SET `item-activity`.`uri-id` = `item-uri`.`id` WHERE `item-activity`.`uri-id` IS NULL"); - Logger::log("Updating item-uri in item-content", LOGGER_DEBUG); + Logger::log("Updating item-uri in item-content", Logger::DEBUG); DBA::e("UPDATE `item-content` INNER JOIN `item-uri` ON `item-uri`.`uri` = `item-content`.`uri` SET `item-content`.`uri-id` = `item-uri`.`id` WHERE `item-content`.`uri-id` IS NULL"); Config::set("system", "post_update_version", 1281); - Logger::log("Done", LOGGER_DEBUG); + Logger::log("Done", Logger::DEBUG); return true; } diff --git a/src/Model/APContact.php b/src/Model/APContact.php index e5dd27e0e3..c7cf54b720 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -193,7 +193,7 @@ class APContact extends BaseObject // Update the gcontact table DBA::update('gcontact', $contact_fields, ['nurl' => normalise_link($url)]); - Logger::log('Updated profile for ' . $url, LOGGER_DEBUG); + Logger::log('Updated profile for ' . $url, Logger::DEBUG); return $apcontact; } diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 155b304abb..5d571e30e1 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -587,7 +587,7 @@ class Contact extends BaseObject return; } } elseif (!isset($contact['url'])) { - Logger::log('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), LOGGER_DEBUG); + Logger::log('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), Logger::DEBUG); } // Contact already archived or "self" contact? => nothing to do @@ -1028,7 +1028,7 @@ class Contact extends BaseObject */ public static function getIdForURL($url, $uid = 0, $no_update = false, $default = [], $in_loop = false) { - Logger::log("Get contact data for url " . $url . " and user " . $uid . " - " . System::callstack(), LOGGER_DEBUG); + Logger::log("Get contact data for url " . $url . " and user " . $uid . " - " . System::callstack(), Logger::DEBUG); $contact_id = 0; diff --git a/src/Model/Conversation.php b/src/Model/Conversation.php index 3332d93e0f..159cd2f20f 100644 --- a/src/Model/Conversation.php +++ b/src/Model/Conversation.php @@ -84,12 +84,12 @@ class Conversation } if (!DBA::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) { Logger::log('Conversation: update for ' . $conversation['item-uri'] . ' from ' . $old_conv['protocol'] . ' to ' . $conversation['protocol'] . ' failed', - LOGGER_DEBUG); + Logger::DEBUG); } } else { if (!DBA::insert('conversation', $conversation, true)) { Logger::log('Conversation: insert for ' . $conversation['item-uri'] . ' (protocol ' . $conversation['protocol'] . ') failed', - LOGGER_DEBUG); + Logger::DEBUG); } } } diff --git a/src/Model/Event.php b/src/Model/Event.php index 3ec6fb1a80..e6ed20f72c 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -225,7 +225,7 @@ class Event extends BaseObject } DBA::delete('event', ['id' => $event_id]); - Logger::log("Deleted event ".$event_id, LOGGER_DEBUG); + Logger::log("Deleted event ".$event_id, Logger::DEBUG); } /** diff --git a/src/Model/GContact.php b/src/Model/GContact.php index a220a59211..398fc77588 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -589,7 +589,7 @@ class GContact } if ($new_url != $url) { - Logger::log("Cleaned contact url ".$url." to ".$new_url." - Called by: ".System::callstack(), LOGGER_DEBUG); + Logger::log("Cleaned contact url ".$url." to ".$new_url." - Called by: ".System::callstack(), Logger::DEBUG); } return $new_url; @@ -606,7 +606,7 @@ class GContact if (($contact["network"] == Protocol::OSTATUS) && PortableContact::alternateOStatusUrl($contact["url"])) { $data = Probe::uri($contact["url"]); if ($contact["network"] == Protocol::OSTATUS) { - Logger::log("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG); + Logger::log("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".System::callstack(), Logger::DEBUG); $contact["url"] = $data["url"]; $contact["addr"] = $data["addr"]; $contact["alias"] = $data["alias"]; @@ -630,12 +630,12 @@ class GContact $last_contact_str = ''; if (empty($contact["network"])) { - Logger::log("Empty network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG); + Logger::log("Empty network for contact url ".$contact["url"]." - Called by: ".System::callstack(), Logger::DEBUG); return false; } if (in_array($contact["network"], [Protocol::PHANTOM])) { - Logger::log("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG); + Logger::log("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), Logger::DEBUG); return false; } @@ -703,7 +703,7 @@ class GContact DBA::unlock(); if ($doprobing) { - Logger::log("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG); + Logger::log("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], Logger::DEBUG); Worker::add(PRIORITY_LOW, 'GProbe', $contact["url"]); } @@ -808,19 +808,19 @@ class GContact if ((($contact["generation"] > 0) && ($contact["generation"] <= $public_contact[0]["generation"])) || ($public_contact[0]["generation"] == 0)) { foreach ($fields as $field => $data) { if ($contact[$field] != $public_contact[0][$field]) { - Logger::log("Difference for contact ".$contact["url"]." in field '".$field."'. New value: '".$contact[$field]."', old value '".$public_contact[0][$field]."'", LOGGER_DEBUG); + Logger::log("Difference for contact ".$contact["url"]." in field '".$field."'. New value: '".$contact[$field]."', old value '".$public_contact[0][$field]."'", Logger::DEBUG); $update = true; } } if ($contact["generation"] < $public_contact[0]["generation"]) { - Logger::log("Difference for contact ".$contact["url"]." in field 'generation'. new value: '".$contact["generation"]."', old value '".$public_contact[0]["generation"]."'", LOGGER_DEBUG); + Logger::log("Difference for contact ".$contact["url"]." in field 'generation'. new value: '".$contact["generation"]."', old value '".$public_contact[0]["generation"]."'", Logger::DEBUG); $update = true; } } if ($update) { - Logger::log("Update gcontact for ".$contact["url"], LOGGER_DEBUG); + Logger::log("Update gcontact for ".$contact["url"], Logger::DEBUG); $condition = ['`nurl` = ? AND (`generation` = 0 OR `generation` >= ?)', normalise_link($contact["url"]), $contact["generation"]]; $contact["updated"] = DateTimeFormat::utc($contact["updated"]); @@ -844,7 +844,7 @@ class GContact // The quality of the gcontact table is mostly lower than the public contact $public_contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]); if (DBA::isResult($public_contact)) { - Logger::log("Update public contact ".$public_contact["id"], LOGGER_DEBUG); + Logger::log("Update public contact ".$public_contact["id"], Logger::DEBUG); Contact::updateAvatar($contact["photo"], 0, $public_contact["id"]); @@ -886,7 +886,7 @@ class GContact $data = Probe::uri($url); if (in_array($data["network"], [Protocol::PHANTOM])) { - Logger::log("Invalid network for contact url ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG); + Logger::log("Invalid network for contact url ".$data["url"]." - Called by: ".System::callstack(), Logger::DEBUG); return; } @@ -917,7 +917,7 @@ class GContact ); if (!DBA::isResult($r)) { - Logger::log('Cannot find user with uid=' . $uid, LOGGER_INFO); + Logger::log('Cannot find user with uid=' . $uid, Logger::INFO); return false; } @@ -954,7 +954,7 @@ class GContact */ public static function fetchGsUsers($server) { - Logger::log("Fetching users from GNU Social server ".$server, LOGGER_DEBUG); + Logger::log("Fetching users from GNU Social server ".$server, Logger::DEBUG); $url = $server."/main/statistics"; diff --git a/src/Model/Item.php b/src/Model/Item.php index 7f70dc9bca..4e854e45c4 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -984,12 +984,12 @@ class Item extends BaseObject 'icid', 'iaid', 'psid']; $item = self::selectFirst($fields, ['id' => $item_id]); if (!DBA::isResult($item)) { - Logger::log('Item with ID ' . $item_id . " hasn't been found.", LOGGER_DEBUG); + Logger::log('Item with ID ' . $item_id . " hasn't been found.", Logger::DEBUG); return false; } if ($item['deleted']) { - Logger::log('Item with ID ' . $item_id . ' has already been deleted.', LOGGER_DEBUG); + Logger::log('Item with ID ' . $item_id . ' has already been deleted.', Logger::DEBUG); return false; } @@ -1090,7 +1090,7 @@ class Item extends BaseObject } } - Logger::log('Item with ID ' . $item_id . " has been deleted.", LOGGER_DEBUG); + Logger::log('Item with ID ' . $item_id . " has been deleted.", Logger::DEBUG); return true; } @@ -1193,7 +1193,7 @@ class Item extends BaseObject if (!empty($contact_id)) { return $contact_id; } - Logger::log('Missing contact-id. Called by: '.System::callstack(), LOGGER_DEBUG); + Logger::log('Missing contact-id. Called by: '.System::callstack(), Logger::DEBUG); /* * First we are looking for a suitable contact that matches with the author of the post * This is done only for comments @@ -1214,7 +1214,7 @@ class Item extends BaseObject $contact_id = $self["id"]; } } - Logger::log("Contact-id was missing for post ".$item['guid']." from user id ".$item['uid']." - now set to ".$contact_id, LOGGER_DEBUG); + Logger::log("Contact-id was missing for post ".$item['guid']." from user id ".$item['uid']." - now set to ".$contact_id, Logger::DEBUG); return $contact_id; } @@ -1299,7 +1299,7 @@ class Item extends BaseObject $item['gravity'] = GRAVITY_COMMENT; } else { $item['gravity'] = GRAVITY_UNKNOWN; // Should not happen - Logger::log('Unknown gravity for verb: ' . $item['verb'], LOGGER_DEBUG); + Logger::log('Unknown gravity for verb: ' . $item['verb'], Logger::DEBUG); } $uid = intval($item['uid']); @@ -1316,7 +1316,7 @@ class Item extends BaseObject $expire_date = time() - ($expire_interval * 86400); $created_date = strtotime($item['created']); if ($created_date < $expire_date) { - Logger::log('item-store: item created ('.date('c', $created_date).') before expiration time ('.date('c', $expire_date).'). ignored. ' . print_r($item,true), LOGGER_DEBUG); + Logger::log('item-store: item created ('.date('c', $created_date).') before expiration time ('.date('c', $expire_date).'). ignored. ' . print_r($item,true), Logger::DEBUG); return 0; } } @@ -1427,17 +1427,17 @@ class Item extends BaseObject } if ($item['network'] == Protocol::PHANTOM) { - Logger::log('Missing network. Called by: '.System::callstack(), LOGGER_DEBUG); + Logger::log('Missing network. Called by: '.System::callstack(), Logger::DEBUG); $item['network'] = Protocol::DFRN; - Logger::log("Set network to " . $item["network"] . " for " . $item["uri"], LOGGER_DEBUG); + Logger::log("Set network to " . $item["network"] . " for " . $item["uri"], Logger::DEBUG); } // Checking if there is already an item with the same guid - Logger::log('Checking for an item for user '.$item['uid'].' on network '.$item['network'].' with the guid '.$item['guid'], LOGGER_DEBUG); + Logger::log('Checking for an item for user '.$item['uid'].' on network '.$item['network'].' with the guid '.$item['guid'], Logger::DEBUG); $condition = ['guid' => $item['guid'], 'network' => $item['network'], 'uid' => $item['uid']]; if (self::exists($condition)) { - Logger::log('found item with guid '.$item['guid'].' for user '.$item['uid'].' on network '.$item['network'], LOGGER_DEBUG); + Logger::log('found item with guid '.$item['guid'].' for user '.$item['uid'].' on network '.$item['network'], Logger::DEBUG); return 0; } @@ -1518,15 +1518,15 @@ class Item extends BaseObject } // If its a post from myself then tag the thread as "mention" - Logger::log("Checking if parent ".$parent_id." has to be tagged as mention for user ".$item['uid'], LOGGER_DEBUG); + Logger::log("Checking if parent ".$parent_id." has to be tagged as mention for user ".$item['uid'], Logger::DEBUG); $user = DBA::selectFirst('user', ['nickname'], ['uid' => $item['uid']]); if (DBA::isResult($user)) { $self = normalise_link(System::baseUrl() . '/profile/' . $user['nickname']); $self_id = Contact::getIdForURL($self, 0, true); - Logger::log("'myself' is ".$self_id." for parent ".$parent_id." checking against ".$item['author-id']." and ".$item['owner-id'], LOGGER_DEBUG); + Logger::log("'myself' is ".$self_id." for parent ".$parent_id." checking against ".$item['author-id']." and ".$item['owner-id'], Logger::DEBUG); if (($item['author-id'] == $self_id) || ($item['owner-id'] == $self_id)) { DBA::update('thread', ['mention' => true], ['iid' => $parent_id]); - Logger::log("tagged thread ".$parent_id." as mention for user ".$self, LOGGER_DEBUG); + Logger::log("tagged thread ".$parent_id." as mention for user ".$self, Logger::DEBUG); } } } else { @@ -1628,12 +1628,12 @@ class Item extends BaseObject */ if ($item["uid"] == 0) { if (self::exists(['uri' => trim($item['uri']), 'uid' => 0])) { - Logger::log('Global item already stored. URI: '.$item['uri'].' on network '.$item['network'], LOGGER_DEBUG); + Logger::log('Global item already stored. URI: '.$item['uri'].' on network '.$item['network'], Logger::DEBUG); return 0; } } - Logger::log('' . print_r($item,true), LOGGER_DATA); + Logger::log('' . print_r($item,true), Logger::DATA); if (array_key_exists('tag', $item)) { $tags = $item['tag']; @@ -1701,7 +1701,7 @@ class Item extends BaseObject $item = array_merge($item, $delivery_data); file_put_contents($spool, json_encode($item)); - Logger::log("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG); + Logger::log("Item wasn't stored - Item was spooled into file ".$file, Logger::DEBUG); } return 0; } @@ -1760,7 +1760,7 @@ class Item extends BaseObject */ if (base64_encode(base64_decode(base64_decode($dsprsig->signature))) == base64_decode($dsprsig->signature)) { $dsprsig->signature = base64_decode($dsprsig->signature); - Logger::log("Repaired double encoded signature from handle ".$dsprsig->signer, LOGGER_DEBUG); + Logger::log("Repaired double encoded signature from handle ".$dsprsig->signer, Logger::DEBUG); } if (!empty($dsprsig->signed_text) && empty($dsprsig->signature) && empty($dsprsig->signer)) { @@ -2145,9 +2145,9 @@ class Item extends BaseObject $distributed = self::insert($item, false, $notify, true); if (!$distributed) { - Logger::log("Distributed public item " . $itemid . " for user " . $uid . " wasn't stored", LOGGER_DEBUG); + Logger::log("Distributed public item " . $itemid . " for user " . $uid . " wasn't stored", Logger::DEBUG); } else { - Logger::log("Distributed public item " . $itemid . " for user " . $uid . " with id " . $distributed, LOGGER_DEBUG); + Logger::log("Distributed public item " . $itemid . " for user " . $uid . " with id " . $distributed, Logger::DEBUG); } } @@ -2210,7 +2210,7 @@ class Item extends BaseObject $public_shadow = self::insert($item, false, false, true); - Logger::log("Stored public shadow for thread ".$itemid." under id ".$public_shadow, LOGGER_DEBUG); + Logger::log("Stored public shadow for thread ".$itemid." under id ".$public_shadow, Logger::DEBUG); } } @@ -2267,7 +2267,7 @@ class Item extends BaseObject $public_shadow = self::insert($item, false, false, true); - Logger::log("Stored public shadow for comment ".$item['uri']." under id ".$public_shadow, LOGGER_DEBUG); + Logger::log("Stored public shadow for comment ".$item['uri']." under id ".$public_shadow, Logger::DEBUG); // If this was a comment to a Diaspora post we don't get our comment back. // This means that we have to distribute the comment by ourselves. @@ -2613,29 +2613,29 @@ class Item extends BaseObject // Prevent the forwarding of posts that are forwarded if (!empty($datarray["extid"]) && ($datarray["extid"] == Protocol::DFRN)) { - Logger::log('Already forwarded', LOGGER_DEBUG); + Logger::log('Already forwarded', Logger::DEBUG); return false; } // Prevent to forward already forwarded posts if ($datarray["app"] == $a->getHostName()) { - Logger::log('Already forwarded (second test)', LOGGER_DEBUG); + Logger::log('Already forwarded (second test)', Logger::DEBUG); return false; } // Only forward posts if ($datarray["verb"] != ACTIVITY_POST) { - Logger::log('No post', LOGGER_DEBUG); + Logger::log('No post', Logger::DEBUG); return false; } if (($contact['network'] != Protocol::FEED) && $datarray['private']) { - Logger::log('Not public', LOGGER_DEBUG); + Logger::log('Not public', Logger::DEBUG); return false; } $datarray2 = $datarray; - Logger::log('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG); + Logger::log('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), Logger::DEBUG); if ($contact['remote_self'] == 2) { $self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'], ['uid' => $contact['uid'], 'self' => true]); @@ -2675,7 +2675,7 @@ class Item extends BaseObject if ($contact['network'] != Protocol::FEED) { // Store the original post $result = self::insert($datarray2, false, false); - Logger::log('remote-self post original item - Contact '.$contact['url'].' return '.$result.' Item '.print_r($datarray2, true), LOGGER_DEBUG); + Logger::log('remote-self post original item - Contact '.$contact['url'].' return '.$result.' Item '.print_r($datarray2, true), Logger::DEBUG); } else { $datarray["app"] = "Feed"; $result = true; @@ -2705,7 +2705,7 @@ class Item extends BaseObject return $s; } - Logger::log('check for photos', LOGGER_DEBUG); + Logger::log('check for photos', Logger::DEBUG); $site = substr(System::baseUrl(), strpos(System::baseUrl(), '://')); $orig_body = $s; @@ -2719,7 +2719,7 @@ class Item extends BaseObject $img_st_close++; // make it point to AFTER the closing bracket $image = substr($orig_body, $img_start + $img_st_close, $img_len); - Logger::log('found photo ' . $image, LOGGER_DEBUG); + Logger::log('found photo ' . $image, Logger::DEBUG); if (stristr($image, $site . '/photo/')) { // Only embed locally hosted photos @@ -2761,7 +2761,7 @@ class Item extends BaseObject // If a custom width and height were specified, apply before embedding if (preg_match("/\[img\=([0-9]*)x([0-9]*)\]/is", substr($orig_body, $img_start, $img_st_close), $match)) { - Logger::log('scaling photo', LOGGER_DEBUG); + Logger::log('scaling photo', Logger::DEBUG); $width = intval($match[1]); $height = intval($match[2]); @@ -2774,9 +2774,9 @@ class Item extends BaseObject } } - Logger::log('replacing photo', LOGGER_DEBUG); + Logger::log('replacing photo', Logger::DEBUG); $image = 'data:' . $type . ';base64,' . base64_encode($data); - Logger::log('replaced: ' . $image, LOGGER_DATA); + Logger::log('replaced: ' . $image, Logger::DATA); } } } @@ -3148,7 +3148,7 @@ class Item extends BaseObject if (!$onlyshadow) { $result = DBA::insert('thread', $item); - Logger::log("Add thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG); + Logger::log("Add thread for item ".$itemid." - ".print_r($result, true), Logger::DEBUG); } } @@ -3180,26 +3180,26 @@ class Item extends BaseObject $result = DBA::update('thread', $fields, ['iid' => $itemid]); - Logger::log("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".(int)$result, LOGGER_DEBUG); + Logger::log("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".(int)$result, Logger::DEBUG); } private static function deleteThread($itemid, $itemuri = "") { $item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]); if (!DBA::isResult($item)) { - Logger::log('No thread found for id '.$itemid, LOGGER_DEBUG); + Logger::log('No thread found for id '.$itemid, Logger::DEBUG); return; } $result = DBA::delete('thread', ['iid' => $itemid], ['cascade' => false]); - Logger::log("deleteThread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG); + Logger::log("deleteThread: Deleted thread for item ".$itemid." - ".print_r($result, true), Logger::DEBUG); if ($itemuri != "") { $condition = ["`uri` = ? AND NOT `deleted` AND NOT (`uid` IN (?, 0))", $itemuri, $item["uid"]]; if (!self::exists($condition)) { DBA::delete('item', ['uri' => $itemuri, 'uid' => 0]); - Logger::log("deleteThread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG); + Logger::log("deleteThread: Deleted shadow for item ".$itemuri, Logger::DEBUG); } } } diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 92e27f175c..fba6759459 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -107,7 +107,7 @@ class Profile $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]); if (!DBA::isResult($user) && empty($profiledata)) { - Logger::log('profile error: ' . $a->query_string, LOGGER_DEBUG); + Logger::log('profile error: ' . $a->query_string, Logger::DEBUG); notice(L10n::t('Requested account is not available.') . EOL); $a->error = 404; return; @@ -125,7 +125,7 @@ class Profile $pdata = self::getByNickname($nickname, $user['uid'], $profile); if (empty($pdata) && empty($profiledata)) { - Logger::log('profile error: ' . $a->query_string, LOGGER_DEBUG); + Logger::log('profile error: ' . $a->query_string, Logger::DEBUG); notice(L10n::t('Requested profile is not available.') . EOL); $a->error = 404; return; @@ -1021,27 +1021,27 @@ class Profile // Try to find the public contact entry of the visitor. $cid = Contact::getIdForURL($my_url); if (!$cid) { - Logger::log('No contact record found for ' . $my_url, LOGGER_DEBUG); + Logger::log('No contact record found for ' . $my_url, Logger::DEBUG); return; } $contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]); if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) { - Logger::log('The visitor ' . $my_url . ' is already authenticated', LOGGER_DEBUG); + Logger::log('The visitor ' . $my_url . ' is already authenticated', Logger::DEBUG); return; } // Avoid endless loops $cachekey = 'zrlInit:' . $my_url; if (Cache::get($cachekey)) { - Logger::log('URL ' . $my_url . ' already tried to authenticate.', LOGGER_DEBUG); + Logger::log('URL ' . $my_url . ' already tried to authenticate.', Logger::DEBUG); return; } else { Cache::set($cachekey, true, Cache::MINUTE); } - Logger::log('Not authenticated. Invoking reverse magic-auth for ' . $my_url, LOGGER_DEBUG); + Logger::log('Not authenticated. Invoking reverse magic-auth for ' . $my_url, Logger::DEBUG); Worker::add(PRIORITY_LOW, 'GProbe', $my_url); @@ -1062,7 +1062,7 @@ class Profile // We have to check if the remote server does understand /magic without invoking something $serverret = Network::curl($basepath . '/magic'); if ($serverret->isSuccess()) { - Logger::log('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path, LOGGER_DEBUG); + Logger::log('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path, Logger::DEBUG); System::externalRedirect($magic_path); } } @@ -1093,7 +1093,7 @@ class Profile // Try to find the public contact entry of the visitor. $cid = Contact::getIdForURL($visitor_handle); if(!$cid) { - Logger::log('owt: unable to finger ' . $visitor_handle, LOGGER_DEBUG); + Logger::log('owt: unable to finger ' . $visitor_handle, Logger::DEBUG); return; } @@ -1122,7 +1122,7 @@ class Profile info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', $a->getHostName(), $visitor['name'])); - Logger::log('OpenWebAuth: auth success from ' . $visitor['addr'], LOGGER_DEBUG); + Logger::log('OpenWebAuth: auth success from ' . $visitor['addr'], Logger::DEBUG); } public static function zrl($s, $force = false) diff --git a/src/Model/PushSubscriber.php b/src/Model/PushSubscriber.php index 4f85ffba50..44495daeef 100644 --- a/src/Model/PushSubscriber.php +++ b/src/Model/PushSubscriber.php @@ -46,7 +46,7 @@ class PushSubscriber $priority = $default_priority; } - Logger::log('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority, LOGGER_DEBUG); + Logger::log('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority, Logger::DEBUG); Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']); } @@ -116,10 +116,10 @@ class PushSubscriber if ($days > 60) { DBA::update('push_subscriber', ['push' => -1, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]); - Logger::log('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', LOGGER_DEBUG); + Logger::log('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', Logger::DEBUG); } else { DBA::update('push_subscriber', ['push' => 0, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]); - Logger::log('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', LOGGER_DEBUG); + Logger::log('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', Logger::DEBUG); } } else { // Calculate the delay until the next trial @@ -129,7 +129,7 @@ class PushSubscriber $retrial = $retrial + 1; DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]); - Logger::log('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, LOGGER_DEBUG); + Logger::log('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, Logger::DEBUG); } } @@ -149,6 +149,6 @@ class PushSubscriber // set last_update to the 'created' date of the last item, and reset push=0 $fields = ['push' => 0, 'next_try' => DBA::NULL_DATETIME, 'last_update' => $last_update]; DBA::update('push_subscriber', $fields, ['id' => $id]); - Logger::log('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', LOGGER_DEBUG); + Logger::log('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', Logger::DEBUG); } } diff --git a/src/Model/User.php b/src/Model/User.php index 29809b2cde..43992cc5f3 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -471,7 +471,7 @@ class User $username_max_length = max(1, min(64, intval(Config::get('system', 'username_max_length', 48)))); if ($username_min_length > $username_max_length) { - Logger::log(L10n::t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), LOGGER_WARNING); + Logger::log(L10n::t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), Logger::WARNING); $tmp = $username_min_length; $username_min_length = $username_max_length; $username_max_length = $tmp; diff --git a/src/Module/Magic.php b/src/Module/Magic.php index 08836a7b9d..b8af1f9614 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -23,9 +23,9 @@ class Magic extends BaseModule { $a = self::getApp(); $ret = ['success' => false, 'url' => '', 'message' => '']; - Logger::log('magic mdule: invoked', LOGGER_DEBUG); + Logger::log('magic mdule: invoked', Logger::DEBUG); - Logger::log('args: ' . print_r($_REQUEST, true), LOGGER_DATA); + Logger::log('args: ' . print_r($_REQUEST, true), Logger::DATA); $addr = ((x($_REQUEST, 'addr')) ? $_REQUEST['addr'] : ''); $dest = ((x($_REQUEST, 'dest')) ? $_REQUEST['dest'] : ''); @@ -42,7 +42,7 @@ class Magic extends BaseModule } if (!$cid) { - Logger::log('No contact record found: ' . print_r($_REQUEST, true), LOGGER_DEBUG); + Logger::log('No contact record found: ' . print_r($_REQUEST, true), Logger::DEBUG); // @TODO Finding a more elegant possibility to redirect to either internal or external URL $a->redirect($dest); } @@ -56,7 +56,7 @@ class Magic extends BaseModule return $ret; } - Logger::log('Contact is already authenticated', LOGGER_DEBUG); + Logger::log('Contact is already authenticated', Logger::DEBUG); System::externalRedirect($dest); } diff --git a/src/Module/Owa.php b/src/Module/Owa.php index a1d11e947d..a1dbfa2f31 100644 --- a/src/Module/Owa.php +++ b/src/Module/Owa.php @@ -58,8 +58,8 @@ class Owa extends BaseModule $verified = HTTPSignature::verifyMagic($contact['pubkey']); if ($verified && $verified['header_signed'] && $verified['header_valid']) { - Logger::log('OWA header: ' . print_r($verified, true), LOGGER_DATA); - Logger::log('OWA success: ' . $contact['addr'], LOGGER_DATA); + Logger::log('OWA header: ' . print_r($verified, true), Logger::DATA); + Logger::log('OWA success: ' . $contact['addr'], Logger::DATA); $ret['success'] = true; $token = random_string(32); @@ -76,10 +76,10 @@ class Owa extends BaseModule openssl_public_encrypt($token, $result, $contact['pubkey']); $ret['encrypted_token'] = base64url_encode($result); } else { - Logger::log('OWA fail: ' . $contact['id'] . ' ' . $contact['addr'] . ' ' . $contact['url'], LOGGER_DEBUG); + Logger::log('OWA fail: ' . $contact['id'] . ' ' . $contact['addr'] . ' ' . $contact['url'], Logger::DEBUG); } } else { - Logger::log('Contact not found: ' . $handle, LOGGER_DEBUG); + Logger::log('Contact not found: ' . $handle, Logger::DEBUG); } } } diff --git a/src/Network/CurlResult.php b/src/Network/CurlResult.php index aef7193004..bbae881b88 100644 --- a/src/Network/CurlResult.php +++ b/src/Network/CurlResult.php @@ -104,7 +104,7 @@ class CurlResult $this->errorNumber = $errorNumber; $this->error = $error; - Logger::log($url . ': ' . $this->returnCode . " " . $result, LOGGER_DATA); + Logger::log($url . ': ' . $this->returnCode . " " . $result, Logger::DATA); $this->parseBodyHeader($result); $this->checkSuccess(); @@ -134,8 +134,8 @@ class CurlResult $this->isSuccess = ($this->returnCode >= 200 && $this->returnCode <= 299) || $this->errorNumber == 0; if (!$this->isSuccess) { - Logger::log('error: ' . $this->url . ': ' . $this->returnCode . ' - ' . $this->error, LOGGER_INFO); - Logger::log('debug: ' . print_r($this->info, true), LOGGER_DATA); + Logger::log('error: ' . $this->url . ': ' . $this->returnCode . ' - ' . $this->error, Logger::INFO); + Logger::log('debug: ' . print_r($this->info, true), Logger::DATA); } if (!$this->isSuccess && $this->errorNumber == CURLE_OPERATION_TIMEDOUT) { diff --git a/src/Network/FKOAuth1.php b/src/Network/FKOAuth1.php index 97c5bccc97..51a558942d 100644 --- a/src/Network/FKOAuth1.php +++ b/src/Network/FKOAuth1.php @@ -40,7 +40,7 @@ class FKOAuth1 extends OAuthServer $record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]); if (!DBA::isResult($record)) { - Logger::log('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); + Logger::log('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), Logger::DEBUG); header('HTTP/1.0 401 Unauthorized'); die('This api requires login'); } diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 894d9abe52..fc93524bfd 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -110,7 +110,7 @@ class Probe $xrd_timeout = Config::get('system', 'xrd_timeout', 20); $redirects = 0; - Logger::log("Probing for ".$host, LOGGER_DEBUG); + Logger::log("Probing for ".$host, Logger::DEBUG); $xrd = null; $curlResult = Network::curl($ssl_url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']); @@ -123,7 +123,7 @@ class Probe if (!is_object($xrd)) { $curlResult = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']); if ($curlResult->isTimeout()) { - Logger::log("Probing timeout for " . $url, LOGGER_DEBUG); + Logger::log("Probing timeout for " . $url, Logger::DEBUG); return false; } $xml = $curlResult->getBody(); @@ -131,13 +131,13 @@ class Probe $host_url = 'http://'.$host; } if (!is_object($xrd)) { - Logger::log("No xrd object found for ".$host, LOGGER_DEBUG); + Logger::log("No xrd object found for ".$host, Logger::DEBUG); return []; } $links = XML::elementToArray($xrd); if (!isset($links["xrd"]["link"])) { - Logger::log("No xrd data found for ".$host, LOGGER_DEBUG); + Logger::log("No xrd data found for ".$host, Logger::DEBUG); return []; } @@ -165,7 +165,7 @@ class Probe self::$baseurl = "http://".$host; - Logger::log("Probing successful for ".$host, LOGGER_DEBUG); + Logger::log("Probing successful for ".$host, Logger::DEBUG); return $lrdd; } @@ -195,7 +195,7 @@ class Probe $profile_link = ''; $links = self::lrdd($webbie); - Logger::log('webfingerDfrn: '.$webbie.':'.print_r($links, true), LOGGER_DATA); + Logger::log('webfingerDfrn: '.$webbie.':'.print_r($links, true), Logger::DATA); if (count($links)) { foreach ($links as $link) { if ($link['@attributes']['rel'] === NAMESPACE_DFRN) { @@ -254,7 +254,7 @@ class Probe } if (!$lrdd) { - Logger::log("No lrdd data found for ".$uri, LOGGER_DEBUG); + Logger::log("No lrdd data found for ".$uri, Logger::DEBUG); return []; } @@ -286,7 +286,7 @@ class Probe } if (!is_array($webfinger["links"])) { - Logger::log("No webfinger links found for ".$uri, LOGGER_DEBUG); + Logger::log("No webfinger links found for ".$uri, Logger::DEBUG); return false; } @@ -596,7 +596,7 @@ class Probe $lrdd = self::hostMeta($host); } if (!$lrdd) { - Logger::log('No XRD data was found for '.$uri, LOGGER_DEBUG); + Logger::log('No XRD data was found for '.$uri, Logger::DEBUG); return self::feed($uri); } $nick = array_pop($path_parts); @@ -631,12 +631,12 @@ class Probe } if (!$lrdd) { - Logger::log('No XRD data was found for '.$uri, LOGGER_DEBUG); + Logger::log('No XRD data was found for '.$uri, Logger::DEBUG); return self::mail($uri, $uid); } $addr = $uri; } else { - Logger::log("Uri ".$uri." was not detectable", LOGGER_DEBUG); + Logger::log("Uri ".$uri." was not detectable", Logger::DEBUG); return false; } @@ -681,7 +681,7 @@ class Probe $result = false; - Logger::log("Probing ".$uri, LOGGER_DEBUG); + Logger::log("Probing ".$uri, Logger::DEBUG); if (in_array($network, ["", Protocol::DFRN])) { $result = self::dfrn($webfinger); @@ -717,7 +717,7 @@ class Probe $result["url"] = $uri; } - Logger::log($uri." is ".$result["network"], LOGGER_DEBUG); + Logger::log($uri." is ".$result["network"], Logger::DEBUG); if (empty($result["baseurl"])) { $pos = strpos($result["url"], $host); @@ -752,7 +752,7 @@ class Probe $webfinger = json_decode($data, true); if (is_array($webfinger)) { if (!isset($webfinger["links"])) { - Logger::log("No json webfinger links for ".$url, LOGGER_DEBUG); + Logger::log("No json webfinger links for ".$url, Logger::DEBUG); return false; } return $webfinger; @@ -761,13 +761,13 @@ class Probe // If it is not JSON, maybe it is XML $xrd = XML::parseString($data, false); if (!is_object($xrd)) { - Logger::log("No webfinger data retrievable for ".$url, LOGGER_DEBUG); + Logger::log("No webfinger data retrievable for ".$url, Logger::DEBUG); return false; } $xrd_arr = XML::elementToArray($xrd); if (!isset($xrd_arr["xrd"]["link"])) { - Logger::log("No XML webfinger links for ".$url, LOGGER_DEBUG); + Logger::log("No XML webfinger links for ".$url, Logger::DEBUG); return false; } @@ -816,13 +816,13 @@ class Probe } $content = $curlResult->getBody(); if (!$content) { - Logger::log("Empty body for ".$noscrape_url, LOGGER_DEBUG); + Logger::log("Empty body for ".$noscrape_url, Logger::DEBUG); return false; } $json = json_decode($content, true); if (!is_array($json)) { - Logger::log("No json data for ".$noscrape_url, LOGGER_DEBUG); + Logger::log("No json data for ".$noscrape_url, Logger::DEBUG); return false; } @@ -928,7 +928,7 @@ class Probe { $data = []; - Logger::log("Check profile ".$profile_link, LOGGER_DEBUG); + Logger::log("Check profile ".$profile_link, Logger::DEBUG); // Fetch data via noscrape - this is faster $noscrape_url = str_replace(["/hcard/", "/profile/"], "/noscrape/", $profile_link); @@ -962,7 +962,7 @@ class Probe $prof_data["fn"] = defaults($data, 'name' , null); $prof_data["key"] = defaults($data, 'pubkey' , null); - Logger::log("Result for profile ".$profile_link.": ".print_r($prof_data, true), LOGGER_DEBUG); + Logger::log("Result for profile ".$profile_link.": ".print_r($prof_data, true), Logger::DEBUG); return $prof_data; } @@ -1633,7 +1633,7 @@ class Probe } $msgs = Email::poll($mbox, $uri); - Logger::log('searching '.$uri.', '.count($msgs).' messages found.', LOGGER_DEBUG); + Logger::log('searching '.$uri.', '.count($msgs).' messages found.', Logger::DEBUG); if (!count($msgs)) { return false; @@ -1715,7 +1715,7 @@ class Probe $fixed = $scheme.$host.$port.$path.$query.$fragment; - Logger::log('Base: '.$base.' - Avatar: '.$avatar.' - Fixed: '.$fixed, LOGGER_DATA); + Logger::log('Base: '.$base.' - Avatar: '.$avatar.' - Fixed: '.$fixed, Logger::DATA); return $fixed; } diff --git a/src/Object/Image.php b/src/Object/Image.php index 6449bf09a5..abce69a1c7 100644 --- a/src/Object/Image.php +++ b/src/Object/Image.php @@ -727,7 +727,7 @@ class Image */ public static function guessType($filename, $fromcurl = false, $header = '') { - Logger::log('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), LOGGER_DEBUG); + Logger::log('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), Logger::DEBUG); $type = null; if ($fromcurl) { $a = get_app(); @@ -765,7 +765,7 @@ class Image } } } - Logger::log('Image: guessType: type='.$type, LOGGER_DEBUG); + Logger::log('Image: guessType: type='.$type, Logger::DEBUG); return $type; } @@ -891,7 +891,7 @@ class Image ); if (!DBA::isResult($r)) { - Logger::log("Can't detect user data for uid ".$uid, LOGGER_DEBUG); + Logger::log("Can't detect user data for uid ".$uid, Logger::DEBUG); return([]); } @@ -902,10 +902,10 @@ class Image /// $community_page = (($r[0]['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false); if ((strlen($imagedata) == 0) && ($url == "")) { - Logger::log("No image data and no url provided", LOGGER_DEBUG); + Logger::log("No image data and no url provided", Logger::DEBUG); return([]); } elseif (strlen($imagedata) == 0) { - Logger::log("Uploading picture from ".$url, LOGGER_DEBUG); + Logger::log("Uploading picture from ".$url, Logger::DEBUG); $stamp1 = microtime(true); $imagedata = @file_get_contents($url); @@ -915,7 +915,7 @@ class Image $maximagesize = Config::get('system', 'maximagesize'); if (($maximagesize) && (strlen($imagedata) > $maximagesize)) { - Logger::log("Image exceeds size limit of ".$maximagesize, LOGGER_DEBUG); + Logger::log("Image exceeds size limit of ".$maximagesize, Logger::DEBUG); return([]); } @@ -929,7 +929,7 @@ class Image if (!isset($data["mime"])) { unlink($tempfile); - Logger::log("File is no picture", LOGGER_DEBUG); + Logger::log("File is no picture", Logger::DEBUG); return([]); } @@ -937,7 +937,7 @@ class Image if (!$Image->isValid()) { unlink($tempfile); - Logger::log("Picture is no valid picture", LOGGER_DEBUG); + Logger::log("Picture is no valid picture", Logger::DEBUG); return([]); } @@ -968,7 +968,7 @@ class Image $r = Photo::store($Image, $uid, $visitor, $hash, $tempfile, L10n::t('Wall Photos'), 0, 0, $defperm); if (!$r) { - Logger::log("Picture couldn't be stored", LOGGER_DEBUG); + Logger::log("Picture couldn't be stored", Logger::DEBUG); return([]); } diff --git a/src/Object/Post.php b/src/Object/Post.php index 08e0fbaa3b..bb1b81c2cc 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -488,10 +488,10 @@ class Post extends BaseObject { $item_id = $item->getId(); if (!$item_id) { - Logger::log('[ERROR] Post::addChild : Item has no ID!!', LOGGER_DEBUG); + Logger::log('[ERROR] Post::addChild : Item has no ID!!', Logger::DEBUG); return false; } elseif ($this->getChild($item->getId())) { - Logger::log('[WARN] Post::addChild : Item already exists (' . $item->getId() . ').', LOGGER_DEBUG); + Logger::log('[WARN] Post::addChild : Item already exists (' . $item->getId() . ').', Logger::DEBUG); return false; } /* @@ -585,7 +585,7 @@ class Post extends BaseObject return true; } } - Logger::log('[WARN] Item::removeChild : Item is not a child (' . $id . ').', LOGGER_DEBUG); + Logger::log('[WARN] Item::removeChild : Item is not a child (' . $id . ').', Logger::DEBUG); return false; } @@ -651,7 +651,7 @@ class Post extends BaseObject public function getDataValue($name) { if (!isset($this->data[$name])) { - // Logger::log('[ERROR] Item::getDataValue : Item has no value name "'. $name .'".', LOGGER_DEBUG); + // Logger::log('[ERROR] Item::getDataValue : Item has no value name "'. $name .'".', Logger::DEBUG); return false; } @@ -668,7 +668,7 @@ class Post extends BaseObject private function setTemplate($name) { if (!x($this->available_templates, $name)) { - Logger::log('[ERROR] Item::setTemplate : Template not available ("' . $name . '").', LOGGER_DEBUG); + Logger::log('[ERROR] Item::setTemplate : Template not available ("' . $name . '").', Logger::DEBUG); return false; } diff --git a/src/Object/Thread.php b/src/Object/Thread.php index e9a2a06387..b6d92e743c 100644 --- a/src/Object/Thread.php +++ b/src/Object/Thread.php @@ -78,7 +78,7 @@ class Thread extends BaseObject $this->writable = $writable; break; default: - Logger::log('[ERROR] Conversation::setMode : Unhandled mode ('. $mode .').', LOGGER_DEBUG); + Logger::log('[ERROR] Conversation::setMode : Unhandled mode ('. $mode .').', Logger::DEBUG); return false; break; } @@ -138,12 +138,12 @@ class Thread extends BaseObject $item_id = $item->getId(); if (!$item_id) { - Logger::log('[ERROR] Conversation::addThread : Item has no ID!!', LOGGER_DEBUG); + Logger::log('[ERROR] Conversation::addThread : Item has no ID!!', Logger::DEBUG); return false; } if ($this->getParent($item->getId())) { - Logger::log('[WARN] Conversation::addThread : Thread already exists ('. $item->getId() .').', LOGGER_DEBUG); + Logger::log('[WARN] Conversation::addThread : Thread already exists ('. $item->getId() .').', Logger::DEBUG); return false; } @@ -151,12 +151,12 @@ class Thread extends BaseObject * Only add will be displayed */ if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) { - Logger::log('[WARN] Conversation::addThread : Thread is a mail ('. $item->getId() .').', LOGGER_DEBUG); + Logger::log('[WARN] Conversation::addThread : Thread is a mail ('. $item->getId() .').', Logger::DEBUG); return false; } if ($item->getDataValue('verb') === ACTIVITY_LIKE || $item->getDataValue('verb') === ACTIVITY_DISLIKE) { - Logger::log('[WARN] Conversation::addThread : Thread is a (dis)like ('. $item->getId() .').', LOGGER_DEBUG); + Logger::log('[WARN] Conversation::addThread : Thread is a (dis)like ('. $item->getId() .').', Logger::DEBUG); return false; } @@ -190,7 +190,7 @@ class Thread extends BaseObject $item_data = $item->getTemplateData($conv_responses); if (!$item_data) { - Logger::log('[ERROR] Conversation::getTemplateData : Failed to get item template data ('. $item->getId() .').', LOGGER_DEBUG); + Logger::log('[ERROR] Conversation::getTemplateData : Failed to get item template data ('. $item->getId() .').', Logger::DEBUG); return false; } $result[] = $item_data; diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index df1ba7dbd4..7d970c0039 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -159,7 +159,7 @@ class Processor { $owner = Contact::getIdForURL($activity['actor']); - Logger::log('Deleting item ' . $activity['object_id'] . ' from ' . $owner, LOGGER_DEBUG); + Logger::log('Deleting item ' . $activity['object_id'] . ' from ' . $owner, Logger::DEBUG); Item::delete(['uri' => $activity['object_id'], 'owner-id' => $owner]); } @@ -212,7 +212,7 @@ class Processor } $event_id = Event::store($event); - Logger::log('Event '.$event_id.' was stored', LOGGER_DEBUG); + Logger::log('Event '.$event_id.' was stored', Logger::DEBUG); } /** @@ -226,7 +226,7 @@ class Processor /// @todo What to do with $activity['context']? if (($item['gravity'] != GRAVITY_PARENT) && !Item::exists(['uri' => $item['parent-uri']])) { - Logger::log('Parent ' . $item['parent-uri'] . ' not found, message will be discarded.', LOGGER_DEBUG); + Logger::log('Parent ' . $item['parent-uri'] . ' not found, message will be discarded.', Logger::DEBUG); return; } @@ -239,7 +239,7 @@ class Processor $item['owner-link'] = $activity['actor']; $item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true); } else { - Logger::log('Ignoring actor because of thread completion.', LOGGER_DEBUG); + Logger::log('Ignoring actor because of thread completion.', Logger::DEBUG); $item['owner-link'] = $item['author-link']; $item['owner-id'] = $item['author-id']; } @@ -375,7 +375,7 @@ class Processor return; } - Logger::log('Updating profile for ' . $activity['object_id'], LOGGER_DEBUG); + Logger::log('Updating profile for ' . $activity['object_id'], Logger::DEBUG); APContact::getByURL($activity['object_id'], true); } @@ -387,12 +387,12 @@ class Processor public static function deletePerson($activity) { if (empty($activity['object_id']) || empty($activity['actor'])) { - Logger::log('Empty object id or actor.', LOGGER_DEBUG); + Logger::log('Empty object id or actor.', Logger::DEBUG); return; } if ($activity['object_id'] != $activity['actor']) { - Logger::log('Object id does not match actor.', LOGGER_DEBUG); + Logger::log('Object id does not match actor.', Logger::DEBUG); return; } @@ -402,7 +402,7 @@ class Processor } DBA::close($contacts); - Logger::log('Deleted contact ' . $activity['object_id'], LOGGER_DEBUG); + Logger::log('Deleted contact ' . $activity['object_id'], Logger::DEBUG); } /** @@ -421,7 +421,7 @@ class Processor $cid = Contact::getIdForURL($activity['actor'], $uid); if (empty($cid)) { - Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG); + Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG); return; } @@ -436,7 +436,7 @@ class Processor $condition = ['id' => $cid]; DBA::update('contact', $fields, $condition); - Logger::log('Accept contact request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Accept contact request from contact ' . $cid . ' for user ' . $uid, Logger::DEBUG); } /** @@ -455,7 +455,7 @@ class Processor $cid = Contact::getIdForURL($activity['actor'], $uid); if (empty($cid)) { - Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG); + Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG); return; } @@ -463,9 +463,9 @@ class Processor if (DBA::exists('contact', ['id' => $cid, 'rel' => Contact::SHARING, 'pending' => true])) { Contact::remove($cid); - Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . ' - contact had been removed.', LOGGER_DEBUG); + Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . ' - contact had been removed.', Logger::DEBUG); } else { - Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . '.', LOGGER_DEBUG); + Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . '.', Logger::DEBUG); } } @@ -508,7 +508,7 @@ class Processor $cid = Contact::getIdForURL($activity['actor'], $uid); if (empty($cid)) { - Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG); + Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG); return; } @@ -520,7 +520,7 @@ class Processor } Contact::removeFollower($owner, $contact); - Logger::log('Undo following request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Undo following request from contact ' . $cid . ' for user ' . $uid, Logger::DEBUG); } /** diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 707d0308ad..80c2a5f084 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -60,16 +60,16 @@ class Receiver { $http_signer = HTTPSignature::getSigner($body, $header); if (empty($http_signer)) { - Logger::log('Invalid HTTP signature, message will be discarded.', LOGGER_DEBUG); + Logger::log('Invalid HTTP signature, message will be discarded.', Logger::DEBUG); return; } else { - Logger::log('HTTP signature is signed by ' . $http_signer, LOGGER_DEBUG); + Logger::log('HTTP signature is signed by ' . $http_signer, Logger::DEBUG); } $activity = json_decode($body, true); if (empty($activity)) { - Logger::log('Invalid body.', LOGGER_DEBUG); + Logger::log('Invalid body.', Logger::DEBUG); return; } @@ -77,31 +77,31 @@ class Receiver $actor = JsonLD::fetchElement($ldactivity, 'as:actor'); - Logger::log('Message for user ' . $uid . ' is from actor ' . $actor, LOGGER_DEBUG); + Logger::log('Message for user ' . $uid . ' is from actor ' . $actor, Logger::DEBUG); if (LDSignature::isSigned($activity)) { $ld_signer = LDSignature::getSigner($activity); if (empty($ld_signer)) { - Logger::log('Invalid JSON-LD signature from ' . $actor, LOGGER_DEBUG); + Logger::log('Invalid JSON-LD signature from ' . $actor, Logger::DEBUG); } if (!empty($ld_signer && ($actor == $http_signer))) { - Logger::log('The HTTP and the JSON-LD signature belong to ' . $ld_signer, LOGGER_DEBUG); + Logger::log('The HTTP and the JSON-LD signature belong to ' . $ld_signer, Logger::DEBUG); $trust_source = true; } elseif (!empty($ld_signer)) { - Logger::log('JSON-LD signature is signed by ' . $ld_signer, LOGGER_DEBUG); + Logger::log('JSON-LD signature is signed by ' . $ld_signer, Logger::DEBUG); $trust_source = true; } elseif ($actor == $http_signer) { - Logger::log('Bad JSON-LD signature, but HTTP signer fits the actor.', LOGGER_DEBUG); + Logger::log('Bad JSON-LD signature, but HTTP signer fits the actor.', Logger::DEBUG); $trust_source = true; } else { - Logger::log('Invalid JSON-LD signature and the HTTP signer is different.', LOGGER_DEBUG); + Logger::log('Invalid JSON-LD signature and the HTTP signer is different.', Logger::DEBUG); $trust_source = false; } } elseif ($actor == $http_signer) { - Logger::log('Trusting post without JSON-LD signature, The actor fits the HTTP signer.', LOGGER_DEBUG); + Logger::log('Trusting post without JSON-LD signature, The actor fits the HTTP signer.', Logger::DEBUG); $trust_source = true; } else { - Logger::log('No JSON-LD signature, different actor.', LOGGER_DEBUG); + Logger::log('No JSON-LD signature, different actor.', Logger::DEBUG); $trust_source = false; } @@ -160,7 +160,7 @@ class Receiver { $actor = JsonLD::fetchElement($activity, 'as:actor'); if (empty($actor)) { - Logger::log('Empty actor', LOGGER_DEBUG); + Logger::log('Empty actor', Logger::DEBUG); return []; } @@ -176,11 +176,11 @@ class Receiver $receivers = array_merge($receivers, $additional); } - Logger::log('Receivers: ' . json_encode($receivers), LOGGER_DEBUG); + Logger::log('Receivers: ' . json_encode($receivers), Logger::DEBUG); $object_id = JsonLD::fetchElement($activity, 'as:object'); if (empty($object_id)) { - Logger::log('No object found', LOGGER_DEBUG); + Logger::log('No object found', Logger::DEBUG); return []; } @@ -193,7 +193,7 @@ class Receiver } $object_data = self::fetchObject($object_id, $activity['as:object'], $trust_source); if (empty($object_data)) { - Logger::log("Object data couldn't be processed", LOGGER_DEBUG); + Logger::log("Object data couldn't be processed", Logger::DEBUG); return []; } // We had been able to retrieve the object data - so we can trust the source @@ -230,7 +230,7 @@ class Receiver $object_data['actor'] = $actor; $object_data['receiver'] = array_merge(defaults($object_data, 'receiver', []), $receivers); - Logger::log('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id'], LOGGER_DEBUG); + Logger::log('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id'], Logger::DEBUG); return $object_data; } @@ -273,17 +273,17 @@ class Receiver { $type = JsonLD::fetchElement($activity, '@type'); if (!$type) { - Logger::log('Empty type', LOGGER_DEBUG); + Logger::log('Empty type', Logger::DEBUG); return; } if (!JsonLD::fetchElement($activity, 'as:object')) { - Logger::log('Empty object', LOGGER_DEBUG); + Logger::log('Empty object', Logger::DEBUG); return; } if (!JsonLD::fetchElement($activity, 'as:actor')) { - Logger::log('Empty actor', LOGGER_DEBUG); + Logger::log('Empty actor', Logger::DEBUG); return; } @@ -291,12 +291,12 @@ class Receiver // $trust_source is called by reference and is set to true if the content was retrieved successfully $object_data = self::prepareObjectData($activity, $uid, $trust_source); if (empty($object_data)) { - Logger::log('No object data found', LOGGER_DEBUG); + Logger::log('No object data found', Logger::DEBUG); return; } if (!$trust_source) { - Logger::log('No trust for activity type "' . $type . '", so we quit now.', LOGGER_DEBUG); + Logger::log('No trust for activity type "' . $type . '", so we quit now.', Logger::DEBUG); return; } @@ -385,7 +385,7 @@ class Receiver break; default: - Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], LOGGER_DEBUG); + Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], Logger::DEBUG); break; } } @@ -415,9 +415,9 @@ class Receiver $profile = APContact::getByURL($actor); $followers = defaults($profile, 'followers', ''); - Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG); + Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, Logger::DEBUG); } else { - Logger::log('Empty actor', LOGGER_DEBUG); + Logger::log('Empty actor', Logger::DEBUG); $followers = ''; } @@ -501,7 +501,7 @@ class Receiver // Send a new follow request to be sure that the connection still exists if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND]])) { ActivityPub\Transmitter::sendActivity('Follow', $profile['url'], $uid); - Logger::log('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, Logger::DEBUG); } } @@ -571,27 +571,27 @@ class Receiver $data = ActivityPub::fetchContent($object_id); if (!empty($data)) { $object = JsonLD::compact($data); - Logger::log('Fetched content for ' . $object_id, LOGGER_DEBUG); + Logger::log('Fetched content for ' . $object_id, Logger::DEBUG); } else { - Logger::log('Empty content for ' . $object_id . ', check if content is available locally.', LOGGER_DEBUG); + Logger::log('Empty content for ' . $object_id . ', check if content is available locally.', Logger::DEBUG); $item = Item::selectFirst([], ['uri' => $object_id]); if (!DBA::isResult($item)) { - Logger::log('Object with url ' . $object_id . ' was not found locally.', LOGGER_DEBUG); + Logger::log('Object with url ' . $object_id . ' was not found locally.', Logger::DEBUG); return false; } - Logger::log('Using already stored item for url ' . $object_id, LOGGER_DEBUG); + Logger::log('Using already stored item for url ' . $object_id, Logger::DEBUG); $data = ActivityPub\Transmitter::createNote($item); $object = JsonLD::compact($data); } } else { - Logger::log('Using original object for url ' . $object_id, LOGGER_DEBUG); + Logger::log('Using original object for url ' . $object_id, Logger::DEBUG); } $type = JsonLD::fetchElement($object, '@type'); if (empty($type)) { - Logger::log('Empty type', LOGGER_DEBUG); + Logger::log('Empty type', Logger::DEBUG); return false; } @@ -607,7 +607,7 @@ class Receiver return self::fetchObject($object_id); } - Logger::log('Unhandled object type: ' . $type, LOGGER_DEBUG); + Logger::log('Unhandled object type: ' . $type, Logger::DEBUG); } /** diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index d9535f0b62..d3043c530b 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -1016,7 +1016,7 @@ class Transmitter $signed = LDSignature::sign($data, $owner); - Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG); + Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG); return HTTPSignature::transmit($signed, $inbox, $uid); } @@ -1045,7 +1045,7 @@ class Transmitter $signed = LDSignature::sign($data, $owner); - Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG); + Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG); return HTTPSignature::transmit($signed, $inbox, $uid); } @@ -1074,7 +1074,7 @@ class Transmitter $signed = LDSignature::sign($data, $owner); - Logger::log('Deliver profile update for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', LOGGER_DEBUG); + Logger::log('Deliver profile update for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG); return HTTPSignature::transmit($signed, $inbox, $uid); } @@ -1099,7 +1099,7 @@ class Transmitter 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => $profile['url']]; - Logger::log('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, Logger::DEBUG); $signed = LDSignature::sign($data, $owner); HTTPSignature::transmit($signed, $profile['inbox'], $uid); @@ -1127,7 +1127,7 @@ class Transmitter 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => $profile['url']]; - Logger::log('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); + Logger::log('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG); $signed = LDSignature::sign($data, $owner); HTTPSignature::transmit($signed, $profile['inbox'], $uid); @@ -1155,7 +1155,7 @@ class Transmitter 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => $profile['url']]; - Logger::log('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); + Logger::log('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG); $signed = LDSignature::sign($data, $owner); HTTPSignature::transmit($signed, $profile['inbox'], $uid); @@ -1184,7 +1184,7 @@ class Transmitter 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => $profile['url']]; - Logger::log('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); + Logger::log('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG); $signed = LDSignature::sign($data, $owner); HTTPSignature::transmit($signed, $profile['inbox'], $uid); diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 95921eecbb..b48dc0a8d8 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -176,7 +176,7 @@ class DFRN ); if (! DBA::isResult($r)) { - Logger::log(sprintf('No contact found for nickname=%d', $owner_nick), LOGGER_WARNING); + Logger::log(sprintf('No contact found for nickname=%d', $owner_nick), Logger::WARNING); killme(); } @@ -212,7 +212,7 @@ class DFRN ); if (! DBA::isResult($r)) { - Logger::log(sprintf('No contact found for uid=%d', $owner_id), LOGGER_WARNING); + Logger::log(sprintf('No contact found for uid=%d', $owner_id), Logger::WARNING); killme(); } @@ -1189,7 +1189,7 @@ class DFRN $rino = Config::get('system', 'rino_encrypt'); $rino = intval($rino); - Logger::log("Local rino version: ". $rino, LOGGER_DEBUG); + Logger::log("Local rino version: ". $rino, Logger::DEBUG); $ssl_val = intval(Config::get('system', 'ssl_policy')); $ssl_policy = ''; @@ -1226,7 +1226,7 @@ class DFRN return -3; // timed out } - Logger::log('dfrn_deliver: ' . $xml, LOGGER_DATA); + Logger::log('dfrn_deliver: ' . $xml, Logger::DATA); if (empty($xml)) { Contact::markForArchival($contact); @@ -1235,7 +1235,7 @@ class DFRN if (strpos($xml, 'rino); $page = (($owner['page-flags'] == Contact::PAGE_COMMUNITY) ? 1 : 0); - Logger::log("Remote rino version: ".$rino_remote_version." for ".$contact["url"], LOGGER_DEBUG); + Logger::log("Remote rino version: ".$rino_remote_version." for ".$contact["url"], Logger::DEBUG); if ($owner['page-flags'] == Contact::PAGE_PRVGROUP) { $page = 2; @@ -1366,13 +1366,13 @@ class DFRN } - Logger::log('dfrn_deliver: ' . "SENDING: " . print_r($postvars, true), LOGGER_DATA); + Logger::log('dfrn_deliver: ' . "SENDING: " . print_r($postvars, true), Logger::DATA); $postResult = Network::post($contact['notify'], $postvars); $xml = $postResult->getBody(); - Logger::log('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA); + Logger::log('dfrn_deliver: ' . "RECEIVED: " . $xml, Logger::DATA); $curl_stat = $postResult->getReturnCode(); if (empty($curl_stat) || empty($xml)) { @@ -1387,7 +1387,7 @@ class DFRN if (strpos($xml, 'message)) { - Logger::log('Delivery returned status '.$res->status.' - '.$res->message, LOGGER_DEBUG); + Logger::log('Delivery returned status '.$res->status.' - '.$res->message, Logger::DEBUG); } if (($res->status >= 200) && ($res->status <= 299)) { @@ -1486,7 +1486,7 @@ class DFRN if (strpos($xml, 'message)) { - Logger::log('Transmit to ' . $dest_url . ' returned status '.$res->status.' - '.$res->message, LOGGER_DEBUG); + Logger::log('Transmit to ' . $dest_url . ' returned status '.$res->status.' - '.$res->message, Logger::DEBUG); } if (($res->status >= 200) && ($res->status <= 299)) { @@ -1576,7 +1576,7 @@ class DFRN $author["network"] = $contact_old["network"]; } else { if (!$onlyfetch) { - Logger::log("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml, LOGGER_DEBUG); + Logger::log("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml, Logger::DEBUG); } $author["contact-unknown"] = true; @@ -1629,7 +1629,7 @@ class DFRN } if (DBA::isResult($contact_old) && !$onlyfetch) { - Logger::log("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", LOGGER_DEBUG); + Logger::log("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", Logger::DEBUG); $poco = ["url" => $contact_old["url"]]; @@ -1690,7 +1690,7 @@ class DFRN // If the "hide" element is present then the profile isn't searchable. $hide = intval(XML::getFirstNodeValue($xpath, $element . "/dfrn:hide/text()", $context) == "true"); - Logger::log("Hidden status for contact " . $contact_old["url"] . ": " . $hide, LOGGER_DEBUG); + Logger::log("Hidden status for contact " . $contact_old["url"] . ": " . $hide, Logger::DEBUG); // If the contact isn't searchable then set the contact to "hidden". // Problem: This can be manually overridden by the user. @@ -1762,20 +1762,20 @@ class DFRN $contact[$field] = DateTimeFormat::utc($contact[$field]); if (strtotime($contact[$field]) > strtotime($contact_old[$field])) { - Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", LOGGER_DEBUG); + Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", Logger::DEBUG); $update = true; } } foreach ($fields as $field => $data) { if ($contact[$field] != $contact_old[$field]) { - Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", LOGGER_DEBUG); + Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", Logger::DEBUG); $update = true; } } if ($update) { - Logger::log("Update contact data for contact " . $contact["id"] . " (" . $contact["nick"] . ")", LOGGER_DEBUG); + Logger::log("Update contact data for contact " . $contact["id"] . " (" . $contact["nick"] . ")", Logger::DEBUG); q( "UPDATE `contact` SET `name` = '%s', `nick` = '%s', `about` = '%s', `location` = '%s', @@ -2299,7 +2299,7 @@ class DFRN */ private static function processVerbs($entrytype, $importer, &$item, &$is_like) { - Logger::log("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG); + Logger::log("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, Logger::DEBUG); if (($entrytype == DFRN::TOP_LEVEL)) { // The filling of the the "contact" variable is done for legcy reasons @@ -2464,7 +2464,7 @@ class DFRN ); // Is there an existing item? if (DBA::isResult($current) && !self::isEditedTimestampNewer($current, $item)) { - Logger::log("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG); + Logger::log("Item ".$item["uri"]." (".$item['edited'].") already existed.", Logger::DEBUG); return; } @@ -2672,10 +2672,10 @@ class DFRN // Is it an event? if (($item["object-type"] == ACTIVITY_OBJ_EVENT) && !$owner_unknown) { - Logger::log("Item ".$item["uri"]." seems to contain an event.", LOGGER_DEBUG); + Logger::log("Item ".$item["uri"]." seems to contain an event.", Logger::DEBUG); $ev = Event::fromBBCode($item["body"]); if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) { - Logger::log("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG); + Logger::log("Event in item ".$item["uri"]." was found.", Logger::DEBUG); $ev["cid"] = $importer["id"]; $ev["uid"] = $importer["importer_uid"]; $ev["uri"] = $item["uri"]; @@ -2691,20 +2691,20 @@ class DFRN } $event_id = Event::store($ev); - Logger::log("Event ".$event_id." was stored", LOGGER_DEBUG); + Logger::log("Event ".$event_id." was stored", Logger::DEBUG); return; } } } if (!self::processVerbs($entrytype, $importer, $item, $is_like)) { - Logger::log("Exiting because 'processVerbs' told us so", LOGGER_DEBUG); + Logger::log("Exiting because 'processVerbs' told us so", Logger::DEBUG); return; } // This check is done here to be able to receive connection requests in "processVerbs" if (($entrytype == DFRN::TOP_LEVEL) && $owner_unknown) { - Logger::log("Item won't be stored because user " . $importer["importer_uid"] . " doesn't follow " . $item["owner-link"] . ".", LOGGER_DEBUG); + Logger::log("Item won't be stored because user " . $importer["importer_uid"] . " doesn't follow " . $item["owner-link"] . ".", Logger::DEBUG); return; } @@ -2712,9 +2712,9 @@ class DFRN // Update content if 'updated' changes if (DBA::isResult($current)) { if (self::updateContent($current, $item, $importer, $entrytype)) { - Logger::log("Item ".$item["uri"]." was updated.", LOGGER_DEBUG); + Logger::log("Item ".$item["uri"]." was updated.", Logger::DEBUG); } else { - Logger::log("Item " . $item["uri"] . " already existed.", LOGGER_DEBUG); + Logger::log("Item " . $item["uri"] . " already existed.", Logger::DEBUG); } return; } @@ -2724,7 +2724,7 @@ class DFRN $parent = 0; if ($posted_id) { - Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, LOGGER_DEBUG); + Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, Logger::DEBUG); if ($item['uid'] == 0) { Item::distribute($posted_id); @@ -2734,7 +2734,7 @@ class DFRN } } else { // $entrytype == DFRN::TOP_LEVEL if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) { - Logger::log("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG); + Logger::log("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", Logger::DEBUG); return; } if (!link_compare($item["owner-link"], $importer["url"])) { @@ -2744,13 +2744,13 @@ class DFRN * the tgroup delivery code called from Item::insert will correct it if it's a forum, * but we're going to unconditionally correct it here so that the post will always be owned by our contact. */ - Logger::log('Correcting item owner.', LOGGER_DEBUG); + Logger::log('Correcting item owner.', Logger::DEBUG); $item["owner-link"] = $importer["url"]; $item["owner-id"] = Contact::getIdForURL($importer["url"], 0); } if (($importer["rel"] == Contact::FOLLOWER) && (!self::tgroupCheck($importer["importer_uid"], $item))) { - Logger::log("Contact ".$importer["id"]." is only follower and tgroup check was negative.", LOGGER_DEBUG); + Logger::log("Contact ".$importer["id"]." is only follower and tgroup check was negative.", Logger::DEBUG); return; } @@ -2764,7 +2764,7 @@ class DFRN $posted_id = $notify; } - Logger::log("Item was stored with id ".$posted_id, LOGGER_DEBUG); + Logger::log("Item was stored with id ".$posted_id, Logger::DEBUG); if ($item['uid'] == 0) { Item::distribute($posted_id); @@ -2803,18 +2803,18 @@ class DFRN $condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]]; $item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition); if (!DBA::isResult($item)) { - Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG); + Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", Logger::DEBUG); return; } if (strstr($item['file'], '[')) { - Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " is filed. So it won't be deleted.", LOGGER_DEBUG); + Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " is filed. So it won't be deleted.", Logger::DEBUG); return; } // When it is a starting post it has to belong to the person that wants to delete it if (($item['id'] == $item['parent']) && ($item['contact-id'] != $importer["id"])) { - Logger::log("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG); + Logger::log("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", Logger::DEBUG); return; } @@ -2822,7 +2822,7 @@ class DFRN if (($item['id'] != $item['parent']) && ($item['contact-id'] != $importer["id"])) { $condition = ['id' => $item['parent'], 'contact-id' => $importer["id"]]; if (!Item::exists($condition)) { - Logger::log("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG); + Logger::log("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", Logger::DEBUG); return; } } @@ -2831,7 +2831,7 @@ class DFRN return; } - Logger::log('deleting item '.$item['id'].' uri='.$uri, LOGGER_DEBUG); + Logger::log('deleting item '.$item['id'].' uri='.$uri, Logger::DEBUG); Item::delete(['id' => $item['id']]); } @@ -2885,7 +2885,7 @@ class DFRN self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml); } - Logger::log("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG); + Logger::log("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], Logger::DEBUG); // is it a public forum? Private forums aren't exposed with this method $forum = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:community/text()")); @@ -2951,7 +2951,7 @@ class DFRN self::processEntry($header, $xpath, $entry, $importer, $xml); } } - Logger::log("Import done for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG); + Logger::log("Import done for user " . $importer["importer_uid"] . " from contact " . $importer["id"], Logger::DEBUG); return 200; } @@ -3036,7 +3036,7 @@ class DFRN $url = curPageURL(); - Logger::log('auto_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG); + Logger::log('auto_redir: ' . $r[0]['name'] . ' ' . $sec, Logger::DEBUG); $dest = (($url) ? '&destination_url=' . $url : ''); System::externalRedirect($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest); diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 516e7c63db..66a19d839c 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -261,7 +261,7 @@ class Diaspora if (base64_encode(base64_decode(base64_decode($signature))) == base64_decode($signature)) { $signature = base64_decode($signature); - Logger::log("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, LOGGER_DEBUG); + Logger::log("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, Logger::DEBUG); // Do a recursive call to be able to fix even multiple levels if ($level < 10) { @@ -498,7 +498,7 @@ class Diaspora } else { // This happens with posts from a relais if (!$importer) { - Logger::log("This is no private post in the old format", LOGGER_DEBUG); + Logger::log("This is no private post in the old format", Logger::DEBUG); return false; } @@ -517,7 +517,7 @@ class Diaspora $decrypted = self::aesDecrypt($outer_key, $outer_iv, $ciphertext); - Logger::log('decrypted: '.$decrypted, LOGGER_DEBUG); + Logger::log('decrypted: '.$decrypted, Logger::DEBUG); $idom = XML::parseString($decrypted); $inner_iv = base64_decode($idom->iv); @@ -662,7 +662,7 @@ class Diaspora $type = $fields->getName(); - Logger::log("Received message type ".$type." from ".$sender." for user ".$importer["uid"], LOGGER_DEBUG); + Logger::log("Received message type ".$type." from ".$sender." for user ".$importer["uid"], Logger::DEBUG); switch ($type) { case "account_migration": @@ -754,7 +754,7 @@ class Diaspora $data = XML::parseString($msg["message"]); if (!is_object($data)) { - Logger::log("No valid XML ".$msg["message"], LOGGER_DEBUG); + Logger::log("No valid XML ".$msg["message"], Logger::DEBUG); return false; } @@ -772,7 +772,7 @@ class Diaspora $type = $element->getName(); $orig_type = $type; - Logger::log("Got message type ".$type.": ".$msg["message"], LOGGER_DATA); + Logger::log("Got message type ".$type.": ".$msg["message"], Logger::DATA); // All retractions are handled identically from now on. // In the new version there will only be "retraction". @@ -859,31 +859,31 @@ class Diaspora } // No author_signature? This is a must, so we quit. if (!isset($author_signature)) { - Logger::log("No author signature for type ".$type." - Message: ".$msg["message"], LOGGER_DEBUG); + Logger::log("No author signature for type ".$type." - Message: ".$msg["message"], Logger::DEBUG); return false; } if (isset($parent_author_signature)) { $key = self::key($msg["author"]); if (empty($key)) { - Logger::log("No key found for parent author ".$msg["author"], LOGGER_DEBUG); + Logger::log("No key found for parent author ".$msg["author"], Logger::DEBUG); return false; } if (!Crypto::rsaVerify($signed_data, $parent_author_signature, $key, "sha256")) { - Logger::log("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, LOGGER_DEBUG); + Logger::log("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, Logger::DEBUG); return false; } } $key = self::key($fields->author); if (empty($key)) { - Logger::log("No key found for author ".$fields->author, LOGGER_DEBUG); + Logger::log("No key found for author ".$fields->author, Logger::DEBUG); return false; } if (!Crypto::rsaVerify($signed_data, $author_signature, $key, "sha256")) { - Logger::log("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, LOGGER_DEBUG); + Logger::log("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, Logger::DEBUG); return false; } else { return $fields; @@ -924,7 +924,7 @@ class Diaspora $person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]); if (DBA::isResult($person)) { - Logger::log("In cache " . print_r($person, true), LOGGER_DEBUG); + Logger::log("In cache " . print_r($person, true), Logger::DEBUG); // update record occasionally so it doesn't get stale $d = strtotime($person["updated"]." +00:00"); @@ -938,7 +938,7 @@ class Diaspora } if (!DBA::isResult($person) || $update) { - Logger::log("create or refresh", LOGGER_DEBUG); + Logger::log("create or refresh", Logger::DEBUG); $r = Probe::uri($handle, Protocol::DIASPORA); // Note that Friendica contacts will return a "Diaspora person" @@ -990,7 +990,7 @@ class Diaspora { $handle = false; - Logger::log("contact id is ".$contact_id." - pcontact id is ".$pcontact_id, LOGGER_DEBUG); + Logger::log("contact id is ".$contact_id." - pcontact id is ".$pcontact_id, Logger::DEBUG); if ($pcontact_id != 0) { $contact = DBA::selectFirst('contact', ['addr'], ['id' => $pcontact_id]); @@ -1008,7 +1008,7 @@ class Diaspora if (DBA::isResult($r)) { $contact = $r[0]; - Logger::log("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG); + Logger::log("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], Logger::DEBUG); if ($contact['addr'] != "") { $handle = $contact['addr']; @@ -1034,7 +1034,7 @@ class Diaspora */ public static function urlFromContactGuid($fcontact_guid) { - Logger::log("fcontact guid is ".$fcontact_guid, LOGGER_DEBUG); + Logger::log("fcontact guid is ".$fcontact_guid, Logger::DEBUG); $r = q( "SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'", @@ -1069,14 +1069,14 @@ class Diaspora } if (!$cid) { - Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG); + Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, Logger::DEBUG); return false; } $contact = DBA::selectFirst('contact', [], ['id' => $cid]); if (!DBA::isResult($contact)) { // This here shouldn't happen at all - Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG); + Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, Logger::DEBUG); return false; } @@ -1278,7 +1278,7 @@ class Diaspora $server = $serverparts["scheme"]."://".$serverparts["host"]; - Logger::log("Trying to fetch item ".$guid." from ".$server, LOGGER_DEBUG); + Logger::log("Trying to fetch item ".$guid." from ".$server, Logger::DEBUG); $msg = self::message($guid, $server); @@ -1286,7 +1286,7 @@ class Diaspora return false; } - Logger::log("Successfully fetched item ".$guid." from ".$server, LOGGER_DEBUG); + Logger::log("Successfully fetched item ".$guid." from ".$server, Logger::DEBUG); // Now call the dispatcher return self::dispatchPublic($msg); @@ -1313,16 +1313,16 @@ class Diaspora // This will work for new Diaspora servers and Friendica servers from 3.5 $source_url = $server."/fetch/post/".urlencode($guid); - Logger::log("Fetch post from ".$source_url, LOGGER_DEBUG); + Logger::log("Fetch post from ".$source_url, Logger::DEBUG); $envelope = Network::fetchUrl($source_url); if ($envelope) { - Logger::log("Envelope was fetched.", LOGGER_DEBUG); + Logger::log("Envelope was fetched.", Logger::DEBUG); $x = self::verifyMagicEnvelope($envelope); if (!$x) { - Logger::log("Envelope could not be verified.", LOGGER_DEBUG); + Logger::log("Envelope could not be verified.", Logger::DEBUG); } else { - Logger::log("Envelope was verified.", LOGGER_DEBUG); + Logger::log("Envelope was verified.", Logger::DEBUG); } } else { $x = false; @@ -1331,7 +1331,7 @@ class Diaspora // This will work for older Diaspora and Friendica servers if (!$x) { $source_url = $server."/p/".urlencode($guid).".xml"; - Logger::log("Fetch post from ".$source_url, LOGGER_DEBUG); + Logger::log("Fetch post from ".$source_url, Logger::DEBUG); $x = Network::fetchUrl($source_url); if (!$x) { @@ -1347,11 +1347,11 @@ class Diaspora if ($source_xml->post->reshare) { // Reshare of a reshare - old Diaspora version - Logger::log("Message is a reshare", LOGGER_DEBUG); + Logger::log("Message is a reshare", Logger::DEBUG); return self::message($source_xml->post->reshare->root_guid, $server, ++$level); } elseif ($source_xml->getName() == "reshare") { // Reshare of a reshare - new Diaspora version - Logger::log("Message is a new reshare", LOGGER_DEBUG); + Logger::log("Message is a new reshare", Logger::DEBUG); return self::message($source_xml->root_guid, $server, ++$level); } @@ -1366,7 +1366,7 @@ class Diaspora // If this isn't a "status_message" then quit if (!$author) { - Logger::log("Message doesn't seem to be a status message", LOGGER_DEBUG); + Logger::log("Message doesn't seem to be a status message", Logger::DEBUG); return false; } @@ -1405,7 +1405,7 @@ class Diaspora } if ($result) { - Logger::log("Fetched missing item ".$guid." - result: ".$result, LOGGER_DEBUG); + Logger::log("Fetched missing item ".$guid." - result: ".$result, Logger::DEBUG); $item = Item::selectFirst($fields, $condition); } @@ -1635,7 +1635,7 @@ class Diaspora { $item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]); if (DBA::isResult($item)) { - Logger::log("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG); + Logger::log("Found user ".$item['uid']." as owner of item ".$guid, Logger::DEBUG); $contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]); if (DBA::isResult($contact)) { return $contact; @@ -1750,7 +1750,7 @@ class Diaspora } if ($message_id) { - Logger::log("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG); + Logger::log("Stored comment ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG); if ($datarray['uid'] == 0) { Item::distribute($message_id, json_encode($data)); } @@ -1805,7 +1805,7 @@ class Diaspora DBA::lock('mail'); if (DBA::exists('mail', ['guid' => $msg_guid, 'uid' => $importer["uid"]])) { - Logger::log("duplicate message already delivered.", LOGGER_DEBUG); + Logger::log("duplicate message already delivered.", Logger::DEBUG); return false; } @@ -2009,7 +2009,7 @@ class Diaspora } if ($message_id) { - Logger::log("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG); + Logger::log("Stored like ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG); if ($datarray['uid'] == 0) { Item::distribute($message_id, json_encode($data)); } @@ -2064,7 +2064,7 @@ class Diaspora DBA::lock('mail'); if (DBA::exists('mail', ['guid' => $guid, 'uid' => $importer["uid"]])) { - Logger::log("duplicate message already delivered.", LOGGER_DEBUG); + Logger::log("duplicate message already delivered.", Logger::DEBUG); return false; } @@ -2132,7 +2132,7 @@ class Diaspora $server = $author; } - Logger::log('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG); + Logger::log('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, Logger::DEBUG); if (!DBA::exists('participation', ['iid' => $item['id'], 'server' => $server])) { DBA::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]); @@ -2149,7 +2149,7 @@ class Diaspora } else { $cmd = $comment['self'] ? 'like' : 'comment-import'; } - Logger::log("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, LOGGER_DEBUG); + Logger::log("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, Logger::DEBUG); Worker::add(PRIORITY_HIGH, 'Delivery', $cmd, $comment['id'], $contact_id); } DBA::close($comments); @@ -2275,7 +2275,7 @@ class Diaspora GContact::link($gcid, $importer["uid"], $contact["id"]); - Logger::log("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG); + Logger::log("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], Logger::DEBUG); return true; } @@ -2337,7 +2337,7 @@ class Diaspora // That makes us friends. if ($contact) { if ($following) { - Logger::log("Author ".$author." (Contact ".$contact["id"].") wants to follow us.", LOGGER_DEBUG); + Logger::log("Author ".$author." (Contact ".$contact["id"].") wants to follow us.", Logger::DEBUG); self::receiveRequestMakeFriend($importer, $contact); // refetch the contact array @@ -2348,30 +2348,30 @@ class Diaspora if (in_array($contact["rel"], [Contact::FRIEND])) { $user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]); if (DBA::isResult($user)) { - Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG); + Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], Logger::DEBUG); $ret = self::sendShare($user, $contact); } } return true; } else { - Logger::log("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG); + Logger::log("Author ".$author." doesn't want to follow us anymore.", Logger::DEBUG); Contact::removeFollower($importer, $contact); return true; } } if (!$following && $sharing && in_array($importer["page-flags"], [Contact::PAGE_SOAPBOX, Contact::PAGE_NORMAL])) { - Logger::log("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", LOGGER_DEBUG); + Logger::log("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", Logger::DEBUG); return false; } elseif (!$following && !$sharing) { - Logger::log("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", LOGGER_DEBUG); + Logger::log("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", Logger::DEBUG); return false; } elseif (!$following && $sharing) { - Logger::log("Author ".$author." wants to share with us.", LOGGER_DEBUG); + Logger::log("Author ".$author." wants to share with us.", Logger::DEBUG); } elseif ($following && $sharing) { - Logger::log("Author ".$author." wants to have a bidirectional conection.", LOGGER_DEBUG); + Logger::log("Author ".$author." wants to have a bidirectional conection.", Logger::DEBUG); } elseif ($following && !$sharing) { - Logger::log("Author ".$author." wants to listen to us.", LOGGER_DEBUG); + Logger::log("Author ".$author." wants to listen to us.", Logger::DEBUG); } $ret = self::personByHandle($author); @@ -2412,14 +2412,14 @@ class Diaspora return; } - Logger::log("Author ".$author." was added as contact number ".$contact_record["id"].".", LOGGER_DEBUG); + Logger::log("Author ".$author." was added as contact number ".$contact_record["id"].".", Logger::DEBUG); Group::addMember(User::getDefaultGroup($importer['uid'], $ret["network"]), $contact_record['id']); Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true); if (in_array($importer["page-flags"], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP])) { - Logger::log("Sending intra message for author ".$author.".", LOGGER_DEBUG); + Logger::log("Sending intra message for author ".$author.".", Logger::DEBUG); $hash = random_string().(string)time(); // Generate a confirm_key @@ -2437,7 +2437,7 @@ class Diaspora } else { // automatic friend approval - Logger::log("Does an automatic friend approval for author ".$author.".", LOGGER_DEBUG); + Logger::log("Does an automatic friend approval for author ".$author.".", Logger::DEBUG); Contact::updateAvatar($contact_record["photo"], $importer["uid"], $contact_record["id"]); @@ -2471,7 +2471,7 @@ class Diaspora $user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]); if (DBA::isResult($user)) { - Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], LOGGER_DEBUG); + Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], Logger::DEBUG); $ret = self::sendShare($user, $contact_record); // Send the profile data, maybe it weren't transmitted before @@ -2644,7 +2644,7 @@ class Diaspora self::sendParticipation($contact, $datarray); if ($message_id) { - Logger::log("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG); + Logger::log("Stored reshare ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG); if ($datarray['uid'] == 0) { Item::distribute($message_id); } @@ -2697,7 +2697,7 @@ class Diaspora while ($item = Item::fetch($r)) { if (strstr($item['file'], '[')) { - Logger::log("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.", LOGGER_DEBUG); + Logger::log("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.", Logger::DEBUG); continue; } @@ -2706,13 +2706,13 @@ class Diaspora // Only delete it if the parent author really fits if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) { - Logger::log("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], LOGGER_DEBUG); + Logger::log("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], Logger::DEBUG); continue; } Item::delete(['id' => $item['id']]); - Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG); + Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], Logger::DEBUG); } return true; @@ -2741,7 +2741,7 @@ class Diaspora $contact = []; } - Logger::log("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], LOGGER_DEBUG); + Logger::log("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], Logger::DEBUG); switch ($target_type) { case "Comment": @@ -2871,7 +2871,7 @@ class Diaspora self::sendParticipation($contact, $datarray); if ($message_id) { - Logger::log("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG); + Logger::log("Stored item ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG); if ($datarray['uid'] == 0) { Item::distribute($message_id); } @@ -2923,7 +2923,7 @@ class Diaspora */ public static function encodePrivateData($msg, array $user, array $contact, $prvkey, $pubkey) { - Logger::log("Message: ".$msg, LOGGER_DATA); + Logger::log("Message: ".$msg, Logger::DATA); // without a public key nothing will work if (!$pubkey) { @@ -3141,8 +3141,8 @@ class Diaspora { $msg = self::buildPostXml($type, $message); - Logger::log('message: '.$msg, LOGGER_DATA); - Logger::log('send guid '.$guid, LOGGER_DEBUG); + Logger::log('message: '.$msg, Logger::DATA); + Logger::log('send guid '.$guid, Logger::DEBUG); // Fallback if the private key wasn't transmitted in the expected field if (empty($owner['uprvkey'])) { @@ -3158,7 +3158,7 @@ class Diaspora $return_code = self::transmit($owner, $contact, $envelope, $public_batch, false, $guid); } - Logger::log("guid: ".$guid." result ".$return_code, LOGGER_DEBUG); + Logger::log("guid: ".$guid." result ".$return_code, Logger::DEBUG); return $return_code; } @@ -3203,7 +3203,7 @@ class Diaspora "parent_type" => "Post", "parent_guid" => $item["guid"]]; - Logger::log("Send participation for ".$item["guid"]." by ".$author, LOGGER_DEBUG); + Logger::log("Send participation for ".$item["guid"]." by ".$author, Logger::DEBUG); // It doesn't matter what we store, we only want to avoid sending repeated notifications for the same item Cache::set($cachekey, $item["guid"], Cache::QUARTER_HOUR); @@ -3232,7 +3232,7 @@ class Diaspora "profile" => $profile, "signature" => $signature]; - Logger::log("Send account migration ".print_r($message, true), LOGGER_DEBUG); + Logger::log("Send account migration ".print_r($message, true), Logger::DEBUG); return self::buildAndTransmit($owner, $contact, "account_migration", $message); } @@ -3275,7 +3275,7 @@ class Diaspora "following" => "true", "sharing" => "true"]; - Logger::log("Send share ".print_r($message, true), LOGGER_DEBUG); + Logger::log("Send share ".print_r($message, true), Logger::DEBUG); return self::buildAndTransmit($owner, $contact, "contact", $message); } @@ -3295,7 +3295,7 @@ class Diaspora "following" => "false", "sharing" => "false"]; - Logger::log("Send unshare ".print_r($message, true), LOGGER_DEBUG); + Logger::log("Send unshare ".print_r($message, true), Logger::DEBUG); return self::buildAndTransmit($owner, $contact, "contact", $message); } @@ -3808,7 +3808,7 @@ class Diaspora $type = "comment"; } - Logger::log("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG); + Logger::log("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", Logger::DEBUG); // Old way - is used by the internal Friendica functions /// @todo Change all signatur storing functions to the new format @@ -3832,13 +3832,13 @@ class Diaspora $message[$field] = $data; } } else { - Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], LOGGER_DEBUG); + Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], Logger::DEBUG); } } $message["parent_author_signature"] = self::signature($owner, $message); - Logger::log("Relayed data ".print_r($message, true), LOGGER_DEBUG); + Logger::log("Relayed data ".print_r($message, true), Logger::DEBUG); return self::buildAndTransmit($owner, $contact, $type, $message, $public_batch, $item["guid"]); } @@ -3872,7 +3872,7 @@ class Diaspora "target_guid" => $item['guid'], "target_type" => $target_type]; - Logger::log("Got message ".print_r($message, true), LOGGER_DEBUG); + Logger::log("Got message ".print_r($message, true), Logger::DEBUG); return self::buildAndTransmit($owner, $contact, $msg_type, $message, $public_batch, $item["guid"]); } @@ -4108,7 +4108,7 @@ class Diaspora $message = self::createProfileData($uid); foreach ($recips as $recip) { - Logger::log("Send updated profile data for user ".$uid." to contact ".$recip["id"], LOGGER_DEBUG); + Logger::log("Send updated profile data for user ".$uid." to contact ".$recip["id"], Logger::DEBUG); self::buildAndTransmit($owner, $recip, "profile", $message, false, "", false); } } @@ -4125,7 +4125,7 @@ class Diaspora { $owner = User::getOwnerDataById($uid); if (empty($owner)) { - Logger::log("No owner post, so not storing signature", LOGGER_DEBUG); + Logger::log("No owner post, so not storing signature", Logger::DEBUG); return false; } @@ -4155,7 +4155,7 @@ class Diaspora { $owner = User::getOwnerDataById($uid); if (empty($owner)) { - Logger::log("No owner post, so not storing signature", LOGGER_DEBUG); + Logger::log("No owner post, so not storing signature", Logger::DEBUG); return false; } diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php index 5dba94ee5a..bb70972b03 100644 --- a/src/Protocol/Email.php +++ b/src/Protocol/Email.php @@ -55,21 +55,21 @@ class Email if (!$search1) { $search1 = []; } else { - Logger::log("Found mails from ".$email_addr, LOGGER_DEBUG); + Logger::log("Found mails from ".$email_addr, Logger::DEBUG); } $search2 = @imap_search($mbox, 'TO "' . $email_addr . '"', SE_UID); if (!$search2) { $search2 = []; } else { - Logger::log("Found mails to ".$email_addr, LOGGER_DEBUG); + Logger::log("Found mails to ".$email_addr, Logger::DEBUG); } $search3 = @imap_search($mbox, 'CC "' . $email_addr . '"', SE_UID); if (!$search3) { $search3 = []; } else { - Logger::log("Found mails cc ".$email_addr, LOGGER_DEBUG); + Logger::log("Found mails cc ".$email_addr, Logger::DEBUG); } $res = array_unique(array_merge($search1, $search2, $search3)); diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 32ff61756d..71ebe5506b 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -41,12 +41,12 @@ class Feed { $a = get_app(); if (!$simulate) { - Logger::log("Import Atom/RSS feed '".$contact["name"]."' (Contact ".$contact["id"].") for user ".$importer["uid"], LOGGER_DEBUG); + Logger::log("Import Atom/RSS feed '".$contact["name"]."' (Contact ".$contact["id"].") for user ".$importer["uid"], Logger::DEBUG); } else { - Logger::log("Test Atom/RSS feed", LOGGER_DEBUG); + Logger::log("Test Atom/RSS feed", Logger::DEBUG); } if (empty($xml)) { - Logger::log('XML is empty.', LOGGER_DEBUG); + Logger::log('XML is empty.', Logger::DEBUG); return; } @@ -200,7 +200,7 @@ class Feed { $header["contact-id"] = $contact["id"]; if (!is_object($entries)) { - Logger::log("There are no entries in this feed.", LOGGER_DEBUG); + Logger::log("There are no entries in this feed.", Logger::DEBUG); return; } @@ -249,7 +249,7 @@ class Feed { $importer["uid"], $item["uri"], Protocol::FEED, Protocol::DFRN]; $previous = Item::selectFirst(['id'], $condition); if (DBA::isResult($previous)) { - Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG); + Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], Logger::DEBUG); continue; } } @@ -424,7 +424,7 @@ class Feed { } if (!$simulate) { - Logger::log("Stored feed: ".print_r($item, true), LOGGER_DEBUG); + Logger::log("Stored feed: ".print_r($item, true), Logger::DEBUG); $notify = Item::isRemoteSelf($contact, $item); diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index e7be6325b6..a1857c5db7 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -196,7 +196,7 @@ class OStatus DBA::update('contact', $contact, ['id' => $contact["id"]], $current); if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) { - Logger::log("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG); + Logger::log("Update profile picture for contact ".$contact["id"], Logger::DEBUG); Contact::updateAvatar($author["author-avatar"], $importer["uid"], $contact["id"]); } @@ -323,7 +323,7 @@ class OStatus self::$conv_list = []; } - Logger::log('Import OStatus message for user ' . $importer['uid'], LOGGER_DEBUG); + Logger::log('Import OStatus message for user ' . $importer['uid'], Logger::DEBUG); if ($xml == "") { return false; @@ -349,7 +349,7 @@ class OStatus foreach ($hub_attributes as $hub_attribute) { if ($hub_attribute->name == "href") { $hub = $hub_attribute->textContent; - Logger::log("Found hub ".$hub, LOGGER_DEBUG); + Logger::log("Found hub ".$hub, Logger::DEBUG); } } } @@ -434,27 +434,27 @@ class OStatus if (in_array($item["verb"], [NAMESPACE_OSTATUS."/unfavorite", ACTIVITY_UNFAVORITE])) { // Ignore "Unfavorite" message - Logger::log("Ignore unfavorite message ".print_r($item, true), LOGGER_DEBUG); + Logger::log("Ignore unfavorite message ".print_r($item, true), Logger::DEBUG); continue; } // Deletions come with the same uri, so we check for duplicates after processing deletions if (Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]])) { - Logger::log('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', LOGGER_DEBUG); + Logger::log('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', Logger::DEBUG); continue; } else { - Logger::log('Processing post with URI '.$item["uri"].' for user '.$importer["uid"].'.', LOGGER_DEBUG); + Logger::log('Processing post with URI '.$item["uri"].' for user '.$importer["uid"].'.', Logger::DEBUG); } if ($item["verb"] == ACTIVITY_JOIN) { // ignore "Join" messages - Logger::log("Ignore join message ".print_r($item, true), LOGGER_DEBUG); + Logger::log("Ignore join message ".print_r($item, true), Logger::DEBUG); continue; } if ($item["verb"] == "http://mastodon.social/schema/1.0/block") { // ignore mastodon "block" messages - Logger::log("Ignore block message ".print_r($item, true), LOGGER_DEBUG); + Logger::log("Ignore block message ".print_r($item, true), Logger::DEBUG); continue; } @@ -481,7 +481,7 @@ class OStatus // http://activitystrea.ms/schema/1.0/rsvp-yes if (!in_array($item["verb"], [ACTIVITY_POST, ACTIVITY_LIKE, ACTIVITY_SHARE])) { - Logger::log("Unhandled verb ".$item["verb"]." ".print_r($item, true), LOGGER_DEBUG); + Logger::log("Unhandled verb ".$item["verb"]." ".print_r($item, true), Logger::DEBUG); } self::processPost($xpath, $entry, $item, $importer); @@ -494,10 +494,10 @@ class OStatus // If not, then it depends on this setting $valid = !Config::get('system', 'ostatus_full_threads'); if ($valid) { - Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", LOGGER_DEBUG); + Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", Logger::DEBUG); } } else { - Logger::log("Item with uri ".self::$itemlist[0]['uri']." belongs to a contact (".self::$itemlist[0]['contact-id']."). It will be imported.", LOGGER_DEBUG); + Logger::log("Item with uri ".self::$itemlist[0]['uri']." belongs to a contact (".self::$itemlist[0]['contact-id']."). It will be imported.", Logger::DEBUG); } if ($valid) { // Never post a thread when the only interaction by our contact was a like @@ -509,14 +509,14 @@ class OStatus } } if ($valid) { - Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", LOGGER_DEBUG); + Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", Logger::DEBUG); } } } else { // But we will only import complete threads $valid = Item::exists(['uid' => $importer["uid"], 'uri' => self::$itemlist[0]['parent-uri']]); if ($valid) { - Logger::log("Item with uri ".self::$itemlist[0]["uri"]." belongs to parent ".self::$itemlist[0]['parent-uri']." of user ".$importer["uid"].". It will be imported.", LOGGER_DEBUG); + Logger::log("Item with uri ".self::$itemlist[0]["uri"]." belongs to parent ".self::$itemlist[0]['parent-uri']." of user ".$importer["uid"].". It will be imported.", Logger::DEBUG); } } @@ -533,9 +533,9 @@ class OStatus foreach (self::$itemlist as $item) { $found = Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]]); if ($found) { - Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already exists.", LOGGER_DEBUG); + Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already exists.", Logger::DEBUG); } elseif ($item['contact-id'] < 0) { - Logger::log("Item with uri ".$item["uri"]." is from a blocked contact.", LOGGER_DEBUG); + Logger::log("Item with uri ".$item["uri"]." is from a blocked contact.", Logger::DEBUG); } else { // We are having duplicated entries. Hopefully this solves it. if (Lock::acquire('ostatus_process_item_insert')) { @@ -551,7 +551,7 @@ class OStatus } self::$itemlist = []; } - Logger::log('Processing done for post with URI '.$item["uri"].' for user '.$importer["uid"].'.', LOGGER_DEBUG); + Logger::log('Processing done for post with URI '.$item["uri"].' for user '.$importer["uid"].'.', Logger::DEBUG); } return true; } @@ -707,7 +707,7 @@ class OStatus self::fetchRelated($related, $item["parent-uri"], $importer); } } else { - Logger::log('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', LOGGER_DEBUG); + Logger::log('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', Logger::DEBUG); } } else { $item["parent-uri"] = $item["uri"]; @@ -853,11 +853,11 @@ class OStatus $condition = ['item-uri' => $conv_data['uri'],'protocol' => Conversation::PARCEL_FEED]; if (DBA::exists('conversation', $condition)) { - Logger::log('Delete deprecated entry for URI '.$conv_data['uri'], LOGGER_DEBUG); + Logger::log('Delete deprecated entry for URI '.$conv_data['uri'], Logger::DEBUG); DBA::delete('conversation', ['item-uri' => $conv_data['uri']]); } - Logger::log('Store conversation data for uri '.$conv_data['uri'], LOGGER_DEBUG); + Logger::log('Store conversation data for uri '.$conv_data['uri'], Logger::DEBUG); Conversation::insert($conv_data); } } @@ -877,7 +877,7 @@ class OStatus { $condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $self, Conversation::PARCEL_DFRN, Conversation::PARCEL_SALMON]; if (DBA::exists('conversation', $condition)) { - Logger::log('Conversation '.$item['uri'].' is already stored.', LOGGER_DEBUG); + Logger::log('Conversation '.$item['uri'].' is already stored.', Logger::DEBUG); return; } @@ -897,7 +897,7 @@ class OStatus $item["protocol"] = Conversation::PARCEL_SALMON; $item["source"] = $xml; - Logger::log('Conversation '.$item['uri'].' is now fetched.', LOGGER_DEBUG); + Logger::log('Conversation '.$item['uri'].' is now fetched.', Logger::DEBUG); } /** @@ -916,11 +916,11 @@ class OStatus $stored = true; $xml = $conversation['source']; if (self::process($xml, $importer, $contact, $hub, $stored, false)) { - Logger::log('Got valid cached XML for URI '.$related_uri, LOGGER_DEBUG); + Logger::log('Got valid cached XML for URI '.$related_uri, Logger::DEBUG); return; } if ($conversation['protocol'] == Conversation::PARCEL_SALMON) { - Logger::log('Delete invalid cached XML for URI '.$related_uri, LOGGER_DEBUG); + Logger::log('Delete invalid cached XML for URI '.$related_uri, Logger::DEBUG); DBA::delete('conversation', ['item-uri' => $related_uri]); } } @@ -935,7 +935,7 @@ class OStatus $xml = ''; if (stristr($curlResult->getHeader(), 'Content-Type: application/atom+xml')) { - Logger::log('Directly fetched XML for URI ' . $related_uri, LOGGER_DEBUG); + Logger::log('Directly fetched XML for URI ' . $related_uri, Logger::DEBUG); $xml = $curlResult->getBody(); } @@ -960,7 +960,7 @@ class OStatus $curlResult = Network::curl($atom_file); if ($curlResult->isSuccess()) { - Logger::log('Fetched XML for URI ' . $related_uri, LOGGER_DEBUG); + Logger::log('Fetched XML for URI ' . $related_uri, Logger::DEBUG); $xml = $curlResult->getBody(); } } @@ -972,7 +972,7 @@ class OStatus $curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related).'.atom'); if ($curlResult->isSuccess()) { - Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, LOGGER_DEBUG); + Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, Logger::DEBUG); $xml = $curlResult->getBody(); } } @@ -983,7 +983,7 @@ class OStatus $curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom'); if ($curlResult->isSuccess()) { - Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, LOGGER_DEBUG); + Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, Logger::DEBUG); $xml = $curlResult->getBody(); } } @@ -994,7 +994,7 @@ class OStatus $conversation = DBA::selectFirst('conversation', ['source'], $condition); if (DBA::isResult($conversation)) { $stored = true; - Logger::log('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG); + Logger::log('Got cached XML from conversation for URI '.$related_uri, Logger::DEBUG); $xml = $conversation['source']; } } @@ -1002,7 +1002,7 @@ class OStatus if ($xml != '') { self::process($xml, $importer, $contact, $hub, $stored, false); } else { - Logger::log("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related, LOGGER_DEBUG); + Logger::log("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related, Logger::DEBUG); } return; } @@ -1652,7 +1652,7 @@ class OStatus private static function reshareEntry(DOMDocument $doc, array $item, array $owner, $repeated_guid, $toplevel) { if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) { - Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG); + Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG); } $title = self::entryHeader($doc, $entry, $owner, $item, $toplevel); @@ -1715,7 +1715,7 @@ class OStatus private static function likeEntry(DOMDocument $doc, array $item, array $owner, $toplevel) { if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) { - Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG); + Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG); } $title = self::entryHeader($doc, $entry, $owner, $item, $toplevel); @@ -1862,7 +1862,7 @@ class OStatus private static function noteEntry(DOMDocument $doc, array $item, array $owner, $toplevel) { if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) { - Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG); + Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG); } $title = self::entryHeader($doc, $entry, $owner, $item, $toplevel); @@ -2153,7 +2153,7 @@ class OStatus if ((time() - strtotime($owner['last-item'])) < 15*60) { $result = Cache::get($cachekey); if (!$nocache && !is_null($result)) { - Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)', LOGGER_DEBUG); + Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)', Logger::DEBUG); $last_update = $result['last_update']; return $result['feed']; } @@ -2213,7 +2213,7 @@ class OStatus $msg = ['feed' => $feeddata, 'last_update' => $last_update]; Cache::set($cachekey, $msg, Cache::QUARTER_HOUR); - Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, LOGGER_DEBUG); + Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, Logger::DEBUG); return $feeddata; } diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index 1cd566336d..fb8b48d7cb 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -85,14 +85,14 @@ class PortableContact $url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation') ; - Logger::log('load: ' . $url, LOGGER_DEBUG); + Logger::log('load: ' . $url, Logger::DEBUG); $fetchresult = Network::fetchUrlFull($url); $s = $fetchresult->getBody(); - Logger::log('load: returns ' . $s, LOGGER_DATA); + Logger::log('load: returns ' . $s, Logger::DATA); - Logger::log('load: return code: ' . $fetchresult->getReturnCode(), LOGGER_DEBUG); + Logger::log('load: return code: ' . $fetchresult->getReturnCode(), Logger::DEBUG); if (($fetchresult->getReturnCode() > 299) || (! $s)) { return; @@ -100,7 +100,7 @@ class PortableContact $j = json_decode($s, true); - Logger::log('load: json: ' . print_r($j, true), LOGGER_DATA); + Logger::log('load: json: ' . print_r($j, true), Logger::DATA); if (!isset($j['entry'])) { return; @@ -200,10 +200,10 @@ class PortableContact GContact::link($gcid, $uid, $cid, $zcid); } catch (Exception $e) { - Logger::log($e->getMessage(), LOGGER_DEBUG); + Logger::log($e->getMessage(), Logger::DEBUG); } } - Logger::log("load: loaded $total entries", LOGGER_DEBUG); + Logger::log("load: loaded $total entries", Logger::DEBUG); $condition = ["`cid` = ? AND `uid` = ? AND `zcid` = ? AND `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY", $cid, $uid, $zcid]; DBA::delete('glink', $condition); @@ -336,7 +336,7 @@ class PortableContact } if (!in_array($gcontacts[0]["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::FEED, Protocol::OSTATUS, ""])) { - Logger::log("Profile ".$profile.": Network type ".$gcontacts[0]["network"]." can't be checked", LOGGER_DEBUG); + Logger::log("Profile ".$profile.": Network type ".$gcontacts[0]["network"]." can't be checked", Logger::DEBUG); return false; } @@ -347,7 +347,7 @@ class PortableContact DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); } - Logger::log("Profile ".$profile.": Server ".$server_url." wasn't reachable.", LOGGER_DEBUG); + Logger::log("Profile ".$profile.": Server ".$server_url." wasn't reachable.", Logger::DEBUG); return false; } $contact['server_url'] = $server_url; @@ -427,7 +427,7 @@ class PortableContact $fields = ['last_contact' => DateTimeFormat::utcNow()]; DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); - Logger::log("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", LOGGER_DEBUG); + Logger::log("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", Logger::DEBUG); return $noscrape["updated"]; } @@ -438,7 +438,7 @@ class PortableContact // If we only can poll the feed, then we only do this once a while if (!$force && !self::updateNeeded($gcontacts[0]["created"], $gcontacts[0]["updated"], $gcontacts[0]["last_failure"], $gcontacts[0]["last_contact"])) { - Logger::log("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG); + Logger::log("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", Logger::DEBUG); GContact::update($contact); return $gcontacts[0]["updated"]; @@ -465,10 +465,10 @@ class PortableContact self::lastUpdated($data["url"], $force); } catch (Exception $e) { - Logger::log($e->getMessage(), LOGGER_DEBUG); + Logger::log($e->getMessage(), Logger::DEBUG); } - Logger::log("Profile ".$profile." was deleted", LOGGER_DEBUG); + Logger::log("Profile ".$profile." was deleted", Logger::DEBUG); return false; } @@ -476,7 +476,7 @@ class PortableContact $fields = ['last_failure' => DateTimeFormat::utcNow()]; DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); - Logger::log("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG); + Logger::log("Profile ".$profile." wasn't reachable (profile)", Logger::DEBUG); return false; } @@ -492,7 +492,7 @@ class PortableContact $fields = ['last_failure' => DateTimeFormat::utcNow()]; DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); - Logger::log("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG); + Logger::log("Profile ".$profile." wasn't reachable (no feed)", Logger::DEBUG); return false; } @@ -540,7 +540,7 @@ class PortableContact DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); } - Logger::log("Profile ".$profile." was last updated at ".$last_updated, LOGGER_DEBUG); + Logger::log("Profile ".$profile." was last updated at ".$last_updated, Logger::DEBUG); return $last_updated; } @@ -663,7 +663,7 @@ class PortableContact foreach ($nodeinfo['links'] as $link) { if (!is_array($link) || empty($link['rel'])) { - Logger::log('Invalid nodeinfo format for ' . $server_url, LOGGER_DEBUG); + Logger::log('Invalid nodeinfo format for ' . $server_url, Logger::DEBUG); continue; } if ($link['rel'] == 'http://nodeinfo.diaspora.software/ns/schema/1.0') { @@ -964,7 +964,7 @@ class PortableContact } if (!$force && !self::updateNeeded($gserver["created"], "", $last_failure, $last_contact)) { - Logger::log("Use cached data for server ".$server_url, LOGGER_DEBUG); + Logger::log("Use cached data for server ".$server_url, Logger::DEBUG); return ($last_contact >= $last_failure); } } else { @@ -980,7 +980,7 @@ class PortableContact $last_contact = DBA::NULL_DATETIME; $last_failure = DBA::NULL_DATETIME; } - Logger::log("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$gserver["created"]." Failure: ".$last_failure." Contact: ".$last_contact, LOGGER_DEBUG); + Logger::log("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$gserver["created"]." Failure: ".$last_failure." Contact: ".$last_contact, Logger::DEBUG); $failure = false; $possible_failure = false; @@ -1005,7 +1005,7 @@ class PortableContact // But we want to make sure to only quit if we are mostly sure that this server url fits. if (DBA::isResult($gserver) && ($orig_server_url == $server_url) && ($curlResult->isTimeout())) { - Logger::log("Connection to server ".$server_url." timed out.", LOGGER_DEBUG); + Logger::log("Connection to server ".$server_url." timed out.", Logger::DEBUG); DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]); return false; } @@ -1020,7 +1020,7 @@ class PortableContact // Quit if there is a timeout if ($curlResult->isTimeout()) { - Logger::log("Connection to server " . $server_url . " timed out.", LOGGER_DEBUG); + Logger::log("Connection to server " . $server_url . " timed out.", Logger::DEBUG); DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]); return false; } @@ -1399,9 +1399,9 @@ class PortableContact } if (($last_contact <= $last_failure) && !$failure) { - Logger::log("Server ".$server_url." seems to be alive, but last contact wasn't set - could be a bug", LOGGER_DEBUG); + Logger::log("Server ".$server_url." seems to be alive, but last contact wasn't set - could be a bug", Logger::DEBUG); } elseif (($last_contact >= $last_failure) && $failure) { - Logger::log("Server ".$server_url." seems to be dead, but last failure wasn't set - could be a bug", LOGGER_DEBUG); + Logger::log("Server ".$server_url." seems to be dead, but last failure wasn't set - could be a bug", Logger::DEBUG); } // Check again if the server exists @@ -1430,7 +1430,7 @@ class PortableContact self::discoverRelay($server_url); } - Logger::log("End discovery for server " . $server_url, LOGGER_DEBUG); + Logger::log("End discovery for server " . $server_url, Logger::DEBUG); return !$failure; } @@ -1442,7 +1442,7 @@ class PortableContact */ private static function discoverRelay($server_url) { - Logger::log("Discover relay data for server " . $server_url, LOGGER_DEBUG); + Logger::log("Discover relay data for server " . $server_url, Logger::DEBUG); $curlResult = Network::curl($server_url . "/.well-known/x-social-relay"); @@ -1558,7 +1558,7 @@ class PortableContact $r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", DBA::escape(normalise_link($server_url))); if (!DBA::isResult($r)) { - Logger::log("Call server check for server ".$server_url, LOGGER_DEBUG); + Logger::log("Call server check for server ".$server_url, Logger::DEBUG); Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server_url); } } @@ -1643,7 +1643,7 @@ class PortableContact // Fetch all users from the other server $url = $server["poco"] . "/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; - Logger::log("Fetch all users from the server " . $server["url"], LOGGER_DEBUG); + Logger::log("Fetch all users from the server " . $server["url"], Logger::DEBUG); $curlResult = Network::curl($url); @@ -1671,7 +1671,7 @@ class PortableContact $curlResult = Network::curl($url); if ($curlResult->isSuccess() && !empty($curlResult->getBody())) { - Logger::log("Fetch all global contacts from the server " . $server["nurl"], LOGGER_DEBUG); + Logger::log("Fetch all global contacts from the server " . $server["nurl"], Logger::DEBUG); $data = json_decode($curlResult->getBody(), true); if (!empty($data)) { @@ -1680,7 +1680,7 @@ class PortableContact } if (!$success && (Config::get('system', 'poco_discovery') > 2)) { - Logger::log("Fetch contacts from users of the server " . $server["nurl"], LOGGER_DEBUG); + Logger::log("Fetch contacts from users of the server " . $server["nurl"], Logger::DEBUG); self::discoverServerUsers($data, $server); } } @@ -1733,7 +1733,7 @@ class PortableContact continue; } - Logger::log('Update directory from server ' . $gserver['url'] . ' with ID ' . $gserver['id'], LOGGER_DEBUG); + Logger::log('Update directory from server ' . $gserver['url'] . ' with ID ' . $gserver['id'], Logger::DEBUG); Worker::add(PRIORITY_LOW, 'DiscoverPoCo', 'update_server_directory', (int) $gserver['id']); if (!$complete && ( --$no_of_queries == 0)) { @@ -1763,7 +1763,7 @@ class PortableContact } if ($username != '') { - Logger::log('Fetch contacts for the user ' . $username . ' from the server ' . $server['nurl'], LOGGER_DEBUG); + Logger::log('Fetch contacts for the user ' . $username . ' from the server ' . $server['nurl'], Logger::DEBUG); // Fetch all contacts from a given user from the other server $url = $server['poco'] . '/' . $username . '/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation'; @@ -1866,7 +1866,7 @@ class PortableContact if ($generation > 0) { $success = true; - Logger::log("Store profile ".$profile_url, LOGGER_DEBUG); + Logger::log("Store profile ".$profile_url, Logger::DEBUG); $gcontact = ["url" => $profile_url, "name" => $name, @@ -1885,10 +1885,10 @@ class PortableContact $gcontact = GContact::sanitize($gcontact); GContact::update($gcontact); } catch (Exception $e) { - Logger::log($e->getMessage(), LOGGER_DEBUG); + Logger::log($e->getMessage(), Logger::DEBUG); } - Logger::log("Done for profile ".$profile_url, LOGGER_DEBUG); + Logger::log("Done for profile ".$profile_url, Logger::DEBUG); } } return $success; diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index b69ceda51c..42aab8f5f3 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -97,8 +97,8 @@ class Emailer $hookdata['headers'], $hookdata['parameters'] ); - Logger::log("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG); - Logger::log("return value " . (($res)?"true":"false"), LOGGER_DEBUG); + Logger::log("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, Logger::DEBUG); + Logger::log("return value " . (($res)?"true":"false"), Logger::DEBUG); return $res; } } diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index cecfe8c262..408f4d9789 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -98,7 +98,7 @@ class HTTPSignature $x = Crypto::rsaVerify($signed_data, $sig_block['signature'], $key, $algorithm); - Logger::log('verified: ' . $x, LOGGER_DEBUG); + Logger::log('verified: ' . $x, Logger::DEBUG); if (!$x) { return $result; @@ -433,12 +433,12 @@ class HTTPSignature $profile = APContact::getByURL($url); if (!empty($profile)) { - Logger::log('Taking key from id ' . $id, LOGGER_DEBUG); + Logger::log('Taking key from id ' . $id, Logger::DEBUG); return ['url' => $url, 'pubkey' => $profile['pubkey']]; } elseif ($url != $actor) { $profile = APContact::getByURL($actor); if (!empty($profile)) { - Logger::log('Taking key from actor ' . $actor, LOGGER_DEBUG); + Logger::log('Taking key from actor ' . $actor, Logger::DEBUG); return ['url' => $actor, 'pubkey' => $profile['pubkey']]; } } diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index 2d16172b78..feaf3e62f5 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -66,7 +66,7 @@ class JsonLD } catch (Exception $e) { $normalized = false; - Logger::log('normalise error:' . print_r($e, true), LOGGER_DEBUG); + Logger::log('normalise error:' . print_r($e, true), Logger::DEBUG); } return $normalized; @@ -99,7 +99,7 @@ class JsonLD } catch (Exception $e) { $compacted = false; - Logger::log('compacting error:' . print_r($e, true), LOGGER_DEBUG); + Logger::log('compacting error:' . print_r($e, true), Logger::DEBUG); } return json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true); diff --git a/src/Util/Network.php b/src/Util/Network.php index 0a36f47f57..255b3c8c4d 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -107,7 +107,7 @@ class Network $url = self::unparseURL($parts); if (self::isUrlBlocked($url)) { - Logger::log('domain of ' . $url . ' is blocked', LOGGER_DATA); + Logger::log('domain of ' . $url . ' is blocked', Logger::DATA); return CurlResult::createErrorCurl($url); } @@ -241,7 +241,7 @@ class Network $stamp1 = microtime(true); if (self::isUrlBlocked($url)) { - Logger::log('post_url: domain of ' . $url . ' is blocked', LOGGER_DATA); + Logger::log('post_url: domain of ' . $url . ' is blocked', Logger::DATA); return CurlResult::createErrorCurl($url); } @@ -252,7 +252,7 @@ class Network return CurlResult::createErrorCurl($url); } - Logger::log('post_url: start ' . $url, LOGGER_DATA); + Logger::log('post_url: start ' . $url, Logger::DATA); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @@ -324,7 +324,7 @@ class Network $a->saveTimestamp($stamp1, 'network'); - Logger::log('post_url: end ' . $url, LOGGER_DATA); + Logger::log('post_url: end ' . $url, Logger::DATA); return $curlResponse; } @@ -528,7 +528,7 @@ class Network $avatar['url'] = System::baseUrl() . '/images/person-300.jpg'; } - Logger::log('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], LOGGER_DEBUG); + Logger::log('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], Logger::DEBUG); return $avatar['url']; } diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index 0475eda5a9..6530959f23 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -124,7 +124,7 @@ class ParseUrl } if ($count > 10) { - Logger::log('Endless loop detected for ' . $url, LOGGER_DEBUG); + Logger::log('Endless loop detected for ' . $url, Logger::DEBUG); return $siteinfo; } @@ -188,7 +188,7 @@ class ParseUrl } if (($charset != '') && (strtoupper($charset) != 'UTF-8')) { - Logger::log('detected charset ' . $charset, LOGGER_DEBUG); + Logger::log('detected charset ' . $charset, Logger::DEBUG); $body = iconv($charset, 'UTF-8//TRANSLIT', $body); } @@ -422,7 +422,7 @@ class ParseUrl } } - Logger::log('Siteinfo for ' . $url . ' ' . print_r($siteinfo, true), LOGGER_DEBUG); + Logger::log('Siteinfo for ' . $url . ' ' . print_r($siteinfo, true), Logger::DEBUG); Addon::callHooks('getsiteinfo', $siteinfo); diff --git a/src/Util/XML.php b/src/Util/XML.php index 5abafec000..865c60406b 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -276,9 +276,9 @@ class XML @xml_parser_free($parser); if (! $xml_values) { - Logger::log('Xml::toArray: libxml: parse error: ' . $contents, LOGGER_DATA); + Logger::log('Xml::toArray: libxml: parse error: ' . $contents, Logger::DATA); foreach (libxml_get_errors() as $err) { - Logger::log('libxml: parse: ' . $err->code . " at " . $err->line . ":" . $err->column . " : " . $err->message, LOGGER_DATA); + Logger::log('libxml: parse: ' . $err->code . " at " . $err->line . ":" . $err->column . " : " . $err->message, Logger::DATA); } libxml_clear_errors(); return; @@ -424,9 +424,9 @@ class XML $x = @simplexml_load_string($s); if (!$x) { - Logger::log('libxml: parse: error: ' . $s, LOGGER_DATA); + Logger::log('libxml: parse: error: ' . $s, Logger::DATA); foreach (libxml_get_errors() as $err) { - Logger::log('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA); + Logger::log('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, Logger::DATA); } libxml_clear_errors(); } diff --git a/src/Worker/APDelivery.php b/src/Worker/APDelivery.php index c800ee02d8..ce82db249a 100644 --- a/src/Worker/APDelivery.php +++ b/src/Worker/APDelivery.php @@ -23,7 +23,7 @@ class APDelivery extends BaseObject */ public static function execute($cmd, $item_id, $inbox, $uid) { - Logger::log('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $inbox, LOGGER_DEBUG); + Logger::log('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $inbox, Logger::DEBUG); $success = true; diff --git a/src/Worker/CheckVersion.php b/src/Worker/CheckVersion.php index 0d87bb9822..f67fb21c85 100644 --- a/src/Worker/CheckVersion.php +++ b/src/Worker/CheckVersion.php @@ -37,11 +37,11 @@ class CheckVersion // don't check return; } - Logger::log("Checking VERSION from: ".$checked_url, LOGGER_DEBUG); + Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG); // fetch the VERSION file $gitversion = DBA::escape(trim(Network::fetchUrl($checked_url))); - Logger::log("Upstream VERSION is: ".$gitversion, LOGGER_DEBUG); + Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG); Config::set('system', 'git_friendica_version', $gitversion); diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index ae3f48617d..0c565daa73 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -34,7 +34,7 @@ class CronJobs return; } - Logger::log("Starting cronjob " . $command, LOGGER_DEBUG); + Logger::log("Starting cronjob " . $command, Logger::DEBUG); // Call possible post update functions // see src/Database/PostUpdate.php for more details @@ -83,7 +83,7 @@ class CronJobs return; } - Logger::log("Xronjob " . $command . " is unknown.", LOGGER_DEBUG); + Logger::log("Xronjob " . $command . " is unknown.", Logger::DEBUG); return; } @@ -212,7 +212,7 @@ class CronJobs // Calculate fragmentation $fragmentation = $table["Data_free"] / ($table["Data_length"] + $table["Index_length"]); - Logger::log("Table " . $table["Name"] . " - Fragmentation level: " . round($fragmentation * 100, 2), LOGGER_DEBUG); + Logger::log("Table " . $table["Name"] . " - Fragmentation level: " . round($fragmentation * 100, 2), Logger::DEBUG); // Don't optimize tables that needn't to be optimized if ($fragmentation < $fragmentation_level) { @@ -220,7 +220,7 @@ class CronJobs } // So optimize it - Logger::log("Optimize Table " . $table["Name"], LOGGER_DEBUG); + Logger::log("Optimize Table " . $table["Name"], Logger::DEBUG); q("OPTIMIZE TABLE `%s`", DBA::escape($table["Name"])); } } @@ -259,7 +259,7 @@ class CronJobs continue; } - Logger::log("Repair contact " . $contact["id"] . " " . $contact["url"], LOGGER_DEBUG); + Logger::log("Repair contact " . $contact["id"] . " " . $contact["url"], Logger::DEBUG); q("UPDATE `contact` SET `batch` = '%s', `notify` = '%s', `poll` = '%s', pubkey = '%s' WHERE `id` = %d", DBA::escape($data["batch"]), DBA::escape($data["notify"]), DBA::escape($data["poll"]), DBA::escape($data["pubkey"]), intval($contact["id"])); diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index b539de5e2d..59d506af3d 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -34,7 +34,7 @@ class Delivery extends BaseObject public static function execute($cmd, $item_id, $contact_id) { - Logger::log('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $contact_id, LOGGER_DEBUG); + Logger::log('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $contact_id, Logger::DEBUG); $top_level = false; $followup = false; @@ -126,7 +126,7 @@ class Delivery extends BaseObject */ if (!$top_level && ($parent['wall'] == 0) && stristr($target_item['uri'], $localhost)) { - Logger::log('Followup ' . $target_item["guid"], LOGGER_DEBUG); + Logger::log('Followup ' . $target_item["guid"], Logger::DEBUG); // local followup to remote post $followup = true; } @@ -241,7 +241,7 @@ class Delivery extends BaseObject $atom = DFRN::entries($msgitems, $owner); } - Logger::log('Notifier entry: ' . $contact["url"] . ' ' . $target_item["guid"] . ' entry: ' . $atom, LOGGER_DATA); + Logger::log('Notifier entry: ' . $contact["url"] . ' ' . $target_item["guid"] . ' entry: ' . $atom, Logger::DATA); $basepath = implode('/', array_slice(explode('/', $contact['url']), 0, 3)); diff --git a/src/Worker/Directory.php b/src/Worker/Directory.php index 33e724ce4d..b4b86e344e 100644 --- a/src/Worker/Directory.php +++ b/src/Worker/Directory.php @@ -34,7 +34,7 @@ class Directory Addon::callHooks('globaldir_update', $arr); - Logger::log('Updating directory: ' . $arr['url'], LOGGER_DEBUG); + Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG); if (strlen($arr['url'])) { Network::fetchUrl($dir . '?url=' . bin2hex($arr['url'])); } diff --git a/src/Worker/DiscoverPoCo.php b/src/Worker/DiscoverPoCo.php index da9142e7d3..72df3420e8 100644 --- a/src/Worker/DiscoverPoCo.php +++ b/src/Worker/DiscoverPoCo.php @@ -90,7 +90,7 @@ class DiscoverPoCo } else { $result .= "failed"; } - Logger::log($result, LOGGER_DEBUG); + Logger::log($result, Logger::DEBUG); } elseif ($mode == 3) { GContact::updateSuggestions(); } elseif (($mode == 2) && Config::get('system', 'poco_completion')) { @@ -130,7 +130,7 @@ class DiscoverPoCo if (!PortableContact::updateNeeded($server["created"], "", $server["last_failure"], $server["last_contact"])) { continue; } - Logger::log('Update server status for server '.$server["url"], LOGGER_DEBUG); + Logger::log('Update server status for server '.$server["url"], Logger::DEBUG); Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server["url"]); @@ -141,7 +141,7 @@ class DiscoverPoCo } private static function discoverUsers() { - Logger::log("Discover users", LOGGER_DEBUG); + Logger::log("Discover users", Logger::DEBUG); $starttime = time(); @@ -209,7 +209,7 @@ class DiscoverPoCo if (!is_null($data)) { // Only search for the same item every 24 hours if (time() < $data + (60 * 60 * 24)) { - Logger::log("Already searched for ".$search." in the last 24 hours", LOGGER_DEBUG); + Logger::log("Already searched for ".$search." in the last 24 hours", Logger::DEBUG); return; } } @@ -222,7 +222,7 @@ class DiscoverPoCo // Check if the contact already exists $exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url)); if (DBA::isResult($exists)) { - Logger::log("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG); + Logger::log("Profile ".$jj->url." already exists (".$search.")", Logger::DEBUG); if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) && ($exists[0]["updated"] < $exists[0]["last_failure"])) { @@ -236,16 +236,16 @@ class DiscoverPoCo $server_url = PortableContact::detectServer($jj->url); if ($server_url != '') { if (!PortableContact::checkServer($server_url)) { - Logger::log("Friendica server ".$server_url." doesn't answer.", LOGGER_DEBUG); + Logger::log("Friendica server ".$server_url." doesn't answer.", Logger::DEBUG); continue; } - Logger::log("Friendica server ".$server_url." seems to be okay.", LOGGER_DEBUG); + Logger::log("Friendica server ".$server_url." seems to be okay.", Logger::DEBUG); } $data = Probe::uri($jj->url); if ($data["network"] == Protocol::DFRN) { - Logger::log("Profile ".$jj->url." is reachable (".$search.")", LOGGER_DEBUG); - Logger::log("Add profile ".$jj->url." to local directory (".$search.")", LOGGER_DEBUG); + Logger::log("Profile ".$jj->url." is reachable (".$search.")", Logger::DEBUG); + Logger::log("Add profile ".$jj->url." to local directory (".$search.")", Logger::DEBUG); if ($jj->tags != "") { $data["keywords"] = $jj->tags; @@ -255,7 +255,7 @@ class DiscoverPoCo GContact::update($data); } else { - Logger::log("Profile ".$jj->url." is not responding or no Friendica contact - but network ".$data["network"], LOGGER_DEBUG); + Logger::log("Profile ".$jj->url." is not responding or no Friendica contact - but network ".$data["network"], Logger::DEBUG); } } } diff --git a/src/Worker/Expire.php b/src/Worker/Expire.php index 9ff523a126..21e873502b 100644 --- a/src/Worker/Expire.php +++ b/src/Worker/Expire.php @@ -27,7 +27,7 @@ class Expire Hook::loadHooks(); if ($param == 'delete') { - Logger::log('Delete expired items', LOGGER_DEBUG); + Logger::log('Delete expired items', Logger::DEBUG); // physically remove anything that has been deleted for more than two months $condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"]; $rows = DBA::select('item', ['id'], $condition); @@ -38,35 +38,35 @@ class Expire // Normally we shouldn't have orphaned data at all. // If we do have some, then we have to check why. - Logger::log('Deleting orphaned item activities - start', LOGGER_DEBUG); + Logger::log('Deleting orphaned item activities - start', Logger::DEBUG); $condition = ["NOT EXISTS (SELECT `iaid` FROM `item` WHERE `item`.`iaid` = `item-activity`.`id`)"]; DBA::delete('item-activity', $condition); - Logger::log('Orphaned item activities deleted: ' . DBA::affectedRows(), LOGGER_DEBUG); + Logger::log('Orphaned item activities deleted: ' . DBA::affectedRows(), Logger::DEBUG); - Logger::log('Deleting orphaned item content - start', LOGGER_DEBUG); + Logger::log('Deleting orphaned item content - start', Logger::DEBUG); $condition = ["NOT EXISTS (SELECT `icid` FROM `item` WHERE `item`.`icid` = `item-content`.`id`)"]; DBA::delete('item-content', $condition); - Logger::log('Orphaned item content deleted: ' . DBA::affectedRows(), LOGGER_DEBUG); + Logger::log('Orphaned item content deleted: ' . DBA::affectedRows(), Logger::DEBUG); // make this optional as it could have a performance impact on large sites if (intval(Config::get('system', 'optimize_items'))) { DBA::e("OPTIMIZE TABLE `item`"); } - Logger::log('Delete expired items - done', LOGGER_DEBUG); + Logger::log('Delete expired items - done', Logger::DEBUG); return; } elseif (intval($param) > 0) { $user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]); if (DBA::isResult($user)) { - Logger::log('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG); + Logger::log('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], Logger::DEBUG); Item::expire($user['uid'], $user['expire']); - Logger::log('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG); + Logger::log('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', Logger::DEBUG); } return; } elseif ($param == 'hook' && !empty($hook_function)) { foreach (Hook::getByName('expire') as $hook) { if ($hook[1] == $hook_function) { - Logger::log("Calling expire hook '" . $hook[1] . "'", LOGGER_DEBUG); + Logger::log("Calling expire hook '" . $hook[1] . "'", Logger::DEBUG); Hook::callSingle($a, 'expire', $hook, $data); } } @@ -80,7 +80,7 @@ class Expire $r = DBA::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0"); while ($row = DBA::fetch($r)) { - Logger::log('Calling expiry for user '.$row['uid'].' ('.$row['username'].')', LOGGER_DEBUG); + Logger::log('Calling expiry for user '.$row['uid'].' ('.$row['username'].')', Logger::DEBUG); Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], 'Expire', (int)$row['uid']); } @@ -88,7 +88,7 @@ class Expire Logger::log('expire: calling hooks'); foreach (Hook::getByName('expire') as $hook) { - Logger::log("Calling expire hook for '" . $hook[1] . "'", LOGGER_DEBUG); + Logger::log("Calling expire hook for '" . $hook[1] . "'", Logger::DEBUG); Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], 'Expire', 'hook', $hook[1]); } diff --git a/src/Worker/GProbe.php b/src/Worker/GProbe.php index 2f80e1e513..55da28f914 100644 --- a/src/Worker/GProbe.php +++ b/src/Worker/GProbe.php @@ -25,7 +25,7 @@ class GProbe { DBA::escape(normalise_link($url)) ); - Logger::log("gprobe start for ".normalise_link($url), LOGGER_DEBUG); + Logger::log("gprobe start for ".normalise_link($url), Logger::DEBUG); if (!DBA::isResult($r)) { // Is it a DDoS attempt? @@ -34,7 +34,7 @@ class GProbe { $result = Cache::get("gprobe:".$urlparts["host"]); if (!is_null($result)) { if (in_array($result["network"], [Protocol::FEED, Protocol::PHANTOM])) { - Logger::log("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG); + Logger::log("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), Logger::DEBUG); return; } } @@ -61,7 +61,7 @@ class GProbe { } } - Logger::log("gprobe end for ".normalise_link($url), LOGGER_DEBUG); + Logger::log("gprobe end for ".normalise_link($url), Logger::DEBUG); return; } } diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index a6e862e7af..2d0140c171 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -58,7 +58,7 @@ class Notifier { $a = BaseObject::getApp(); - Logger::log('notifier: invoked: '.$cmd.': '.$item_id, LOGGER_DEBUG); + Logger::log('notifier: invoked: '.$cmd.': '.$item_id, Logger::DEBUG); $top_level = false; $recipients = []; @@ -105,7 +105,7 @@ class Notifier $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser(0); foreach ($inboxes as $inbox) { - Logger::log('Account removal for user ' . $item_id . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG); + Logger::log('Account removal for user ' . $item_id . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG); Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], 'APDelivery', Delivery::REMOVAL, '', $inbox, $item_id); } @@ -185,7 +185,7 @@ class Notifier $condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]]; $thr_parent = Item::selectFirst($fields, $condition); - Logger::log('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent['network'], LOGGER_DEBUG); + Logger::log('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent['network'], Logger::DEBUG); // This is IMPORTANT!!!! @@ -249,7 +249,7 @@ class Notifier $recipients = [$parent['contact-id']]; $recipients_followup = [$parent['contact-id']]; - Logger::log('notifier: followup '.$target_item["guid"].' to '.$conversant_str, LOGGER_DEBUG); + Logger::log('notifier: followup '.$target_item["guid"].' to '.$conversant_str, Logger::DEBUG); //if (!$target_item['private'] && $target_item['wall'] && if (!$target_item['private'] && @@ -279,11 +279,11 @@ class Notifier $push_notify = false; } - Logger::log("Notify ".$target_item["guid"]." via PuSH: ".($push_notify?"Yes":"No"), LOGGER_DEBUG); + Logger::log("Notify ".$target_item["guid"]." via PuSH: ".($push_notify?"Yes":"No"), Logger::DEBUG); } else { $followup = false; - Logger::log('Distributing directly '.$target_item["guid"], LOGGER_DEBUG); + Logger::log('Distributing directly '.$target_item["guid"], Logger::DEBUG); // don't send deletions onward for other people's stuff @@ -346,7 +346,7 @@ class Notifier if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) { $diaspora_delivery = false; - Logger::log('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG); + Logger::log('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], Logger::DEBUG); // Send a salmon to the parent author $probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]); @@ -365,7 +365,7 @@ class Notifier // Send a salmon notification to every person we mentioned in the post $arr = explode(',',$target_item['tag']); foreach ($arr as $x) { - //Logger::log('Checking tag '.$x, LOGGER_DEBUG); + //Logger::log('Checking tag '.$x, Logger::DEBUG); $matches = null; if (preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) { $probed_contact = Probe::uri($matches[1]); @@ -420,7 +420,7 @@ class Notifier // delivery loop if (DBA::isResult($r)) { foreach ($r as $contact) { - Logger::log("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG); + Logger::log("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], Logger::DEBUG); Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], 'Delivery', $cmd, $item_id, (int)$contact['id']); @@ -470,7 +470,7 @@ class Notifier $r = array_merge($r2, $r1); if (DBA::isResult($r)) { - Logger::log('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG); + Logger::log('pubdeliver '.$target_item["guid"].': '.print_r($r,true), Logger::DEBUG); foreach ($r as $rr) { // except for Diaspora batch jobs @@ -494,13 +494,13 @@ class Notifier // Notify PuSH subscribers (Used for OStatus distribution of regular posts) if ($push_notify) { - Logger::log('Activating internal PuSH for item '.$item_id, LOGGER_DEBUG); + Logger::log('Activating internal PuSH for item '.$item_id, Logger::DEBUG); // Handling the pubsubhubbub requests PushSubscriber::publishFeed($owner['uid'], $a->queue['priority']); } - Logger::log('notifier: calling hooks for ' . $cmd . ' ' . $item_id, LOGGER_DEBUG); + Logger::log('notifier: calling hooks for ' . $cmd . ' ' . $item_id, Logger::DEBUG); if ($normal_mode) { Hook::fork($a->queue['priority'], 'notifier_normal', $target_item); @@ -518,15 +518,15 @@ class Notifier if ($target_item['origin']) { $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid); - Logger::log('Origin item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', LOGGER_DEBUG); + Logger::log('Origin item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', Logger::DEBUG); } elseif (!DBA::exists('conversation', ['item-uri' => $target_item['uri'], 'protocol' => Conversation::PARCEL_ACTIVITYPUB])) { - Logger::log('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' is no AP post. It will not be distributed.', LOGGER_DEBUG); + Logger::log('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' is no AP post. It will not be distributed.', Logger::DEBUG); return; } else { // Remote items are transmitted via the personal inboxes. // Doing so ensures that the dedicated receiver will get the message. $personal = true; - Logger::log('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', LOGGER_DEBUG); + Logger::log('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', Logger::DEBUG); } if ($parent['origin']) { @@ -535,7 +535,7 @@ class Notifier } if (empty($inboxes)) { - Logger::log('No inboxes found for item ' . $item_id . ' with URL ' . $target_item['uri'] . '. It will not be distributed.', LOGGER_DEBUG); + Logger::log('No inboxes found for item ' . $item_id . ' with URL ' . $target_item['uri'] . '. It will not be distributed.', Logger::DEBUG); return; } @@ -543,7 +543,7 @@ class Notifier ActivityPub\Transmitter::createCachedActivityFromItem($item_id, true); foreach ($inboxes as $inbox) { - Logger::log('Deliver ' . $item_id .' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG); + Logger::log('Deliver ' . $item_id .' to ' . $inbox .' via ActivityPub', Logger::DEBUG); Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], 'APDelivery', $cmd, $item_id, $inbox, $uid); diff --git a/src/Worker/OnePoll.php b/src/Worker/OnePoll.php index 6628115f09..77745b8070 100644 --- a/src/Worker/OnePoll.php +++ b/src/Worker/OnePoll.php @@ -87,7 +87,7 @@ class OnePoll $updated = DateTimeFormat::utcNow(); if ($last_updated) { - Logger::log('Contact '.$contact['id'].' had last update on '.$last_updated, LOGGER_DEBUG); + Logger::log('Contact '.$contact['id'].' had last update on '.$last_updated, Logger::DEBUG); // The last public item can be older than the last item we got if ($last_updated < $contact['last-item']) { @@ -100,7 +100,7 @@ class OnePoll } else { self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]); Contact::markForArchival($contact); - Logger::log('Contact '.$contact['id'].' is marked for archival', LOGGER_DEBUG); + Logger::log('Contact '.$contact['id'].' is marked for archival', Logger::DEBUG); } return; @@ -214,7 +214,7 @@ class OnePoll $handshake_xml = $curlResult->getBody(); $html_code = $curlResult->getReturnCode(); - Logger::log('handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA); + Logger::log('handshake with url ' . $url . ' returns xml: ' . $handshake_xml, Logger::DATA); if (!strlen($handshake_xml) || ($html_code >= 400) || !$html_code) { Logger::log("$url appears to be dead - marking for death "); @@ -348,7 +348,7 @@ class OnePoll $xml = $curlResult->getBody(); } elseif ($contact['network'] === Protocol::MAIL) { - Logger::log("Mail: Fetching for ".$contact['addr'], LOGGER_DEBUG); + Logger::log("Mail: Fetching for ".$contact['addr'], Logger::DEBUG); $mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1); if ($mail_disabled) { @@ -358,7 +358,7 @@ class OnePoll return; } - Logger::log("Mail: Enabled", LOGGER_DEBUG); + Logger::log("Mail: Enabled", Logger::DEBUG); $mbox = null; $user = DBA::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]); @@ -385,17 +385,17 @@ class OnePoll $msgs = Email::poll($mbox, $contact['addr']); if (count($msgs)) { - Logger::log("Mail: Parsing ".count($msgs)." mails from ".$contact['addr']." for ".$mailconf['user'], LOGGER_DEBUG); + Logger::log("Mail: Parsing ".count($msgs)." mails from ".$contact['addr']." for ".$mailconf['user'], Logger::DEBUG); $metas = Email::messageMeta($mbox, implode(',', $msgs)); if (count($metas) != count($msgs)) { - Logger::log("for " . $mailconf['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", LOGGER_DEBUG); + Logger::log("for " . $mailconf['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", Logger::DEBUG); } else { $msgs = array_combine($msgs, $metas); foreach ($msgs as $msg_uid => $meta) { - Logger::log("Mail: Parsing mail ".$msg_uid, LOGGER_DATA); + Logger::log("Mail: Parsing mail ".$msg_uid, Logger::DATA); $datarray = []; $datarray['verb'] = ACTIVITY_POST; @@ -410,7 +410,7 @@ class OnePoll $condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']]; $item = Item::selectFirst($fields, $condition); if (DBA::isResult($item)) { - Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG); + Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],Logger::DEBUG); // Only delete when mails aren't automatically moved or deleted if (($mailconf['action'] != 1) && ($mailconf['action'] != 3)) @@ -421,7 +421,7 @@ class OnePoll switch ($mailconf['action']) { case 0: - Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", LOGGER_DEBUG); + Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", Logger::DEBUG); break; case 1: Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']); @@ -555,7 +555,7 @@ class OnePoll switch ($mailconf['action']) { case 0: - Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", LOGGER_DEBUG); + Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", Logger::DEBUG); break; case 1: Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']); @@ -585,7 +585,7 @@ class OnePoll } if ($xml) { - Logger::log('received xml : ' . $xml, LOGGER_DATA); + Logger::log('received xml : ' . $xml, Logger::DATA); if (!strstr($xml, '<')) { Logger::log('post_handshake: response from ' . $url . ' did not contain XML.'); diff --git a/src/Worker/ProfileUpdate.php b/src/Worker/ProfileUpdate.php index 98952658ab..808d47299f 100644 --- a/src/Worker/ProfileUpdate.php +++ b/src/Worker/ProfileUpdate.php @@ -23,7 +23,7 @@ class ProfileUpdate { $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid); foreach ($inboxes as $inbox) { - Logger::log('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG); + Logger::log('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG); Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], 'APDelivery', Delivery::PROFILEUPDATE, '', $inbox, $uid); } diff --git a/src/Worker/PubSubPublish.php b/src/Worker/PubSubPublish.php index bc9233d55e..801bdc8880 100644 --- a/src/Worker/PubSubPublish.php +++ b/src/Worker/PubSubPublish.php @@ -38,7 +38,7 @@ class PubSubPublish /// @todo Check server status with PortableContact::checkServer() // Before this can be done we need a way to safely detect the server url. - Logger::log("Generate feed of user " . $subscriber['nickname']. " to " . $subscriber['callback_url']. " - last updated " . $subscriber['last_update'], LOGGER_DEBUG); + Logger::log("Generate feed of user " . $subscriber['nickname']. " to " . $subscriber['callback_url']. " - last updated " . $subscriber['last_update'], Logger::DEBUG); $last_update = $subscriber['last_update']; $params = OStatus::feed($subscriber['nickname'], $last_update); @@ -55,7 +55,7 @@ class PubSubPublish $subscriber['topic']), "X-Hub-Signature: sha1=" . $hmac_sig]; - Logger::log('POST ' . print_r($headers, true) . "\n" . $params, LOGGER_DATA); + Logger::log('POST ' . print_r($headers, true) . "\n" . $params, Logger::DATA); $postResult = Network::post($subscriber['callback_url'], $params, $headers); $ret = $postResult->getReturnCode(); diff --git a/src/Worker/SpoolPost.php b/src/Worker/SpoolPost.php index ca26a2f63b..2efd77d553 100644 --- a/src/Worker/SpoolPost.php +++ b/src/Worker/SpoolPost.php @@ -50,7 +50,7 @@ class SpoolPost { $result = Item::insert($arr); - Logger::log("Spool file ".$file." stored: ".$result, LOGGER_DEBUG); + Logger::log("Spool file ".$file." stored: ".$result, Logger::DEBUG); unlink($fullfile); } closedir($dh); diff --git a/view/theme/vier/style.php b/view/theme/vier/style.php index 9b528a14bb..196d377656 100644 --- a/view/theme/vier/style.php +++ b/view/theme/vier/style.php @@ -31,7 +31,7 @@ foreach (['style', $style] as $file) { $modified = $stylemodified; } } else { - //TODO: use LOGGER_ERROR? + //TODO: use Logger::ERROR? Logger::log('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')'); } } -- 2.39.5