1
0
Fork 0

Logger Levels

update logger levels in calls
This commit is contained in:
Adam Magness 2018-10-30 09:58:45 -04:00
parent 91ef9f238c
commit 50da89d861
86 changed files with 673 additions and 673 deletions

View file

@ -98,7 +98,7 @@ if ($mode == "stop") {
unlink($pidfile); 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); Config::set('system', 'worker_daemon_mode', false);
die("Worker daemon process $pid was killed.\n"); 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"); die("Daemon process $pid is already running.\n");
} }
Logger::log('Starting worker daemon.', LOGGER_DEBUG); Logger::log('Starting worker daemon.', Logger::DEBUG);
if (!$foreground) { if (!$foreground) {
echo "Starting worker daemon.\n"; echo "Starting worker daemon.\n";
@ -156,7 +156,7 @@ $last_cron = 0;
// Now running as a daemon. // Now running as a daemon.
while (true) { while (true) {
if (!$do_cron && ($last_cron + $wait_interval) < time()) { 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; $do_cron = true;
} }
@ -170,7 +170,7 @@ while (true) {
$last_cron = time(); $last_cron = time();
} }
Logger::log("Sleeping", LOGGER_DEBUG); Logger::log("Sleeping", Logger::DEBUG);
$start = time(); $start = time();
do { do {
$seconds = (time() - $start); $seconds = (time() - $start);
@ -187,10 +187,10 @@ while (true) {
if ($timeout) { if ($timeout) {
$do_cron = true; $do_cron = true;
Logger::log("Woke up after $wait_interval seconds.", LOGGER_DEBUG); Logger::log("Woke up after $wait_interval seconds.", Logger::DEBUG);
} else { } else {
$do_cron = false; $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);
} }
} }

View file

@ -97,9 +97,9 @@ function api_source()
return "Twidere"; 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 { } else {
Logger::log("Empty user-agent", LOGGER_DEBUG); Logger::log("Empty user-agent", Logger::DEBUG);
} }
return "api"; return "api";
@ -195,7 +195,7 @@ function api_login(App $a)
} }
if (!x($_SERVER, 'PHP_AUTH_USER')) { 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"'); header('WWW-Authenticate: Basic realm="Friendica"');
throw new UnauthorizedException("This API requires login"); throw new UnauthorizedException("This API requires login");
} }
@ -236,7 +236,7 @@ function api_login(App $a)
} }
if (!DBA::isResult($record)) { 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('WWW-Authenticate: Basic realm="Friendica"');
//header('HTTP/1.0 401 Unauthorized'); //header('HTTP/1.0 401 Unauthorized');
//die('This api requires login'); //die('This api requires login');
@ -315,7 +315,7 @@ function api_call(App $a)
$stamp = microtime(true); $stamp = microtime(true);
$return = call_user_func($info['func'], $type); $return = call_user_func($info['func'], $type);
$duration = (float) (microtime(true) - $stamp); $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")) { if (Config::get("system", "profiler")) {
$duration = microtime(true)-$a->performance["start"]; $duration = microtime(true)-$a->performance["start"];
@ -335,7 +335,7 @@ function api_call(App $a)
+ $a->performance["network"] + $a->performance["file"]), 2), + $a->performance["network"] + $a->performance["file"]), 2),
round($duration, 2) round($duration, 2)
), ),
LOGGER_DEBUG Logger::DEBUG
); );
if (Config::get("rendertime", "callstack")) { if (Config::get("rendertime", "callstack")) {
@ -376,7 +376,7 @@ function api_call(App $a)
$o .= $func . ": " . $time . "\n"; $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 = ""; $extra_query = "";
$url = ""; $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 // Searching for contact URL
if (!is_null($contact_id) && (intval($contact_id) == 0)) { 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 (!$user) {
if (api_user() === false) { if (api_user() === false) {
@ -1136,7 +1136,7 @@ function api_statuses_update($type)
$posts_day = DBA::count('thread', $condition); $posts_day = DBA::count('thread', $condition);
if ($posts_day > $throttle_day) { 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)); // 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)); 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); $posts_week = DBA::count('thread', $condition);
if ($posts_week > $throttle_week) { 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))); // 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)); 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); $posts_month = DBA::count('thread', $condition);
if ($posts_month > $throttle_month) { 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)); // 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)); 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"], "h" => $media["height"],
"image_type" => $media["type"]]; "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]; return ["media" => $returndata];
} }
@ -1269,7 +1269,7 @@ function api_status_show($type, $item_id = 0)
$user_info = api_get_user($a); $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") { if ($type == "raw") {
$privacy_sql = "AND NOT `private`"; $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"]["uid"]);
unset($status_info["user"]["self"]); 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") { if ($type == "raw") {
return $status_info; return $status_info;
@ -2142,7 +2142,7 @@ function api_statuses_user_timeline($type)
"api_statuses_user_timeline: api_user: ". api_user() . "api_statuses_user_timeline: api_user: ". api_user() .
"\nuser_info: ".print_r($user_info, true) . "\nuser_info: ".print_r($user_info, true) .
"\n_REQUEST: ".print_r($_REQUEST, true), "\n_REQUEST: ".print_r($_REQUEST, true),
LOGGER_DEBUG Logger::DEBUG
); );
$since_id = x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0; $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'); $contact_id = defaults($_REQUEST, 'user_id');
if (empty($contact_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"); 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]); $contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id, 'uid' => 0, 'self' => false]);
if(!DBA::isResult($contact)) { 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"); throw new NotFoundException("no contact found to given ID");
} }
@ -3670,12 +3670,12 @@ function api_friendships_destroy($type)
$contact = DBA::selectFirst('contact', [], $condition); $contact = DBA::selectFirst('contact', [], $condition);
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
Logger::log("Not following Contact", LOGGER_DEBUG); Logger::log("Not following Contact", Logger::DEBUG);
throw new NotFoundException("Not following Contact"); throw new NotFoundException("Not following Contact");
} }
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) { 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"); throw new ExpectationFailedException("Not supported");
} }
@ -3686,7 +3686,7 @@ function api_friendships_destroy($type)
Contact::terminateFriendship($owner, $contact, $dissolve); Contact::terminateFriendship($owner, $contact, $dissolve);
} }
else { else {
Logger::log("No owner found", LOGGER_DEBUG); Logger::log("No owner found", Logger::DEBUG);
throw new NotFoundException("Error Processing Request"); throw new NotFoundException("Error Processing Request");
} }
@ -4489,7 +4489,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
Logger::log( Logger::log(
"File upload src: " . $src . " - filename: " . $filename . "File upload src: " . $src . " - filename: " . $filename .
" - size: " . $filesize . " - type: " . $filetype, " - size: " . $filesize . " - type: " . $filetype,
LOGGER_DEBUG Logger::DEBUG
); );
// check if there was a php upload error // 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) { if ($max_length > 0) {
$Image->scaleDown($max_length); $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(); $width = $Image->getWidth();
$height = $Image->getHeight(); $height = $Image->getHeight();
@ -4531,7 +4531,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
if ($mediatype == "photo") { if ($mediatype == "photo") {
// upload normal image (scales 0, 1, 2) // 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); $r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) { 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: 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") { } elseif ($mediatype == "profileimage") {
// upload profile image (scales 4, 5, 6) // 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) { if ($width > 300 || $height > 300) {
$Image->scaleDown(300); $Image->scaleDown(300);
@ -4581,7 +4581,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
} }
} }
$Image->__destruct(); $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) { if (isset($r) && $r) {
@ -4808,7 +4808,7 @@ function api_friendica_remoteauth()
'sec' => $sec, 'expire' => time() + 45]; 'sec' => $sec, 'expire' => time() + 45];
DBA::insert('profile_check', $fields); DBA::insert('profile_check', $fields);
Logger::log($contact['name'] . ' ' . $sec, LOGGER_DEBUG); Logger::log($contact['name'] . ' ' . $sec, Logger::DEBUG);
$dest = ($url ? '&destination_url=' . $url : ''); $dest = ($url ? '&destination_url=' . $url : '');
System::externalRedirect( System::externalRedirect(
@ -5056,7 +5056,7 @@ function api_in_reply_to($item)
// https://github.com/friendica/friendica/issues/1010 // https://github.com/friendica/friendica/issues/1010
// This is a bugfix for that. // This is a bugfix for that.
if (intval($in_reply_to['status_id']) == intval($item['id'])) { 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['status_id'] = null;
$in_reply_to['user_id'] = null; $in_reply_to['user_id'] = null;
$in_reply_to['status_id_str'] = null; $in_reply_to['status_id_str'] = null;

View file

@ -752,7 +752,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
$threads = $conv->getTemplateData($conv_responses); $threads = $conv->getTemplateData($conv_responses);
if (!$threads) { 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 = []; $threads = [];
} }
} }

View file

@ -134,7 +134,7 @@ function notification($params)
if ($params['type'] == NOTIFY_COMMENT) { if ($params['type'] == NOTIFY_COMMENT) {
$thread = Item::selectFirstThreadForUser($params['uid'] ,['ignored'], ['iid' => $parent_id]); $thread = Item::selectFirstThreadForUser($params['uid'] ,['ignored'], ['iid' => $parent_id]);
if (DBA::isResult($thread) && $thread["ignored"]) { 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(); L10n::popLang();
return; return;
} }
@ -453,7 +453,7 @@ function notification($params)
$itemlink = $h['itemlink']; $itemlink = $h['itemlink'];
if ($show_in_notification_page) { if ($show_in_notification_page) {
Logger::log("adding notification entry", LOGGER_DEBUG); Logger::log("adding notification entry", Logger::DEBUG);
do { do {
$dups = false; $dups = false;
$hash = random_string(); $hash = random_string();
@ -537,7 +537,7 @@ function notification($params)
// Is this the first email notification for this parent item and user? // 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']])) { 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'], $fields = ['notify-id' => $notify_id, 'master-parent-item' => $params['parent'],
'receiver-uid' => $params['uid'], 'parent-item' => 0]; 'receiver-uid' => $params['uid'], 'parent-item' => 0];
@ -546,11 +546,11 @@ function notification($params)
$additional_mail_header .= "Message-ID: <${id_for_parent}>\n"; $additional_mail_header .= "Message-ID: <${id_for_parent}>\n";
$log_msg = "include/enotify: No previous notification found for this parent:\n". $log_msg = "include/enotify: No previous notification found for this parent:\n".
" parent: ${params['parent']}\n"." uid : ${params['uid']}\n"; " parent: ${params['parent']}\n"." uid : ${params['uid']}\n";
Logger::log($log_msg, LOGGER_DEBUG); Logger::log($log_msg, Logger::DEBUG);
} else { } else {
// If not, just "follow" the thread. // If not, just "follow" the thread.
$additional_mail_header .= "References: <${id_for_parent}>\nIn-Reply-To: <${id_for_parent}>\n"; $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);
} }
} }

View file

@ -110,7 +110,7 @@ function query_page_info($url, $photo = "", $keywords = false, $keyword_blacklis
$data["images"][0]["src"] = $photo; $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"])) { if (!$keywords && isset($data["keywords"])) {
unset($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) 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 = "^\[\]"; $URLSearchString = "^\[\]";
@ -252,7 +252,7 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0
// Test - remove before flight // Test - remove before flight
//$tempfile = tempnam(get_temppath(), "ostatus2"); //$tempfile = tempnam(get_temppath(), "ostatus2");
//file_put_contents($tempfile, $xml); //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); 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 ($contact['network'] === Protocol::FEED) {
if ($pass < 2) { if ($pass < 2) {
Logger::log("Consume feeds", LOGGER_DEBUG); Logger::log("Consume feeds", Logger::DEBUG);
Feed::import($xml, $importer, $contact, $hub); 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) { 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"]); $dfrn_importer = DFRN::getImporter($contact["id"], $importer["uid"]);
if (!empty($dfrn_importer)) { if (!empty($dfrn_importer)) {
Logger::log("Now import the DFRN feed"); 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); $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; return;

View file

@ -35,7 +35,7 @@ function acl_content(App $a)
$search = $_REQUEST['query']; $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 != '') { if ($search != '') {
$sql_extra = "AND `name` LIKE '%%" . DBA::escape($search) . "%%'"; $sql_extra = "AND `name` LIKE '%%" . DBA::escape($search) . "%%'";

View file

@ -911,7 +911,7 @@ function admin_page_summary(App $a)
$users+= $u['count']; $users+= $u['count'];
} }
Logger::log('accounts: ' . print_r($accounts, true), LOGGER_DATA); Logger::log('accounts: ' . print_r($accounts, true), Logger::DATA);
$pending = Register::getPendingCount(); $pending = Register::getPendingCount();
@ -2400,12 +2400,12 @@ function admin_page_logs_post(App $a)
function admin_page_logs(App $a) function admin_page_logs(App $a)
{ {
$log_choices = [ $log_choices = [
LOGGER_WARNING => 'Warning', Logger::WARNING => 'Warning',
LOGGER_INFO => 'Info', Logger::INFO => 'Info',
LOGGER_TRACE => 'Trace', Logger::TRACE => 'Trace',
LOGGER_DEBUG => 'Debug', Logger::DEBUG => 'Debug',
LOGGER_DATA => 'Data', Logger::DATA => 'Data',
LOGGER_ALL => 'All' Logger::ALL => 'All'
]; ];
if (ini_get('log_errors')) { if (ini_get('log_errors')) {
@ -2500,7 +2500,7 @@ function admin_page_features_post(App $a)
{ {
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features'); 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); $features = Feature::get(false);

View file

@ -212,7 +212,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$params['page'] = 2; $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(); $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 // Now figure out what they responded. Try to be robust if the remote site is
// having difficulty and throwing up errors of some kind. // 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: 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. // If $aes_key is set, both of these items require unpacking from the hex transport encoding.

View file

@ -18,7 +18,7 @@ use Friendica\Protocol\Diaspora;
require_once 'include/items.php'; require_once 'include/items.php';
function dfrn_notify_post(App $a) { function dfrn_notify_post(App $a) {
Logger::log(__function__, LOGGER_TRACE); Logger::log(__function__, Logger::TRACE);
$postdata = file_get_contents('php://input'); $postdata = file_get_contents('php://input');
@ -118,7 +118,7 @@ function dfrn_notify_post(App $a) {
$importer = Contact::updateSslPolicy($importer, $ssl_policy); $importer = Contact::updateSslPolicy($importer, $ssl_policy);
Logger::log('data: ' . $data, LOGGER_DATA); Logger::log('data: ' . $data, Logger::DATA);
if ($dissolve == 1) { if ($dissolve == 1) {
// Relationship is dissolved permanently // Relationship is dissolved permanently
@ -140,7 +140,7 @@ function dfrn_notify_post(App $a) {
} }
$rawkey = hex2bin(trim($key)); $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 = ''; $final_key = '';
@ -170,10 +170,10 @@ function dfrn_notify_post(App $a) {
System::xmlExit(0, "Invalid sent version '$rino_remote'"); 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); $ret = DFRN::import($data, $importer);
System::xmlExit($ret, 'Processed'); System::xmlExit($ret, 'Processed');
@ -204,7 +204,7 @@ function dfrn_dispatch_public($postdata)
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found'); 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 // Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer); $ret = DFRN::import($msg['message'], $importer);
@ -237,7 +237,7 @@ function dfrn_dispatch_private($user, $postdata)
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found'); 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 // Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer); $ret = DFRN::import($msg['message'], $importer);
@ -277,7 +277,7 @@ function dfrn_notify_content(App $a) {
'type' => $type, 'last_update' => $last_update]; 'type' => $type, 'last_update' => $last_update];
DBA::insert('challenge', $fields); 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]]); $user = DBA::selectFirst('user', ['uid'], ['nickname' => $a->argv[1]]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
@ -317,7 +317,7 @@ function dfrn_notify_content(App $a) {
killme(); 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 = ''; $challenge = '';
$encrypted_id = ''; $encrypted_id = '';
@ -345,7 +345,7 @@ function dfrn_notify_content(App $a) {
$rino = Config::get('system', 'rino_encrypt'); $rino = Config::get('system', 'rino_encrypt');
$rino = intval($rino); $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 lower than enabled local rino, lower local rino version
// if requested rino is higher than enabled local rino, reply with local rino // if requested rino is higher than enabled local rino, reply with local rino

View file

@ -105,7 +105,7 @@ function dfrn_poll_init(App $a)
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
$s = Network::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check'); $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)) { if (strlen($s)) {
$xml = XML::parseString($s); $xml = XML::parseString($s);
@ -192,7 +192,7 @@ function dfrn_poll_init(App $a)
} }
if ($final_dfrn_id != $orig_id) { 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 // did not decode properly - cannot trust this site
System::xmlExit(3, 'Bad decryption'); System::xmlExit(3, 'Bad decryption');
} }
@ -284,7 +284,7 @@ function dfrn_poll_post(App $a)
} }
if ($final_dfrn_id != $orig_id) { 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 // did not decode properly - cannot trust this site
System::xmlExit(3, 'Bad decryption'); System::xmlExit(3, 'Bad decryption');
} }
@ -373,7 +373,7 @@ function dfrn_poll_post(App $a)
// NOTREACHED // NOTREACHED
} else { } else {
// Update the writable flag if it changed // 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 ($dfrn_version >= 2.21) {
if ($perm === 'rw') { if ($perm === 'rw') {
$writable = 1; $writable = 1;
@ -511,12 +511,12 @@ function dfrn_poll_content(App $a)
])->getBody(); ])->getBody();
} }
Logger::log("dfrn_poll: sec profile: " . $s, LOGGER_DATA); Logger::log("dfrn_poll: sec profile: " . $s, Logger::DATA);
if (strlen($s) && strstr($s, '<?xml')) { if (strlen($s) && strstr($s, '<?xml')) {
$xml = XML::parseString($s); $xml = XML::parseString($s);
Logger::log('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), LOGGER_DATA); Logger::log('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), Logger::DATA);
Logger::log('dfrn_poll: secure profile: challenge: ' . $xml->challenge . ' expecting ' . $hash); Logger::log('dfrn_poll: secure profile: challenge: ' . $xml->challenge . ' expecting ' . $hash);
Logger::log('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec); Logger::log('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec);

View file

@ -298,7 +298,7 @@ function dfrn_request_post(App $a)
$network = Protocol::DFRN; $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) { if ($network === Protocol::DFRN) {
$ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1", $ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",

View file

@ -75,7 +75,7 @@ function display_init(App $a)
} }
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) { 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); displayShowFeed($item["id"], false);
} }

View file

@ -48,7 +48,7 @@ function events_init(App $a)
function events_post(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()) { if (!local_user()) {
return; return;

View file

@ -57,7 +57,7 @@ function item_post(App $a) {
Addon::callHooks('post_local_start', $_REQUEST); 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); $api_source = defaults($_REQUEST, 'api_source', false);
@ -73,7 +73,7 @@ function item_post(App $a) {
*/ */
if (!$preview && !empty($_REQUEST['post_id_random'])) { if (!$preview && !empty($_REQUEST['post_id_random'])) {
if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_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); item_post_return(System::baseUrl(), $api_source, $return_path);
} else { } else {
$_SESSION['post-random'] = $_REQUEST['post_id_random']; $_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) // Check for multiple posts with the same message id (when the post was created via API)
if (($message_id != '') && ($profile_uid != 0)) { if (($message_id != '') && ($profile_uid != 0)) {
if (Item::exists(['uri' => $message_id, 'uid' => $profile_uid])) { 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; return 0;
} }
} }
@ -862,7 +862,7 @@ function item_post_return($baseurl, $api_source, $return_path)
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload']; $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); echo json_encode($json);
killme(); killme();

View file

@ -204,22 +204,22 @@ function nodeinfo_cron() {
Config::set('nodeinfo', 'active_users_halfyear', $active_users_halfyear); Config::set('nodeinfo', 'active_users_halfyear', $active_users_halfyear);
Config::set('nodeinfo', 'active_users_monthly', $active_users_monthly); 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"]); $local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_posts', $local_posts); 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"]); $local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_comments', $local_comments); 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 // Now trying to register
$url = 'http://the-federation.info/register/'.$a->getHostName(); $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); $ret = Network::fetchUrl($url);
Logger::log('registering answer: '.$ret, LOGGER_DEBUG); Logger::log('registering answer: '.$ret, Logger::DEBUG);
Logger::log('cron_end'); Logger::log('cron_end');
} }

View file

@ -17,7 +17,7 @@ function openid_content(App $a) {
if($noid) if($noid)
$a->internalRedirect(); $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'))) { if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {

View file

@ -142,9 +142,9 @@ function photos_init(App $a) {
function photos_post(App $a) function photos_post(App $a)
{ {
Logger::log('mod-photos: photos_post: begin' , LOGGER_DEBUG); Logger::log('mod-photos: photos_post: begin' , Logger::DEBUG);
Logger::log('mod_photos: REQUEST ' . print_r($_REQUEST, true), LOGGER_DATA); 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: FILES ' . print_r($_FILES, true), Logger::DATA);
$phototypes = Image::supportedTypes(); $phototypes = Image::supportedTypes();
@ -707,7 +707,7 @@ function photos_post(App $a)
$album = !empty($_REQUEST['album']) ? notags(trim($_REQUEST['album'])) : ''; $album = !empty($_REQUEST['album']) ? notags(trim($_REQUEST['album'])) : '';
$newalbum = !empty($_REQUEST['newalbum']) ? notags(trim($_REQUEST['newalbum'])) : ''; $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($album)) {
if (strlen($newalbum)) { if (strlen($newalbum)) {
@ -800,7 +800,7 @@ function photos_post(App $a)
$type = Image::guessType($filename); $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'); $maximagesize = Config::get('system', 'maximagesize');
@ -820,14 +820,14 @@ function photos_post(App $a)
return; 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); $imagedata = @file_get_contents($src);
$image = new Image($imagedata, $type); $image = new Image($imagedata, $type);
if (!$image->isValid()) { 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); notice(L10n::t('Unable to process image.') . EOL);
@unlink($src); @unlink($src);
$foo = 0; $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); $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) { 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); notice(L10n::t('Image upload failed.') . EOL);
killme(); killme();
} }

View file

@ -122,7 +122,7 @@ function poco_init(App $a) {
$itemsPerPage = ((x($_GET, 'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults); $itemsPerPage = ((x($_GET, 'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
if ($global) { 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` $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", ORDER BY `updated` DESC LIMIT %d, %d",
DBA::escape($update_limit), DBA::escape($update_limit),
@ -133,7 +133,7 @@ function poco_init(App $a) {
intval($itemsPerPage) intval($itemsPerPage)
); );
} elseif ($system_mode) { } 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`, $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`.`gender` AS `pgender`, `profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`,
`profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type` `profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type`
@ -145,7 +145,7 @@ function poco_init(App $a) {
intval($itemsPerPage) intval($itemsPerPage)
); );
} else { } 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 $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 (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d", AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d",
@ -158,7 +158,7 @@ function poco_init(App $a) {
intval($itemsPerPage) intval($itemsPerPage)
); );
} }
Logger::log("Query done", LOGGER_DEBUG); Logger::log("Query done", Logger::DEBUG);
$ret = []; $ret = [];
if (x($_GET, 'sorted')) { if (x($_GET, 'sorted')) {
@ -370,7 +370,7 @@ function poco_init(App $a) {
} else { } else {
System::httpExit(500); System::httpExit(500);
} }
Logger::log("End of poco", LOGGER_DEBUG); Logger::log("End of poco", Logger::DEBUG);
if ($format === 'xml') { if ($format === 'xml') {
header('Content-type: text/xml'); header('Content-type: text/xml');

View file

@ -54,7 +54,7 @@ function poke_init(App $a)
$parent = (x($_GET,'parent') ? intval($_GET['parent']) : 0); $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", $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",

View file

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

View file

@ -41,7 +41,7 @@ function pubsub_init(App $a)
$hub_verify = notags(trim(defaults($_GET, 'hub_verify_token', ''))); $hub_verify = notags(trim(defaults($_GET, 'hub_verify_token', '')));
Logger::log('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick); 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); $subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
@ -89,7 +89,7 @@ function pubsub_post(App $a)
$xml = file_get_contents('php://input'); $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('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])) : ''); $nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 ); $contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );

View file

@ -42,7 +42,7 @@ function receive_post(App $a)
// It is an application/x-www-form-urlencoded // 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'])) { if (empty($_POST['xml'])) {
$postdata = file_get_contents("php://input"); $postdata = file_get_contents("php://input");
@ -50,29 +50,29 @@ function receive_post(App $a)
System::httpExit(500); 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); $msg = Diaspora::decodeRaw($importer, $postdata);
} else { } else {
$xml = urldecode($_POST['xml']); $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); $msg = Diaspora::decode($importer, $xml);
if ($public && !$msg) { 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); $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)) { if (!is_array($msg)) {
System::httpExit(500); System::httpExit(500);
} }
Logger::log('mod-diaspora: dispatching', LOGGER_DEBUG); Logger::log('mod-diaspora: dispatching', Logger::DEBUG);
$ret = true; $ret = true;
if ($public) { if ($public) {

View file

@ -52,7 +52,7 @@ function redir_init(App $a) {
if (!empty($a->contact['id']) && $a->contact['id'] == $cid) { if (!empty($a->contact['id']) && $a->contact['id'] == $cid) {
// Local user is already authenticated. // Local user is already authenticated.
$target_url = defaults($url, $contact_url); $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); $a->redirect($target_url);
} }
} }
@ -73,7 +73,7 @@ function redir_init(App $a) {
if ($v['uid'] == $_SESSION['visitor_visiting'] && $v['cid'] == $_SESSION['visitor_id']) { if ($v['uid'] == $_SESSION['visitor_visiting'] && $v['cid'] == $_SESSION['visitor_id']) {
// Remote user is already authenticated. // Remote user is already authenticated.
$target_url = defaults($url, $contact_url); $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); $a->redirect($target_url);
} }
} }
@ -99,7 +99,7 @@ function redir_init(App $a) {
'sec' => $sec, 'expire' => time() + 45]; 'sec' => $sec, 'expire' => time() + 45];
DBA::insert('profile_check', $fields); 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 : ''); $dest = (!empty($url) ? '&destination_url=' . $url : '');
@ -121,7 +121,7 @@ function redir_init(App $a) {
$url .= $separator . 'zrl=' . urlencode($my_profile); $url .= $separator . 'zrl=' . urlencode($my_profile);
} }
Logger::log('redirecting to ' . $url, LOGGER_DEBUG); Logger::log('redirecting to ' . $url, Logger::DEBUG);
$a->redirect($url); $a->redirect($url);
} }

View file

@ -21,7 +21,7 @@ function salmon_post(App $a, $xml = '') {
$xml = file_get_contents('php://input'); $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])) : ''); $nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false); $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]); $m = base64url_decode($key_info[1]);
$e = base64url_decode($key_info[2]); $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); $pubkey = Crypto::meToPem($m, $e);

View file

@ -205,7 +205,7 @@ function search_content(App $a) {
$pager = new Pager($a->query_string); $pager = new Pager($a->query_string);
if ($tag) { 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`)) $condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `otype` = ? AND `type` = ? AND `term` = ?", AND `otype` = ? AND `type` = ? AND `term` = ?",
@ -228,7 +228,7 @@ function search_content(App $a) {
$r = []; $r = [];
} }
} else { } 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`)) $condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `body` LIKE CONCAT('%',?,'%')", AND `body` LIKE CONCAT('%',?,'%')",
@ -255,12 +255,12 @@ function search_content(App $a) {
'$title' => $title '$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 .= conversation($a, $r, $pager, 'search', false, false, 'commented', local_user());
$o .= $pager->renderMinimal(count($r)); $o .= $pager->renderMinimal(count($r));
Logger::log("Done '".$search."'", LOGGER_DEBUG); Logger::log("Done '".$search."'", Logger::DEBUG);
return $o; return $o;
} }

View file

@ -57,6 +57,6 @@ function statistics_json_init(App $a) {
header("Content-Type: application/json"); header("Content-Type: application/json");
echo json_encode($statistics, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); 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(); killme();
} }

View file

@ -20,7 +20,7 @@ use Friendica\Object\Image;
function wall_upload_post(App $a, $desktopmode = true) 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'); $r_json = (x($_GET, 'response') && $_GET['response'] == 'json');
$album = (x($_GET, 'album') ? notags(trim($_GET['album'])) : ''); $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 . 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'); $maximagesize = Config::get('system', 'maximagesize');
@ -226,7 +226,7 @@ function wall_upload_post(App $a, $desktopmode = true)
} }
if ($max_length > 0) { if ($max_length > 0) {
$Image->scaleDown($max_length); $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(); $width = $Image->getWidth();
@ -301,11 +301,11 @@ function wall_upload_post(App $a, $desktopmode = true)
echo json_encode(['picture' => $picture]); echo json_encode(['picture' => $picture]);
killme(); killme();
} }
Logger::log("upload done", LOGGER_DEBUG); Logger::log("upload done", Logger::DEBUG);
return $picture; return $picture;
} }
Logger::log("upload done", LOGGER_DEBUG); Logger::log("upload done", Logger::DEBUG);
if ($r_json) { if ($r_json) {
echo json_encode(['ok' => true]); echo json_encode(['ok' => true]);

View file

@ -1101,10 +1101,10 @@ class App
$processlist = DBA::processlist(); $processlist = DBA::processlist();
if ($processlist['list'] != '') { 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) { 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; return true;
} }
} }
@ -1150,7 +1150,7 @@ class App
$reached = ($free < $min_memory); $reached = ($free < $min_memory);
if ($reached) { 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; return $reached;
@ -1222,7 +1222,7 @@ class App
$resource = proc_open($cmdline . ' &', [], $foo, $this->getBasePath()); $resource = proc_open($cmdline . ' &', [], $foo, $this->getBasePath());
} }
if (!is_resource($resource)) { 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; return;
} }
proc_close($resource); proc_close($resource);
@ -1253,27 +1253,27 @@ class App
public static function isDirectoryUsable($directory, $check_writable = true) public static function isDirectoryUsable($directory, $check_writable = true)
{ {
if ($directory == '') { 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; return false;
} }
if (!file_exists($directory)) { 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; return false;
} }
if (is_file($directory)) { 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; return false;
} }
if (!is_dir($directory)) { 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; return false;
} }
if ($check_writable && !is_writable($directory)) { 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; return false;
} }
@ -1646,7 +1646,7 @@ class App
} else { } else {
// Someone came with an invalid parameter, maybe as a DDoS attempt // Someone came with an invalid parameter, maybe as a DDoS attempt
// We simply stop processing here // 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']); Core\System::httpExit(403, ['title' => '403 Forbidden']);
} }
} }
@ -1789,7 +1789,7 @@ class App
$this->internalRedirect($_SERVER['REQUEST_URI']); $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')); header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . Core\L10n::t('Not Found'));
$tpl = get_markup_template("404.tpl"); $tpl = get_markup_template("404.tpl");

View file

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

View file

@ -415,7 +415,7 @@ class BBCode extends BaseObject
$Image->scaleDown(640); $Image->scaleDown(640);
$new_width = $Image->getWidth(); $new_width = $Image->getWidth();
$new_height = $Image->getHeight(); $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( $s = str_replace(
$mtch[0], $mtch[0],
'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]' '[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]'
@ -424,7 +424,7 @@ class BBCode extends BaseObject
: ''), : ''),
$s $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 // than the maximum, then don't waste time looking for the images
if ($maxlen && (strlen($body) > $maxlen)) { 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; $orig_body = $body;
$new_body = ''; $new_body = '';
@ -472,7 +472,7 @@ class BBCode extends BaseObject
if (($textlen + $img_start) > $maxlen) { if (($textlen + $img_start) > $maxlen) {
if ($textlen < $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); $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
$textlen = $maxlen; $textlen = $maxlen;
} }
@ -486,7 +486,7 @@ class BBCode extends BaseObject
if (($textlen + $img_end) > $maxlen) { if (($textlen + $img_end) > $maxlen) {
if ($textlen < $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); $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
$textlen = $maxlen; $textlen = $maxlen;
} }
@ -509,11 +509,11 @@ class BBCode extends BaseObject
if (($textlen + strlen($orig_body)) > $maxlen) { if (($textlen + strlen($orig_body)) > $maxlen) {
if ($textlen < $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); $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
} }
} else { } 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; $new_body = $new_body . $orig_body;
} }

View file

@ -154,10 +154,10 @@ class Authentication extends BaseObject
} }
if ($login_initial) { 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) { 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]); $contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);

View file

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

View file

@ -359,7 +359,7 @@ class NotificationsManager extends BaseObject
break; break;
} }
/// @todo Check if this part here is used at all /// @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' ?" . ">"; $xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
$obj = XML::parseString($xmlhead . $it['object']); $obj = XML::parseString($xmlhead . $it['object']);

View file

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

View file

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

View file

@ -38,7 +38,7 @@ class UserImport
private static function checkCols($table, &$arr) private static function checkCols($table, &$arr)
{ {
$query = sprintf("SHOW COLUMNS IN `%s`", DBA::escape($table)); $query = sprintf("SHOW COLUMNS IN `%s`", DBA::escape($table));
Logger::log("uimport: $query", LOGGER_DEBUG); Logger::log("uimport: $query", Logger::DEBUG);
$r = q($query); $r = q($query);
$tcols = []; $tcols = [];
// get a plain array of column names // get a plain array of column names
@ -69,7 +69,7 @@ class UserImport
$cols = implode("`,`", array_map(['Friendica\Database\DBA', 'escape'], array_keys($arr))); $cols = implode("`,`", array_map(['Friendica\Database\DBA', 'escape'], array_keys($arr)));
$vals = implode("','", array_map(['Friendica\Database\DBA', 'escape'], array_values($arr))); $vals = implode("','", array_map(['Friendica\Database\DBA', 'escape'], array_values($arr)));
$query = "INSERT INTO `$table` (`$cols`) VALUES ('$vals')"; $query = "INSERT INTO `$table` (`$cols`) VALUES ('$vals')";
Logger::log("uimport: $query", LOGGER_TRACE); Logger::log("uimport: $query", Logger::TRACE);
if (self::IMPORT_DEBUG) { if (self::IMPORT_DEBUG) {
return true; return true;
@ -144,7 +144,7 @@ class UserImport
// import user // import user
$r = self::dbImportAssoc('user', $account['user']); $r = self::dbImportAssoc('user', $account['user']);
if ($r === false) { 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")); notice(L10n::t("User creation error"));
return; return;
} }
@ -162,7 +162,7 @@ class UserImport
$profile['uid'] = $newuid; $profile['uid'] = $newuid;
$r = self::dbImportAssoc('profile', $profile); $r = self::dbImportAssoc('profile', $profile);
if ($r === false) { 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")); info(L10n::t("User profile creation error"));
DBA::delete('user', ['uid' => $newuid]); DBA::delete('user', ['uid' => $newuid]);
return; return;
@ -200,7 +200,7 @@ class UserImport
$contact['uid'] = $newuid; $contact['uid'] = $newuid;
$r = self::dbImportAssoc('contact', $contact); $r = self::dbImportAssoc('contact', $contact);
if ($r === false) { 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++; $errorcount++;
} else { } else {
$contact['newid'] = self::lastInsertId(); $contact['newid'] = self::lastInsertId();
@ -214,7 +214,7 @@ class UserImport
$group['uid'] = $newuid; $group['uid'] = $newuid;
$r = self::dbImportAssoc('group', $group); $r = self::dbImportAssoc('group', $group);
if ($r === false) { 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 { } else {
$group['newid'] = self::lastInsertId(); $group['newid'] = self::lastInsertId();
} }
@ -239,7 +239,7 @@ class UserImport
if ($import == 2) { if ($import == 2) {
$r = self::dbImportAssoc('group_member', $group_member); $r = self::dbImportAssoc('group_member', $group_member);
if ($r === false) { 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) { 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; $pconfig['uid'] = $newuid;
$r = self::dbImportAssoc('pconfig', $pconfig); $r = self::dbImportAssoc('pconfig', $pconfig);
if ($r === false) { 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);
} }
} }

View file

@ -43,7 +43,7 @@ class Worker
// At first check the maximum load. We shouldn't continue with a high load // At first check the maximum load. We shouldn't continue with a high load
if ($a->isMaxLoadReached()) { if ($a->isMaxLoadReached()) {
Logger::log('Pre check: maximum load reached, quitting.', LOGGER_DEBUG); Logger::log('Pre check: maximum load reached, quitting.', Logger::DEBUG);
return; return;
} }
@ -59,25 +59,25 @@ class Worker
// Count active workers and compare them with a maximum value that depends on the load // Count active workers and compare them with a maximum value that depends on the load
if (self::tooMuchWorkers()) { 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; return;
} }
// Do we have too few memory? // Do we have too few memory?
if ($a->isMinMemoryReached()) { if ($a->isMinMemoryReached()) {
Logger::log('Pre check: Memory limit reached, quitting.', LOGGER_DEBUG); Logger::log('Pre check: Memory limit reached, quitting.', Logger::DEBUG);
return; return;
} }
// Possibly there are too much database connections // Possibly there are too much database connections
if (self::maxConnectionsReached()) { if (self::maxConnectionsReached()) {
Logger::log('Pre check: maximum connections reached, quitting.', LOGGER_DEBUG); Logger::log('Pre check: maximum connections reached, quitting.', Logger::DEBUG);
return; return;
} }
// Possibly there are too much database processes that block the system // Possibly there are too much database processes that block the system
if ($a->isMaxProcessesReached()) { if ($a->isMaxProcessesReached()) {
Logger::log('Pre check: maximum processes reached, quitting.', LOGGER_DEBUG); Logger::log('Pre check: maximum processes reached, quitting.', Logger::DEBUG);
return; return;
} }
@ -100,7 +100,7 @@ class Worker
// The work will be done // The work will be done
if (!self::execute($entry)) { if (!self::execute($entry)) {
Logger::log('Process execution failed, quitting.', LOGGER_DEBUG); Logger::log('Process execution failed, quitting.', Logger::DEBUG);
return; return;
} }
@ -118,14 +118,14 @@ class Worker
$stamp = (float)microtime(true); $stamp = (float)microtime(true);
// Count active workers and compare them with a maximum value that depends on the load // Count active workers and compare them with a maximum value that depends on the load
if (self::tooMuchWorkers()) { if (self::tooMuchWorkers()) {
Logger::log('Active worker limit reached, quitting.', LOGGER_DEBUG); Logger::log('Active worker limit reached, quitting.', Logger::DEBUG);
Lock::release('worker'); Lock::release('worker');
return; return;
} }
// Check free memory // Check free memory
if ($a->isMinMemoryReached()) { if ($a->isMinMemoryReached()) {
Logger::log('Memory limit reached, quitting.', LOGGER_DEBUG); Logger::log('Memory limit reached, quitting.', Logger::DEBUG);
Lock::release('worker'); Lock::release('worker');
return; return;
} }
@ -135,7 +135,7 @@ class Worker
// Quit the worker once every 5 minutes // Quit the worker once every 5 minutes
if (time() > ($starttime + 300)) { if (time() > ($starttime + 300)) {
Logger::log('Process lifetime reached, quitting.', LOGGER_DEBUG); Logger::log('Process lifetime reached, quitting.', Logger::DEBUG);
return; return;
} }
} }
@ -144,7 +144,7 @@ class Worker
if (Config::get('system', 'worker_daemon_mode', false)) { if (Config::get('system', 'worker_daemon_mode', false)) {
self::IPCSetJobState(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 // Quit when in maintenance
if (Config::get('system', 'maintenance', false, true)) { 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; return false;
} }
// Constantly check the number of parallel database processes // Constantly check the number of parallel database processes
if ($a->isMaxProcessesReached()) { 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; return false;
} }
// Constantly check the number of available database connections to let the frontend be accessible at any time // Constantly check the number of available database connections to let the frontend be accessible at any time
if (self::maxConnectionsReached()) { 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; return false;
} }
@ -384,19 +384,19 @@ class Worker
' - Lock: '.number_format(self::$lock_duration, 2). ' - Lock: '.number_format(self::$lock_duration, 2).
' - Rest: '.number_format($up_duration - self::$db_duration - self::$lock_duration, 2). ' - Rest: '.number_format($up_duration - self::$db_duration - self::$lock_duration, 2).
' - Execution: '.number_format($duration, 2), ' - Execution: '.number_format($duration, 2),
LOGGER_DEBUG Logger::DEBUG
); );
self::$lock_duration = 0; self::$lock_duration = 0;
if ($duration > 3600) { 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) { } 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) { } 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) { } 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); 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), + $a->performance["network"] + $a->performance["file"]), 2),
number_format($duration, 2) number_format($duration, 2)
), ),
LOGGER_DEBUG Logger::DEBUG
); );
} }
@ -519,7 +519,7 @@ class Worker
$used = DBA::numRows($r); $used = DBA::numRows($r);
DBA::close($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; $level = ($used / $max) * 100;
@ -547,7 +547,7 @@ class Worker
if ($used == 0) { if ($used == 0) {
return false; 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; $level = $used / $max * 100;
@ -615,7 +615,7 @@ class Worker
['id' => $entry["id"]] ['id' => $entry["id"]]
); );
} else { } 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); $high_running = self::processWithPriorityActive($top_priority);
if (!$high_running && ($top_priority > PRIORITY_UNDEFINED) && ($top_priority < PRIORITY_NEGLIGIBLE)) { 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; $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. // 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)) { 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)) { if (Config::get('system', 'worker_daemon_mode', false)) {
self::IPCSetJobState(true); self::IPCSetJobState(true);
} else { } else {
@ -780,11 +780,11 @@ class Worker
++$high; ++$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)); $passing_slow = (($high/count($priorities)) > (2/3));
if ($passing_slow) { 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; return $passing_slow;
} }
@ -817,7 +817,7 @@ class Worker
$slope = $queue_length / pow($lower_job_limit, $exponent); $slope = $queue_length / pow($lower_job_limit, $exponent);
$limit = min($queue_length, ceil($slope * pow($jobs, $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 = []; $ids = [];
if (self::passingSlow($highest_priority)) { if (self::passingSlow($highest_priority)) {
// Are there waiting processes with a higher priority than the currently highest? // Are there waiting processes with a higher priority than the currently highest?
@ -976,7 +976,7 @@ class Worker
self::runCron(); self::runCron();
Logger::log('Call worker', LOGGER_DEBUG); Logger::log('Call worker', Logger::DEBUG);
self::spawnWorker(); self::spawnWorker();
return; return;
} }
@ -1015,7 +1015,7 @@ class Worker
*/ */
private static function runCron() private static function runCron()
{ {
Logger::log('Add cron entries', LOGGER_DEBUG); Logger::log('Add cron entries', Logger::DEBUG);
// Check for spooled items // Check for spooled items
self::add(PRIORITY_HIGH, "SpoolPost"); self::add(PRIORITY_HIGH, "SpoolPost");
@ -1153,7 +1153,7 @@ class Worker
$id = $queue['id']; $id = $queue['id'];
if ($retrial > 14) { 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; return;
} }
@ -1161,7 +1161,7 @@ class Worker
$delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1)); $delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds'); $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]; $fields = ['retrial' => $retrial + 1, 'next_try' => $next, 'executed' => DBA::NULL_DATETIME, 'pid' => 0];
DBA::update('workerqueue', $fields, ['id' => $id]); DBA::update('workerqueue', $fields, ['id' => $id]);

View file

@ -413,7 +413,7 @@ class DBA
if ((substr_count($sql, '?') != count($args)) && (count($args) > 0)) { if ((substr_count($sql, '?') != count($args)) && (count($args) > 0)) {
// Question: Should we continue or stop the query here? // 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); $sql = self::cleanQuery($sql);
@ -1143,7 +1143,7 @@ class DBA
if ((count($command['conditions']) > 1) || is_int($first_key)) { if ((count($command['conditions']) > 1) || is_int($first_key)) {
$sql = "DELETE FROM `" . $command['table'] . "`" . $condition_string; $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 (!self::e($sql, $conditions)) {
if ($do_transaction) { if ($do_transaction) {
@ -1173,7 +1173,7 @@ class DBA
$sql = "DELETE FROM `" . $table . "` WHERE `" . $field . "` IN (" . $sql = "DELETE FROM `" . $table . "` WHERE `" . $field . "` IN (" .
substr(str_repeat("?, ", count($field_values)), 0, -2) . ");"; 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 (!self::e($sql, $field_values)) {
if ($do_transaction) { if ($do_transaction) {

View file

@ -70,7 +70,7 @@ class DBStructure
// No valid result? // No valid result?
if (!DBA::isResult($adminlist)) { 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 // Don't continue
return; return;
@ -222,7 +222,7 @@ class DBStructure
$errors = ''; $errors = '';
Logger::log('updating structure', LOGGER_DEBUG); Logger::log('updating structure', Logger::DEBUG);
// Get the current structure // Get the current structure
$database = []; $database = [];
@ -235,7 +235,7 @@ class DBStructure
foreach ($tables AS $table) { foreach ($tables AS $table) {
$table = current($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); $database[$table] = self::tableStructure($table);
} }
} }

View file

@ -53,7 +53,7 @@ class PostUpdate
return true; return true;
} }
Logger::log("Start", LOGGER_DEBUG); Logger::log("Start", Logger::DEBUG);
$end_id = Config::get("system", "post_update_1194_end"); $end_id = Config::get("system", "post_update_1194_end");
if (!$end_id) { 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"); $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)); DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
if (!$r) { if (!$r) {
Config::set("system", "post_update_version", 1194); Config::set("system", "post_update_version", 1194);
Logger::log("Update is done", LOGGER_DEBUG); Logger::log("Update is done", Logger::DEBUG);
return true; return true;
} else { } else {
Config::set("system", "post_update_1194_start", $r[0]["id"]); Config::set("system", "post_update_1194_start", $r[0]["id"]);
$start_id = Config::get("system", "post_update_1194_start"); $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", $r = q($query1.$query2.$query3." ORDER BY `item`.`id` LIMIT 1000,1",
intval($start_id), intval($end_id), intval($start_id), intval($end_id),
@ -100,13 +100,13 @@ class PostUpdate
} else { } else {
$pos_id = $end_id; $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, q("UPDATE `item` ".$query2." SET `item`.`global` = 1 ".$query3,
intval($start_id), intval($pos_id), intval($start_id), intval($pos_id),
DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS)); 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; return true;
} }
Logger::log("Start", LOGGER_DEBUG); Logger::log("Start", Logger::DEBUG);
$r = q("SELECT `contact`.`id`, `contact`.`last-item`, $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` (SELECT MAX(`changed`) FROM `item` USE INDEX (`uid_wall_changed`) WHERE `wall` AND `uid` = `user`.`uid`) AS `lastitem_date`
FROM `user` FROM `user`
@ -139,7 +139,7 @@ class PostUpdate
} }
Config::set("system", "post_update_version", 1206); Config::set("system", "post_update_version", 1206);
Logger::log("Done", LOGGER_DEBUG); Logger::log("Done", Logger::DEBUG);
return true; return true;
} }
@ -157,7 +157,7 @@ class PostUpdate
$id = Config::get("system", "post_update_version_1279_id", 0); $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', $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', '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); 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) { if ($start_id == $id) {
// Set all deprecated fields to "null" if they contain an empty string // Set all deprecated fields to "null" if they contain an empty string
@ -238,13 +238,13 @@ class PostUpdate
foreach ($nullfields as $field) { foreach ($nullfields as $field) {
$fields = [$field => null]; $fields = [$field => null];
$condition = [$field => '']; $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" // Important: This has to be a "DBA::update", not a "Item::update"
DBA::update('item', $fields, $condition); DBA::update('item', $fields, $condition);
} }
Config::set("system", "post_update_version", 1279); Config::set("system", "post_update_version", 1279);
Logger::log("Done", LOGGER_DEBUG); Logger::log("Done", Logger::DEBUG);
return true; return true;
} }
@ -307,7 +307,7 @@ class PostUpdate
$id = Config::get("system", "post_update_version_1281_id", 0); $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']; $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); 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) { 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"); 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"); 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); Config::set("system", "post_update_version", 1281);
Logger::log("Done", LOGGER_DEBUG); Logger::log("Done", Logger::DEBUG);
return true; return true;
} }

View file

@ -193,7 +193,7 @@ class APContact extends BaseObject
// Update the gcontact table // Update the gcontact table
DBA::update('gcontact', $contact_fields, ['nurl' => normalise_link($url)]); 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; return $apcontact;
} }

View file

@ -587,7 +587,7 @@ class Contact extends BaseObject
return; return;
} }
} elseif (!isset($contact['url'])) { } 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 // 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) 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; $contact_id = 0;

View file

@ -84,12 +84,12 @@ class Conversation
} }
if (!DBA::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) { 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::log('Conversation: update for ' . $conversation['item-uri'] . ' from ' . $old_conv['protocol'] . ' to ' . $conversation['protocol'] . ' failed',
LOGGER_DEBUG); Logger::DEBUG);
} }
} else { } else {
if (!DBA::insert('conversation', $conversation, true)) { if (!DBA::insert('conversation', $conversation, true)) {
Logger::log('Conversation: insert for ' . $conversation['item-uri'] . ' (protocol ' . $conversation['protocol'] . ') failed', Logger::log('Conversation: insert for ' . $conversation['item-uri'] . ' (protocol ' . $conversation['protocol'] . ') failed',
LOGGER_DEBUG); Logger::DEBUG);
} }
} }
} }

View file

@ -225,7 +225,7 @@ class Event extends BaseObject
} }
DBA::delete('event', ['id' => $event_id]); DBA::delete('event', ['id' => $event_id]);
Logger::log("Deleted event ".$event_id, LOGGER_DEBUG); Logger::log("Deleted event ".$event_id, Logger::DEBUG);
} }
/** /**

View file

@ -589,7 +589,7 @@ class GContact
} }
if ($new_url != $url) { 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; return $new_url;
@ -606,7 +606,7 @@ class GContact
if (($contact["network"] == Protocol::OSTATUS) && PortableContact::alternateOStatusUrl($contact["url"])) { if (($contact["network"] == Protocol::OSTATUS) && PortableContact::alternateOStatusUrl($contact["url"])) {
$data = Probe::uri($contact["url"]); $data = Probe::uri($contact["url"]);
if ($contact["network"] == Protocol::OSTATUS) { 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["url"] = $data["url"];
$contact["addr"] = $data["addr"]; $contact["addr"] = $data["addr"];
$contact["alias"] = $data["alias"]; $contact["alias"] = $data["alias"];
@ -630,12 +630,12 @@ class GContact
$last_contact_str = ''; $last_contact_str = '';
if (empty($contact["network"])) { 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; return false;
} }
if (in_array($contact["network"], [Protocol::PHANTOM])) { 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; return false;
} }
@ -703,7 +703,7 @@ class GContact
DBA::unlock(); DBA::unlock();
if ($doprobing) { 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"]); 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)) { if ((($contact["generation"] > 0) && ($contact["generation"] <= $public_contact[0]["generation"])) || ($public_contact[0]["generation"] == 0)) {
foreach ($fields as $field => $data) { foreach ($fields as $field => $data) {
if ($contact[$field] != $public_contact[0][$field]) { 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; $update = true;
} }
} }
if ($contact["generation"] < $public_contact[0]["generation"]) { 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; $update = true;
} }
} }
if ($update) { 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` >= ?)', $condition = ['`nurl` = ? AND (`generation` = 0 OR `generation` >= ?)',
normalise_link($contact["url"]), $contact["generation"]]; normalise_link($contact["url"]), $contact["generation"]];
$contact["updated"] = DateTimeFormat::utc($contact["updated"]); $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 // 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]); $public_contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]);
if (DBA::isResult($public_contact)) { 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"]); Contact::updateAvatar($contact["photo"], 0, $public_contact["id"]);
@ -886,7 +886,7 @@ class GContact
$data = Probe::uri($url); $data = Probe::uri($url);
if (in_array($data["network"], [Protocol::PHANTOM])) { 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; return;
} }
@ -917,7 +917,7 @@ class GContact
); );
if (!DBA::isResult($r)) { 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; return false;
} }
@ -954,7 +954,7 @@ class GContact
*/ */
public static function fetchGsUsers($server) 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"; $url = $server."/main/statistics";

View file

@ -984,12 +984,12 @@ class Item extends BaseObject
'icid', 'iaid', 'psid']; 'icid', 'iaid', 'psid'];
$item = self::selectFirst($fields, ['id' => $item_id]); $item = self::selectFirst($fields, ['id' => $item_id]);
if (!DBA::isResult($item)) { 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; return false;
} }
if ($item['deleted']) { 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; 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; return true;
} }
@ -1193,7 +1193,7 @@ class Item extends BaseObject
if (!empty($contact_id)) { if (!empty($contact_id)) {
return $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 * First we are looking for a suitable contact that matches with the author of the post
* This is done only for comments * This is done only for comments
@ -1214,7 +1214,7 @@ class Item extends BaseObject
$contact_id = $self["id"]; $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; return $contact_id;
} }
@ -1299,7 +1299,7 @@ class Item extends BaseObject
$item['gravity'] = GRAVITY_COMMENT; $item['gravity'] = GRAVITY_COMMENT;
} else { } else {
$item['gravity'] = GRAVITY_UNKNOWN; // Should not happen $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']); $uid = intval($item['uid']);
@ -1316,7 +1316,7 @@ class Item extends BaseObject
$expire_date = time() - ($expire_interval * 86400); $expire_date = time() - ($expire_interval * 86400);
$created_date = strtotime($item['created']); $created_date = strtotime($item['created']);
if ($created_date < $expire_date) { 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; return 0;
} }
} }
@ -1427,17 +1427,17 @@ class Item extends BaseObject
} }
if ($item['network'] == Protocol::PHANTOM) { 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; $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 // 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']]; $condition = ['guid' => $item['guid'], 'network' => $item['network'], 'uid' => $item['uid']];
if (self::exists($condition)) { 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; return 0;
} }
@ -1518,15 +1518,15 @@ class Item extends BaseObject
} }
// If its a post from myself then tag the thread as "mention" // 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']]); $user = DBA::selectFirst('user', ['nickname'], ['uid' => $item['uid']]);
if (DBA::isResult($user)) { if (DBA::isResult($user)) {
$self = normalise_link(System::baseUrl() . '/profile/' . $user['nickname']); $self = normalise_link(System::baseUrl() . '/profile/' . $user['nickname']);
$self_id = Contact::getIdForURL($self, 0, true); $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)) { if (($item['author-id'] == $self_id) || ($item['owner-id'] == $self_id)) {
DBA::update('thread', ['mention' => true], ['iid' => $parent_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 { } else {
@ -1628,12 +1628,12 @@ class Item extends BaseObject
*/ */
if ($item["uid"] == 0) { if ($item["uid"] == 0) {
if (self::exists(['uri' => trim($item['uri']), '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; return 0;
} }
} }
Logger::log('' . print_r($item,true), LOGGER_DATA); Logger::log('' . print_r($item,true), Logger::DATA);
if (array_key_exists('tag', $item)) { if (array_key_exists('tag', $item)) {
$tags = $item['tag']; $tags = $item['tag'];
@ -1701,7 +1701,7 @@ class Item extends BaseObject
$item = array_merge($item, $delivery_data); $item = array_merge($item, $delivery_data);
file_put_contents($spool, json_encode($item)); 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; return 0;
} }
@ -1760,7 +1760,7 @@ class Item extends BaseObject
*/ */
if (base64_encode(base64_decode(base64_decode($dsprsig->signature))) == base64_decode($dsprsig->signature)) { if (base64_encode(base64_decode(base64_decode($dsprsig->signature))) == base64_decode($dsprsig->signature)) {
$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)) { 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); $distributed = self::insert($item, false, $notify, true);
if (!$distributed) { 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 { } 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); $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); $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. // 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. // 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 // Prevent the forwarding of posts that are forwarded
if (!empty($datarray["extid"]) && ($datarray["extid"] == Protocol::DFRN)) { if (!empty($datarray["extid"]) && ($datarray["extid"] == Protocol::DFRN)) {
Logger::log('Already forwarded', LOGGER_DEBUG); Logger::log('Already forwarded', Logger::DEBUG);
return false; return false;
} }
// Prevent to forward already forwarded posts // Prevent to forward already forwarded posts
if ($datarray["app"] == $a->getHostName()) { if ($datarray["app"] == $a->getHostName()) {
Logger::log('Already forwarded (second test)', LOGGER_DEBUG); Logger::log('Already forwarded (second test)', Logger::DEBUG);
return false; return false;
} }
// Only forward posts // Only forward posts
if ($datarray["verb"] != ACTIVITY_POST) { if ($datarray["verb"] != ACTIVITY_POST) {
Logger::log('No post', LOGGER_DEBUG); Logger::log('No post', Logger::DEBUG);
return false; return false;
} }
if (($contact['network'] != Protocol::FEED) && $datarray['private']) { if (($contact['network'] != Protocol::FEED) && $datarray['private']) {
Logger::log('Not public', LOGGER_DEBUG); Logger::log('Not public', Logger::DEBUG);
return false; return false;
} }
$datarray2 = $datarray; $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) { if ($contact['remote_self'] == 2) {
$self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'], $self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'],
['uid' => $contact['uid'], 'self' => true]); ['uid' => $contact['uid'], 'self' => true]);
@ -2675,7 +2675,7 @@ class Item extends BaseObject
if ($contact['network'] != Protocol::FEED) { if ($contact['network'] != Protocol::FEED) {
// Store the original post // Store the original post
$result = self::insert($datarray2, false, false); $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 { } else {
$datarray["app"] = "Feed"; $datarray["app"] = "Feed";
$result = true; $result = true;
@ -2705,7 +2705,7 @@ class Item extends BaseObject
return $s; return $s;
} }
Logger::log('check for photos', LOGGER_DEBUG); Logger::log('check for photos', Logger::DEBUG);
$site = substr(System::baseUrl(), strpos(System::baseUrl(), '://')); $site = substr(System::baseUrl(), strpos(System::baseUrl(), '://'));
$orig_body = $s; $orig_body = $s;
@ -2719,7 +2719,7 @@ class Item extends BaseObject
$img_st_close++; // make it point to AFTER the closing bracket $img_st_close++; // make it point to AFTER the closing bracket
$image = substr($orig_body, $img_start + $img_st_close, $img_len); $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/')) { if (stristr($image, $site . '/photo/')) {
// Only embed locally hosted photos // 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 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)) { 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]); $width = intval($match[1]);
$height = intval($match[2]); $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); $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) { if (!$onlyshadow) {
$result = DBA::insert('thread', $item); $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]); $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 = "") private static function deleteThread($itemid, $itemuri = "")
{ {
$item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]); $item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]);
if (!DBA::isResult($item)) { 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; return;
} }
$result = DBA::delete('thread', ['iid' => $itemid], ['cascade' => false]); $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 != "") { if ($itemuri != "") {
$condition = ["`uri` = ? AND NOT `deleted` AND NOT (`uid` IN (?, 0))", $itemuri, $item["uid"]]; $condition = ["`uri` = ? AND NOT `deleted` AND NOT (`uid` IN (?, 0))", $itemuri, $item["uid"]];
if (!self::exists($condition)) { if (!self::exists($condition)) {
DBA::delete('item', ['uri' => $itemuri, 'uid' => 0]); 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);
} }
} }
} }

View file

@ -107,7 +107,7 @@ class Profile
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]); $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
if (!DBA::isResult($user) && empty($profiledata)) { 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); notice(L10n::t('Requested account is not available.') . EOL);
$a->error = 404; $a->error = 404;
return; return;
@ -125,7 +125,7 @@ class Profile
$pdata = self::getByNickname($nickname, $user['uid'], $profile); $pdata = self::getByNickname($nickname, $user['uid'], $profile);
if (empty($pdata) && empty($profiledata)) { 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); notice(L10n::t('Requested profile is not available.') . EOL);
$a->error = 404; $a->error = 404;
return; return;
@ -1021,27 +1021,27 @@ class Profile
// Try to find the public contact entry of the visitor. // Try to find the public contact entry of the visitor.
$cid = Contact::getIdForURL($my_url); $cid = Contact::getIdForURL($my_url);
if (!$cid) { 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; return;
} }
$contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]); $contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) { 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; return;
} }
// Avoid endless loops // Avoid endless loops
$cachekey = 'zrlInit:' . $my_url; $cachekey = 'zrlInit:' . $my_url;
if (Cache::get($cachekey)) { 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; return;
} else { } else {
Cache::set($cachekey, true, Cache::MINUTE); 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); 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 // We have to check if the remote server does understand /magic without invoking something
$serverret = Network::curl($basepath . '/magic'); $serverret = Network::curl($basepath . '/magic');
if ($serverret->isSuccess()) { 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); System::externalRedirect($magic_path);
} }
} }
@ -1093,7 +1093,7 @@ class Profile
// Try to find the public contact entry of the visitor. // Try to find the public contact entry of the visitor.
$cid = Contact::getIdForURL($visitor_handle); $cid = Contact::getIdForURL($visitor_handle);
if(!$cid) { if(!$cid) {
Logger::log('owt: unable to finger ' . $visitor_handle, LOGGER_DEBUG); Logger::log('owt: unable to finger ' . $visitor_handle, Logger::DEBUG);
return; return;
} }
@ -1122,7 +1122,7 @@ class Profile
info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', $a->getHostName(), $visitor['name'])); 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) public static function zrl($s, $force = false)

View file

@ -46,7 +46,7 @@ class PushSubscriber
$priority = $default_priority; $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']); Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']);
} }
@ -116,10 +116,10 @@ class PushSubscriber
if ($days > 60) { if ($days > 60) {
DBA::update('push_subscriber', ['push' => -1, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]); 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 { } else {
DBA::update('push_subscriber', ['push' => 0, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]); 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 { } else {
// Calculate the delay until the next trial // Calculate the delay until the next trial
@ -129,7 +129,7 @@ class PushSubscriber
$retrial = $retrial + 1; $retrial = $retrial + 1;
DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]); 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 // 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]; $fields = ['push' => 0, 'next_try' => DBA::NULL_DATETIME, 'last_update' => $last_update];
DBA::update('push_subscriber', $fields, ['id' => $id]); 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);
} }
} }

View file

@ -471,7 +471,7 @@ class User
$username_max_length = max(1, min(64, intval(Config::get('system', 'username_max_length', 48)))); $username_max_length = max(1, min(64, intval(Config::get('system', 'username_max_length', 48))));
if ($username_min_length > $username_max_length) { 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; $tmp = $username_min_length;
$username_min_length = $username_max_length; $username_min_length = $username_max_length;
$username_max_length = $tmp; $username_max_length = $tmp;

View file

@ -23,9 +23,9 @@ class Magic extends BaseModule
{ {
$a = self::getApp(); $a = self::getApp();
$ret = ['success' => false, 'url' => '', 'message' => '']; $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'] : ''); $addr = ((x($_REQUEST, 'addr')) ? $_REQUEST['addr'] : '');
$dest = ((x($_REQUEST, 'dest')) ? $_REQUEST['dest'] : ''); $dest = ((x($_REQUEST, 'dest')) ? $_REQUEST['dest'] : '');
@ -42,7 +42,7 @@ class Magic extends BaseModule
} }
if (!$cid) { 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 // @TODO Finding a more elegant possibility to redirect to either internal or external URL
$a->redirect($dest); $a->redirect($dest);
} }
@ -56,7 +56,7 @@ class Magic extends BaseModule
return $ret; return $ret;
} }
Logger::log('Contact is already authenticated', LOGGER_DEBUG); Logger::log('Contact is already authenticated', Logger::DEBUG);
System::externalRedirect($dest); System::externalRedirect($dest);
} }

View file

@ -58,8 +58,8 @@ class Owa extends BaseModule
$verified = HTTPSignature::verifyMagic($contact['pubkey']); $verified = HTTPSignature::verifyMagic($contact['pubkey']);
if ($verified && $verified['header_signed'] && $verified['header_valid']) { if ($verified && $verified['header_signed'] && $verified['header_valid']) {
Logger::log('OWA header: ' . print_r($verified, true), LOGGER_DATA); Logger::log('OWA header: ' . print_r($verified, true), Logger::DATA);
Logger::log('OWA success: ' . $contact['addr'], LOGGER_DATA); Logger::log('OWA success: ' . $contact['addr'], Logger::DATA);
$ret['success'] = true; $ret['success'] = true;
$token = random_string(32); $token = random_string(32);
@ -76,10 +76,10 @@ class Owa extends BaseModule
openssl_public_encrypt($token, $result, $contact['pubkey']); openssl_public_encrypt($token, $result, $contact['pubkey']);
$ret['encrypted_token'] = base64url_encode($result); $ret['encrypted_token'] = base64url_encode($result);
} else { } 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 { } else {
Logger::log('Contact not found: ' . $handle, LOGGER_DEBUG); Logger::log('Contact not found: ' . $handle, Logger::DEBUG);
} }
} }
} }

View file

@ -104,7 +104,7 @@ class CurlResult
$this->errorNumber = $errorNumber; $this->errorNumber = $errorNumber;
$this->error = $error; $this->error = $error;
Logger::log($url . ': ' . $this->returnCode . " " . $result, LOGGER_DATA); Logger::log($url . ': ' . $this->returnCode . " " . $result, Logger::DATA);
$this->parseBodyHeader($result); $this->parseBodyHeader($result);
$this->checkSuccess(); $this->checkSuccess();
@ -134,8 +134,8 @@ class CurlResult
$this->isSuccess = ($this->returnCode >= 200 && $this->returnCode <= 299) || $this->errorNumber == 0; $this->isSuccess = ($this->returnCode >= 200 && $this->returnCode <= 299) || $this->errorNumber == 0;
if (!$this->isSuccess) { if (!$this->isSuccess) {
Logger::log('error: ' . $this->url . ': ' . $this->returnCode . ' - ' . $this->error, LOGGER_INFO); Logger::log('error: ' . $this->url . ': ' . $this->returnCode . ' - ' . $this->error, Logger::INFO);
Logger::log('debug: ' . print_r($this->info, true), LOGGER_DATA); Logger::log('debug: ' . print_r($this->info, true), Logger::DATA);
} }
if (!$this->isSuccess && $this->errorNumber == CURLE_OPERATION_TIMEDOUT) { if (!$this->isSuccess && $this->errorNumber == CURLE_OPERATION_TIMEDOUT) {

View file

@ -40,7 +40,7 @@ class FKOAuth1 extends OAuthServer
$record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]); $record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
if (!DBA::isResult($record)) { 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'); header('HTTP/1.0 401 Unauthorized');
die('This api requires login'); die('This api requires login');
} }

View file

@ -110,7 +110,7 @@ class Probe
$xrd_timeout = Config::get('system', 'xrd_timeout', 20); $xrd_timeout = Config::get('system', 'xrd_timeout', 20);
$redirects = 0; $redirects = 0;
Logger::log("Probing for ".$host, LOGGER_DEBUG); Logger::log("Probing for ".$host, Logger::DEBUG);
$xrd = null; $xrd = null;
$curlResult = Network::curl($ssl_url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']); $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)) { if (!is_object($xrd)) {
$curlResult = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']); $curlResult = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
if ($curlResult->isTimeout()) { if ($curlResult->isTimeout()) {
Logger::log("Probing timeout for " . $url, LOGGER_DEBUG); Logger::log("Probing timeout for " . $url, Logger::DEBUG);
return false; return false;
} }
$xml = $curlResult->getBody(); $xml = $curlResult->getBody();
@ -131,13 +131,13 @@ class Probe
$host_url = 'http://'.$host; $host_url = 'http://'.$host;
} }
if (!is_object($xrd)) { 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 []; return [];
} }
$links = XML::elementToArray($xrd); $links = XML::elementToArray($xrd);
if (!isset($links["xrd"]["link"])) { 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 []; return [];
} }
@ -165,7 +165,7 @@ class Probe
self::$baseurl = "http://".$host; self::$baseurl = "http://".$host;
Logger::log("Probing successful for ".$host, LOGGER_DEBUG); Logger::log("Probing successful for ".$host, Logger::DEBUG);
return $lrdd; return $lrdd;
} }
@ -195,7 +195,7 @@ class Probe
$profile_link = ''; $profile_link = '';
$links = self::lrdd($webbie); $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)) { if (count($links)) {
foreach ($links as $link) { foreach ($links as $link) {
if ($link['@attributes']['rel'] === NAMESPACE_DFRN) { if ($link['@attributes']['rel'] === NAMESPACE_DFRN) {
@ -254,7 +254,7 @@ class Probe
} }
if (!$lrdd) { if (!$lrdd) {
Logger::log("No lrdd data found for ".$uri, LOGGER_DEBUG); Logger::log("No lrdd data found for ".$uri, Logger::DEBUG);
return []; return [];
} }
@ -286,7 +286,7 @@ class Probe
} }
if (!is_array($webfinger["links"])) { 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; return false;
} }
@ -596,7 +596,7 @@ class Probe
$lrdd = self::hostMeta($host); $lrdd = self::hostMeta($host);
} }
if (!$lrdd) { 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); return self::feed($uri);
} }
$nick = array_pop($path_parts); $nick = array_pop($path_parts);
@ -631,12 +631,12 @@ class Probe
} }
if (!$lrdd) { 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); return self::mail($uri, $uid);
} }
$addr = $uri; $addr = $uri;
} else { } else {
Logger::log("Uri ".$uri." was not detectable", LOGGER_DEBUG); Logger::log("Uri ".$uri." was not detectable", Logger::DEBUG);
return false; return false;
} }
@ -681,7 +681,7 @@ class Probe
$result = false; $result = false;
Logger::log("Probing ".$uri, LOGGER_DEBUG); Logger::log("Probing ".$uri, Logger::DEBUG);
if (in_array($network, ["", Protocol::DFRN])) { if (in_array($network, ["", Protocol::DFRN])) {
$result = self::dfrn($webfinger); $result = self::dfrn($webfinger);
@ -717,7 +717,7 @@ class Probe
$result["url"] = $uri; $result["url"] = $uri;
} }
Logger::log($uri." is ".$result["network"], LOGGER_DEBUG); Logger::log($uri." is ".$result["network"], Logger::DEBUG);
if (empty($result["baseurl"])) { if (empty($result["baseurl"])) {
$pos = strpos($result["url"], $host); $pos = strpos($result["url"], $host);
@ -752,7 +752,7 @@ class Probe
$webfinger = json_decode($data, true); $webfinger = json_decode($data, true);
if (is_array($webfinger)) { if (is_array($webfinger)) {
if (!isset($webfinger["links"])) { 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 false;
} }
return $webfinger; return $webfinger;
@ -761,13 +761,13 @@ class Probe
// If it is not JSON, maybe it is XML // If it is not JSON, maybe it is XML
$xrd = XML::parseString($data, false); $xrd = XML::parseString($data, false);
if (!is_object($xrd)) { 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; return false;
} }
$xrd_arr = XML::elementToArray($xrd); $xrd_arr = XML::elementToArray($xrd);
if (!isset($xrd_arr["xrd"]["link"])) { 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; return false;
} }
@ -816,13 +816,13 @@ class Probe
} }
$content = $curlResult->getBody(); $content = $curlResult->getBody();
if (!$content) { if (!$content) {
Logger::log("Empty body for ".$noscrape_url, LOGGER_DEBUG); Logger::log("Empty body for ".$noscrape_url, Logger::DEBUG);
return false; return false;
} }
$json = json_decode($content, true); $json = json_decode($content, true);
if (!is_array($json)) { 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; return false;
} }
@ -928,7 +928,7 @@ class Probe
{ {
$data = []; $data = [];
Logger::log("Check profile ".$profile_link, LOGGER_DEBUG); Logger::log("Check profile ".$profile_link, Logger::DEBUG);
// Fetch data via noscrape - this is faster // Fetch data via noscrape - this is faster
$noscrape_url = str_replace(["/hcard/", "/profile/"], "/noscrape/", $profile_link); $noscrape_url = str_replace(["/hcard/", "/profile/"], "/noscrape/", $profile_link);
@ -962,7 +962,7 @@ class Probe
$prof_data["fn"] = defaults($data, 'name' , null); $prof_data["fn"] = defaults($data, 'name' , null);
$prof_data["key"] = defaults($data, 'pubkey' , 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; return $prof_data;
} }
@ -1633,7 +1633,7 @@ class Probe
} }
$msgs = Email::poll($mbox, $uri); $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)) { if (!count($msgs)) {
return false; return false;
@ -1715,7 +1715,7 @@ class Probe
$fixed = $scheme.$host.$port.$path.$query.$fragment; $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; return $fixed;
} }

View file

@ -727,7 +727,7 @@ class Image
*/ */
public static function guessType($filename, $fromcurl = false, $header = '') 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; $type = null;
if ($fromcurl) { if ($fromcurl) {
$a = get_app(); $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; return $type;
} }
@ -891,7 +891,7 @@ class Image
); );
if (!DBA::isResult($r)) { 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([]); return([]);
} }
@ -902,10 +902,10 @@ class Image
/// $community_page = (($r[0]['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false); /// $community_page = (($r[0]['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
if ((strlen($imagedata) == 0) && ($url == "")) { 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([]); return([]);
} elseif (strlen($imagedata) == 0) { } elseif (strlen($imagedata) == 0) {
Logger::log("Uploading picture from ".$url, LOGGER_DEBUG); Logger::log("Uploading picture from ".$url, Logger::DEBUG);
$stamp1 = microtime(true); $stamp1 = microtime(true);
$imagedata = @file_get_contents($url); $imagedata = @file_get_contents($url);
@ -915,7 +915,7 @@ class Image
$maximagesize = Config::get('system', 'maximagesize'); $maximagesize = Config::get('system', 'maximagesize');
if (($maximagesize) && (strlen($imagedata) > $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([]); return([]);
} }
@ -929,7 +929,7 @@ class Image
if (!isset($data["mime"])) { if (!isset($data["mime"])) {
unlink($tempfile); unlink($tempfile);
Logger::log("File is no picture", LOGGER_DEBUG); Logger::log("File is no picture", Logger::DEBUG);
return([]); return([]);
} }
@ -937,7 +937,7 @@ class Image
if (!$Image->isValid()) { if (!$Image->isValid()) {
unlink($tempfile); unlink($tempfile);
Logger::log("Picture is no valid picture", LOGGER_DEBUG); Logger::log("Picture is no valid picture", Logger::DEBUG);
return([]); return([]);
} }
@ -968,7 +968,7 @@ class Image
$r = Photo::store($Image, $uid, $visitor, $hash, $tempfile, L10n::t('Wall Photos'), 0, 0, $defperm); $r = Photo::store($Image, $uid, $visitor, $hash, $tempfile, L10n::t('Wall Photos'), 0, 0, $defperm);
if (!$r) { if (!$r) {
Logger::log("Picture couldn't be stored", LOGGER_DEBUG); Logger::log("Picture couldn't be stored", Logger::DEBUG);
return([]); return([]);
} }

View file

@ -488,10 +488,10 @@ class Post extends BaseObject
{ {
$item_id = $item->getId(); $item_id = $item->getId();
if (!$item_id) { 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; return false;
} elseif ($this->getChild($item->getId())) { } 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; return false;
} }
/* /*
@ -585,7 +585,7 @@ class Post extends BaseObject
return true; 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; return false;
} }
@ -651,7 +651,7 @@ class Post extends BaseObject
public function getDataValue($name) public function getDataValue($name)
{ {
if (!isset($this->data[$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; return false;
} }
@ -668,7 +668,7 @@ class Post extends BaseObject
private function setTemplate($name) private function setTemplate($name)
{ {
if (!x($this->available_templates, $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; return false;
} }

View file

@ -78,7 +78,7 @@ class Thread extends BaseObject
$this->writable = $writable; $this->writable = $writable;
break; break;
default: default:
Logger::log('[ERROR] Conversation::setMode : Unhandled mode ('. $mode .').', LOGGER_DEBUG); Logger::log('[ERROR] Conversation::setMode : Unhandled mode ('. $mode .').', Logger::DEBUG);
return false; return false;
break; break;
} }
@ -138,12 +138,12 @@ class Thread extends BaseObject
$item_id = $item->getId(); $item_id = $item->getId();
if (!$item_id) { 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; return false;
} }
if ($this->getParent($item->getId())) { 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; return false;
} }
@ -151,12 +151,12 @@ class Thread extends BaseObject
* Only add will be displayed * Only add will be displayed
*/ */
if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) { 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; return false;
} }
if ($item->getDataValue('verb') === ACTIVITY_LIKE || $item->getDataValue('verb') === ACTIVITY_DISLIKE) { 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; return false;
} }
@ -190,7 +190,7 @@ class Thread extends BaseObject
$item_data = $item->getTemplateData($conv_responses); $item_data = $item->getTemplateData($conv_responses);
if (!$item_data) { 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; return false;
} }
$result[] = $item_data; $result[] = $item_data;

View file

@ -159,7 +159,7 @@ class Processor
{ {
$owner = Contact::getIdForURL($activity['actor']); $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]); Item::delete(['uri' => $activity['object_id'], 'owner-id' => $owner]);
} }
@ -212,7 +212,7 @@ class Processor
} }
$event_id = Event::store($event); $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']? /// @todo What to do with $activity['context']?
if (($item['gravity'] != GRAVITY_PARENT) && !Item::exists(['uri' => $item['parent-uri']])) { 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; return;
} }
@ -239,7 +239,7 @@ class Processor
$item['owner-link'] = $activity['actor']; $item['owner-link'] = $activity['actor'];
$item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true); $item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true);
} else { } 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-link'] = $item['author-link'];
$item['owner-id'] = $item['author-id']; $item['owner-id'] = $item['author-id'];
} }
@ -375,7 +375,7 @@ class Processor
return; 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); APContact::getByURL($activity['object_id'], true);
} }
@ -387,12 +387,12 @@ class Processor
public static function deletePerson($activity) public static function deletePerson($activity)
{ {
if (empty($activity['object_id']) || empty($activity['actor'])) { 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; return;
} }
if ($activity['object_id'] != $activity['actor']) { 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; return;
} }
@ -402,7 +402,7 @@ class Processor
} }
DBA::close($contacts); 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); $cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) { if (empty($cid)) {
Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG); Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
return; return;
} }
@ -436,7 +436,7 @@ class Processor
$condition = ['id' => $cid]; $condition = ['id' => $cid];
DBA::update('contact', $fields, $condition); 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); $cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) { if (empty($cid)) {
Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG); Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
return; return;
} }
@ -463,9 +463,9 @@ class Processor
if (DBA::exists('contact', ['id' => $cid, 'rel' => Contact::SHARING, 'pending' => true])) { if (DBA::exists('contact', ['id' => $cid, 'rel' => Contact::SHARING, 'pending' => true])) {
Contact::remove($cid); 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 { } 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); $cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) { if (empty($cid)) {
Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG); Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
return; return;
} }
@ -520,7 +520,7 @@ class Processor
} }
Contact::removeFollower($owner, $contact); 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);
} }
/** /**

View file

@ -60,16 +60,16 @@ class Receiver
{ {
$http_signer = HTTPSignature::getSigner($body, $header); $http_signer = HTTPSignature::getSigner($body, $header);
if (empty($http_signer)) { 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; return;
} else { } 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); $activity = json_decode($body, true);
if (empty($activity)) { if (empty($activity)) {
Logger::log('Invalid body.', LOGGER_DEBUG); Logger::log('Invalid body.', Logger::DEBUG);
return; return;
} }
@ -77,31 +77,31 @@ class Receiver
$actor = JsonLD::fetchElement($ldactivity, 'as:actor'); $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)) { if (LDSignature::isSigned($activity)) {
$ld_signer = LDSignature::getSigner($activity); $ld_signer = LDSignature::getSigner($activity);
if (empty($ld_signer)) { 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))) { 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; $trust_source = true;
} elseif (!empty($ld_signer)) { } 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; $trust_source = true;
} elseif ($actor == $http_signer) { } 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; $trust_source = true;
} else { } 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; $trust_source = false;
} }
} elseif ($actor == $http_signer) { } 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; $trust_source = true;
} else { } else {
Logger::log('No JSON-LD signature, different actor.', LOGGER_DEBUG); Logger::log('No JSON-LD signature, different actor.', Logger::DEBUG);
$trust_source = false; $trust_source = false;
} }
@ -160,7 +160,7 @@ class Receiver
{ {
$actor = JsonLD::fetchElement($activity, 'as:actor'); $actor = JsonLD::fetchElement($activity, 'as:actor');
if (empty($actor)) { if (empty($actor)) {
Logger::log('Empty actor', LOGGER_DEBUG); Logger::log('Empty actor', Logger::DEBUG);
return []; return [];
} }
@ -176,11 +176,11 @@ class Receiver
$receivers = array_merge($receivers, $additional); $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'); $object_id = JsonLD::fetchElement($activity, 'as:object');
if (empty($object_id)) { if (empty($object_id)) {
Logger::log('No object found', LOGGER_DEBUG); Logger::log('No object found', Logger::DEBUG);
return []; return [];
} }
@ -193,7 +193,7 @@ class Receiver
} }
$object_data = self::fetchObject($object_id, $activity['as:object'], $trust_source); $object_data = self::fetchObject($object_id, $activity['as:object'], $trust_source);
if (empty($object_data)) { 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 []; return [];
} }
// We had been able to retrieve the object data - so we can trust the source // 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['actor'] = $actor;
$object_data['receiver'] = array_merge(defaults($object_data, 'receiver', []), $receivers); $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; return $object_data;
} }
@ -273,17 +273,17 @@ class Receiver
{ {
$type = JsonLD::fetchElement($activity, '@type'); $type = JsonLD::fetchElement($activity, '@type');
if (!$type) { if (!$type) {
Logger::log('Empty type', LOGGER_DEBUG); Logger::log('Empty type', Logger::DEBUG);
return; return;
} }
if (!JsonLD::fetchElement($activity, 'as:object')) { if (!JsonLD::fetchElement($activity, 'as:object')) {
Logger::log('Empty object', LOGGER_DEBUG); Logger::log('Empty object', Logger::DEBUG);
return; return;
} }
if (!JsonLD::fetchElement($activity, 'as:actor')) { if (!JsonLD::fetchElement($activity, 'as:actor')) {
Logger::log('Empty actor', LOGGER_DEBUG); Logger::log('Empty actor', Logger::DEBUG);
return; return;
} }
@ -291,12 +291,12 @@ class Receiver
// $trust_source is called by reference and is set to true if the content was retrieved successfully // $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); $object_data = self::prepareObjectData($activity, $uid, $trust_source);
if (empty($object_data)) { if (empty($object_data)) {
Logger::log('No object data found', LOGGER_DEBUG); Logger::log('No object data found', Logger::DEBUG);
return; return;
} }
if (!$trust_source) { 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; return;
} }
@ -385,7 +385,7 @@ class Receiver
break; break;
default: default:
Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], LOGGER_DEBUG); Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], Logger::DEBUG);
break; break;
} }
} }
@ -415,9 +415,9 @@ class Receiver
$profile = APContact::getByURL($actor); $profile = APContact::getByURL($actor);
$followers = defaults($profile, 'followers', ''); $followers = defaults($profile, 'followers', '');
Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG); Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, Logger::DEBUG);
} else { } else {
Logger::log('Empty actor', LOGGER_DEBUG); Logger::log('Empty actor', Logger::DEBUG);
$followers = ''; $followers = '';
} }
@ -501,7 +501,7 @@ class Receiver
// Send a new follow request to be sure that the connection still exists // 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]])) { if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND]])) {
ActivityPub\Transmitter::sendActivity('Follow', $profile['url'], $uid); 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); $data = ActivityPub::fetchContent($object_id);
if (!empty($data)) { if (!empty($data)) {
$object = JsonLD::compact($data); $object = JsonLD::compact($data);
Logger::log('Fetched content for ' . $object_id, LOGGER_DEBUG); Logger::log('Fetched content for ' . $object_id, Logger::DEBUG);
} else { } 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]); $item = Item::selectFirst([], ['uri' => $object_id]);
if (!DBA::isResult($item)) { 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; 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); $data = ActivityPub\Transmitter::createNote($item);
$object = JsonLD::compact($data); $object = JsonLD::compact($data);
} }
} else { } 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'); $type = JsonLD::fetchElement($object, '@type');
if (empty($type)) { if (empty($type)) {
Logger::log('Empty type', LOGGER_DEBUG); Logger::log('Empty type', Logger::DEBUG);
return false; return false;
} }
@ -607,7 +607,7 @@ class Receiver
return self::fetchObject($object_id); return self::fetchObject($object_id);
} }
Logger::log('Unhandled object type: ' . $type, LOGGER_DEBUG); Logger::log('Unhandled object type: ' . $type, Logger::DEBUG);
} }
/** /**

View file

@ -1016,7 +1016,7 @@ class Transmitter
$signed = LDSignature::sign($data, $owner); $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); return HTTPSignature::transmit($signed, $inbox, $uid);
} }
@ -1045,7 +1045,7 @@ class Transmitter
$signed = LDSignature::sign($data, $owner); $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); return HTTPSignature::transmit($signed, $inbox, $uid);
} }
@ -1074,7 +1074,7 @@ class Transmitter
$signed = LDSignature::sign($data, $owner); $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); return HTTPSignature::transmit($signed, $inbox, $uid);
} }
@ -1099,7 +1099,7 @@ class Transmitter
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
'to' => $profile['url']]; '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); $signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);
@ -1127,7 +1127,7 @@ class Transmitter
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
'to' => $profile['url']]; '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); $signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);
@ -1155,7 +1155,7 @@ class Transmitter
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
'to' => $profile['url']]; '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); $signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);
@ -1184,7 +1184,7 @@ class Transmitter
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
'to' => $profile['url']]; '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); $signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);

View file

@ -176,7 +176,7 @@ class DFRN
); );
if (! DBA::isResult($r)) { 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(); killme();
} }
@ -212,7 +212,7 @@ class DFRN
); );
if (! DBA::isResult($r)) { 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(); killme();
} }
@ -1189,7 +1189,7 @@ class DFRN
$rino = Config::get('system', 'rino_encrypt'); $rino = Config::get('system', 'rino_encrypt');
$rino = intval($rino); $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_val = intval(Config::get('system', 'ssl_policy'));
$ssl_policy = ''; $ssl_policy = '';
@ -1226,7 +1226,7 @@ class DFRN
return -3; // timed out return -3; // timed out
} }
Logger::log('dfrn_deliver: ' . $xml, LOGGER_DATA); Logger::log('dfrn_deliver: ' . $xml, Logger::DATA);
if (empty($xml)) { if (empty($xml)) {
Contact::markForArchival($contact); Contact::markForArchival($contact);
@ -1235,7 +1235,7 @@ class DFRN
if (strpos($xml, '<?xml') === false) { if (strpos($xml, '<?xml') === false) {
Logger::log('dfrn_deliver: no valid XML returned'); Logger::log('dfrn_deliver: no valid XML returned');
Logger::log('dfrn_deliver: returned XML: ' . $xml, LOGGER_DATA); Logger::log('dfrn_deliver: returned XML: ' . $xml, Logger::DATA);
Contact::markForArchival($contact); Contact::markForArchival($contact);
return 3; return 3;
} }
@ -1262,7 +1262,7 @@ class DFRN
$rino_remote_version = intval($res->rino); $rino_remote_version = intval($res->rino);
$page = (($owner['page-flags'] == Contact::PAGE_COMMUNITY) ? 1 : 0); $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) { if ($owner['page-flags'] == Contact::PAGE_PRVGROUP) {
$page = 2; $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); $postResult = Network::post($contact['notify'], $postvars);
$xml = $postResult->getBody(); $xml = $postResult->getBody();
Logger::log('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA); Logger::log('dfrn_deliver: ' . "RECEIVED: " . $xml, Logger::DATA);
$curl_stat = $postResult->getReturnCode(); $curl_stat = $postResult->getReturnCode();
if (empty($curl_stat) || empty($xml)) { if (empty($curl_stat) || empty($xml)) {
@ -1387,7 +1387,7 @@ class DFRN
if (strpos($xml, '<?xml') === false) { if (strpos($xml, '<?xml') === false) {
Logger::log('dfrn_deliver: phase 2: no valid XML returned'); Logger::log('dfrn_deliver: phase 2: no valid XML returned');
Logger::log('dfrn_deliver: phase 2: returned XML: ' . $xml, LOGGER_DATA); Logger::log('dfrn_deliver: phase 2: returned XML: ' . $xml, Logger::DATA);
Contact::markForArchival($contact); Contact::markForArchival($contact);
return 3; return 3;
} }
@ -1405,7 +1405,7 @@ class DFRN
} }
if (!empty($res->message)) { if (!empty($res->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)) { if (($res->status >= 200) && ($res->status <= 299)) {
@ -1486,7 +1486,7 @@ class DFRN
if (strpos($xml, '<?xml') === false) { if (strpos($xml, '<?xml') === false) {
Logger::log('No valid XML returned from ' . $contact['id'] . ' - ' . $dest_url); Logger::log('No valid XML returned from ' . $contact['id'] . ' - ' . $dest_url);
Logger::log('Returned XML: ' . $xml, LOGGER_DATA); Logger::log('Returned XML: ' . $xml, Logger::DATA);
Contact::markForArchival($contact); Contact::markForArchival($contact);
return 3; return 3;
} }
@ -1499,7 +1499,7 @@ class DFRN
} }
if (!empty($res->message)) { if (!empty($res->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)) { if (($res->status >= 200) && ($res->status <= 299)) {
@ -1576,7 +1576,7 @@ class DFRN
$author["network"] = $contact_old["network"]; $author["network"] = $contact_old["network"];
} else { } else {
if (!$onlyfetch) { 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; $author["contact-unknown"] = true;
@ -1629,7 +1629,7 @@ class DFRN
} }
if (DBA::isResult($contact_old) && !$onlyfetch) { 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"]]; $poco = ["url" => $contact_old["url"]];
@ -1690,7 +1690,7 @@ class DFRN
// If the "hide" element is present then the profile isn't searchable. // If the "hide" element is present then the profile isn't searchable.
$hide = intval(XML::getFirstNodeValue($xpath, $element . "/dfrn:hide/text()", $context) == "true"); $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". // If the contact isn't searchable then set the contact to "hidden".
// Problem: This can be manually overridden by the user. // Problem: This can be manually overridden by the user.
@ -1762,20 +1762,20 @@ class DFRN
$contact[$field] = DateTimeFormat::utc($contact[$field]); $contact[$field] = DateTimeFormat::utc($contact[$field]);
if (strtotime($contact[$field]) > strtotime($contact_old[$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; $update = true;
} }
} }
foreach ($fields as $field => $data) { foreach ($fields as $field => $data) {
if ($contact[$field] != $contact_old[$field]) { 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; $update = true;
} }
} }
if ($update) { 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( q(
"UPDATE `contact` SET `name` = '%s', `nick` = '%s', `about` = '%s', `location` = '%s', "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) 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)) { if (($entrytype == DFRN::TOP_LEVEL)) {
// The filling of the the "contact" variable is done for legcy reasons // The filling of the the "contact" variable is done for legcy reasons
@ -2464,7 +2464,7 @@ class DFRN
); );
// Is there an existing item? // Is there an existing item?
if (DBA::isResult($current) && !self::isEditedTimestampNewer($current, $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; return;
} }
@ -2672,10 +2672,10 @@ class DFRN
// Is it an event? // Is it an event?
if (($item["object-type"] == ACTIVITY_OBJ_EVENT) && !$owner_unknown) { 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"]); $ev = Event::fromBBCode($item["body"]);
if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) { 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["cid"] = $importer["id"];
$ev["uid"] = $importer["importer_uid"]; $ev["uid"] = $importer["importer_uid"];
$ev["uri"] = $item["uri"]; $ev["uri"] = $item["uri"];
@ -2691,20 +2691,20 @@ class DFRN
} }
$event_id = Event::store($ev); $event_id = Event::store($ev);
Logger::log("Event ".$event_id." was stored", LOGGER_DEBUG); Logger::log("Event ".$event_id." was stored", Logger::DEBUG);
return; return;
} }
} }
} }
if (!self::processVerbs($entrytype, $importer, $item, $is_like)) { 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; return;
} }
// This check is done here to be able to receive connection requests in "processVerbs" // This check is done here to be able to receive connection requests in "processVerbs"
if (($entrytype == DFRN::TOP_LEVEL) && $owner_unknown) { 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; return;
} }
@ -2712,9 +2712,9 @@ class DFRN
// Update content if 'updated' changes // Update content if 'updated' changes
if (DBA::isResult($current)) { if (DBA::isResult($current)) {
if (self::updateContent($current, $item, $importer, $entrytype)) { 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 { } else {
Logger::log("Item " . $item["uri"] . " already existed.", LOGGER_DEBUG); Logger::log("Item " . $item["uri"] . " already existed.", Logger::DEBUG);
} }
return; return;
} }
@ -2724,7 +2724,7 @@ class DFRN
$parent = 0; $parent = 0;
if ($posted_id) { 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) { if ($item['uid'] == 0) {
Item::distribute($posted_id); Item::distribute($posted_id);
@ -2734,7 +2734,7 @@ class DFRN
} }
} else { // $entrytype == DFRN::TOP_LEVEL } else { // $entrytype == DFRN::TOP_LEVEL
if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) { 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; return;
} }
if (!link_compare($item["owner-link"], $importer["url"])) { 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, * 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. * 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-link"] = $importer["url"];
$item["owner-id"] = Contact::getIdForURL($importer["url"], 0); $item["owner-id"] = Contact::getIdForURL($importer["url"], 0);
} }
if (($importer["rel"] == Contact::FOLLOWER) && (!self::tgroupCheck($importer["importer_uid"], $item))) { 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; return;
} }
@ -2764,7 +2764,7 @@ class DFRN
$posted_id = $notify; $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) { if ($item['uid'] == 0) {
Item::distribute($posted_id); Item::distribute($posted_id);
@ -2803,18 +2803,18 @@ class DFRN
$condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]]; $condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
$item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition); $item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition);
if (!DBA::isResult($item)) { 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; return;
} }
if (strstr($item['file'], '[')) { 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; return;
} }
// When it is a starting post it has to belong to the person that wants to delete it // 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"])) { 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; return;
} }
@ -2822,7 +2822,7 @@ class DFRN
if (($item['id'] != $item['parent']) && ($item['contact-id'] != $importer["id"])) { if (($item['id'] != $item['parent']) && ($item['contact-id'] != $importer["id"])) {
$condition = ['id' => $item['parent'], 'contact-id' => $importer["id"]]; $condition = ['id' => $item['parent'], 'contact-id' => $importer["id"]];
if (!Item::exists($condition)) { 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; return;
} }
} }
@ -2831,7 +2831,7 @@ class DFRN
return; 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']]); Item::delete(['id' => $item['id']]);
} }
@ -2885,7 +2885,7 @@ class DFRN
self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml); 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 // is it a public forum? Private forums aren't exposed with this method
$forum = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:community/text()")); $forum = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:community/text()"));
@ -2951,7 +2951,7 @@ class DFRN
self::processEntry($header, $xpath, $entry, $importer, $xml); 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; return 200;
} }
@ -3036,7 +3036,7 @@ class DFRN
$url = curPageURL(); $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 : ''); $dest = (($url) ? '&destination_url=' . $url : '');
System::externalRedirect($r[0]['poll'] . '?dfrn_id=' . $dfrn_id System::externalRedirect($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest); . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest);

View file

@ -261,7 +261,7 @@ class Diaspora
if (base64_encode(base64_decode(base64_decode($signature))) == base64_decode($signature)) { if (base64_encode(base64_decode(base64_decode($signature))) == base64_decode($signature)) {
$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 // Do a recursive call to be able to fix even multiple levels
if ($level < 10) { if ($level < 10) {
@ -498,7 +498,7 @@ class Diaspora
} else { } else {
// This happens with posts from a relais // This happens with posts from a relais
if (!$importer) { 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; return false;
} }
@ -517,7 +517,7 @@ class Diaspora
$decrypted = self::aesDecrypt($outer_key, $outer_iv, $ciphertext); $decrypted = self::aesDecrypt($outer_key, $outer_iv, $ciphertext);
Logger::log('decrypted: '.$decrypted, LOGGER_DEBUG); Logger::log('decrypted: '.$decrypted, Logger::DEBUG);
$idom = XML::parseString($decrypted); $idom = XML::parseString($decrypted);
$inner_iv = base64_decode($idom->iv); $inner_iv = base64_decode($idom->iv);
@ -662,7 +662,7 @@ class Diaspora
$type = $fields->getName(); $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) { switch ($type) {
case "account_migration": case "account_migration":
@ -754,7 +754,7 @@ class Diaspora
$data = XML::parseString($msg["message"]); $data = XML::parseString($msg["message"]);
if (!is_object($data)) { if (!is_object($data)) {
Logger::log("No valid XML ".$msg["message"], LOGGER_DEBUG); Logger::log("No valid XML ".$msg["message"], Logger::DEBUG);
return false; return false;
} }
@ -772,7 +772,7 @@ class Diaspora
$type = $element->getName(); $type = $element->getName();
$orig_type = $type; $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. // All retractions are handled identically from now on.
// In the new version there will only be "retraction". // 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. // No author_signature? This is a must, so we quit.
if (!isset($author_signature)) { 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; return false;
} }
if (isset($parent_author_signature)) { if (isset($parent_author_signature)) {
$key = self::key($msg["author"]); $key = self::key($msg["author"]);
if (empty($key)) { 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; return false;
} }
if (!Crypto::rsaVerify($signed_data, $parent_author_signature, $key, "sha256")) { 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; return false;
} }
} }
$key = self::key($fields->author); $key = self::key($fields->author);
if (empty($key)) { 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; return false;
} }
if (!Crypto::rsaVerify($signed_data, $author_signature, $key, "sha256")) { 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; return false;
} else { } else {
return $fields; return $fields;
@ -924,7 +924,7 @@ class Diaspora
$person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]); $person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (DBA::isResult($person)) { 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 // update record occasionally so it doesn't get stale
$d = strtotime($person["updated"]." +00:00"); $d = strtotime($person["updated"]." +00:00");
@ -938,7 +938,7 @@ class Diaspora
} }
if (!DBA::isResult($person) || $update) { 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); $r = Probe::uri($handle, Protocol::DIASPORA);
// Note that Friendica contacts will return a "Diaspora person" // Note that Friendica contacts will return a "Diaspora person"
@ -990,7 +990,7 @@ class Diaspora
{ {
$handle = false; $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) { if ($pcontact_id != 0) {
$contact = DBA::selectFirst('contact', ['addr'], ['id' => $pcontact_id]); $contact = DBA::selectFirst('contact', ['addr'], ['id' => $pcontact_id]);
@ -1008,7 +1008,7 @@ class Diaspora
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
$contact = $r[0]; $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'] != "") { if ($contact['addr'] != "") {
$handle = $contact['addr']; $handle = $contact['addr'];
@ -1034,7 +1034,7 @@ class Diaspora
*/ */
public static function urlFromContactGuid($fcontact_guid) 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( $r = q(
"SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'", "SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'",
@ -1069,14 +1069,14 @@ class Diaspora
} }
if (!$cid) { 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; return false;
} }
$contact = DBA::selectFirst('contact', [], ['id' => $cid]); $contact = DBA::selectFirst('contact', [], ['id' => $cid]);
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
// This here shouldn't happen at all // 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; return false;
} }
@ -1278,7 +1278,7 @@ class Diaspora
$server = $serverparts["scheme"]."://".$serverparts["host"]; $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); $msg = self::message($guid, $server);
@ -1286,7 +1286,7 @@ class Diaspora
return false; 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 // Now call the dispatcher
return self::dispatchPublic($msg); return self::dispatchPublic($msg);
@ -1313,16 +1313,16 @@ class Diaspora
// This will work for new Diaspora servers and Friendica servers from 3.5 // This will work for new Diaspora servers and Friendica servers from 3.5
$source_url = $server."/fetch/post/".urlencode($guid); $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); $envelope = Network::fetchUrl($source_url);
if ($envelope) { if ($envelope) {
Logger::log("Envelope was fetched.", LOGGER_DEBUG); Logger::log("Envelope was fetched.", Logger::DEBUG);
$x = self::verifyMagicEnvelope($envelope); $x = self::verifyMagicEnvelope($envelope);
if (!$x) { if (!$x) {
Logger::log("Envelope could not be verified.", LOGGER_DEBUG); Logger::log("Envelope could not be verified.", Logger::DEBUG);
} else { } else {
Logger::log("Envelope was verified.", LOGGER_DEBUG); Logger::log("Envelope was verified.", Logger::DEBUG);
} }
} else { } else {
$x = false; $x = false;
@ -1331,7 +1331,7 @@ class Diaspora
// This will work for older Diaspora and Friendica servers // This will work for older Diaspora and Friendica servers
if (!$x) { if (!$x) {
$source_url = $server."/p/".urlencode($guid).".xml"; $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); $x = Network::fetchUrl($source_url);
if (!$x) { if (!$x) {
@ -1347,11 +1347,11 @@ class Diaspora
if ($source_xml->post->reshare) { if ($source_xml->post->reshare) {
// Reshare of a reshare - old Diaspora version // 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); return self::message($source_xml->post->reshare->root_guid, $server, ++$level);
} elseif ($source_xml->getName() == "reshare") { } elseif ($source_xml->getName() == "reshare") {
// Reshare of a reshare - new Diaspora version // 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); 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 this isn't a "status_message" then quit
if (!$author) { 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; return false;
} }
@ -1405,7 +1405,7 @@ class Diaspora
} }
if ($result) { 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); $item = Item::selectFirst($fields, $condition);
} }
@ -1635,7 +1635,7 @@ class Diaspora
{ {
$item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]); $item = Item::selectFirst(['uid'], ['origin' => true, 'guid' => $guid]);
if (DBA::isResult($item)) { 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']]); $contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {
return $contact; return $contact;
@ -1750,7 +1750,7 @@ class Diaspora
} }
if ($message_id) { 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) { if ($datarray['uid'] == 0) {
Item::distribute($message_id, json_encode($data)); Item::distribute($message_id, json_encode($data));
} }
@ -1805,7 +1805,7 @@ class Diaspora
DBA::lock('mail'); DBA::lock('mail');
if (DBA::exists('mail', ['guid' => $msg_guid, 'uid' => $importer["uid"]])) { 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; return false;
} }
@ -2009,7 +2009,7 @@ class Diaspora
} }
if ($message_id) { 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) { if ($datarray['uid'] == 0) {
Item::distribute($message_id, json_encode($data)); Item::distribute($message_id, json_encode($data));
} }
@ -2064,7 +2064,7 @@ class Diaspora
DBA::lock('mail'); DBA::lock('mail');
if (DBA::exists('mail', ['guid' => $guid, 'uid' => $importer["uid"]])) { 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; return false;
} }
@ -2132,7 +2132,7 @@ class Diaspora
$server = $author; $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])) { if (!DBA::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
DBA::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]); DBA::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
@ -2149,7 +2149,7 @@ class Diaspora
} else { } else {
$cmd = $comment['self'] ? 'like' : 'comment-import'; $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); Worker::add(PRIORITY_HIGH, 'Delivery', $cmd, $comment['id'], $contact_id);
} }
DBA::close($comments); DBA::close($comments);
@ -2275,7 +2275,7 @@ class Diaspora
GContact::link($gcid, $importer["uid"], $contact["id"]); 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; return true;
} }
@ -2337,7 +2337,7 @@ class Diaspora
// That makes us friends. // That makes us friends.
if ($contact) { if ($contact) {
if ($following) { 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); self::receiveRequestMakeFriend($importer, $contact);
// refetch the contact array // refetch the contact array
@ -2348,30 +2348,30 @@ class Diaspora
if (in_array($contact["rel"], [Contact::FRIEND])) { if (in_array($contact["rel"], [Contact::FRIEND])) {
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]); $user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
if (DBA::isResult($user)) { 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); $ret = self::sendShare($user, $contact);
} }
} }
return true; return true;
} else { } 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); Contact::removeFollower($importer, $contact);
return true; return true;
} }
} }
if (!$following && $sharing && in_array($importer["page-flags"], [Contact::PAGE_SOAPBOX, Contact::PAGE_NORMAL])) { 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; return false;
} elseif (!$following && !$sharing) { } 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; return false;
} elseif (!$following && $sharing) { } 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) { } 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) { } 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); $ret = self::personByHandle($author);
@ -2412,14 +2412,14 @@ class Diaspora
return; 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']); Group::addMember(User::getDefaultGroup($importer['uid'], $ret["network"]), $contact_record['id']);
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true); Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
if (in_array($importer["page-flags"], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP])) { 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 $hash = random_string().(string)time(); // Generate a confirm_key
@ -2437,7 +2437,7 @@ class Diaspora
} else { } else {
// automatic friend approval // 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"]); Contact::updateAvatar($contact_record["photo"], $importer["uid"], $contact_record["id"]);
@ -2471,7 +2471,7 @@ class Diaspora
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]); $user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
if (DBA::isResult($user)) { 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); $ret = self::sendShare($user, $contact_record);
// Send the profile data, maybe it weren't transmitted before // Send the profile data, maybe it weren't transmitted before
@ -2644,7 +2644,7 @@ class Diaspora
self::sendParticipation($contact, $datarray); self::sendParticipation($contact, $datarray);
if ($message_id) { 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) { if ($datarray['uid'] == 0) {
Item::distribute($message_id); Item::distribute($message_id);
} }
@ -2697,7 +2697,7 @@ class Diaspora
while ($item = Item::fetch($r)) { while ($item = Item::fetch($r)) {
if (strstr($item['file'], '[')) { 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; continue;
} }
@ -2706,13 +2706,13 @@ class Diaspora
// Only delete it if the parent author really fits // Only delete it if the parent author really fits
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) { 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; continue;
} }
Item::delete(['id' => $item['id']]); 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; return true;
@ -2741,7 +2741,7 @@ class Diaspora
$contact = []; $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) { switch ($target_type) {
case "Comment": case "Comment":
@ -2871,7 +2871,7 @@ class Diaspora
self::sendParticipation($contact, $datarray); self::sendParticipation($contact, $datarray);
if ($message_id) { 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) { if ($datarray['uid'] == 0) {
Item::distribute($message_id); Item::distribute($message_id);
} }
@ -2923,7 +2923,7 @@ class Diaspora
*/ */
public static function encodePrivateData($msg, array $user, array $contact, $prvkey, $pubkey) 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 // without a public key nothing will work
if (!$pubkey) { if (!$pubkey) {
@ -3141,8 +3141,8 @@ class Diaspora
{ {
$msg = self::buildPostXml($type, $message); $msg = self::buildPostXml($type, $message);
Logger::log('message: '.$msg, LOGGER_DATA); Logger::log('message: '.$msg, Logger::DATA);
Logger::log('send guid '.$guid, LOGGER_DEBUG); Logger::log('send guid '.$guid, Logger::DEBUG);
// Fallback if the private key wasn't transmitted in the expected field // Fallback if the private key wasn't transmitted in the expected field
if (empty($owner['uprvkey'])) { if (empty($owner['uprvkey'])) {
@ -3158,7 +3158,7 @@ class Diaspora
$return_code = self::transmit($owner, $contact, $envelope, $public_batch, false, $guid); $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; return $return_code;
} }
@ -3203,7 +3203,7 @@ class Diaspora
"parent_type" => "Post", "parent_type" => "Post",
"parent_guid" => $item["guid"]]; "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 // 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); Cache::set($cachekey, $item["guid"], Cache::QUARTER_HOUR);
@ -3232,7 +3232,7 @@ class Diaspora
"profile" => $profile, "profile" => $profile,
"signature" => $signature]; "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); return self::buildAndTransmit($owner, $contact, "account_migration", $message);
} }
@ -3275,7 +3275,7 @@ class Diaspora
"following" => "true", "following" => "true",
"sharing" => "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); return self::buildAndTransmit($owner, $contact, "contact", $message);
} }
@ -3295,7 +3295,7 @@ class Diaspora
"following" => "false", "following" => "false",
"sharing" => "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); return self::buildAndTransmit($owner, $contact, "contact", $message);
} }
@ -3808,7 +3808,7 @@ class Diaspora
$type = "comment"; $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 // Old way - is used by the internal Friendica functions
/// @todo Change all signatur storing functions to the new format /// @todo Change all signatur storing functions to the new format
@ -3832,13 +3832,13 @@ class Diaspora
$message[$field] = $data; $message[$field] = $data;
} }
} else { } 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); $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"]); return self::buildAndTransmit($owner, $contact, $type, $message, $public_batch, $item["guid"]);
} }
@ -3872,7 +3872,7 @@ class Diaspora
"target_guid" => $item['guid'], "target_guid" => $item['guid'],
"target_type" => $target_type]; "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"]); return self::buildAndTransmit($owner, $contact, $msg_type, $message, $public_batch, $item["guid"]);
} }
@ -4108,7 +4108,7 @@ class Diaspora
$message = self::createProfileData($uid); $message = self::createProfileData($uid);
foreach ($recips as $recip) { 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); self::buildAndTransmit($owner, $recip, "profile", $message, false, "", false);
} }
} }
@ -4125,7 +4125,7 @@ class Diaspora
{ {
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
if (empty($owner)) { 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; return false;
} }
@ -4155,7 +4155,7 @@ class Diaspora
{ {
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
if (empty($owner)) { 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; return false;
} }

View file

@ -55,21 +55,21 @@ class Email
if (!$search1) { if (!$search1) {
$search1 = []; $search1 = [];
} else { } 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); $search2 = @imap_search($mbox, 'TO "' . $email_addr . '"', SE_UID);
if (!$search2) { if (!$search2) {
$search2 = []; $search2 = [];
} else { } 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); $search3 = @imap_search($mbox, 'CC "' . $email_addr . '"', SE_UID);
if (!$search3) { if (!$search3) {
$search3 = []; $search3 = [];
} else { } 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)); $res = array_unique(array_merge($search1, $search2, $search3));

View file

@ -41,12 +41,12 @@ class Feed {
$a = get_app(); $a = get_app();
if (!$simulate) { 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 { } else {
Logger::log("Test Atom/RSS feed", LOGGER_DEBUG); Logger::log("Test Atom/RSS feed", Logger::DEBUG);
} }
if (empty($xml)) { if (empty($xml)) {
Logger::log('XML is empty.', LOGGER_DEBUG); Logger::log('XML is empty.', Logger::DEBUG);
return; return;
} }
@ -200,7 +200,7 @@ class Feed {
$header["contact-id"] = $contact["id"]; $header["contact-id"] = $contact["id"];
if (!is_object($entries)) { 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; return;
} }
@ -249,7 +249,7 @@ class Feed {
$importer["uid"], $item["uri"], Protocol::FEED, Protocol::DFRN]; $importer["uid"], $item["uri"], Protocol::FEED, Protocol::DFRN];
$previous = Item::selectFirst(['id'], $condition); $previous = Item::selectFirst(['id'], $condition);
if (DBA::isResult($previous)) { 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; continue;
} }
} }
@ -424,7 +424,7 @@ class Feed {
} }
if (!$simulate) { 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); $notify = Item::isRemoteSelf($contact, $item);

View file

@ -196,7 +196,7 @@ class OStatus
DBA::update('contact', $contact, ['id' => $contact["id"]], $current); DBA::update('contact', $contact, ['id' => $contact["id"]], $current);
if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) { 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"]); Contact::updateAvatar($author["author-avatar"], $importer["uid"], $contact["id"]);
} }
@ -323,7 +323,7 @@ class OStatus
self::$conv_list = []; 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 == "") { if ($xml == "") {
return false; return false;
@ -349,7 +349,7 @@ class OStatus
foreach ($hub_attributes as $hub_attribute) { foreach ($hub_attributes as $hub_attribute) {
if ($hub_attribute->name == "href") { if ($hub_attribute->name == "href") {
$hub = $hub_attribute->textContent; $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])) { if (in_array($item["verb"], [NAMESPACE_OSTATUS."/unfavorite", ACTIVITY_UNFAVORITE])) {
// Ignore "Unfavorite" message // 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; continue;
} }
// Deletions come with the same uri, so we check for duplicates after processing deletions // Deletions come with the same uri, so we check for duplicates after processing deletions
if (Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]])) { 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; continue;
} else { } 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) { if ($item["verb"] == ACTIVITY_JOIN) {
// ignore "Join" messages // 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; continue;
} }
if ($item["verb"] == "http://mastodon.social/schema/1.0/block") { if ($item["verb"] == "http://mastodon.social/schema/1.0/block") {
// ignore mastodon "block" messages // 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; continue;
} }
@ -481,7 +481,7 @@ class OStatus
// http://activitystrea.ms/schema/1.0/rsvp-yes // http://activitystrea.ms/schema/1.0/rsvp-yes
if (!in_array($item["verb"], [ACTIVITY_POST, ACTIVITY_LIKE, ACTIVITY_SHARE])) { 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); self::processPost($xpath, $entry, $item, $importer);
@ -494,10 +494,10 @@ class OStatus
// If not, then it depends on this setting // If not, then it depends on this setting
$valid = !Config::get('system', 'ostatus_full_threads'); $valid = !Config::get('system', 'ostatus_full_threads');
if ($valid) { 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 { } 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) { if ($valid) {
// Never post a thread when the only interaction by our contact was a like // Never post a thread when the only interaction by our contact was a like
@ -509,14 +509,14 @@ class OStatus
} }
} }
if ($valid) { 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 { } else {
// But we will only import complete threads // But we will only import complete threads
$valid = Item::exists(['uid' => $importer["uid"], 'uri' => self::$itemlist[0]['parent-uri']]); $valid = Item::exists(['uid' => $importer["uid"], 'uri' => self::$itemlist[0]['parent-uri']]);
if ($valid) { 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) { foreach (self::$itemlist as $item) {
$found = Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]]); $found = Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]]);
if ($found) { 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) { } 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 { } else {
// We are having duplicated entries. Hopefully this solves it. // We are having duplicated entries. Hopefully this solves it.
if (Lock::acquire('ostatus_process_item_insert')) { if (Lock::acquire('ostatus_process_item_insert')) {
@ -551,7 +551,7 @@ class OStatus
} }
self::$itemlist = []; 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; return true;
} }
@ -707,7 +707,7 @@ class OStatus
self::fetchRelated($related, $item["parent-uri"], $importer); self::fetchRelated($related, $item["parent-uri"], $importer);
} }
} else { } 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 { } else {
$item["parent-uri"] = $item["uri"]; $item["parent-uri"] = $item["uri"];
@ -853,11 +853,11 @@ class OStatus
$condition = ['item-uri' => $conv_data['uri'],'protocol' => Conversation::PARCEL_FEED]; $condition = ['item-uri' => $conv_data['uri'],'protocol' => Conversation::PARCEL_FEED];
if (DBA::exists('conversation', $condition)) { 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']]); 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); Conversation::insert($conv_data);
} }
} }
@ -877,7 +877,7 @@ class OStatus
{ {
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $self, Conversation::PARCEL_DFRN, Conversation::PARCEL_SALMON]; $condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $self, Conversation::PARCEL_DFRN, Conversation::PARCEL_SALMON];
if (DBA::exists('conversation', $condition)) { 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; return;
} }
@ -897,7 +897,7 @@ class OStatus
$item["protocol"] = Conversation::PARCEL_SALMON; $item["protocol"] = Conversation::PARCEL_SALMON;
$item["source"] = $xml; $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; $stored = true;
$xml = $conversation['source']; $xml = $conversation['source'];
if (self::process($xml, $importer, $contact, $hub, $stored, false)) { 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; return;
} }
if ($conversation['protocol'] == Conversation::PARCEL_SALMON) { 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]); DBA::delete('conversation', ['item-uri' => $related_uri]);
} }
} }
@ -935,7 +935,7 @@ class OStatus
$xml = ''; $xml = '';
if (stristr($curlResult->getHeader(), 'Content-Type: application/atom+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(); $xml = $curlResult->getBody();
} }
@ -960,7 +960,7 @@ class OStatus
$curlResult = Network::curl($atom_file); $curlResult = Network::curl($atom_file);
if ($curlResult->isSuccess()) { 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(); $xml = $curlResult->getBody();
} }
} }
@ -972,7 +972,7 @@ class OStatus
$curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related).'.atom'); $curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related).'.atom');
if ($curlResult->isSuccess()) { 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(); $xml = $curlResult->getBody();
} }
} }
@ -983,7 +983,7 @@ class OStatus
$curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom'); $curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom');
if ($curlResult->isSuccess()) { 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(); $xml = $curlResult->getBody();
} }
} }
@ -994,7 +994,7 @@ class OStatus
$conversation = DBA::selectFirst('conversation', ['source'], $condition); $conversation = DBA::selectFirst('conversation', ['source'], $condition);
if (DBA::isResult($conversation)) { if (DBA::isResult($conversation)) {
$stored = true; $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']; $xml = $conversation['source'];
} }
} }
@ -1002,7 +1002,7 @@ class OStatus
if ($xml != '') { if ($xml != '') {
self::process($xml, $importer, $contact, $hub, $stored, false); self::process($xml, $importer, $contact, $hub, $stored, false);
} else { } 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; return;
} }
@ -1652,7 +1652,7 @@ class OStatus
private static function reshareEntry(DOMDocument $doc, array $item, array $owner, $repeated_guid, $toplevel) 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"]))) { 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); $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) 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"]))) { 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); $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) 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"]))) { 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); $title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
@ -2153,7 +2153,7 @@ class OStatus
if ((time() - strtotime($owner['last-item'])) < 15*60) { if ((time() - strtotime($owner['last-item'])) < 15*60) {
$result = Cache::get($cachekey); $result = Cache::get($cachekey);
if (!$nocache && !is_null($result)) { 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']; $last_update = $result['last_update'];
return $result['feed']; return $result['feed'];
} }
@ -2213,7 +2213,7 @@ class OStatus
$msg = ['feed' => $feeddata, 'last_update' => $last_update]; $msg = ['feed' => $feeddata, 'last_update' => $last_update];
Cache::set($cachekey, $msg, Cache::QUARTER_HOUR); 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; return $feeddata;
} }

View file

@ -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') ; $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); $fetchresult = Network::fetchUrlFull($url);
$s = $fetchresult->getBody(); $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)) { if (($fetchresult->getReturnCode() > 299) || (! $s)) {
return; return;
@ -100,7 +100,7 @@ class PortableContact
$j = json_decode($s, true); $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'])) { if (!isset($j['entry'])) {
return; return;
@ -200,10 +200,10 @@ class PortableContact
GContact::link($gcid, $uid, $cid, $zcid); GContact::link($gcid, $uid, $cid, $zcid);
} catch (Exception $e) { } 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]; $condition = ["`cid` = ? AND `uid` = ? AND `zcid` = ? AND `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY", $cid, $uid, $zcid];
DBA::delete('glink', $condition); 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, ""])) { 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; return false;
} }
@ -347,7 +347,7 @@ class PortableContact
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); 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; return false;
} }
$contact['server_url'] = $server_url; $contact['server_url'] = $server_url;
@ -427,7 +427,7 @@ class PortableContact
$fields = ['last_contact' => DateTimeFormat::utcNow()]; $fields = ['last_contact' => DateTimeFormat::utcNow()];
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); 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"]; 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 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"])) { 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); GContact::update($contact);
return $gcontacts[0]["updated"]; return $gcontacts[0]["updated"];
@ -465,10 +465,10 @@ class PortableContact
self::lastUpdated($data["url"], $force); self::lastUpdated($data["url"], $force);
} catch (Exception $e) { } 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; return false;
} }
@ -476,7 +476,7 @@ class PortableContact
$fields = ['last_failure' => DateTimeFormat::utcNow()]; $fields = ['last_failure' => DateTimeFormat::utcNow()];
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); 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; return false;
} }
@ -492,7 +492,7 @@ class PortableContact
$fields = ['last_failure' => DateTimeFormat::utcNow()]; $fields = ['last_failure' => DateTimeFormat::utcNow()];
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); 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; return false;
} }
@ -540,7 +540,7 @@ class PortableContact
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]); 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; return $last_updated;
} }
@ -663,7 +663,7 @@ class PortableContact
foreach ($nodeinfo['links'] as $link) { foreach ($nodeinfo['links'] as $link) {
if (!is_array($link) || empty($link['rel'])) { 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; continue;
} }
if ($link['rel'] == 'http://nodeinfo.diaspora.software/ns/schema/1.0') { 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)) { 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); return ($last_contact >= $last_failure);
} }
} else { } else {
@ -980,7 +980,7 @@ class PortableContact
$last_contact = DBA::NULL_DATETIME; $last_contact = DBA::NULL_DATETIME;
$last_failure = 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; $failure = false;
$possible_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. // 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) && if (DBA::isResult($gserver) && ($orig_server_url == $server_url) &&
($curlResult->isTimeout())) { ($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)]); DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
return false; return false;
} }
@ -1020,7 +1020,7 @@ class PortableContact
// Quit if there is a timeout // Quit if there is a timeout
if ($curlResult->isTimeout()) { 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)]); DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
return false; return false;
} }
@ -1399,9 +1399,9 @@ class PortableContact
} }
if (($last_contact <= $last_failure) && !$failure) { 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) { } 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 // Check again if the server exists
@ -1430,7 +1430,7 @@ class PortableContact
self::discoverRelay($server_url); 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; return !$failure;
} }
@ -1442,7 +1442,7 @@ class PortableContact
*/ */
private static function discoverRelay($server_url) 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"); $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))); $r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", DBA::escape(normalise_link($server_url)));
if (!DBA::isResult($r)) { 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); Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server_url);
} }
} }
@ -1643,7 +1643,7 @@ class PortableContact
// Fetch all users from the other server // Fetch all users from the other server
$url = $server["poco"] . "/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; $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); $curlResult = Network::curl($url);
@ -1671,7 +1671,7 @@ class PortableContact
$curlResult = Network::curl($url); $curlResult = Network::curl($url);
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) { 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); $data = json_decode($curlResult->getBody(), true);
if (!empty($data)) { if (!empty($data)) {
@ -1680,7 +1680,7 @@ class PortableContact
} }
if (!$success && (Config::get('system', 'poco_discovery') > 2)) { 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); self::discoverServerUsers($data, $server);
} }
} }
@ -1733,7 +1733,7 @@ class PortableContact
continue; 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']); Worker::add(PRIORITY_LOW, 'DiscoverPoCo', 'update_server_directory', (int) $gserver['id']);
if (!$complete && ( --$no_of_queries == 0)) { if (!$complete && ( --$no_of_queries == 0)) {
@ -1763,7 +1763,7 @@ class PortableContact
} }
if ($username != '') { 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 // 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'; $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) { if ($generation > 0) {
$success = true; $success = true;
Logger::log("Store profile ".$profile_url, LOGGER_DEBUG); Logger::log("Store profile ".$profile_url, Logger::DEBUG);
$gcontact = ["url" => $profile_url, $gcontact = ["url" => $profile_url,
"name" => $name, "name" => $name,
@ -1885,10 +1885,10 @@ class PortableContact
$gcontact = GContact::sanitize($gcontact); $gcontact = GContact::sanitize($gcontact);
GContact::update($gcontact); GContact::update($gcontact);
} catch (Exception $e) { } 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; return $success;

View file

@ -97,8 +97,8 @@ class Emailer
$hookdata['headers'], $hookdata['headers'],
$hookdata['parameters'] $hookdata['parameters']
); );
Logger::log("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG); Logger::log("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, Logger::DEBUG);
Logger::log("return value " . (($res)?"true":"false"), LOGGER_DEBUG); Logger::log("return value " . (($res)?"true":"false"), Logger::DEBUG);
return $res; return $res;
} }
} }

View file

@ -98,7 +98,7 @@ class HTTPSignature
$x = Crypto::rsaVerify($signed_data, $sig_block['signature'], $key, $algorithm); $x = Crypto::rsaVerify($signed_data, $sig_block['signature'], $key, $algorithm);
Logger::log('verified: ' . $x, LOGGER_DEBUG); Logger::log('verified: ' . $x, Logger::DEBUG);
if (!$x) { if (!$x) {
return $result; return $result;
@ -433,12 +433,12 @@ class HTTPSignature
$profile = APContact::getByURL($url); $profile = APContact::getByURL($url);
if (!empty($profile)) { 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']]; return ['url' => $url, 'pubkey' => $profile['pubkey']];
} elseif ($url != $actor) { } elseif ($url != $actor) {
$profile = APContact::getByURL($actor); $profile = APContact::getByURL($actor);
if (!empty($profile)) { 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']]; return ['url' => $actor, 'pubkey' => $profile['pubkey']];
} }
} }

View file

@ -66,7 +66,7 @@ class JsonLD
} }
catch (Exception $e) { catch (Exception $e) {
$normalized = false; $normalized = false;
Logger::log('normalise error:' . print_r($e, true), LOGGER_DEBUG); Logger::log('normalise error:' . print_r($e, true), Logger::DEBUG);
} }
return $normalized; return $normalized;
@ -99,7 +99,7 @@ class JsonLD
} }
catch (Exception $e) { catch (Exception $e) {
$compacted = false; $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); return json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true);

View file

@ -107,7 +107,7 @@ class Network
$url = self::unparseURL($parts); $url = self::unparseURL($parts);
if (self::isUrlBlocked($url)) { 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); return CurlResult::createErrorCurl($url);
} }
@ -241,7 +241,7 @@ class Network
$stamp1 = microtime(true); $stamp1 = microtime(true);
if (self::isUrlBlocked($url)) { 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); return CurlResult::createErrorCurl($url);
} }
@ -252,7 +252,7 @@ class Network
return CurlResult::createErrorCurl($url); 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_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@ -324,7 +324,7 @@ class Network
$a->saveTimestamp($stamp1, 'network'); $a->saveTimestamp($stamp1, 'network');
Logger::log('post_url: end ' . $url, LOGGER_DATA); Logger::log('post_url: end ' . $url, Logger::DATA);
return $curlResponse; return $curlResponse;
} }
@ -528,7 +528,7 @@ class Network
$avatar['url'] = System::baseUrl() . '/images/person-300.jpg'; $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']; return $avatar['url'];
} }

View file

@ -124,7 +124,7 @@ class ParseUrl
} }
if ($count > 10) { if ($count > 10) {
Logger::log('Endless loop detected for ' . $url, LOGGER_DEBUG); Logger::log('Endless loop detected for ' . $url, Logger::DEBUG);
return $siteinfo; return $siteinfo;
} }
@ -188,7 +188,7 @@ class ParseUrl
} }
if (($charset != '') && (strtoupper($charset) != 'UTF-8')) { 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); $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); Addon::callHooks('getsiteinfo', $siteinfo);

View file

@ -276,9 +276,9 @@ class XML
@xml_parser_free($parser); @xml_parser_free($parser);
if (! $xml_values) { 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) { 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(); libxml_clear_errors();
return; return;
@ -424,9 +424,9 @@ class XML
$x = @simplexml_load_string($s); $x = @simplexml_load_string($s);
if (!$x) { if (!$x) {
Logger::log('libxml: parse: error: ' . $s, LOGGER_DATA); Logger::log('libxml: parse: error: ' . $s, Logger::DATA);
foreach (libxml_get_errors() as $err) { 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(); libxml_clear_errors();
} }

View file

@ -23,7 +23,7 @@ class APDelivery extends BaseObject
*/ */
public static function execute($cmd, $item_id, $inbox, $uid) 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; $success = true;

View file

@ -37,11 +37,11 @@ class CheckVersion
// don't check // don't check
return; return;
} }
Logger::log("Checking VERSION from: ".$checked_url, LOGGER_DEBUG); Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG);
// fetch the VERSION file // fetch the VERSION file
$gitversion = DBA::escape(trim(Network::fetchUrl($checked_url))); $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); Config::set('system', 'git_friendica_version', $gitversion);

View file

@ -34,7 +34,7 @@ class CronJobs
return; return;
} }
Logger::log("Starting cronjob " . $command, LOGGER_DEBUG); Logger::log("Starting cronjob " . $command, Logger::DEBUG);
// Call possible post update functions // Call possible post update functions
// see src/Database/PostUpdate.php for more details // see src/Database/PostUpdate.php for more details
@ -83,7 +83,7 @@ class CronJobs
return; return;
} }
Logger::log("Xronjob " . $command . " is unknown.", LOGGER_DEBUG); Logger::log("Xronjob " . $command . " is unknown.", Logger::DEBUG);
return; return;
} }
@ -212,7 +212,7 @@ class CronJobs
// Calculate fragmentation // Calculate fragmentation
$fragmentation = $table["Data_free"] / ($table["Data_length"] + $table["Index_length"]); $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 // Don't optimize tables that needn't to be optimized
if ($fragmentation < $fragmentation_level) { if ($fragmentation < $fragmentation_level) {
@ -220,7 +220,7 @@ class CronJobs
} }
// So optimize it // 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"])); q("OPTIMIZE TABLE `%s`", DBA::escape($table["Name"]));
} }
} }
@ -259,7 +259,7 @@ class CronJobs
continue; 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", 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"]), DBA::escape($data["batch"]), DBA::escape($data["notify"]), DBA::escape($data["poll"]), DBA::escape($data["pubkey"]),
intval($contact["id"])); intval($contact["id"]));

View file

@ -34,7 +34,7 @@ class Delivery extends BaseObject
public static function execute($cmd, $item_id, $contact_id) 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; $top_level = false;
$followup = false; $followup = false;
@ -126,7 +126,7 @@ class Delivery extends BaseObject
*/ */
if (!$top_level && ($parent['wall'] == 0) && stristr($target_item['uri'], $localhost)) { 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 // local followup to remote post
$followup = true; $followup = true;
} }
@ -241,7 +241,7 @@ class Delivery extends BaseObject
$atom = DFRN::entries($msgitems, $owner); $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)); $basepath = implode('/', array_slice(explode('/', $contact['url']), 0, 3));

View file

@ -34,7 +34,7 @@ class Directory
Addon::callHooks('globaldir_update', $arr); 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'])) { if (strlen($arr['url'])) {
Network::fetchUrl($dir . '?url=' . bin2hex($arr['url'])); Network::fetchUrl($dir . '?url=' . bin2hex($arr['url']));
} }

View file

@ -90,7 +90,7 @@ class DiscoverPoCo
} else { } else {
$result .= "failed"; $result .= "failed";
} }
Logger::log($result, LOGGER_DEBUG); Logger::log($result, Logger::DEBUG);
} elseif ($mode == 3) { } elseif ($mode == 3) {
GContact::updateSuggestions(); GContact::updateSuggestions();
} elseif (($mode == 2) && Config::get('system', 'poco_completion')) { } 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"])) { if (!PortableContact::updateNeeded($server["created"], "", $server["last_failure"], $server["last_contact"])) {
continue; 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"]); Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server["url"]);
@ -141,7 +141,7 @@ class DiscoverPoCo
} }
private static function discoverUsers() { private static function discoverUsers() {
Logger::log("Discover users", LOGGER_DEBUG); Logger::log("Discover users", Logger::DEBUG);
$starttime = time(); $starttime = time();
@ -209,7 +209,7 @@ class DiscoverPoCo
if (!is_null($data)) { if (!is_null($data)) {
// Only search for the same item every 24 hours // Only search for the same item every 24 hours
if (time() < $data + (60 * 60 * 24)) { 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; return;
} }
} }
@ -222,7 +222,7 @@ class DiscoverPoCo
// Check if the contact already exists // Check if the contact already exists
$exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url)); $exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url));
if (DBA::isResult($exists)) { 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"]) && if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) &&
($exists[0]["updated"] < $exists[0]["last_failure"])) { ($exists[0]["updated"] < $exists[0]["last_failure"])) {
@ -236,16 +236,16 @@ class DiscoverPoCo
$server_url = PortableContact::detectServer($jj->url); $server_url = PortableContact::detectServer($jj->url);
if ($server_url != '') { if ($server_url != '') {
if (!PortableContact::checkServer($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; 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); $data = Probe::uri($jj->url);
if ($data["network"] == Protocol::DFRN) { if ($data["network"] == Protocol::DFRN) {
Logger::log("Profile ".$jj->url." is reachable (".$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); Logger::log("Add profile ".$jj->url." to local directory (".$search.")", Logger::DEBUG);
if ($jj->tags != "") { if ($jj->tags != "") {
$data["keywords"] = $jj->tags; $data["keywords"] = $jj->tags;
@ -255,7 +255,7 @@ class DiscoverPoCo
GContact::update($data); GContact::update($data);
} else { } 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);
} }
} }
} }

View file

@ -27,7 +27,7 @@ class Expire
Hook::loadHooks(); Hook::loadHooks();
if ($param == 'delete') { 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 // physically remove anything that has been deleted for more than two months
$condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"]; $condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"];
$rows = DBA::select('item', ['id'], $condition); $rows = DBA::select('item', ['id'], $condition);
@ -38,35 +38,35 @@ class Expire
// Normally we shouldn't have orphaned data at all. // Normally we shouldn't have orphaned data at all.
// If we do have some, then we have to check why. // 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`)"]; $condition = ["NOT EXISTS (SELECT `iaid` FROM `item` WHERE `item`.`iaid` = `item-activity`.`id`)"];
DBA::delete('item-activity', $condition); 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`)"]; $condition = ["NOT EXISTS (SELECT `icid` FROM `item` WHERE `item`.`icid` = `item-content`.`id`)"];
DBA::delete('item-content', $condition); 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 // make this optional as it could have a performance impact on large sites
if (intval(Config::get('system', 'optimize_items'))) { if (intval(Config::get('system', 'optimize_items'))) {
DBA::e("OPTIMIZE TABLE `item`"); DBA::e("OPTIMIZE TABLE `item`");
} }
Logger::log('Delete expired items - done', LOGGER_DEBUG); Logger::log('Delete expired items - done', Logger::DEBUG);
return; return;
} elseif (intval($param) > 0) { } elseif (intval($param) > 0) {
$user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]); $user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
if (DBA::isResult($user)) { 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']); 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; return;
} elseif ($param == 'hook' && !empty($hook_function)) { } elseif ($param == 'hook' && !empty($hook_function)) {
foreach (Hook::getByName('expire') as $hook) { foreach (Hook::getByName('expire') as $hook) {
if ($hook[1] == $hook_function) { 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); Hook::callSingle($a, 'expire', $hook, $data);
} }
} }
@ -80,7 +80,7 @@ class Expire
$r = DBA::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0"); $r = DBA::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
while ($row = DBA::fetch($r)) { 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], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Expire', (int)$row['uid']); 'Expire', (int)$row['uid']);
} }
@ -88,7 +88,7 @@ class Expire
Logger::log('expire: calling hooks'); Logger::log('expire: calling hooks');
foreach (Hook::getByName('expire') as $hook) { 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], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Expire', 'hook', $hook[1]); 'Expire', 'hook', $hook[1]);
} }

View file

@ -25,7 +25,7 @@ class GProbe {
DBA::escape(normalise_link($url)) 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)) { if (!DBA::isResult($r)) {
// Is it a DDoS attempt? // Is it a DDoS attempt?
@ -34,7 +34,7 @@ class GProbe {
$result = Cache::get("gprobe:".$urlparts["host"]); $result = Cache::get("gprobe:".$urlparts["host"]);
if (!is_null($result)) { if (!is_null($result)) {
if (in_array($result["network"], [Protocol::FEED, Protocol::PHANTOM])) { 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; 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; return;
} }
} }

View file

@ -58,7 +58,7 @@ class Notifier
{ {
$a = BaseObject::getApp(); $a = BaseObject::getApp();
Logger::log('notifier: invoked: '.$cmd.': '.$item_id, LOGGER_DEBUG); Logger::log('notifier: invoked: '.$cmd.': '.$item_id, Logger::DEBUG);
$top_level = false; $top_level = false;
$recipients = []; $recipients = [];
@ -105,7 +105,7 @@ class Notifier
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser(0); $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser(0);
foreach ($inboxes as $inbox) { 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], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'APDelivery', Delivery::REMOVAL, '', $inbox, $item_id); 'APDelivery', Delivery::REMOVAL, '', $inbox, $item_id);
} }
@ -185,7 +185,7 @@ class Notifier
$condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]]; $condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];
$thr_parent = Item::selectFirst($fields, $condition); $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!!!! // This is IMPORTANT!!!!
@ -249,7 +249,7 @@ class Notifier
$recipients = [$parent['contact-id']]; $recipients = [$parent['contact-id']];
$recipients_followup = [$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'] && $target_item['wall'] &&
if (!$target_item['private'] && if (!$target_item['private'] &&
@ -279,11 +279,11 @@ class Notifier
$push_notify = false; $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 { } else {
$followup = false; $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 // 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)) { if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) {
$diaspora_delivery = false; $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 // Send a salmon to the parent author
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]); $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 // Send a salmon notification to every person we mentioned in the post
$arr = explode(',',$target_item['tag']); $arr = explode(',',$target_item['tag']);
foreach ($arr as $x) { foreach ($arr as $x) {
//Logger::log('Checking tag '.$x, LOGGER_DEBUG); //Logger::log('Checking tag '.$x, Logger::DEBUG);
$matches = null; $matches = null;
if (preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) { if (preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) {
$probed_contact = Probe::uri($matches[1]); $probed_contact = Probe::uri($matches[1]);
@ -420,7 +420,7 @@ class Notifier
// delivery loop // delivery loop
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
foreach ($r as $contact) { 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], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Delivery', $cmd, $item_id, (int)$contact['id']); 'Delivery', $cmd, $item_id, (int)$contact['id']);
@ -470,7 +470,7 @@ class Notifier
$r = array_merge($r2, $r1); $r = array_merge($r2, $r1);
if (DBA::isResult($r)) { 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) { foreach ($r as $rr) {
// except for Diaspora batch jobs // except for Diaspora batch jobs
@ -494,13 +494,13 @@ class Notifier
// Notify PuSH subscribers (Used for OStatus distribution of regular posts) // Notify PuSH subscribers (Used for OStatus distribution of regular posts)
if ($push_notify) { 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 // Handling the pubsubhubbub requests
PushSubscriber::publishFeed($owner['uid'], $a->queue['priority']); 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) { if ($normal_mode) {
Hook::fork($a->queue['priority'], 'notifier_normal', $target_item); Hook::fork($a->queue['priority'], 'notifier_normal', $target_item);
@ -518,15 +518,15 @@ class Notifier
if ($target_item['origin']) { if ($target_item['origin']) {
$inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid); $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])) { } 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; return;
} else { } else {
// Remote items are transmitted via the personal inboxes. // Remote items are transmitted via the personal inboxes.
// Doing so ensures that the dedicated receiver will get the message. // Doing so ensures that the dedicated receiver will get the message.
$personal = true; $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']) { if ($parent['origin']) {
@ -535,7 +535,7 @@ class Notifier
} }
if (empty($inboxes)) { 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; return;
} }
@ -543,7 +543,7 @@ class Notifier
ActivityPub\Transmitter::createCachedActivityFromItem($item_id, true); ActivityPub\Transmitter::createCachedActivityFromItem($item_id, true);
foreach ($inboxes as $inbox) { 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], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'APDelivery', $cmd, $item_id, $inbox, $uid); 'APDelivery', $cmd, $item_id, $inbox, $uid);

View file

@ -87,7 +87,7 @@ class OnePoll
$updated = DateTimeFormat::utcNow(); $updated = DateTimeFormat::utcNow();
if ($last_updated) { 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 // The last public item can be older than the last item we got
if ($last_updated < $contact['last-item']) { if ($last_updated < $contact['last-item']) {
@ -100,7 +100,7 @@ class OnePoll
} else { } else {
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]); self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
Contact::markForArchival($contact); 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; return;
@ -214,7 +214,7 @@ class OnePoll
$handshake_xml = $curlResult->getBody(); $handshake_xml = $curlResult->getBody();
$html_code = $curlResult->getReturnCode(); $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) { if (!strlen($handshake_xml) || ($html_code >= 400) || !$html_code) {
Logger::log("$url appears to be dead - marking for death "); Logger::log("$url appears to be dead - marking for death ");
@ -348,7 +348,7 @@ class OnePoll
$xml = $curlResult->getBody(); $xml = $curlResult->getBody();
} elseif ($contact['network'] === Protocol::MAIL) { } 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); $mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1);
if ($mail_disabled) { if ($mail_disabled) {
@ -358,7 +358,7 @@ class OnePoll
return; return;
} }
Logger::log("Mail: Enabled", LOGGER_DEBUG); Logger::log("Mail: Enabled", Logger::DEBUG);
$mbox = null; $mbox = null;
$user = DBA::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]); $user = DBA::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
@ -385,17 +385,17 @@ class OnePoll
$msgs = Email::poll($mbox, $contact['addr']); $msgs = Email::poll($mbox, $contact['addr']);
if (count($msgs)) { 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)); $metas = Email::messageMeta($mbox, implode(',', $msgs));
if (count($metas) != count($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 { } else {
$msgs = array_combine($msgs, $metas); $msgs = array_combine($msgs, $metas);
foreach ($msgs as $msg_uid => $meta) { 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 = [];
$datarray['verb'] = ACTIVITY_POST; $datarray['verb'] = ACTIVITY_POST;
@ -410,7 +410,7 @@ class OnePoll
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']]; $condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
$item = Item::selectFirst($fields, $condition); $item = Item::selectFirst($fields, $condition);
if (DBA::isResult($item)) { 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 // Only delete when mails aren't automatically moved or deleted
if (($mailconf['action'] != 1) && ($mailconf['action'] != 3)) if (($mailconf['action'] != 1) && ($mailconf['action'] != 3))
@ -421,7 +421,7 @@ class OnePoll
switch ($mailconf['action']) { switch ($mailconf['action']) {
case 0: 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; break;
case 1: case 1:
Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']); Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']);
@ -555,7 +555,7 @@ class OnePoll
switch ($mailconf['action']) { switch ($mailconf['action']) {
case 0: 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; break;
case 1: case 1:
Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']); Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']);
@ -585,7 +585,7 @@ class OnePoll
} }
if ($xml) { if ($xml) {
Logger::log('received xml : ' . $xml, LOGGER_DATA); Logger::log('received xml : ' . $xml, Logger::DATA);
if (!strstr($xml, '<')) { if (!strstr($xml, '<')) {
Logger::log('post_handshake: response from ' . $url . ' did not contain XML.'); Logger::log('post_handshake: response from ' . $url . ' did not contain XML.');

View file

@ -23,7 +23,7 @@ class ProfileUpdate {
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid); $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
foreach ($inboxes as $inbox) { 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], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'APDelivery', Delivery::PROFILEUPDATE, '', $inbox, $uid); 'APDelivery', Delivery::PROFILEUPDATE, '', $inbox, $uid);
} }

View file

@ -38,7 +38,7 @@ class PubSubPublish
/// @todo Check server status with PortableContact::checkServer() /// @todo Check server status with PortableContact::checkServer()
// Before this can be done we need a way to safely detect the server url. // 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']; $last_update = $subscriber['last_update'];
$params = OStatus::feed($subscriber['nickname'], $last_update); $params = OStatus::feed($subscriber['nickname'], $last_update);
@ -55,7 +55,7 @@ class PubSubPublish
$subscriber['topic']), $subscriber['topic']),
"X-Hub-Signature: sha1=" . $hmac_sig]; "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); $postResult = Network::post($subscriber['callback_url'], $params, $headers);
$ret = $postResult->getReturnCode(); $ret = $postResult->getReturnCode();

View file

@ -50,7 +50,7 @@ class SpoolPost {
$result = Item::insert($arr); $result = Item::insert($arr);
Logger::log("Spool file ".$file." stored: ".$result, LOGGER_DEBUG); Logger::log("Spool file ".$file." stored: ".$result, Logger::DEBUG);
unlink($fullfile); unlink($fullfile);
} }
closedir($dh); closedir($dh);

View file

@ -31,7 +31,7 @@ foreach (['style', $style] as $file) {
$modified = $stylemodified; $modified = $stylemodified;
} }
} else { } else {
//TODO: use LOGGER_ERROR? //TODO: use Logger::ERROR?
Logger::log('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')'); Logger::log('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')');
} }
} }