unlink($pidfile);
- Logger::log("Worker daemon process $pid was killed.", LOGGER_DEBUG);
+ Logger::log("Worker daemon process $pid was killed.", Logger::DEBUG);
Config::set('system', 'worker_daemon_mode', false);
die("Worker daemon process $pid was killed.\n");
die("Daemon process $pid is already running.\n");
}
-Logger::log('Starting worker daemon.', LOGGER_DEBUG);
+Logger::log('Starting worker daemon.', Logger::DEBUG);
if (!$foreground) {
echo "Starting worker daemon.\n";
// Now running as a daemon.
while (true) {
if (!$do_cron && ($last_cron + $wait_interval) < time()) {
- Logger::log('Forcing cron worker call.', LOGGER_DEBUG);
+ Logger::log('Forcing cron worker call.', Logger::DEBUG);
$do_cron = true;
}
$last_cron = time();
}
- Logger::log("Sleeping", LOGGER_DEBUG);
+ Logger::log("Sleeping", Logger::DEBUG);
$start = time();
do {
$seconds = (time() - $start);
if ($timeout) {
$do_cron = true;
- Logger::log("Woke up after $wait_interval seconds.", LOGGER_DEBUG);
+ Logger::log("Woke up after $wait_interval seconds.", Logger::DEBUG);
} else {
$do_cron = false;
- Logger::log("Worker jobs are calling to be forked.", LOGGER_DEBUG);
+ Logger::log("Worker jobs are calling to be forked.", Logger::DEBUG);
}
}
return "Twidere";
}
- Logger::log("Unrecognized user-agent ".$_SERVER['HTTP_USER_AGENT'], LOGGER_DEBUG);
+ Logger::log("Unrecognized user-agent ".$_SERVER['HTTP_USER_AGENT'], Logger::DEBUG);
} else {
- Logger::log("Empty user-agent", LOGGER_DEBUG);
+ Logger::log("Empty user-agent", Logger::DEBUG);
}
return "api";
}
if (!x($_SERVER, 'PHP_AUTH_USER')) {
- Logger::log('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+ Logger::log('API_login: ' . print_r($_SERVER, true), Logger::DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
throw new UnauthorizedException("This API requires login");
}
}
if (!DBA::isResult($record)) {
- Logger::log('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+ Logger::log('API_login failure: ' . print_r($_SERVER, true), Logger::DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
//header('HTTP/1.0 401 Unauthorized');
//die('This api requires login');
$stamp = microtime(true);
$return = call_user_func($info['func'], $type);
$duration = (float) (microtime(true) - $stamp);
- Logger::log("API call duration: " . round($duration, 2) . "\t" . $a->query_string, LOGGER_DEBUG);
+ Logger::log("API call duration: " . round($duration, 2) . "\t" . $a->query_string, Logger::DEBUG);
if (Config::get("system", "profiler")) {
$duration = microtime(true)-$a->performance["start"];
+ $a->performance["network"] + $a->performance["file"]), 2),
round($duration, 2)
),
- LOGGER_DEBUG
+ Logger::DEBUG
);
if (Config::get("rendertime", "callstack")) {
$o .= $func . ": " . $time . "\n";
}
}
- Logger::log($o, LOGGER_DEBUG);
+ Logger::log($o, Logger::DEBUG);
}
}
$extra_query = "";
$url = "";
- Logger::log("api_get_user: Fetching user data for user ".$contact_id, LOGGER_DEBUG);
+ Logger::log("api_get_user: Fetching user data for user ".$contact_id, Logger::DEBUG);
// Searching for contact URL
if (!is_null($contact_id) && (intval($contact_id) == 0)) {
}
}
- Logger::log("api_get_user: user ".$user, LOGGER_DEBUG);
+ Logger::log("api_get_user: user ".$user, Logger::DEBUG);
if (!$user) {
if (api_user() === false) {
$posts_day = DBA::count('thread', $condition);
if ($posts_day > $throttle_day) {
- Logger::log('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
+ Logger::log('Daily posting limit reached for user '.api_user(), Logger::DEBUG);
// die(api_error($type, L10n::t("Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
throw new TooManyRequestsException(L10n::tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
}
$posts_week = DBA::count('thread', $condition);
if ($posts_week > $throttle_week) {
- Logger::log('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
+ Logger::log('Weekly posting limit reached for user '.api_user(), Logger::DEBUG);
// die(api_error($type, L10n::t("Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week)));
throw new TooManyRequestsException(L10n::tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week));
}
$posts_month = DBA::count('thread', $condition);
if ($posts_month > $throttle_month) {
- Logger::log('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
+ Logger::log('Monthly posting limit reached for user '.api_user(), Logger::DEBUG);
// die(api_error($type, L10n::t("Monthly posting limit of %d posts reached. The post was rejected.", $throttle_month));
throw new TooManyRequestsException(L10n::t("Monthly posting limit of %d post reached. The post was rejected.", "Monthly posting limit of %d posts reached. The post was rejected.", $throttle_month));
}
"h" => $media["height"],
"image_type" => $media["type"]];
- Logger::log("Media uploaded: " . print_r($returndata, true), LOGGER_DEBUG);
+ Logger::log("Media uploaded: " . print_r($returndata, true), Logger::DEBUG);
return ["media" => $returndata];
}
$user_info = api_get_user($a);
- Logger::log('api_status_show: user_info: '.print_r($user_info, true), LOGGER_DEBUG);
+ Logger::log('api_status_show: user_info: '.print_r($user_info, true), Logger::DEBUG);
if ($type == "raw") {
$privacy_sql = "AND NOT `private`";
unset($status_info["user"]["uid"]);
unset($status_info["user"]["self"]);
- Logger::log('status_info: '.print_r($status_info, true), LOGGER_DEBUG);
+ Logger::log('status_info: '.print_r($status_info, true), Logger::DEBUG);
if ($type == "raw") {
return $status_info;
"api_statuses_user_timeline: api_user: ". api_user() .
"\nuser_info: ".print_r($user_info, true) .
"\n_REQUEST: ".print_r($_REQUEST, true),
- LOGGER_DEBUG
+ Logger::DEBUG
);
$since_id = x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0;
$contact_id = defaults($_REQUEST, 'user_id');
if (empty($contact_id)) {
- Logger::log("No user_id specified", LOGGER_DEBUG);
+ Logger::log("No user_id specified", Logger::DEBUG);
throw new BadRequestException("no user_id specified");
}
$contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id, 'uid' => 0, 'self' => false]);
if(!DBA::isResult($contact)) {
- Logger::log("No contact found for ID" . $contact_id, LOGGER_DEBUG);
+ Logger::log("No contact found for ID" . $contact_id, Logger::DEBUG);
throw new NotFoundException("no contact found to given ID");
}
$contact = DBA::selectFirst('contact', [], $condition);
if (!DBA::isResult($contact)) {
- Logger::log("Not following Contact", LOGGER_DEBUG);
+ Logger::log("Not following Contact", Logger::DEBUG);
throw new NotFoundException("Not following Contact");
}
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
- Logger::log("Not supported", LOGGER_DEBUG);
+ Logger::log("Not supported", Logger::DEBUG);
throw new ExpectationFailedException("Not supported");
}
Contact::terminateFriendship($owner, $contact, $dissolve);
}
else {
- Logger::log("No owner found", LOGGER_DEBUG);
+ Logger::log("No owner found", Logger::DEBUG);
throw new NotFoundException("Error Processing Request");
}
Logger::log(
"File upload src: " . $src . " - filename: " . $filename .
" - size: " . $filesize . " - type: " . $filetype,
- LOGGER_DEBUG
+ Logger::DEBUG
);
// check if there was a php upload error
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
- Logger::log("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
+ Logger::log("File upload: Scaling picture to new size " . $max_length, Logger::DEBUG);
}
$width = $Image->getWidth();
$height = $Image->getHeight();
if ($mediatype == "photo") {
// upload normal image (scales 0, 1, 2)
- Logger::log("photo upload: starting new photo upload", LOGGER_DEBUG);
+ Logger::log("photo upload: starting new photo upload", Logger::DEBUG);
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
Logger::log("photo upload: image upload with scale 2 (320x320) failed");
}
}
- Logger::log("photo upload: new photo upload ended", LOGGER_DEBUG);
+ Logger::log("photo upload: new photo upload ended", Logger::DEBUG);
} elseif ($mediatype == "profileimage") {
// upload profile image (scales 4, 5, 6)
- Logger::log("photo upload: starting new profile image upload", LOGGER_DEBUG);
+ Logger::log("photo upload: starting new profile image upload", Logger::DEBUG);
if ($width > 300 || $height > 300) {
$Image->scaleDown(300);
}
}
$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) {
'sec' => $sec, 'expire' => time() + 45];
DBA::insert('profile_check', $fields);
- Logger::log($contact['name'] . ' ' . $sec, LOGGER_DEBUG);
+ Logger::log($contact['name'] . ' ' . $sec, Logger::DEBUG);
$dest = ($url ? '&destination_url=' . $url : '');
System::externalRedirect(
// https://github.com/friendica/friendica/issues/1010
// This is a bugfix for that.
if (intval($in_reply_to['status_id']) == intval($item['id'])) {
- Logger::log('this message should never appear: id: '.$item['id'].' similar to reply-to: '.$in_reply_to['status_id'], LOGGER_DEBUG);
+ Logger::log('this message should never appear: id: '.$item['id'].' similar to reply-to: '.$in_reply_to['status_id'], Logger::DEBUG);
$in_reply_to['status_id'] = null;
$in_reply_to['user_id'] = null;
$in_reply_to['status_id_str'] = null;
$threads = $conv->getTemplateData($conv_responses);
if (!$threads) {
- Logger::log('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
+ Logger::log('[ERROR] conversation : Failed to get template data.', Logger::DEBUG);
$threads = [];
}
}
if ($params['type'] == NOTIFY_COMMENT) {
$thread = Item::selectFirstThreadForUser($params['uid'] ,['ignored'], ['iid' => $parent_id]);
if (DBA::isResult($thread) && $thread["ignored"]) {
- Logger::log("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
+ Logger::log("Thread ".$parent_id." will be ignored", Logger::DEBUG);
L10n::popLang();
return;
}
$itemlink = $h['itemlink'];
if ($show_in_notification_page) {
- Logger::log("adding notification entry", LOGGER_DEBUG);
+ Logger::log("adding notification entry", Logger::DEBUG);
do {
$dups = false;
$hash = random_string();
// Is this the first email notification for this parent item and user?
if (!DBA::exists('notify-threads', ['master-parent-item' => $params['parent'], 'receiver-uid' => $params['uid']])) {
- Logger::log("notify_id:".intval($notify_id).", parent: ".intval($params['parent'])."uid: ".intval($params['uid']), LOGGER_DEBUG);
+ Logger::log("notify_id:".intval($notify_id).", parent: ".intval($params['parent'])."uid: ".intval($params['uid']), Logger::DEBUG);
$fields = ['notify-id' => $notify_id, 'master-parent-item' => $params['parent'],
'receiver-uid' => $params['uid'], 'parent-item' => 0];
$additional_mail_header .= "Message-ID: <${id_for_parent}>\n";
$log_msg = "include/enotify: No previous notification found for this parent:\n".
" parent: ${params['parent']}\n"." uid : ${params['uid']}\n";
- Logger::log($log_msg, LOGGER_DEBUG);
+ Logger::log($log_msg, Logger::DEBUG);
} else {
// If not, just "follow" the thread.
$additional_mail_header .= "References: <${id_for_parent}>\nIn-Reply-To: <${id_for_parent}>\n";
- Logger::log("There's already a notification for this parent.", LOGGER_DEBUG);
+ Logger::log("There's already a notification for this parent.", Logger::DEBUG);
}
}
$data["images"][0]["src"] = $photo;
}
- Logger::log('fetch page info for ' . $url . ' ' . print_r($data, true), LOGGER_DEBUG);
+ Logger::log('fetch page info for ' . $url . ' ' . print_r($data, true), Logger::DEBUG);
if (!$keywords && isset($data["keywords"])) {
unset($data["keywords"]);
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 = "^\[\]";
// Test - remove before flight
//$tempfile = tempnam(get_temppath(), "ostatus2");
//file_put_contents($tempfile, $xml);
- Logger::log("Consume OStatus messages ", LOGGER_DEBUG);
+ Logger::log("Consume OStatus messages ", Logger::DEBUG);
OStatus::import($xml, $importer, $contact, $hub);
}
if ($contact['network'] === Protocol::FEED) {
if ($pass < 2) {
- Logger::log("Consume feeds", LOGGER_DEBUG);
+ Logger::log("Consume feeds", Logger::DEBUG);
Feed::import($xml, $importer, $contact, $hub);
}
}
if ($contact['network'] === Protocol::DFRN) {
- Logger::log("Consume DFRN messages", LOGGER_DEBUG);
+ Logger::log("Consume DFRN messages", Logger::DEBUG);
$dfrn_importer = DFRN::getImporter($contact["id"], $importer["uid"]);
if (!empty($dfrn_importer)) {
Logger::log("Now import the DFRN feed");
$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;
$search = $_REQUEST['query'];
}
- Logger::log("Searching for ".$search." - type ".$type." conversation ".$conv_id, LOGGER_DEBUG);
+ Logger::log("Searching for ".$search." - type ".$type." conversation ".$conv_id, Logger::DEBUG);
if ($search != '') {
$sql_extra = "AND `name` LIKE '%%" . DBA::escape($search) . "%%'";
$users+= $u['count'];
}
- Logger::log('accounts: ' . print_r($accounts, true), LOGGER_DATA);
+ Logger::log('accounts: ' . print_r($accounts, true), Logger::DATA);
$pending = Register::getPendingCount();
function admin_page_logs(App $a)
{
$log_choices = [
- LOGGER_WARNING => 'Warning',
- LOGGER_INFO => 'Info',
- LOGGER_TRACE => 'Trace',
- LOGGER_DEBUG => 'Debug',
- LOGGER_DATA => 'Data',
- LOGGER_ALL => 'All'
+ Logger::WARNING => 'Warning',
+ Logger::INFO => 'Info',
+ Logger::TRACE => 'Trace',
+ Logger::DEBUG => 'Debug',
+ Logger::DATA => 'Data',
+ Logger::ALL => 'All'
];
if (ini_get('log_errors')) {
{
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);
$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);
/*
*
$res = Network::post($dfrn_confirm, $params, null, $redirects, 120)->getBody();
- Logger::log(' Confirm: received data: ' . $res, LOGGER_DATA);
+ Logger::log(' Confirm: received data: ' . $res, Logger::DATA);
// Now figure out what they responded. Try to be robust if the remote site is
// having difficulty and throwing up errors of some kind.
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.
require_once 'include/items.php';
function dfrn_notify_post(App $a) {
- Logger::log(__function__, LOGGER_TRACE);
+ Logger::log(__function__, Logger::TRACE);
$postdata = file_get_contents('php://input');
$importer = Contact::updateSslPolicy($importer, $ssl_policy);
- Logger::log('data: ' . $data, LOGGER_DATA);
+ Logger::log('data: ' . $data, Logger::DATA);
if ($dissolve == 1) {
// Relationship is dissolved permanently
}
$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 = '';
System::xmlExit(0, "Invalid sent version '$rino_remote'");
}
- Logger::log('rino: decrypted data: ' . $data, LOGGER_DATA);
+ Logger::log('rino: decrypted data: ' . $data, Logger::DATA);
}
- Logger::log('Importing post from ' . $importer['addr'] . ' to ' . $importer['nickname'] . ' with the RINO ' . $rino_remote . ' encryption.', LOGGER_DEBUG);
+ Logger::log('Importing post from ' . $importer['addr'] . ' to ' . $importer['nickname'] . ' with the RINO ' . $rino_remote . ' encryption.', Logger::DEBUG);
$ret = DFRN::import($data, $importer);
System::xmlExit($ret, 'Processed');
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}
- Logger::log('Importing post from ' . $msg['author'] . ' with the public envelope.', LOGGER_DEBUG);
+ Logger::log('Importing post from ' . $msg['author'] . ' with the public envelope.', Logger::DEBUG);
// Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer);
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}
- Logger::log('Importing post from ' . $msg['author'] . ' to ' . $user['nickname'] . ' with the private envelope.', LOGGER_DEBUG);
+ Logger::log('Importing post from ' . $msg['author'] . ' to ' . $user['nickname'] . ' with the private envelope.', Logger::DEBUG);
// Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer);
'type' => $type, 'last_update' => $last_update];
DBA::insert('challenge', $fields);
- Logger::log('challenge=' . $hash, LOGGER_DATA);
+ Logger::log('challenge=' . $hash, Logger::DATA);
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $a->argv[1]]);
if (!DBA::isResult($user)) {
killme();
}
- Logger::log("Remote rino version: ".$rino_remote." for ".$importer["url"], LOGGER_DATA);
+ Logger::log("Remote rino version: ".$rino_remote." for ".$importer["url"], Logger::DATA);
$challenge = '';
$encrypted_id = '';
$rino = Config::get('system', 'rino_encrypt');
$rino = intval($rino);
- Logger::log("Local rino version: ". $rino, LOGGER_DATA);
+ Logger::log("Local rino version: ". $rino, Logger::DATA);
// if requested rino is lower than enabled local rino, lower local rino version
// if requested rino is higher than enabled local rino, reply with local rino
if (DBA::isResult($r)) {
$s = Network::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
- Logger::log("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
+ Logger::log("dfrn_poll: old profile returns " . $s, Logger::DATA);
if (strlen($s)) {
$xml = XML::parseString($s);
}
if ($final_dfrn_id != $orig_id) {
- Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
+ Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, Logger::DEBUG);
// did not decode properly - cannot trust this site
System::xmlExit(3, 'Bad decryption');
}
}
if ($final_dfrn_id != $orig_id) {
- Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
+ Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, Logger::DEBUG);
// did not decode properly - cannot trust this site
System::xmlExit(3, 'Bad decryption');
}
// NOTREACHED
} else {
// Update the writable flag if it changed
- Logger::log('dfrn_poll: post request feed: ' . print_r($_POST, true), LOGGER_DATA);
+ Logger::log('dfrn_poll: post request feed: ' . print_r($_POST, true), Logger::DATA);
if ($dfrn_version >= 2.21) {
if ($perm === 'rw') {
$writable = 1;
])->getBody();
}
- Logger::log("dfrn_poll: sec profile: " . $s, LOGGER_DATA);
+ Logger::log("dfrn_poll: sec profile: " . $s, Logger::DATA);
if (strlen($s) && strstr($s, '<?xml')) {
$xml = XML::parseString($s);
- Logger::log('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), LOGGER_DATA);
+ Logger::log('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), Logger::DATA);
Logger::log('dfrn_poll: secure profile: challenge: ' . $xml->challenge . ' expecting ' . $hash);
Logger::log('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec);
$network = Protocol::DFRN;
}
- Logger::log('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
+ Logger::log('dfrn_request: url: ' . $url . ',network=' . $network, Logger::DEBUG);
if ($network === Protocol::DFRN) {
$ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",
}
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);
}
function events_post(App $a)
{
- Logger::log('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
+ Logger::log('post: ' . print_r($_REQUEST, true), Logger::DATA);
if (!local_user()) {
return;
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);
*/
if (!$preview && !empty($_REQUEST['post_id_random'])) {
if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
- Logger::log("item post: duplicate post", LOGGER_DEBUG);
+ Logger::log("item post: duplicate post", Logger::DEBUG);
item_post_return(System::baseUrl(), $api_source, $return_path);
} else {
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
// Check for multiple posts with the same message id (when the post was created via API)
if (($message_id != '') && ($profile_uid != 0)) {
if (Item::exists(['uri' => $message_id, 'uid' => $profile_uid])) {
- Logger::log("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
+ Logger::log("Message with URI ".$message_id." already exists for user ".$profile_uid, Logger::DEBUG);
return 0;
}
}
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
}
- Logger::log('post_json: ' . print_r($json, true), LOGGER_DEBUG);
+ Logger::log('post_json: ' . print_r($json, true), Logger::DEBUG);
echo json_encode($json);
killme();
Config::set('nodeinfo', 'active_users_halfyear', $active_users_halfyear);
Config::set('nodeinfo', 'active_users_monthly', $active_users_monthly);
- Logger::log('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
+ Logger::log('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, Logger::DEBUG);
}
$local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_posts', $local_posts);
- Logger::log('local_posts: ' . $local_posts, LOGGER_DEBUG);
+ Logger::log('local_posts: ' . $local_posts, Logger::DEBUG);
$local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_comments', $local_comments);
- Logger::log('local_comments: ' . $local_comments, LOGGER_DEBUG);
+ Logger::log('local_comments: ' . $local_comments, Logger::DEBUG);
// Now trying to register
$url = 'http://the-federation.info/register/'.$a->getHostName();
- Logger::log('registering url: '.$url, LOGGER_DEBUG);
+ Logger::log('registering url: '.$url, Logger::DEBUG);
$ret = Network::fetchUrl($url);
- Logger::log('registering answer: '.$ret, LOGGER_DEBUG);
+ Logger::log('registering answer: '.$ret, Logger::DEBUG);
Logger::log('cron_end');
}
if($noid)
$a->internalRedirect();
- Logger::log('mod_openid ' . print_r($_REQUEST,true), LOGGER_DATA);
+ Logger::log('mod_openid ' . print_r($_REQUEST,true), Logger::DATA);
if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
function photos_post(App $a)
{
- Logger::log('mod-photos: photos_post: begin' , LOGGER_DEBUG);
- Logger::log('mod_photos: REQUEST ' . print_r($_REQUEST, true), LOGGER_DATA);
- Logger::log('mod_photos: FILES ' . print_r($_FILES, true), LOGGER_DATA);
+ Logger::log('mod-photos: photos_post: begin' , Logger::DEBUG);
+ Logger::log('mod_photos: REQUEST ' . print_r($_REQUEST, true), Logger::DATA);
+ Logger::log('mod_photos: FILES ' . print_r($_FILES, true), Logger::DATA);
$phototypes = Image::supportedTypes();
$album = !empty($_REQUEST['album']) ? notags(trim($_REQUEST['album'])) : '';
$newalbum = !empty($_REQUEST['newalbum']) ? notags(trim($_REQUEST['newalbum'])) : '';
- Logger::log('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , LOGGER_DEBUG);
+ Logger::log('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , Logger::DEBUG);
if (!strlen($album)) {
if (strlen($newalbum)) {
$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');
return;
}
- Logger::log('mod/photos.php: photos_post(): loading the contents of ' . $src , LOGGER_DEBUG);
+ Logger::log('mod/photos.php: photos_post(): loading the contents of ' . $src , Logger::DEBUG);
$imagedata = @file_get_contents($src);
$image = new Image($imagedata, $type);
if (!$image->isValid()) {
- Logger::log('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
+ Logger::log('mod/photos.php: photos_post(): unable to process image' , Logger::DEBUG);
notice(L10n::t('Unable to process image.') . EOL);
@unlink($src);
$foo = 0;
$r = Photo::store($image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
if (!$r) {
- Logger::log('mod/photos.php: photos_post(): image store failed', LOGGER_DEBUG);
+ Logger::log('mod/photos.php: photos_post(): image store failed', Logger::DEBUG);
notice(L10n::t('Image upload failed.') . EOL);
killme();
}
$itemsPerPage = ((x($_GET, 'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
if ($global) {
- Logger::log("Start global query", LOGGER_DEBUG);
+ Logger::log("Start global query", Logger::DEBUG);
$contacts = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
ORDER BY `updated` DESC LIMIT %d, %d",
DBA::escape($update_limit),
intval($itemsPerPage)
);
} elseif ($system_mode) {
- Logger::log("Start system mode query", LOGGER_DEBUG);
+ Logger::log("Start system mode query", Logger::DEBUG);
$contacts = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`,
`profile`.`gender` AS `pgender`, `profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`,
`profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type`
intval($itemsPerPage)
);
} else {
- Logger::log("Start query for user " . $user['nickname'], LOGGER_DEBUG);
+ Logger::log("Start query for user " . $user['nickname'], Logger::DEBUG);
$contacts = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d",
intval($itemsPerPage)
);
}
- Logger::log("Query done", LOGGER_DEBUG);
+ Logger::log("Query done", Logger::DEBUG);
$ret = [];
if (x($_GET, 'sorted')) {
} else {
System::httpExit(500);
}
- Logger::log("End of poco", LOGGER_DEBUG);
+ Logger::log("End of poco", Logger::DEBUG);
if ($format === 'xml') {
header('Content-type: text/xml');
$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",
if (DBA::isResult($r)) {
$a->internalRedirect('profile/' . $r[0]['nickname']);
} else {
- Logger::log('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
+ Logger::log('profile error: mod_profile ' . $a->query_string, Logger::DEBUG);
notice(L10n::t('Requested profile is not available.') . EOL);
$a->error = 404;
return;
$hub_verify = notags(trim(defaults($_GET, 'hub_verify_token', '')));
Logger::log('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);
- Logger::log('Data: ' . print_r($_GET,true), LOGGER_DATA);
+ Logger::log('Data: ' . print_r($_GET,true), Logger::DATA);
$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
$xml = file_get_contents('php://input');
Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $a->cmd . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
- Logger::log('Data: ' . $xml, LOGGER_DATA);
+ Logger::log('Data: ' . $xml, Logger::DATA);
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
// It is an application/x-www-form-urlencoded
- Logger::log('mod-diaspora: receiving post', LOGGER_DEBUG);
+ Logger::log('mod-diaspora: receiving post', Logger::DEBUG);
if (empty($_POST['xml'])) {
$postdata = file_get_contents("php://input");
System::httpExit(500);
}
- Logger::log('mod-diaspora: message is in the new format', LOGGER_DEBUG);
+ Logger::log('mod-diaspora: message is in the new format', Logger::DEBUG);
$msg = Diaspora::decodeRaw($importer, $postdata);
} else {
$xml = urldecode($_POST['xml']);
- Logger::log('mod-diaspora: decode message in the old format', LOGGER_DEBUG);
+ Logger::log('mod-diaspora: decode message in the old format', Logger::DEBUG);
$msg = Diaspora::decode($importer, $xml);
if ($public && !$msg) {
- Logger::log('mod-diaspora: decode message in the new format', LOGGER_DEBUG);
+ Logger::log('mod-diaspora: decode message in the new format', Logger::DEBUG);
$msg = Diaspora::decodeRaw($importer, $xml);
}
}
- Logger::log('mod-diaspora: decoded', LOGGER_DEBUG);
+ Logger::log('mod-diaspora: decoded', Logger::DEBUG);
- Logger::log('mod-diaspora: decoded msg: ' . print_r($msg, true), LOGGER_DATA);
+ Logger::log('mod-diaspora: decoded msg: ' . print_r($msg, true), Logger::DATA);
if (!is_array($msg)) {
System::httpExit(500);
}
- Logger::log('mod-diaspora: dispatching', LOGGER_DEBUG);
+ Logger::log('mod-diaspora: dispatching', Logger::DEBUG);
$ret = true;
if ($public) {
if (!empty($a->contact['id']) && $a->contact['id'] == $cid) {
// Local user is already authenticated.
$target_url = defaults($url, $contact_url);
- Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
+ Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
$a->redirect($target_url);
}
}
if ($v['uid'] == $_SESSION['visitor_visiting'] && $v['cid'] == $_SESSION['visitor_id']) {
// Remote user is already authenticated.
$target_url = defaults($url, $contact_url);
- Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
+ Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
$a->redirect($target_url);
}
}
'sec' => $sec, 'expire' => time() + 45];
DBA::insert('profile_check', $fields);
- Logger::log('mod_redir: ' . $contact['name'] . ' ' . $sec, LOGGER_DEBUG);
+ Logger::log('mod_redir: ' . $contact['name'] . ' ' . $sec, Logger::DEBUG);
$dest = (!empty($url) ? '&destination_url=' . $url : '');
$url .= $separator . 'zrl=' . urlencode($my_profile);
}
- Logger::log('redirecting to ' . $url, LOGGER_DEBUG);
+ Logger::log('redirecting to ' . $url, Logger::DEBUG);
$a->redirect($url);
}
$xml = file_get_contents('php://input');
}
- Logger::log('new salmon ' . $xml, LOGGER_DATA);
+ Logger::log('new salmon ' . $xml, Logger::DATA);
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false);
$m = base64url_decode($key_info[1]);
$e = base64url_decode($key_info[2]);
- Logger::log('key details: ' . print_r($key_info,true), LOGGER_DEBUG);
+ Logger::log('key details: ' . print_r($key_info,true), Logger::DEBUG);
$pubkey = Crypto::meToPem($m, $e);
$pager = new Pager($a->query_string);
if ($tag) {
- Logger::log("Start tag search for '".$search."'", LOGGER_DEBUG);
+ Logger::log("Start tag search for '".$search."'", Logger::DEBUG);
$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `otype` = ? AND `type` = ? AND `term` = ?",
$r = [];
}
} else {
- Logger::log("Start fulltext search for '".$search."'", LOGGER_DEBUG);
+ Logger::log("Start fulltext search for '".$search."'", Logger::DEBUG);
$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `body` LIKE CONCAT('%',?,'%')",
'$title' => $title
]);
- Logger::log("Start Conversation for '".$search."'", LOGGER_DEBUG);
+ Logger::log("Start Conversation for '".$search."'", Logger::DEBUG);
$o .= conversation($a, $r, $pager, 'search', false, false, 'commented', local_user());
$o .= $pager->renderMinimal(count($r));
- Logger::log("Done '".$search."'", LOGGER_DEBUG);
+ Logger::log("Done '".$search."'", Logger::DEBUG);
return $o;
}
header("Content-Type: application/json");
echo json_encode($statistics, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
- Logger::log("statistics_init: printed " . print_r($statistics, true), LOGGER_DATA);
+ Logger::log("statistics_init: printed " . print_r($statistics, true), Logger::DATA);
killme();
}
function wall_upload_post(App $a, $desktopmode = true)
{
- Logger::log("wall upload: starting new upload", LOGGER_DEBUG);
+ Logger::log("wall upload: starting new upload", Logger::DEBUG);
$r_json = (x($_GET, 'response') && $_GET['response'] == 'json');
$album = (x($_GET, 'album') ? notags(trim($_GET['album'])) : '');
}
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');
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
- Logger::log("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
+ Logger::log("File upload: Scaling picture to new size " . $max_length, Logger::DEBUG);
}
$width = $Image->getWidth();
echo json_encode(['picture' => $picture]);
killme();
}
- Logger::log("upload done", LOGGER_DEBUG);
+ Logger::log("upload done", Logger::DEBUG);
return $picture;
}
- Logger::log("upload done", LOGGER_DEBUG);
+ Logger::log("upload done", Logger::DEBUG);
if ($r_json) {
echo json_encode(['ok' => true]);
$processlist = DBA::processlist();
if ($processlist['list'] != '') {
- Core\Logger::log('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], LOGGER_DEBUG);
+ Core\Logger::log('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], Logger::DEBUG);
if ($processlist['amount'] > $max_processes) {
- Core\Logger::log('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.', LOGGER_DEBUG);
+ Core\Logger::log('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.', Logger::DEBUG);
return true;
}
}
$reached = ($free < $min_memory);
if ($reached) {
- Core\Logger::log('Minimal memory reached: ' . $free . '/' . $meminfo['MemTotal'] . ' - limit ' . $min_memory, LOGGER_DEBUG);
+ Core\Logger::log('Minimal memory reached: ' . $free . '/' . $meminfo['MemTotal'] . ' - limit ' . $min_memory, Logger::DEBUG);
}
return $reached;
$resource = proc_open($cmdline . ' &', [], $foo, $this->getBasePath());
}
if (!is_resource($resource)) {
- Core\Logger::log('We got no resource for command ' . $cmdline, LOGGER_DEBUG);
+ Core\Logger::log('We got no resource for command ' . $cmdline, Logger::DEBUG);
return;
}
proc_close($resource);
public static function isDirectoryUsable($directory, $check_writable = true)
{
if ($directory == '') {
- Core\Logger::log('Directory is empty. This shouldn\'t happen.', LOGGER_DEBUG);
+ Core\Logger::log('Directory is empty. This shouldn\'t happen.', Logger::DEBUG);
return false;
}
if (!file_exists($directory)) {
- Core\Logger::log('Path "' . $directory . '" does not exist for user ' . self::getSystemUser(), LOGGER_DEBUG);
+ Core\Logger::log('Path "' . $directory . '" does not exist for user ' . self::getSystemUser(), Logger::DEBUG);
return false;
}
if (is_file($directory)) {
- Core\Logger::log('Path "' . $directory . '" is a file for user ' . self::getSystemUser(), LOGGER_DEBUG);
+ Core\Logger::log('Path "' . $directory . '" is a file for user ' . self::getSystemUser(), Logger::DEBUG);
return false;
}
if (!is_dir($directory)) {
- Core\Logger::log('Path "' . $directory . '" is not a directory for user ' . self::getSystemUser(), LOGGER_DEBUG);
+ Core\Logger::log('Path "' . $directory . '" is not a directory for user ' . self::getSystemUser(), Logger::DEBUG);
return false;
}
if ($check_writable && !is_writable($directory)) {
- Core\Logger::log('Path "' . $directory . '" is not writable for user ' . self::getSystemUser(), LOGGER_DEBUG);
+ Core\Logger::log('Path "' . $directory . '" is not writable for user ' . self::getSystemUser(), Logger::DEBUG);
return false;
}
} else {
// Someone came with an invalid parameter, maybe as a DDoS attempt
// We simply stop processing here
- Core\Logger::log("Invalid ZRL parameter " . $_GET['zrl'], LOGGER_DEBUG);
+ Core\Logger::log("Invalid ZRL parameter " . $_GET['zrl'], Logger::DEBUG);
Core\System::httpExit(403, ['title' => '403 Forbidden']);
}
}
$this->internalRedirect($_SERVER['REQUEST_URI']);
}
- Core\Logger::log('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
+ Core\Logger::log('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], Logger::DEBUG);
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . Core\L10n::t('Not Found'));
$tpl = get_markup_template("404.tpl");
if (!self::checkFormSecurityToken($typename, $formname)) {
$a = get_app();
Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
- Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
+ Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
notice(self::getFormSecurityStandardErrorMessage());
$a->internalRedirect($err_redirect);
}
if (!self::checkFormSecurityToken($typename, $formname)) {
$a = get_app();
Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
- Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
+ Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
header('HTTP/1.1 403 Forbidden');
killme();
}
$Image->scaleDown(640);
$new_width = $Image->getWidth();
$new_height = $Image->getHeight();
- Logger::log('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
+ Logger::log('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], Logger::DEBUG);
$s = str_replace(
$mtch[0],
'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]'
: ''),
$s
);
- Logger::log('scale_external_images: new string: ' . $s, LOGGER_DEBUG);
+ Logger::log('scale_external_images: new string: ' . $s, Logger::DEBUG);
}
}
}
// than the maximum, then don't waste time looking for the images
if ($maxlen && (strlen($body) > $maxlen)) {
- Logger::log('the total body length exceeds the limit', LOGGER_DEBUG);
+ Logger::log('the total body length exceeds the limit', Logger::DEBUG);
$orig_body = $body;
$new_body = '';
if (($textlen + $img_start) > $maxlen) {
if ($textlen < $maxlen) {
- Logger::log('the limit happens before an embedded image', LOGGER_DEBUG);
+ Logger::log('the limit happens before an embedded image', Logger::DEBUG);
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
$textlen = $maxlen;
}
if (($textlen + $img_end) > $maxlen) {
if ($textlen < $maxlen) {
- Logger::log('the limit happens before the end of a non-embedded image', LOGGER_DEBUG);
+ Logger::log('the limit happens before the end of a non-embedded image', Logger::DEBUG);
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
$textlen = $maxlen;
}
if (($textlen + strlen($orig_body)) > $maxlen) {
if ($textlen < $maxlen) {
- Logger::log('the limit happens after the end of the last image', LOGGER_DEBUG);
+ Logger::log('the limit happens after the end of the last image', Logger::DEBUG);
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
}
} else {
- Logger::log('the text size with embedded images extracted did not violate the limit', LOGGER_DEBUG);
+ Logger::log('the text size with embedded images extracted did not violate the limit', Logger::DEBUG);
$new_body = $new_body . $orig_body;
}
}
if ($login_initial) {
- Logger::log('auth_identities: ' . print_r($a->identities, true), LOGGER_DEBUG);
+ Logger::log('auth_identities: ' . print_r($a->identities, true), Logger::DEBUG);
}
if ($login_refresh) {
- Logger::log('auth_identities refresh: ' . print_r($a->identities, true), LOGGER_DEBUG);
+ Logger::log('auth_identities refresh: ' . print_r($a->identities, true), Logger::DEBUG);
}
$contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);
if ($this->memcached->getResultCode() == Memcached::RES_SUCCESS) {
return $this->filterArrayKeysByPrefix($keys, $prefix);
} else {
- Logger::log('Memcached \'getAllKeys\' failed with ' . $this->memcached->getResultMessage(), LOGGER_ALL);
+ Logger::log('Memcached \'getAllKeys\' failed with ' . $this->memcached->getResultMessage(), Logger::ALL);
return [];
}
}
if ($this->memcached->getResultCode() === Memcached::RES_SUCCESS) {
$return = $value;
} else {
- Logger::log('Memcached \'get\' failed with ' . $this->memcached->getResultMessage(), LOGGER_ALL);
+ Logger::log('Memcached \'get\' failed with ' . $this->memcached->getResultMessage(), Logger::ALL);
}
return $return;
break;
}
/// @todo Check if this part here is used at all
- Logger::log('Complete data: ' . json_encode($it) . ' - ' . System::callstack(20), LOGGER_DEBUG);
+ Logger::log('Complete data: ' . json_encode($it) . ' - ' . System::callstack(20), Logger::DEBUG);
$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
$obj = XML::parseString($xmlhead . $it['object']);
Session::$exists = true;
return $data;
}
- Logger::log("no data for session $session_id", LOGGER_TRACE);
+ Logger::log("no data for session $session_id", Logger::TRACE);
return '';
}
Session::$exists = true;
return $session['data'];
}
- Logger::log("no data for session $session_id", LOGGER_TRACE);
+ Logger::log("no data for session $session_id", Logger::TRACE);
return '';
}
private static function checkCols($table, &$arr)
{
$query = sprintf("SHOW COLUMNS IN `%s`", DBA::escape($table));
- Logger::log("uimport: $query", LOGGER_DEBUG);
+ Logger::log("uimport: $query", Logger::DEBUG);
$r = q($query);
$tcols = [];
// get a plain array of column names
$cols = implode("`,`", array_map(['Friendica\Database\DBA', 'escape'], array_keys($arr)));
$vals = implode("','", array_map(['Friendica\Database\DBA', 'escape'], array_values($arr)));
$query = "INSERT INTO `$table` (`$cols`) VALUES ('$vals')";
- Logger::log("uimport: $query", LOGGER_TRACE);
+ Logger::log("uimport: $query", Logger::TRACE);
if (self::IMPORT_DEBUG) {
return true;
// import user
$r = self::dbImportAssoc('user', $account['user']);
if ($r === false) {
- Logger::log("uimport:insert user : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
+ Logger::log("uimport:insert user : ERROR : " . DBA::errorMessage(), Logger::INFO);
notice(L10n::t("User creation error"));
return;
}
$profile['uid'] = $newuid;
$r = self::dbImportAssoc('profile', $profile);
if ($r === false) {
- Logger::log("uimport:insert profile " . $profile['profile-name'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
+ Logger::log("uimport:insert profile " . $profile['profile-name'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
info(L10n::t("User profile creation error"));
DBA::delete('user', ['uid' => $newuid]);
return;
$contact['uid'] = $newuid;
$r = self::dbImportAssoc('contact', $contact);
if ($r === false) {
- Logger::log("uimport:insert contact " . $contact['nick'] . "," . $contact['network'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
+ Logger::log("uimport:insert contact " . $contact['nick'] . "," . $contact['network'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
$errorcount++;
} else {
$contact['newid'] = self::lastInsertId();
$group['uid'] = $newuid;
$r = self::dbImportAssoc('group', $group);
if ($r === false) {
- Logger::log("uimport:insert group " . $group['name'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
+ Logger::log("uimport:insert group " . $group['name'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
} else {
$group['newid'] = self::lastInsertId();
}
if ($import == 2) {
$r = self::dbImportAssoc('group_member', $group_member);
if ($r === false) {
- Logger::log("uimport:insert group member " . $group_member['id'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
+ Logger::log("uimport:insert group member " . $group_member['id'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
}
}
}
);
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);
}
}
$pconfig['uid'] = $newuid;
$r = self::dbImportAssoc('pconfig', $pconfig);
if ($r === false) {
- Logger::log("uimport:insert pconfig " . $pconfig['id'] . " : ERROR : " . DBA::errorMessage(), LOGGER_INFO);
+ Logger::log("uimport:insert pconfig " . $pconfig['id'] . " : ERROR : " . DBA::errorMessage(), Logger::INFO);
}
}
// At first check the maximum load. We shouldn't continue with a high load
if ($a->isMaxLoadReached()) {
- Logger::log('Pre check: maximum load reached, quitting.', LOGGER_DEBUG);
+ Logger::log('Pre check: maximum load reached, quitting.', Logger::DEBUG);
return;
}
// Count active workers and compare them with a maximum value that depends on the load
if (self::tooMuchWorkers()) {
- Logger::log('Pre check: Active worker limit reached, quitting.', LOGGER_DEBUG);
+ Logger::log('Pre check: Active worker limit reached, quitting.', Logger::DEBUG);
return;
}
// Do we have too few memory?
if ($a->isMinMemoryReached()) {
- Logger::log('Pre check: Memory limit reached, quitting.', LOGGER_DEBUG);
+ Logger::log('Pre check: Memory limit reached, quitting.', Logger::DEBUG);
return;
}
// Possibly there are too much database connections
if (self::maxConnectionsReached()) {
- Logger::log('Pre check: maximum connections reached, quitting.', LOGGER_DEBUG);
+ Logger::log('Pre check: maximum connections reached, quitting.', Logger::DEBUG);
return;
}
// Possibly there are too much database processes that block the system
if ($a->isMaxProcessesReached()) {
- Logger::log('Pre check: maximum processes reached, quitting.', LOGGER_DEBUG);
+ Logger::log('Pre check: maximum processes reached, quitting.', Logger::DEBUG);
return;
}
// The work will be done
if (!self::execute($entry)) {
- Logger::log('Process execution failed, quitting.', LOGGER_DEBUG);
+ Logger::log('Process execution failed, quitting.', Logger::DEBUG);
return;
}
$stamp = (float)microtime(true);
// Count active workers and compare them with a maximum value that depends on the load
if (self::tooMuchWorkers()) {
- Logger::log('Active worker limit reached, quitting.', LOGGER_DEBUG);
+ Logger::log('Active worker limit reached, quitting.', Logger::DEBUG);
Lock::release('worker');
return;
}
// Check free memory
if ($a->isMinMemoryReached()) {
- Logger::log('Memory limit reached, quitting.', LOGGER_DEBUG);
+ Logger::log('Memory limit reached, quitting.', Logger::DEBUG);
Lock::release('worker');
return;
}
// Quit the worker once every 5 minutes
if (time() > ($starttime + 300)) {
- Logger::log('Process lifetime reached, quitting.', LOGGER_DEBUG);
+ Logger::log('Process lifetime reached, quitting.', Logger::DEBUG);
return;
}
}
if (Config::get('system', 'worker_daemon_mode', false)) {
self::IPCSetJobState(false);
}
- Logger::log("Couldn't select a workerqueue entry, quitting process " . getmypid() . ".", LOGGER_DEBUG);
+ Logger::log("Couldn't select a workerqueue entry, quitting process " . getmypid() . ".", Logger::DEBUG);
}
/**
// Quit when in maintenance
if (Config::get('system', 'maintenance', false, true)) {
- Logger::log("Maintenance mode - quit process ".$mypid, LOGGER_DEBUG);
+ Logger::log("Maintenance mode - quit process ".$mypid, Logger::DEBUG);
return false;
}
// Constantly check the number of parallel database processes
if ($a->isMaxProcessesReached()) {
- Logger::log("Max processes reached for process ".$mypid, LOGGER_DEBUG);
+ Logger::log("Max processes reached for process ".$mypid, Logger::DEBUG);
return false;
}
// Constantly check the number of available database connections to let the frontend be accessible at any time
if (self::maxConnectionsReached()) {
- Logger::log("Max connection reached for process ".$mypid, LOGGER_DEBUG);
+ Logger::log("Max connection reached for process ".$mypid, Logger::DEBUG);
return false;
}
' - Lock: '.number_format(self::$lock_duration, 2).
' - Rest: '.number_format($up_duration - self::$db_duration - self::$lock_duration, 2).
' - Execution: '.number_format($duration, 2),
- LOGGER_DEBUG
+ Logger::DEBUG
);
self::$lock_duration = 0;
if ($duration > 3600) {
- Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 1 hour (".round($duration/60, 3).")", LOGGER_DEBUG);
+ Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 1 hour (".round($duration/60, 3).")", Logger::DEBUG);
} elseif ($duration > 600) {
- Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 10 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
+ Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 10 minutes (".round($duration/60, 3).")", Logger::DEBUG);
} elseif ($duration > 300) {
- Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 5 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
+ Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 5 minutes (".round($duration/60, 3).")", Logger::DEBUG);
} elseif ($duration > 120) {
- Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 2 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
+ Logger::log("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 2 minutes (".round($duration/60, 3).")", Logger::DEBUG);
}
Logger::log("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - done in ".$duration." seconds. Process PID: ".$new_process_id);
+ $a->performance["network"] + $a->performance["file"]), 2),
number_format($duration, 2)
),
- LOGGER_DEBUG
+ Logger::DEBUG
);
}
$used = DBA::numRows($r);
DBA::close($r);
- Logger::log("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
+ Logger::log("Connection usage (user values): ".$used."/".$max, Logger::DEBUG);
$level = ($used / $max) * 100;
if ($used == 0) {
return false;
}
- Logger::log("Connection usage (system values): ".$used."/".$max, LOGGER_DEBUG);
+ Logger::log("Connection usage (system values): ".$used."/".$max, Logger::DEBUG);
$level = $used / $max * 100;
['id' => $entry["id"]]
);
} else {
- Logger::log("Worker process ".$entry["pid"]." (".substr(json_encode($argv), 0, 50).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
+ Logger::log("Worker process ".$entry["pid"]." (".substr(json_encode($argv), 0, 50).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", Logger::DEBUG);
}
}
}
$high_running = self::processWithPriorityActive($top_priority);
if (!$high_running && ($top_priority > PRIORITY_UNDEFINED) && ($top_priority < PRIORITY_NEGLIGIBLE)) {
- Logger::log("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", LOGGER_DEBUG);
+ Logger::log("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", Logger::DEBUG);
$queues = $active + 1;
}
}
- Logger::log("Load: " . $load ."/" . $maxsysload . " - processes: " . $deferred . "/" . $active . "/" . $entries . $processlist . " - maximum: " . $queues . "/" . $maxqueues, LOGGER_DEBUG);
+ Logger::log("Load: " . $load ."/" . $maxsysload . " - processes: " . $deferred . "/" . $active . "/" . $entries . $processlist . " - maximum: " . $queues . "/" . $maxqueues, Logger::DEBUG);
// Are there fewer workers running as possible? Then fork a new one.
if (!Config::get("system", "worker_dont_fork", false) && ($queues > ($active + 1)) && ($entries > 1)) {
- Logger::log("Active workers: ".$active."/".$queues." Fork a new worker.", LOGGER_DEBUG);
+ Logger::log("Active workers: ".$active."/".$queues." Fork a new worker.", Logger::DEBUG);
if (Config::get('system', 'worker_daemon_mode', false)) {
self::IPCSetJobState(true);
} else {
++$high;
}
}
- Logger::log("Highest priority: ".$highest_priority." Total processes: ".count($priorities)." Count high priority processes: ".$high, LOGGER_DEBUG);
+ Logger::log("Highest priority: ".$highest_priority." Total processes: ".count($priorities)." Count high priority processes: ".$high, Logger::DEBUG);
$passing_slow = (($high/count($priorities)) > (2/3));
if ($passing_slow) {
- Logger::log("Passing slower processes than priority ".$highest_priority, LOGGER_DEBUG);
+ Logger::log("Passing slower processes than priority ".$highest_priority, Logger::DEBUG);
}
return $passing_slow;
}
$slope = $queue_length / pow($lower_job_limit, $exponent);
$limit = min($queue_length, ceil($slope * pow($jobs, $exponent)));
- Logger::log('Deferred: ' . $deferred . ' - Total: ' . $jobs . ' - Maximum: ' . $queue_length . ' - jobs per queue: ' . $limit, LOGGER_DEBUG);
+ Logger::log('Deferred: ' . $deferred . ' - Total: ' . $jobs . ' - Maximum: ' . $queue_length . ' - jobs per queue: ' . $limit, Logger::DEBUG);
$ids = [];
if (self::passingSlow($highest_priority)) {
// Are there waiting processes with a higher priority than the currently highest?
self::runCron();
- Logger::log('Call worker', LOGGER_DEBUG);
+ Logger::log('Call worker', Logger::DEBUG);
self::spawnWorker();
return;
}
*/
private static function runCron()
{
- Logger::log('Add cron entries', LOGGER_DEBUG);
+ Logger::log('Add cron entries', Logger::DEBUG);
// Check for spooled items
self::add(PRIORITY_HIGH, "SpoolPost");
$id = $queue['id'];
if ($retrial > 14) {
- Logger::log('Id ' . $id . ' had been tried 14 times. We stop now.', LOGGER_DEBUG);
+ Logger::log('Id ' . $id . ' had been tried 14 times. We stop now.', Logger::DEBUG);
return;
}
$delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
- Logger::log('Defer execution ' . $retrial . ' of id ' . $id . ' to ' . $next, LOGGER_DEBUG);
+ Logger::log('Defer execution ' . $retrial . ' of id ' . $id . ' to ' . $next, Logger::DEBUG);
$fields = ['retrial' => $retrial + 1, 'next_try' => $next, 'executed' => DBA::NULL_DATETIME, 'pid' => 0];
DBA::update('workerqueue', $fields, ['id' => $id]);
if ((substr_count($sql, '?') != count($args)) && (count($args) > 0)) {
// Question: Should we continue or stop the query here?
- Logger::log('Parameter mismatch. Query "'.$sql.'" - Parameters '.print_r($args, true), LOGGER_DEBUG);
+ Logger::log('Parameter mismatch. Query "'.$sql.'" - Parameters '.print_r($args, true), Logger::DEBUG);
}
$sql = self::cleanQuery($sql);
if ((count($command['conditions']) > 1) || is_int($first_key)) {
$sql = "DELETE FROM `" . $command['table'] . "`" . $condition_string;
- Logger::log(self::replaceParameters($sql, $conditions), LOGGER_DATA);
+ Logger::log(self::replaceParameters($sql, $conditions), Logger::DATA);
if (!self::e($sql, $conditions)) {
if ($do_transaction) {
$sql = "DELETE FROM `" . $table . "` WHERE `" . $field . "` IN (" .
substr(str_repeat("?, ", count($field_values)), 0, -2) . ");";
- Logger::log(self::replaceParameters($sql, $field_values), LOGGER_DATA);
+ Logger::log(self::replaceParameters($sql, $field_values), Logger::DATA);
if (!self::e($sql, $field_values)) {
if ($do_transaction) {
// No valid result?
if (!DBA::isResult($adminlist)) {
- Logger::log(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_INFO);
+ Logger::log(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), Logger::INFO);
// Don't continue
return;
$errors = '';
- Logger::log('updating structure', LOGGER_DEBUG);
+ Logger::log('updating structure', Logger::DEBUG);
// Get the current structure
$database = [];
foreach ($tables AS $table) {
$table = current($table);
- Logger::log(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
+ Logger::log(sprintf('updating structure for table %s ...', $table), Logger::DEBUG);
$database[$table] = self::tableStructure($table);
}
}
return true;
}
- Logger::log("Start", LOGGER_DEBUG);
+ Logger::log("Start", Logger::DEBUG);
$end_id = Config::get("system", "post_update_1194_end");
if (!$end_id) {
}
}
- 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");
DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
if (!$r) {
Config::set("system", "post_update_version", 1194);
- Logger::log("Update is done", LOGGER_DEBUG);
+ Logger::log("Update is done", Logger::DEBUG);
return true;
} else {
Config::set("system", "post_update_1194_start", $r[0]["id"]);
$start_id = Config::get("system", "post_update_1194_start");
}
- Logger::log("Start ID: ".$start_id, LOGGER_DEBUG);
+ Logger::log("Start ID: ".$start_id, Logger::DEBUG);
$r = q($query1.$query2.$query3." ORDER BY `item`.`id` LIMIT 1000,1",
intval($start_id), intval($end_id),
} else {
$pos_id = $end_id;
}
- Logger::log("Progress: Start: ".$start_id." position: ".$pos_id." end: ".$end_id, LOGGER_DEBUG);
+ Logger::log("Progress: Start: ".$start_id." position: ".$pos_id." end: ".$end_id, Logger::DEBUG);
q("UPDATE `item` ".$query2." SET `item`.`global` = 1 ".$query3,
intval($start_id), intval($pos_id),
DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
- Logger::log("Done", LOGGER_DEBUG);
+ Logger::log("Done", Logger::DEBUG);
}
/**
return true;
}
- Logger::log("Start", LOGGER_DEBUG);
+ Logger::log("Start", Logger::DEBUG);
$r = q("SELECT `contact`.`id`, `contact`.`last-item`,
(SELECT MAX(`changed`) FROM `item` USE INDEX (`uid_wall_changed`) WHERE `wall` AND `uid` = `user`.`uid`) AS `lastitem_date`
FROM `user`
}
Config::set("system", "post_update_version", 1206);
- Logger::log("Done", LOGGER_DEBUG);
+ Logger::log("Done", Logger::DEBUG);
return true;
}
$id = Config::get("system", "post_update_version_1279_id", 0);
- Logger::log("Start from item " . $id, LOGGER_DEBUG);
+ Logger::log("Start from item " . $id, Logger::DEBUG);
$fields = array_merge(Item::MIXED_CONTENT_FIELDLIST, ['network', 'author-id', 'owner-id', 'tag', 'file',
'author-name', 'author-avatar', 'author-link', 'owner-name', 'owner-avatar', 'owner-link', 'id',
Config::set("system", "post_update_version_1279_id", $id);
- Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, LOGGER_DEBUG);
+ Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG);
if ($start_id == $id) {
// Set all deprecated fields to "null" if they contain an empty string
foreach ($nullfields as $field) {
$fields = [$field => null];
$condition = [$field => ''];
- Logger::log("Setting '" . $field . "' to null if empty.", LOGGER_DEBUG);
+ Logger::log("Setting '" . $field . "' to null if empty.", Logger::DEBUG);
// Important: This has to be a "DBA::update", not a "Item::update"
DBA::update('item', $fields, $condition);
}
Config::set("system", "post_update_version", 1279);
- Logger::log("Done", LOGGER_DEBUG);
+ Logger::log("Done", Logger::DEBUG);
return true;
}
$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'];
Config::set("system", "post_update_version_1281_id", $id);
- Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, LOGGER_DEBUG);
+ Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG);
if ($start_id == $id) {
- Logger::log("Updating item-uri in item-activity", LOGGER_DEBUG);
+ Logger::log("Updating item-uri in item-activity", Logger::DEBUG);
DBA::e("UPDATE `item-activity` INNER JOIN `item-uri` ON `item-uri`.`uri` = `item-activity`.`uri` SET `item-activity`.`uri-id` = `item-uri`.`id` WHERE `item-activity`.`uri-id` IS NULL");
- Logger::log("Updating item-uri in item-content", LOGGER_DEBUG);
+ Logger::log("Updating item-uri in item-content", Logger::DEBUG);
DBA::e("UPDATE `item-content` INNER JOIN `item-uri` ON `item-uri`.`uri` = `item-content`.`uri` SET `item-content`.`uri-id` = `item-uri`.`id` WHERE `item-content`.`uri-id` IS NULL");
Config::set("system", "post_update_version", 1281);
- Logger::log("Done", LOGGER_DEBUG);
+ Logger::log("Done", Logger::DEBUG);
return true;
}
// Update the gcontact table
DBA::update('gcontact', $contact_fields, ['nurl' => normalise_link($url)]);
- Logger::log('Updated profile for ' . $url, LOGGER_DEBUG);
+ Logger::log('Updated profile for ' . $url, Logger::DEBUG);
return $apcontact;
}
return;
}
} elseif (!isset($contact['url'])) {
- Logger::log('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), LOGGER_DEBUG);
+ Logger::log('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), Logger::DEBUG);
}
// Contact already archived or "self" contact? => nothing to do
*/
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;
}
if (!DBA::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) {
Logger::log('Conversation: update for ' . $conversation['item-uri'] . ' from ' . $old_conv['protocol'] . ' to ' . $conversation['protocol'] . ' failed',
- LOGGER_DEBUG);
+ Logger::DEBUG);
}
} else {
if (!DBA::insert('conversation', $conversation, true)) {
Logger::log('Conversation: insert for ' . $conversation['item-uri'] . ' (protocol ' . $conversation['protocol'] . ') failed',
- LOGGER_DEBUG);
+ Logger::DEBUG);
}
}
}
}
DBA::delete('event', ['id' => $event_id]);
- Logger::log("Deleted event ".$event_id, LOGGER_DEBUG);
+ Logger::log("Deleted event ".$event_id, Logger::DEBUG);
}
/**
}
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;
if (($contact["network"] == Protocol::OSTATUS) && PortableContact::alternateOStatusUrl($contact["url"])) {
$data = Probe::uri($contact["url"]);
if ($contact["network"] == Protocol::OSTATUS) {
- Logger::log("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
+ Logger::log("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".System::callstack(), Logger::DEBUG);
$contact["url"] = $data["url"];
$contact["addr"] = $data["addr"];
$contact["alias"] = $data["alias"];
$last_contact_str = '';
if (empty($contact["network"])) {
- Logger::log("Empty network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
+ Logger::log("Empty network for contact url ".$contact["url"]." - Called by: ".System::callstack(), Logger::DEBUG);
return false;
}
if (in_array($contact["network"], [Protocol::PHANTOM])) {
- Logger::log("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
+ Logger::log("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), Logger::DEBUG);
return false;
}
DBA::unlock();
if ($doprobing) {
- Logger::log("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
+ Logger::log("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], Logger::DEBUG);
Worker::add(PRIORITY_LOW, 'GProbe', $contact["url"]);
}
if ((($contact["generation"] > 0) && ($contact["generation"] <= $public_contact[0]["generation"])) || ($public_contact[0]["generation"] == 0)) {
foreach ($fields as $field => $data) {
if ($contact[$field] != $public_contact[0][$field]) {
- Logger::log("Difference for contact ".$contact["url"]." in field '".$field."'. New value: '".$contact[$field]."', old value '".$public_contact[0][$field]."'", LOGGER_DEBUG);
+ Logger::log("Difference for contact ".$contact["url"]." in field '".$field."'. New value: '".$contact[$field]."', old value '".$public_contact[0][$field]."'", Logger::DEBUG);
$update = true;
}
}
if ($contact["generation"] < $public_contact[0]["generation"]) {
- Logger::log("Difference for contact ".$contact["url"]." in field 'generation'. new value: '".$contact["generation"]."', old value '".$public_contact[0]["generation"]."'", LOGGER_DEBUG);
+ Logger::log("Difference for contact ".$contact["url"]." in field 'generation'. new value: '".$contact["generation"]."', old value '".$public_contact[0]["generation"]."'", Logger::DEBUG);
$update = true;
}
}
if ($update) {
- Logger::log("Update gcontact for ".$contact["url"], LOGGER_DEBUG);
+ Logger::log("Update gcontact for ".$contact["url"], Logger::DEBUG);
$condition = ['`nurl` = ? AND (`generation` = 0 OR `generation` >= ?)',
normalise_link($contact["url"]), $contact["generation"]];
$contact["updated"] = DateTimeFormat::utc($contact["updated"]);
// The quality of the gcontact table is mostly lower than the public contact
$public_contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link($contact["url"]), 'uid' => 0]);
if (DBA::isResult($public_contact)) {
- Logger::log("Update public contact ".$public_contact["id"], LOGGER_DEBUG);
+ Logger::log("Update public contact ".$public_contact["id"], Logger::DEBUG);
Contact::updateAvatar($contact["photo"], 0, $public_contact["id"]);
$data = Probe::uri($url);
if (in_array($data["network"], [Protocol::PHANTOM])) {
- Logger::log("Invalid network for contact url ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
+ Logger::log("Invalid network for contact url ".$data["url"]." - Called by: ".System::callstack(), Logger::DEBUG);
return;
}
);
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;
}
*/
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";
'icid', 'iaid', 'psid'];
$item = self::selectFirst($fields, ['id' => $item_id]);
if (!DBA::isResult($item)) {
- Logger::log('Item with ID ' . $item_id . " hasn't been found.", LOGGER_DEBUG);
+ Logger::log('Item with ID ' . $item_id . " hasn't been found.", Logger::DEBUG);
return false;
}
if ($item['deleted']) {
- Logger::log('Item with ID ' . $item_id . ' has already been deleted.', LOGGER_DEBUG);
+ Logger::log('Item with ID ' . $item_id . ' has already been deleted.', Logger::DEBUG);
return false;
}
}
}
- 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;
}
if (!empty($contact_id)) {
return $contact_id;
}
- Logger::log('Missing contact-id. Called by: '.System::callstack(), LOGGER_DEBUG);
+ Logger::log('Missing contact-id. Called by: '.System::callstack(), Logger::DEBUG);
/*
* First we are looking for a suitable contact that matches with the author of the post
* This is done only for comments
$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;
}
$item['gravity'] = GRAVITY_COMMENT;
} else {
$item['gravity'] = GRAVITY_UNKNOWN; // Should not happen
- Logger::log('Unknown gravity for verb: ' . $item['verb'], LOGGER_DEBUG);
+ Logger::log('Unknown gravity for verb: ' . $item['verb'], Logger::DEBUG);
}
$uid = intval($item['uid']);
$expire_date = time() - ($expire_interval * 86400);
$created_date = strtotime($item['created']);
if ($created_date < $expire_date) {
- Logger::log('item-store: item created ('.date('c', $created_date).') before expiration time ('.date('c', $expire_date).'). ignored. ' . print_r($item,true), LOGGER_DEBUG);
+ Logger::log('item-store: item created ('.date('c', $created_date).') before expiration time ('.date('c', $expire_date).'). ignored. ' . print_r($item,true), Logger::DEBUG);
return 0;
}
}
}
if ($item['network'] == Protocol::PHANTOM) {
- Logger::log('Missing network. Called by: '.System::callstack(), LOGGER_DEBUG);
+ Logger::log('Missing network. Called by: '.System::callstack(), Logger::DEBUG);
$item['network'] = Protocol::DFRN;
- Logger::log("Set network to " . $item["network"] . " for " . $item["uri"], LOGGER_DEBUG);
+ Logger::log("Set network to " . $item["network"] . " for " . $item["uri"], Logger::DEBUG);
}
// Checking if there is already an item with the same guid
- Logger::log('Checking for an item for user '.$item['uid'].' on network '.$item['network'].' with the guid '.$item['guid'], LOGGER_DEBUG);
+ Logger::log('Checking for an item for user '.$item['uid'].' on network '.$item['network'].' with the guid '.$item['guid'], Logger::DEBUG);
$condition = ['guid' => $item['guid'], 'network' => $item['network'], 'uid' => $item['uid']];
if (self::exists($condition)) {
- Logger::log('found item with guid '.$item['guid'].' for user '.$item['uid'].' on network '.$item['network'], LOGGER_DEBUG);
+ Logger::log('found item with guid '.$item['guid'].' for user '.$item['uid'].' on network '.$item['network'], Logger::DEBUG);
return 0;
}
}
// If its a post from myself then tag the thread as "mention"
- Logger::log("Checking if parent ".$parent_id." has to be tagged as mention for user ".$item['uid'], LOGGER_DEBUG);
+ Logger::log("Checking if parent ".$parent_id." has to be tagged as mention for user ".$item['uid'], Logger::DEBUG);
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $item['uid']]);
if (DBA::isResult($user)) {
$self = normalise_link(System::baseUrl() . '/profile/' . $user['nickname']);
$self_id = Contact::getIdForURL($self, 0, true);
- Logger::log("'myself' is ".$self_id." for parent ".$parent_id." checking against ".$item['author-id']." and ".$item['owner-id'], LOGGER_DEBUG);
+ Logger::log("'myself' is ".$self_id." for parent ".$parent_id." checking against ".$item['author-id']." and ".$item['owner-id'], Logger::DEBUG);
if (($item['author-id'] == $self_id) || ($item['owner-id'] == $self_id)) {
DBA::update('thread', ['mention' => true], ['iid' => $parent_id]);
- Logger::log("tagged thread ".$parent_id." as mention for user ".$self, LOGGER_DEBUG);
+ Logger::log("tagged thread ".$parent_id." as mention for user ".$self, Logger::DEBUG);
}
}
} else {
*/
if ($item["uid"] == 0) {
if (self::exists(['uri' => trim($item['uri']), 'uid' => 0])) {
- Logger::log('Global item already stored. URI: '.$item['uri'].' on network '.$item['network'], LOGGER_DEBUG);
+ Logger::log('Global item already stored. URI: '.$item['uri'].' on network '.$item['network'], Logger::DEBUG);
return 0;
}
}
- Logger::log('' . print_r($item,true), LOGGER_DATA);
+ Logger::log('' . print_r($item,true), Logger::DATA);
if (array_key_exists('tag', $item)) {
$tags = $item['tag'];
$item = array_merge($item, $delivery_data);
file_put_contents($spool, json_encode($item));
- Logger::log("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG);
+ Logger::log("Item wasn't stored - Item was spooled into file ".$file, Logger::DEBUG);
}
return 0;
}
*/
if (base64_encode(base64_decode(base64_decode($dsprsig->signature))) == base64_decode($dsprsig->signature)) {
$dsprsig->signature = base64_decode($dsprsig->signature);
- Logger::log("Repaired double encoded signature from handle ".$dsprsig->signer, LOGGER_DEBUG);
+ Logger::log("Repaired double encoded signature from handle ".$dsprsig->signer, Logger::DEBUG);
}
if (!empty($dsprsig->signed_text) && empty($dsprsig->signature) && empty($dsprsig->signer)) {
$distributed = self::insert($item, false, $notify, true);
if (!$distributed) {
- Logger::log("Distributed public item " . $itemid . " for user " . $uid . " wasn't stored", LOGGER_DEBUG);
+ Logger::log("Distributed public item " . $itemid . " for user " . $uid . " wasn't stored", Logger::DEBUG);
} else {
- Logger::log("Distributed public item " . $itemid . " for user " . $uid . " with id " . $distributed, LOGGER_DEBUG);
+ Logger::log("Distributed public item " . $itemid . " for user " . $uid . " with id " . $distributed, Logger::DEBUG);
}
}
$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);
}
}
$public_shadow = self::insert($item, false, false, true);
- Logger::log("Stored public shadow for comment ".$item['uri']." under id ".$public_shadow, LOGGER_DEBUG);
+ Logger::log("Stored public shadow for comment ".$item['uri']." under id ".$public_shadow, Logger::DEBUG);
// If this was a comment to a Diaspora post we don't get our comment back.
// This means that we have to distribute the comment by ourselves.
// Prevent the forwarding of posts that are forwarded
if (!empty($datarray["extid"]) && ($datarray["extid"] == Protocol::DFRN)) {
- Logger::log('Already forwarded', LOGGER_DEBUG);
+ Logger::log('Already forwarded', Logger::DEBUG);
return false;
}
// Prevent to forward already forwarded posts
if ($datarray["app"] == $a->getHostName()) {
- Logger::log('Already forwarded (second test)', LOGGER_DEBUG);
+ Logger::log('Already forwarded (second test)', Logger::DEBUG);
return false;
}
// Only forward posts
if ($datarray["verb"] != ACTIVITY_POST) {
- Logger::log('No post', LOGGER_DEBUG);
+ Logger::log('No post', Logger::DEBUG);
return false;
}
if (($contact['network'] != Protocol::FEED) && $datarray['private']) {
- Logger::log('Not public', LOGGER_DEBUG);
+ Logger::log('Not public', Logger::DEBUG);
return false;
}
$datarray2 = $datarray;
- Logger::log('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG);
+ Logger::log('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), Logger::DEBUG);
if ($contact['remote_self'] == 2) {
$self = DBA::selectFirst('contact', ['id', 'name', 'url', 'thumb'],
['uid' => $contact['uid'], 'self' => true]);
if ($contact['network'] != Protocol::FEED) {
// Store the original post
$result = self::insert($datarray2, false, false);
- Logger::log('remote-self post original item - Contact '.$contact['url'].' return '.$result.' Item '.print_r($datarray2, true), LOGGER_DEBUG);
+ Logger::log('remote-self post original item - Contact '.$contact['url'].' return '.$result.' Item '.print_r($datarray2, true), Logger::DEBUG);
} else {
$datarray["app"] = "Feed";
$result = true;
return $s;
}
- Logger::log('check for photos', LOGGER_DEBUG);
+ Logger::log('check for photos', Logger::DEBUG);
$site = substr(System::baseUrl(), strpos(System::baseUrl(), '://'));
$orig_body = $s;
$img_st_close++; // make it point to AFTER the closing bracket
$image = substr($orig_body, $img_start + $img_st_close, $img_len);
- Logger::log('found photo ' . $image, LOGGER_DEBUG);
+ Logger::log('found photo ' . $image, Logger::DEBUG);
if (stristr($image, $site . '/photo/')) {
// Only embed locally hosted photos
// If a custom width and height were specified, apply before embedding
if (preg_match("/\[img\=([0-9]*)x([0-9]*)\]/is", substr($orig_body, $img_start, $img_st_close), $match)) {
- Logger::log('scaling photo', LOGGER_DEBUG);
+ Logger::log('scaling photo', Logger::DEBUG);
$width = intval($match[1]);
$height = intval($match[2]);
}
}
- Logger::log('replacing photo', LOGGER_DEBUG);
+ Logger::log('replacing photo', Logger::DEBUG);
$image = 'data:' . $type . ';base64,' . base64_encode($data);
- Logger::log('replaced: ' . $image, LOGGER_DATA);
+ Logger::log('replaced: ' . $image, Logger::DATA);
}
}
}
if (!$onlyshadow) {
$result = DBA::insert('thread', $item);
- Logger::log("Add thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
+ Logger::log("Add thread for item ".$itemid." - ".print_r($result, true), Logger::DEBUG);
}
}
$result = DBA::update('thread', $fields, ['iid' => $itemid]);
- Logger::log("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".(int)$result, LOGGER_DEBUG);
+ Logger::log("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".(int)$result, Logger::DEBUG);
}
private static function deleteThread($itemid, $itemuri = "")
{
$item = DBA::selectFirst('thread', ['uid'], ['iid' => $itemid]);
if (!DBA::isResult($item)) {
- Logger::log('No thread found for id '.$itemid, LOGGER_DEBUG);
+ Logger::log('No thread found for id '.$itemid, Logger::DEBUG);
return;
}
$result = DBA::delete('thread', ['iid' => $itemid], ['cascade' => false]);
- Logger::log("deleteThread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
+ Logger::log("deleteThread: Deleted thread for item ".$itemid." - ".print_r($result, true), Logger::DEBUG);
if ($itemuri != "") {
$condition = ["`uri` = ? AND NOT `deleted` AND NOT (`uid` IN (?, 0))", $itemuri, $item["uid"]];
if (!self::exists($condition)) {
DBA::delete('item', ['uri' => $itemuri, 'uid' => 0]);
- Logger::log("deleteThread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG);
+ Logger::log("deleteThread: Deleted shadow for item ".$itemuri, Logger::DEBUG);
}
}
}
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
if (!DBA::isResult($user) && empty($profiledata)) {
- Logger::log('profile error: ' . $a->query_string, LOGGER_DEBUG);
+ Logger::log('profile error: ' . $a->query_string, Logger::DEBUG);
notice(L10n::t('Requested account is not available.') . EOL);
$a->error = 404;
return;
$pdata = self::getByNickname($nickname, $user['uid'], $profile);
if (empty($pdata) && empty($profiledata)) {
- Logger::log('profile error: ' . $a->query_string, LOGGER_DEBUG);
+ Logger::log('profile error: ' . $a->query_string, Logger::DEBUG);
notice(L10n::t('Requested profile is not available.') . EOL);
$a->error = 404;
return;
// Try to find the public contact entry of the visitor.
$cid = Contact::getIdForURL($my_url);
if (!$cid) {
- Logger::log('No contact record found for ' . $my_url, LOGGER_DEBUG);
+ Logger::log('No contact record found for ' . $my_url, Logger::DEBUG);
return;
}
$contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
- Logger::log('The visitor ' . $my_url . ' is already authenticated', LOGGER_DEBUG);
+ Logger::log('The visitor ' . $my_url . ' is already authenticated', Logger::DEBUG);
return;
}
// Avoid endless loops
$cachekey = 'zrlInit:' . $my_url;
if (Cache::get($cachekey)) {
- Logger::log('URL ' . $my_url . ' already tried to authenticate.', LOGGER_DEBUG);
+ Logger::log('URL ' . $my_url . ' already tried to authenticate.', Logger::DEBUG);
return;
} else {
Cache::set($cachekey, true, Cache::MINUTE);
}
- Logger::log('Not authenticated. Invoking reverse magic-auth for ' . $my_url, LOGGER_DEBUG);
+ Logger::log('Not authenticated. Invoking reverse magic-auth for ' . $my_url, Logger::DEBUG);
Worker::add(PRIORITY_LOW, 'GProbe', $my_url);
// We have to check if the remote server does understand /magic without invoking something
$serverret = Network::curl($basepath . '/magic');
if ($serverret->isSuccess()) {
- Logger::log('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path, LOGGER_DEBUG);
+ Logger::log('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path, Logger::DEBUG);
System::externalRedirect($magic_path);
}
}
// Try to find the public contact entry of the visitor.
$cid = Contact::getIdForURL($visitor_handle);
if(!$cid) {
- Logger::log('owt: unable to finger ' . $visitor_handle, LOGGER_DEBUG);
+ Logger::log('owt: unable to finger ' . $visitor_handle, Logger::DEBUG);
return;
}
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)
$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']);
}
if ($days > 60) {
DBA::update('push_subscriber', ['push' => -1, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
- Logger::log('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', LOGGER_DEBUG);
+ Logger::log('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', Logger::DEBUG);
} else {
DBA::update('push_subscriber', ['push' => 0, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
- Logger::log('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', LOGGER_DEBUG);
+ Logger::log('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', Logger::DEBUG);
}
} else {
// Calculate the delay until the next trial
$retrial = $retrial + 1;
DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
- Logger::log('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, LOGGER_DEBUG);
+ Logger::log('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, Logger::DEBUG);
}
}
// set last_update to the 'created' date of the last item, and reset push=0
$fields = ['push' => 0, 'next_try' => DBA::NULL_DATETIME, 'last_update' => $last_update];
DBA::update('push_subscriber', $fields, ['id' => $id]);
- Logger::log('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', LOGGER_DEBUG);
+ Logger::log('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', Logger::DEBUG);
}
}
$username_max_length = max(1, min(64, intval(Config::get('system', 'username_max_length', 48))));
if ($username_min_length > $username_max_length) {
- Logger::log(L10n::t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), LOGGER_WARNING);
+ Logger::log(L10n::t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), Logger::WARNING);
$tmp = $username_min_length;
$username_min_length = $username_max_length;
$username_max_length = $tmp;
{
$a = self::getApp();
$ret = ['success' => false, 'url' => '', 'message' => ''];
- Logger::log('magic mdule: invoked', LOGGER_DEBUG);
+ Logger::log('magic mdule: invoked', Logger::DEBUG);
- Logger::log('args: ' . print_r($_REQUEST, true), LOGGER_DATA);
+ Logger::log('args: ' . print_r($_REQUEST, true), Logger::DATA);
$addr = ((x($_REQUEST, 'addr')) ? $_REQUEST['addr'] : '');
$dest = ((x($_REQUEST, 'dest')) ? $_REQUEST['dest'] : '');
}
if (!$cid) {
- Logger::log('No contact record found: ' . print_r($_REQUEST, true), LOGGER_DEBUG);
+ Logger::log('No contact record found: ' . print_r($_REQUEST, true), Logger::DEBUG);
// @TODO Finding a more elegant possibility to redirect to either internal or external URL
$a->redirect($dest);
}
return $ret;
}
- Logger::log('Contact is already authenticated', LOGGER_DEBUG);
+ Logger::log('Contact is already authenticated', Logger::DEBUG);
System::externalRedirect($dest);
}
$verified = HTTPSignature::verifyMagic($contact['pubkey']);
if ($verified && $verified['header_signed'] && $verified['header_valid']) {
- Logger::log('OWA header: ' . print_r($verified, true), LOGGER_DATA);
- Logger::log('OWA success: ' . $contact['addr'], LOGGER_DATA);
+ Logger::log('OWA header: ' . print_r($verified, true), Logger::DATA);
+ Logger::log('OWA success: ' . $contact['addr'], Logger::DATA);
$ret['success'] = true;
$token = random_string(32);
openssl_public_encrypt($token, $result, $contact['pubkey']);
$ret['encrypted_token'] = base64url_encode($result);
} else {
- Logger::log('OWA fail: ' . $contact['id'] . ' ' . $contact['addr'] . ' ' . $contact['url'], LOGGER_DEBUG);
+ Logger::log('OWA fail: ' . $contact['id'] . ' ' . $contact['addr'] . ' ' . $contact['url'], Logger::DEBUG);
}
} else {
- Logger::log('Contact not found: ' . $handle, LOGGER_DEBUG);
+ Logger::log('Contact not found: ' . $handle, Logger::DEBUG);
}
}
}
$this->errorNumber = $errorNumber;
$this->error = $error;
- Logger::log($url . ': ' . $this->returnCode . " " . $result, LOGGER_DATA);
+ Logger::log($url . ': ' . $this->returnCode . " " . $result, Logger::DATA);
$this->parseBodyHeader($result);
$this->checkSuccess();
$this->isSuccess = ($this->returnCode >= 200 && $this->returnCode <= 299) || $this->errorNumber == 0;
if (!$this->isSuccess) {
- Logger::log('error: ' . $this->url . ': ' . $this->returnCode . ' - ' . $this->error, LOGGER_INFO);
- Logger::log('debug: ' . print_r($this->info, true), LOGGER_DATA);
+ Logger::log('error: ' . $this->url . ': ' . $this->returnCode . ' - ' . $this->error, Logger::INFO);
+ Logger::log('debug: ' . print_r($this->info, true), Logger::DATA);
}
if (!$this->isSuccess && $this->errorNumber == CURLE_OPERATION_TIMEDOUT) {
$record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
if (!DBA::isResult($record)) {
- Logger::log('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+ Logger::log('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), Logger::DEBUG);
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
}
$xrd_timeout = Config::get('system', 'xrd_timeout', 20);
$redirects = 0;
- Logger::log("Probing for ".$host, LOGGER_DEBUG);
+ Logger::log("Probing for ".$host, Logger::DEBUG);
$xrd = null;
$curlResult = Network::curl($ssl_url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
if (!is_object($xrd)) {
$curlResult = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
if ($curlResult->isTimeout()) {
- Logger::log("Probing timeout for " . $url, LOGGER_DEBUG);
+ Logger::log("Probing timeout for " . $url, Logger::DEBUG);
return false;
}
$xml = $curlResult->getBody();
$host_url = 'http://'.$host;
}
if (!is_object($xrd)) {
- Logger::log("No xrd object found for ".$host, LOGGER_DEBUG);
+ Logger::log("No xrd object found for ".$host, Logger::DEBUG);
return [];
}
$links = XML::elementToArray($xrd);
if (!isset($links["xrd"]["link"])) {
- Logger::log("No xrd data found for ".$host, LOGGER_DEBUG);
+ Logger::log("No xrd data found for ".$host, Logger::DEBUG);
return [];
}
self::$baseurl = "http://".$host;
- Logger::log("Probing successful for ".$host, LOGGER_DEBUG);
+ Logger::log("Probing successful for ".$host, Logger::DEBUG);
return $lrdd;
}
$profile_link = '';
$links = self::lrdd($webbie);
- Logger::log('webfingerDfrn: '.$webbie.':'.print_r($links, true), LOGGER_DATA);
+ Logger::log('webfingerDfrn: '.$webbie.':'.print_r($links, true), Logger::DATA);
if (count($links)) {
foreach ($links as $link) {
if ($link['@attributes']['rel'] === NAMESPACE_DFRN) {
}
if (!$lrdd) {
- Logger::log("No lrdd data found for ".$uri, LOGGER_DEBUG);
+ Logger::log("No lrdd data found for ".$uri, Logger::DEBUG);
return [];
}
}
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;
}
$lrdd = self::hostMeta($host);
}
if (!$lrdd) {
- Logger::log('No XRD data was found for '.$uri, LOGGER_DEBUG);
+ Logger::log('No XRD data was found for '.$uri, Logger::DEBUG);
return self::feed($uri);
}
$nick = array_pop($path_parts);
}
if (!$lrdd) {
- Logger::log('No XRD data was found for '.$uri, LOGGER_DEBUG);
+ Logger::log('No XRD data was found for '.$uri, Logger::DEBUG);
return self::mail($uri, $uid);
}
$addr = $uri;
} else {
- Logger::log("Uri ".$uri." was not detectable", LOGGER_DEBUG);
+ Logger::log("Uri ".$uri." was not detectable", Logger::DEBUG);
return false;
}
$result = false;
- Logger::log("Probing ".$uri, LOGGER_DEBUG);
+ Logger::log("Probing ".$uri, Logger::DEBUG);
if (in_array($network, ["", Protocol::DFRN])) {
$result = self::dfrn($webfinger);
$result["url"] = $uri;
}
- Logger::log($uri." is ".$result["network"], LOGGER_DEBUG);
+ Logger::log($uri." is ".$result["network"], Logger::DEBUG);
if (empty($result["baseurl"])) {
$pos = strpos($result["url"], $host);
$webfinger = json_decode($data, true);
if (is_array($webfinger)) {
if (!isset($webfinger["links"])) {
- Logger::log("No json webfinger links for ".$url, LOGGER_DEBUG);
+ Logger::log("No json webfinger links for ".$url, Logger::DEBUG);
return false;
}
return $webfinger;
// If it is not JSON, maybe it is XML
$xrd = XML::parseString($data, false);
if (!is_object($xrd)) {
- Logger::log("No webfinger data retrievable for ".$url, LOGGER_DEBUG);
+ Logger::log("No webfinger data retrievable for ".$url, Logger::DEBUG);
return false;
}
$xrd_arr = XML::elementToArray($xrd);
if (!isset($xrd_arr["xrd"]["link"])) {
- Logger::log("No XML webfinger links for ".$url, LOGGER_DEBUG);
+ Logger::log("No XML webfinger links for ".$url, Logger::DEBUG);
return false;
}
}
$content = $curlResult->getBody();
if (!$content) {
- Logger::log("Empty body for ".$noscrape_url, LOGGER_DEBUG);
+ Logger::log("Empty body for ".$noscrape_url, Logger::DEBUG);
return false;
}
$json = json_decode($content, true);
if (!is_array($json)) {
- Logger::log("No json data for ".$noscrape_url, LOGGER_DEBUG);
+ Logger::log("No json data for ".$noscrape_url, Logger::DEBUG);
return false;
}
{
$data = [];
- Logger::log("Check profile ".$profile_link, LOGGER_DEBUG);
+ Logger::log("Check profile ".$profile_link, Logger::DEBUG);
// Fetch data via noscrape - this is faster
$noscrape_url = str_replace(["/hcard/", "/profile/"], "/noscrape/", $profile_link);
$prof_data["fn"] = defaults($data, 'name' , null);
$prof_data["key"] = defaults($data, 'pubkey' , null);
- Logger::log("Result for profile ".$profile_link.": ".print_r($prof_data, true), LOGGER_DEBUG);
+ Logger::log("Result for profile ".$profile_link.": ".print_r($prof_data, true), Logger::DEBUG);
return $prof_data;
}
}
$msgs = Email::poll($mbox, $uri);
- Logger::log('searching '.$uri.', '.count($msgs).' messages found.', LOGGER_DEBUG);
+ Logger::log('searching '.$uri.', '.count($msgs).' messages found.', Logger::DEBUG);
if (!count($msgs)) {
return false;
$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;
}
*/
public static function guessType($filename, $fromcurl = false, $header = '')
{
- Logger::log('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), LOGGER_DEBUG);
+ Logger::log('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), Logger::DEBUG);
$type = null;
if ($fromcurl) {
$a = get_app();
}
}
}
- Logger::log('Image: guessType: type='.$type, LOGGER_DEBUG);
+ Logger::log('Image: guessType: type='.$type, Logger::DEBUG);
return $type;
}
);
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([]);
}
/// $community_page = (($r[0]['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
if ((strlen($imagedata) == 0) && ($url == "")) {
- Logger::log("No image data and no url provided", LOGGER_DEBUG);
+ Logger::log("No image data and no url provided", Logger::DEBUG);
return([]);
} elseif (strlen($imagedata) == 0) {
- Logger::log("Uploading picture from ".$url, LOGGER_DEBUG);
+ Logger::log("Uploading picture from ".$url, Logger::DEBUG);
$stamp1 = microtime(true);
$imagedata = @file_get_contents($url);
$maximagesize = Config::get('system', 'maximagesize');
if (($maximagesize) && (strlen($imagedata) > $maximagesize)) {
- Logger::log("Image exceeds size limit of ".$maximagesize, LOGGER_DEBUG);
+ Logger::log("Image exceeds size limit of ".$maximagesize, Logger::DEBUG);
return([]);
}
if (!isset($data["mime"])) {
unlink($tempfile);
- Logger::log("File is no picture", LOGGER_DEBUG);
+ Logger::log("File is no picture", Logger::DEBUG);
return([]);
}
if (!$Image->isValid()) {
unlink($tempfile);
- Logger::log("Picture is no valid picture", LOGGER_DEBUG);
+ Logger::log("Picture is no valid picture", Logger::DEBUG);
return([]);
}
$r = Photo::store($Image, $uid, $visitor, $hash, $tempfile, L10n::t('Wall Photos'), 0, 0, $defperm);
if (!$r) {
- Logger::log("Picture couldn't be stored", LOGGER_DEBUG);
+ Logger::log("Picture couldn't be stored", Logger::DEBUG);
return([]);
}
{
$item_id = $item->getId();
if (!$item_id) {
- Logger::log('[ERROR] Post::addChild : Item has no ID!!', LOGGER_DEBUG);
+ Logger::log('[ERROR] Post::addChild : Item has no ID!!', Logger::DEBUG);
return false;
} elseif ($this->getChild($item->getId())) {
- Logger::log('[WARN] Post::addChild : Item already exists (' . $item->getId() . ').', LOGGER_DEBUG);
+ Logger::log('[WARN] Post::addChild : Item already exists (' . $item->getId() . ').', Logger::DEBUG);
return false;
}
/*
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;
}
public function getDataValue($name)
{
if (!isset($this->data[$name])) {
- // Logger::log('[ERROR] Item::getDataValue : Item has no value name "'. $name .'".', LOGGER_DEBUG);
+ // Logger::log('[ERROR] Item::getDataValue : Item has no value name "'. $name .'".', Logger::DEBUG);
return false;
}
private function setTemplate($name)
{
if (!x($this->available_templates, $name)) {
- Logger::log('[ERROR] Item::setTemplate : Template not available ("' . $name . '").', LOGGER_DEBUG);
+ Logger::log('[ERROR] Item::setTemplate : Template not available ("' . $name . '").', Logger::DEBUG);
return false;
}
$this->writable = $writable;
break;
default:
- Logger::log('[ERROR] Conversation::setMode : Unhandled mode ('. $mode .').', LOGGER_DEBUG);
+ Logger::log('[ERROR] Conversation::setMode : Unhandled mode ('. $mode .').', Logger::DEBUG);
return false;
break;
}
$item_id = $item->getId();
if (!$item_id) {
- Logger::log('[ERROR] Conversation::addThread : Item has no ID!!', LOGGER_DEBUG);
+ Logger::log('[ERROR] Conversation::addThread : Item has no ID!!', Logger::DEBUG);
return false;
}
if ($this->getParent($item->getId())) {
- Logger::log('[WARN] Conversation::addThread : Thread already exists ('. $item->getId() .').', LOGGER_DEBUG);
+ Logger::log('[WARN] Conversation::addThread : Thread already exists ('. $item->getId() .').', Logger::DEBUG);
return false;
}
* Only add will be displayed
*/
if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
- Logger::log('[WARN] Conversation::addThread : Thread is a mail ('. $item->getId() .').', LOGGER_DEBUG);
+ Logger::log('[WARN] Conversation::addThread : Thread is a mail ('. $item->getId() .').', Logger::DEBUG);
return false;
}
if ($item->getDataValue('verb') === ACTIVITY_LIKE || $item->getDataValue('verb') === ACTIVITY_DISLIKE) {
- Logger::log('[WARN] Conversation::addThread : Thread is a (dis)like ('. $item->getId() .').', LOGGER_DEBUG);
+ Logger::log('[WARN] Conversation::addThread : Thread is a (dis)like ('. $item->getId() .').', Logger::DEBUG);
return false;
}
$item_data = $item->getTemplateData($conv_responses);
if (!$item_data) {
- Logger::log('[ERROR] Conversation::getTemplateData : Failed to get item template data ('. $item->getId() .').', LOGGER_DEBUG);
+ Logger::log('[ERROR] Conversation::getTemplateData : Failed to get item template data ('. $item->getId() .').', Logger::DEBUG);
return false;
}
$result[] = $item_data;
{
$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]);
}
}
$event_id = Event::store($event);
- Logger::log('Event '.$event_id.' was stored', LOGGER_DEBUG);
+ Logger::log('Event '.$event_id.' was stored', Logger::DEBUG);
}
/**
/// @todo What to do with $activity['context']?
if (($item['gravity'] != GRAVITY_PARENT) && !Item::exists(['uri' => $item['parent-uri']])) {
- Logger::log('Parent ' . $item['parent-uri'] . ' not found, message will be discarded.', LOGGER_DEBUG);
+ Logger::log('Parent ' . $item['parent-uri'] . ' not found, message will be discarded.', Logger::DEBUG);
return;
}
$item['owner-link'] = $activity['actor'];
$item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true);
} else {
- Logger::log('Ignoring actor because of thread completion.', LOGGER_DEBUG);
+ Logger::log('Ignoring actor because of thread completion.', Logger::DEBUG);
$item['owner-link'] = $item['author-link'];
$item['owner-id'] = $item['author-id'];
}
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);
}
public static function deletePerson($activity)
{
if (empty($activity['object_id']) || empty($activity['actor'])) {
- Logger::log('Empty object id or actor.', LOGGER_DEBUG);
+ Logger::log('Empty object id or actor.', Logger::DEBUG);
return;
}
if ($activity['object_id'] != $activity['actor']) {
- Logger::log('Object id does not match actor.', LOGGER_DEBUG);
+ Logger::log('Object id does not match actor.', Logger::DEBUG);
return;
}
}
DBA::close($contacts);
- Logger::log('Deleted contact ' . $activity['object_id'], LOGGER_DEBUG);
+ Logger::log('Deleted contact ' . $activity['object_id'], Logger::DEBUG);
}
/**
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
- Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
+ Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
return;
}
$condition = ['id' => $cid];
DBA::update('contact', $fields, $condition);
- Logger::log('Accept contact request from contact ' . $cid . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Accept contact request from contact ' . $cid . ' for user ' . $uid, Logger::DEBUG);
}
/**
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
- Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
+ Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
return;
}
if (DBA::exists('contact', ['id' => $cid, 'rel' => Contact::SHARING, 'pending' => true])) {
Contact::remove($cid);
- Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . ' - contact had been removed.', LOGGER_DEBUG);
+ Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . ' - contact had been removed.', Logger::DEBUG);
} else {
- Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . '.', LOGGER_DEBUG);
+ Logger::log('Rejected contact request from contact ' . $cid . ' for user ' . $uid . '.', Logger::DEBUG);
}
}
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
- Logger::log('No contact found for ' . $activity['actor'], LOGGER_DEBUG);
+ Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
return;
}
}
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);
}
/**
{
$http_signer = HTTPSignature::getSigner($body, $header);
if (empty($http_signer)) {
- Logger::log('Invalid HTTP signature, message will be discarded.', LOGGER_DEBUG);
+ Logger::log('Invalid HTTP signature, message will be discarded.', Logger::DEBUG);
return;
} else {
- Logger::log('HTTP signature is signed by ' . $http_signer, LOGGER_DEBUG);
+ Logger::log('HTTP signature is signed by ' . $http_signer, Logger::DEBUG);
}
$activity = json_decode($body, true);
if (empty($activity)) {
- Logger::log('Invalid body.', LOGGER_DEBUG);
+ Logger::log('Invalid body.', Logger::DEBUG);
return;
}
$actor = JsonLD::fetchElement($ldactivity, 'as:actor');
- Logger::log('Message for user ' . $uid . ' is from actor ' . $actor, LOGGER_DEBUG);
+ Logger::log('Message for user ' . $uid . ' is from actor ' . $actor, Logger::DEBUG);
if (LDSignature::isSigned($activity)) {
$ld_signer = LDSignature::getSigner($activity);
if (empty($ld_signer)) {
- Logger::log('Invalid JSON-LD signature from ' . $actor, LOGGER_DEBUG);
+ Logger::log('Invalid JSON-LD signature from ' . $actor, Logger::DEBUG);
}
if (!empty($ld_signer && ($actor == $http_signer))) {
- Logger::log('The HTTP and the JSON-LD signature belong to ' . $ld_signer, LOGGER_DEBUG);
+ Logger::log('The HTTP and the JSON-LD signature belong to ' . $ld_signer, Logger::DEBUG);
$trust_source = true;
} elseif (!empty($ld_signer)) {
- Logger::log('JSON-LD signature is signed by ' . $ld_signer, LOGGER_DEBUG);
+ Logger::log('JSON-LD signature is signed by ' . $ld_signer, Logger::DEBUG);
$trust_source = true;
} elseif ($actor == $http_signer) {
- Logger::log('Bad JSON-LD signature, but HTTP signer fits the actor.', LOGGER_DEBUG);
+ Logger::log('Bad JSON-LD signature, but HTTP signer fits the actor.', Logger::DEBUG);
$trust_source = true;
} else {
- Logger::log('Invalid JSON-LD signature and the HTTP signer is different.', LOGGER_DEBUG);
+ Logger::log('Invalid JSON-LD signature and the HTTP signer is different.', Logger::DEBUG);
$trust_source = false;
}
} elseif ($actor == $http_signer) {
- Logger::log('Trusting post without JSON-LD signature, The actor fits the HTTP signer.', LOGGER_DEBUG);
+ Logger::log('Trusting post without JSON-LD signature, The actor fits the HTTP signer.', Logger::DEBUG);
$trust_source = true;
} else {
- Logger::log('No JSON-LD signature, different actor.', LOGGER_DEBUG);
+ Logger::log('No JSON-LD signature, different actor.', Logger::DEBUG);
$trust_source = false;
}
{
$actor = JsonLD::fetchElement($activity, 'as:actor');
if (empty($actor)) {
- Logger::log('Empty actor', LOGGER_DEBUG);
+ Logger::log('Empty actor', Logger::DEBUG);
return [];
}
$receivers = array_merge($receivers, $additional);
}
- Logger::log('Receivers: ' . json_encode($receivers), LOGGER_DEBUG);
+ Logger::log('Receivers: ' . json_encode($receivers), Logger::DEBUG);
$object_id = JsonLD::fetchElement($activity, 'as:object');
if (empty($object_id)) {
- Logger::log('No object found', LOGGER_DEBUG);
+ Logger::log('No object found', Logger::DEBUG);
return [];
}
}
$object_data = self::fetchObject($object_id, $activity['as:object'], $trust_source);
if (empty($object_data)) {
- Logger::log("Object data couldn't be processed", LOGGER_DEBUG);
+ Logger::log("Object data couldn't be processed", Logger::DEBUG);
return [];
}
// We had been able to retrieve the object data - so we can trust the source
$object_data['actor'] = $actor;
$object_data['receiver'] = array_merge(defaults($object_data, 'receiver', []), $receivers);
- Logger::log('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id'], LOGGER_DEBUG);
+ Logger::log('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id'], Logger::DEBUG);
return $object_data;
}
{
$type = JsonLD::fetchElement($activity, '@type');
if (!$type) {
- Logger::log('Empty type', LOGGER_DEBUG);
+ Logger::log('Empty type', Logger::DEBUG);
return;
}
if (!JsonLD::fetchElement($activity, 'as:object')) {
- Logger::log('Empty object', LOGGER_DEBUG);
+ Logger::log('Empty object', Logger::DEBUG);
return;
}
if (!JsonLD::fetchElement($activity, 'as:actor')) {
- Logger::log('Empty actor', LOGGER_DEBUG);
+ Logger::log('Empty actor', Logger::DEBUG);
return;
}
// $trust_source is called by reference and is set to true if the content was retrieved successfully
$object_data = self::prepareObjectData($activity, $uid, $trust_source);
if (empty($object_data)) {
- Logger::log('No object data found', LOGGER_DEBUG);
+ Logger::log('No object data found', Logger::DEBUG);
return;
}
if (!$trust_source) {
- Logger::log('No trust for activity type "' . $type . '", so we quit now.', LOGGER_DEBUG);
+ Logger::log('No trust for activity type "' . $type . '", so we quit now.', Logger::DEBUG);
return;
}
break;
default:
- Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], LOGGER_DEBUG);
+ Logger::log('Unknown activity: ' . $type . ' ' . $object_data['object_type'], Logger::DEBUG);
break;
}
}
$profile = APContact::getByURL($actor);
$followers = defaults($profile, 'followers', '');
- Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG);
+ Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, Logger::DEBUG);
} else {
- Logger::log('Empty actor', LOGGER_DEBUG);
+ Logger::log('Empty actor', Logger::DEBUG);
$followers = '';
}
// Send a new follow request to be sure that the connection still exists
if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND]])) {
ActivityPub\Transmitter::sendActivity('Follow', $profile['url'], $uid);
- Logger::log('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, Logger::DEBUG);
}
}
$data = ActivityPub::fetchContent($object_id);
if (!empty($data)) {
$object = JsonLD::compact($data);
- Logger::log('Fetched content for ' . $object_id, LOGGER_DEBUG);
+ Logger::log('Fetched content for ' . $object_id, Logger::DEBUG);
} else {
- Logger::log('Empty content for ' . $object_id . ', check if content is available locally.', LOGGER_DEBUG);
+ Logger::log('Empty content for ' . $object_id . ', check if content is available locally.', Logger::DEBUG);
$item = Item::selectFirst([], ['uri' => $object_id]);
if (!DBA::isResult($item)) {
- Logger::log('Object with url ' . $object_id . ' was not found locally.', LOGGER_DEBUG);
+ Logger::log('Object with url ' . $object_id . ' was not found locally.', Logger::DEBUG);
return false;
}
- Logger::log('Using already stored item for url ' . $object_id, LOGGER_DEBUG);
+ Logger::log('Using already stored item for url ' . $object_id, Logger::DEBUG);
$data = ActivityPub\Transmitter::createNote($item);
$object = JsonLD::compact($data);
}
} else {
- Logger::log('Using original object for url ' . $object_id, LOGGER_DEBUG);
+ Logger::log('Using original object for url ' . $object_id, Logger::DEBUG);
}
$type = JsonLD::fetchElement($object, '@type');
if (empty($type)) {
- Logger::log('Empty type', LOGGER_DEBUG);
+ Logger::log('Empty type', Logger::DEBUG);
return false;
}
return self::fetchObject($object_id);
}
- Logger::log('Unhandled object type: ' . $type, LOGGER_DEBUG);
+ Logger::log('Unhandled object type: ' . $type, Logger::DEBUG);
}
/**
$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);
}
$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);
}
$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);
}
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
'to' => $profile['url']];
- Logger::log('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, Logger::DEBUG);
$signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid);
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
'to' => $profile['url']];
- Logger::log('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
+ Logger::log('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG);
$signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid);
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
'to' => $profile['url']];
- Logger::log('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
+ Logger::log('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG);
$signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid);
'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()],
'to' => $profile['url']];
- Logger::log('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG);
+ Logger::log('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG);
$signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid);
);
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();
}
);
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();
}
$rino = Config::get('system', 'rino_encrypt');
$rino = intval($rino);
- Logger::log("Local rino version: ". $rino, LOGGER_DEBUG);
+ Logger::log("Local rino version: ". $rino, Logger::DEBUG);
$ssl_val = intval(Config::get('system', 'ssl_policy'));
$ssl_policy = '';
return -3; // timed out
}
- Logger::log('dfrn_deliver: ' . $xml, LOGGER_DATA);
+ Logger::log('dfrn_deliver: ' . $xml, Logger::DATA);
if (empty($xml)) {
Contact::markForArchival($contact);
if (strpos($xml, '<?xml') === false) {
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);
return 3;
}
$rino_remote_version = intval($res->rino);
$page = (($owner['page-flags'] == Contact::PAGE_COMMUNITY) ? 1 : 0);
- Logger::log("Remote rino version: ".$rino_remote_version." for ".$contact["url"], LOGGER_DEBUG);
+ Logger::log("Remote rino version: ".$rino_remote_version." for ".$contact["url"], Logger::DEBUG);
if ($owner['page-flags'] == Contact::PAGE_PRVGROUP) {
$page = 2;
}
- Logger::log('dfrn_deliver: ' . "SENDING: " . print_r($postvars, true), LOGGER_DATA);
+ Logger::log('dfrn_deliver: ' . "SENDING: " . print_r($postvars, true), Logger::DATA);
$postResult = Network::post($contact['notify'], $postvars);
$xml = $postResult->getBody();
- Logger::log('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA);
+ Logger::log('dfrn_deliver: ' . "RECEIVED: " . $xml, Logger::DATA);
$curl_stat = $postResult->getReturnCode();
if (empty($curl_stat) || empty($xml)) {
if (strpos($xml, '<?xml') === false) {
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);
return 3;
}
}
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 (strpos($xml, '<?xml') === false) {
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);
return 3;
}
}
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)) {
$author["network"] = $contact_old["network"];
} else {
if (!$onlyfetch) {
- Logger::log("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml, LOGGER_DEBUG);
+ Logger::log("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml, Logger::DEBUG);
}
$author["contact-unknown"] = true;
}
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"]];
// If the "hide" element is present then the profile isn't searchable.
$hide = intval(XML::getFirstNodeValue($xpath, $element . "/dfrn:hide/text()", $context) == "true");
- Logger::log("Hidden status for contact " . $contact_old["url"] . ": " . $hide, LOGGER_DEBUG);
+ Logger::log("Hidden status for contact " . $contact_old["url"] . ": " . $hide, Logger::DEBUG);
// If the contact isn't searchable then set the contact to "hidden".
// Problem: This can be manually overridden by the user.
$contact[$field] = DateTimeFormat::utc($contact[$field]);
if (strtotime($contact[$field]) > strtotime($contact_old[$field])) {
- Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", LOGGER_DEBUG);
+ Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", Logger::DEBUG);
$update = true;
}
}
foreach ($fields as $field => $data) {
if ($contact[$field] != $contact_old[$field]) {
- Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", LOGGER_DEBUG);
+ Logger::log("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $contact_old[$field] . "'", Logger::DEBUG);
$update = true;
}
}
if ($update) {
- Logger::log("Update contact data for contact " . $contact["id"] . " (" . $contact["nick"] . ")", LOGGER_DEBUG);
+ Logger::log("Update contact data for contact " . $contact["id"] . " (" . $contact["nick"] . ")", Logger::DEBUG);
q(
"UPDATE `contact` SET `name` = '%s', `nick` = '%s', `about` = '%s', `location` = '%s',
*/
private static function processVerbs($entrytype, $importer, &$item, &$is_like)
{
- Logger::log("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);
+ Logger::log("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, Logger::DEBUG);
if (($entrytype == DFRN::TOP_LEVEL)) {
// The filling of the the "contact" variable is done for legcy reasons
);
// Is there an existing item?
if (DBA::isResult($current) && !self::isEditedTimestampNewer($current, $item)) {
- Logger::log("Item ".$item["uri"]." (".$item['edited'].") already existed.", LOGGER_DEBUG);
+ Logger::log("Item ".$item["uri"]." (".$item['edited'].") already existed.", Logger::DEBUG);
return;
}
// Is it an event?
if (($item["object-type"] == ACTIVITY_OBJ_EVENT) && !$owner_unknown) {
- Logger::log("Item ".$item["uri"]." seems to contain an event.", LOGGER_DEBUG);
+ Logger::log("Item ".$item["uri"]." seems to contain an event.", Logger::DEBUG);
$ev = Event::fromBBCode($item["body"]);
if ((x($ev, "desc") || x($ev, "summary")) && x($ev, "start")) {
- Logger::log("Event in item ".$item["uri"]." was found.", LOGGER_DEBUG);
+ Logger::log("Event in item ".$item["uri"]." was found.", Logger::DEBUG);
$ev["cid"] = $importer["id"];
$ev["uid"] = $importer["importer_uid"];
$ev["uri"] = $item["uri"];
}
$event_id = Event::store($ev);
- Logger::log("Event ".$event_id." was stored", LOGGER_DEBUG);
+ Logger::log("Event ".$event_id." was stored", Logger::DEBUG);
return;
}
}
}
if (!self::processVerbs($entrytype, $importer, $item, $is_like)) {
- Logger::log("Exiting because 'processVerbs' told us so", LOGGER_DEBUG);
+ Logger::log("Exiting because 'processVerbs' told us so", Logger::DEBUG);
return;
}
// This check is done here to be able to receive connection requests in "processVerbs"
if (($entrytype == DFRN::TOP_LEVEL) && $owner_unknown) {
- Logger::log("Item won't be stored because user " . $importer["importer_uid"] . " doesn't follow " . $item["owner-link"] . ".", LOGGER_DEBUG);
+ Logger::log("Item won't be stored because user " . $importer["importer_uid"] . " doesn't follow " . $item["owner-link"] . ".", Logger::DEBUG);
return;
}
// Update content if 'updated' changes
if (DBA::isResult($current)) {
if (self::updateContent($current, $item, $importer, $entrytype)) {
- Logger::log("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
+ Logger::log("Item ".$item["uri"]." was updated.", Logger::DEBUG);
} else {
- Logger::log("Item " . $item["uri"] . " already existed.", LOGGER_DEBUG);
+ Logger::log("Item " . $item["uri"] . " already existed.", Logger::DEBUG);
}
return;
}
$parent = 0;
if ($posted_id) {
- Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, LOGGER_DEBUG);
+ Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, Logger::DEBUG);
if ($item['uid'] == 0) {
Item::distribute($posted_id);
}
} else { // $entrytype == DFRN::TOP_LEVEL
if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) {
- Logger::log("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG);
+ Logger::log("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", Logger::DEBUG);
return;
}
if (!link_compare($item["owner-link"], $importer["url"])) {
* the tgroup delivery code called from Item::insert will correct it if it's a forum,
* but we're going to unconditionally correct it here so that the post will always be owned by our contact.
*/
- Logger::log('Correcting item owner.', LOGGER_DEBUG);
+ Logger::log('Correcting item owner.', Logger::DEBUG);
$item["owner-link"] = $importer["url"];
$item["owner-id"] = Contact::getIdForURL($importer["url"], 0);
}
if (($importer["rel"] == Contact::FOLLOWER) && (!self::tgroupCheck($importer["importer_uid"], $item))) {
- Logger::log("Contact ".$importer["id"]." is only follower and tgroup check was negative.", LOGGER_DEBUG);
+ Logger::log("Contact ".$importer["id"]." is only follower and tgroup check was negative.", Logger::DEBUG);
return;
}
$posted_id = $notify;
}
- Logger::log("Item was stored with id ".$posted_id, LOGGER_DEBUG);
+ Logger::log("Item was stored with id ".$posted_id, Logger::DEBUG);
if ($item['uid'] == 0) {
Item::distribute($posted_id);
$condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
$item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition);
if (!DBA::isResult($item)) {
- Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG);
+ Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", Logger::DEBUG);
return;
}
if (strstr($item['file'], '[')) {
- Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " is filed. So it won't be deleted.", LOGGER_DEBUG);
+ Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " is filed. So it won't be deleted.", Logger::DEBUG);
return;
}
// When it is a starting post it has to belong to the person that wants to delete it
if (($item['id'] == $item['parent']) && ($item['contact-id'] != $importer["id"])) {
- Logger::log("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG);
+ Logger::log("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", Logger::DEBUG);
return;
}
if (($item['id'] != $item['parent']) && ($item['contact-id'] != $importer["id"])) {
$condition = ['id' => $item['parent'], 'contact-id' => $importer["id"]];
if (!Item::exists($condition)) {
- Logger::log("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG);
+ Logger::log("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", Logger::DEBUG);
return;
}
}
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']]);
}
self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml);
}
- Logger::log("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
+ Logger::log("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], Logger::DEBUG);
// is it a public forum? Private forums aren't exposed with this method
$forum = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:community/text()"));
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;
}
$url = curPageURL();
- Logger::log('auto_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
+ Logger::log('auto_redir: ' . $r[0]['name'] . ' ' . $sec, Logger::DEBUG);
$dest = (($url) ? '&destination_url=' . $url : '');
System::externalRedirect($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest);
if (base64_encode(base64_decode(base64_decode($signature))) == base64_decode($signature)) {
$signature = base64_decode($signature);
- Logger::log("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, LOGGER_DEBUG);
+ Logger::log("Repaired double encoded signature from Diaspora/Hubzilla handle ".$handle." - level ".$level, Logger::DEBUG);
// Do a recursive call to be able to fix even multiple levels
if ($level < 10) {
} else {
// This happens with posts from a relais
if (!$importer) {
- Logger::log("This is no private post in the old format", LOGGER_DEBUG);
+ Logger::log("This is no private post in the old format", Logger::DEBUG);
return false;
}
$decrypted = self::aesDecrypt($outer_key, $outer_iv, $ciphertext);
- Logger::log('decrypted: '.$decrypted, LOGGER_DEBUG);
+ Logger::log('decrypted: '.$decrypted, Logger::DEBUG);
$idom = XML::parseString($decrypted);
$inner_iv = base64_decode($idom->iv);
$type = $fields->getName();
- Logger::log("Received message type ".$type." from ".$sender." for user ".$importer["uid"], LOGGER_DEBUG);
+ Logger::log("Received message type ".$type." from ".$sender." for user ".$importer["uid"], Logger::DEBUG);
switch ($type) {
case "account_migration":
$data = XML::parseString($msg["message"]);
if (!is_object($data)) {
- Logger::log("No valid XML ".$msg["message"], LOGGER_DEBUG);
+ Logger::log("No valid XML ".$msg["message"], Logger::DEBUG);
return false;
}
$type = $element->getName();
$orig_type = $type;
- Logger::log("Got message type ".$type.": ".$msg["message"], LOGGER_DATA);
+ Logger::log("Got message type ".$type.": ".$msg["message"], Logger::DATA);
// All retractions are handled identically from now on.
// In the new version there will only be "retraction".
}
// No author_signature? This is a must, so we quit.
if (!isset($author_signature)) {
- Logger::log("No author signature for type ".$type." - Message: ".$msg["message"], LOGGER_DEBUG);
+ Logger::log("No author signature for type ".$type." - Message: ".$msg["message"], Logger::DEBUG);
return false;
}
if (isset($parent_author_signature)) {
$key = self::key($msg["author"]);
if (empty($key)) {
- Logger::log("No key found for parent author ".$msg["author"], LOGGER_DEBUG);
+ Logger::log("No key found for parent author ".$msg["author"], Logger::DEBUG);
return false;
}
if (!Crypto::rsaVerify($signed_data, $parent_author_signature, $key, "sha256")) {
- Logger::log("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, LOGGER_DEBUG);
+ Logger::log("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, Logger::DEBUG);
return false;
}
}
$key = self::key($fields->author);
if (empty($key)) {
- Logger::log("No key found for author ".$fields->author, LOGGER_DEBUG);
+ Logger::log("No key found for author ".$fields->author, Logger::DEBUG);
return false;
}
if (!Crypto::rsaVerify($signed_data, $author_signature, $key, "sha256")) {
- Logger::log("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, LOGGER_DEBUG);
+ Logger::log("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, Logger::DEBUG);
return false;
} else {
return $fields;
$person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (DBA::isResult($person)) {
- Logger::log("In cache " . print_r($person, true), LOGGER_DEBUG);
+ Logger::log("In cache " . print_r($person, true), Logger::DEBUG);
// update record occasionally so it doesn't get stale
$d = strtotime($person["updated"]." +00:00");
}
if (!DBA::isResult($person) || $update) {
- Logger::log("create or refresh", LOGGER_DEBUG);
+ Logger::log("create or refresh", Logger::DEBUG);
$r = Probe::uri($handle, Protocol::DIASPORA);
// Note that Friendica contacts will return a "Diaspora person"
{
$handle = false;
- Logger::log("contact id is ".$contact_id." - pcontact id is ".$pcontact_id, LOGGER_DEBUG);
+ Logger::log("contact id is ".$contact_id." - pcontact id is ".$pcontact_id, Logger::DEBUG);
if ($pcontact_id != 0) {
$contact = DBA::selectFirst('contact', ['addr'], ['id' => $pcontact_id]);
if (DBA::isResult($r)) {
$contact = $r[0];
- Logger::log("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], LOGGER_DEBUG);
+ Logger::log("contact 'self' = ".$contact['self']." 'url' = ".$contact['url'], Logger::DEBUG);
if ($contact['addr'] != "") {
$handle = $contact['addr'];
*/
public static function urlFromContactGuid($fcontact_guid)
{
- Logger::log("fcontact guid is ".$fcontact_guid, LOGGER_DEBUG);
+ Logger::log("fcontact guid is ".$fcontact_guid, Logger::DEBUG);
$r = q(
"SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'",
}
if (!$cid) {
- Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
+ Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, Logger::DEBUG);
return false;
}
$contact = DBA::selectFirst('contact', [], ['id' => $cid]);
if (!DBA::isResult($contact)) {
// This here shouldn't happen at all
- Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, LOGGER_DEBUG);
+ Logger::log("Haven't found a contact for user " . $uid . " and handle " . $handle, Logger::DEBUG);
return false;
}
$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);
return false;
}
- Logger::log("Successfully fetched item ".$guid." from ".$server, LOGGER_DEBUG);
+ Logger::log("Successfully fetched item ".$guid." from ".$server, Logger::DEBUG);
// Now call the dispatcher
return self::dispatchPublic($msg);
// This will work for new Diaspora servers and Friendica servers from 3.5
$source_url = $server."/fetch/post/".urlencode($guid);
- Logger::log("Fetch post from ".$source_url, LOGGER_DEBUG);
+ Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
$envelope = Network::fetchUrl($source_url);
if ($envelope) {
- Logger::log("Envelope was fetched.", LOGGER_DEBUG);
+ Logger::log("Envelope was fetched.", Logger::DEBUG);
$x = self::verifyMagicEnvelope($envelope);
if (!$x) {
- Logger::log("Envelope could not be verified.", LOGGER_DEBUG);
+ Logger::log("Envelope could not be verified.", Logger::DEBUG);
} else {
- Logger::log("Envelope was verified.", LOGGER_DEBUG);
+ Logger::log("Envelope was verified.", Logger::DEBUG);
}
} else {
$x = false;
// This will work for older Diaspora and Friendica servers
if (!$x) {
$source_url = $server."/p/".urlencode($guid).".xml";
- Logger::log("Fetch post from ".$source_url, LOGGER_DEBUG);
+ Logger::log("Fetch post from ".$source_url, Logger::DEBUG);
$x = Network::fetchUrl($source_url);
if (!$x) {
if ($source_xml->post->reshare) {
// Reshare of a reshare - old Diaspora version
- Logger::log("Message is a reshare", LOGGER_DEBUG);
+ Logger::log("Message is a reshare", Logger::DEBUG);
return self::message($source_xml->post->reshare->root_guid, $server, ++$level);
} elseif ($source_xml->getName() == "reshare") {
// Reshare of a reshare - new Diaspora version
- Logger::log("Message is a new reshare", LOGGER_DEBUG);
+ Logger::log("Message is a new reshare", Logger::DEBUG);
return self::message($source_xml->root_guid, $server, ++$level);
}
// If this isn't a "status_message" then quit
if (!$author) {
- Logger::log("Message doesn't seem to be a status message", LOGGER_DEBUG);
+ Logger::log("Message doesn't seem to be a status message", Logger::DEBUG);
return false;
}
}
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(['uid'], ['origin' => true, 'guid' => $guid]);
if (DBA::isResult($item)) {
- Logger::log("Found user ".$item['uid']." as owner of item ".$guid, LOGGER_DEBUG);
+ Logger::log("Found user ".$item['uid']." as owner of item ".$guid, Logger::DEBUG);
$contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $item['uid']]);
if (DBA::isResult($contact)) {
return $contact;
}
if ($message_id) {
- Logger::log("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
+ Logger::log("Stored comment ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG);
if ($datarray['uid'] == 0) {
Item::distribute($message_id, json_encode($data));
}
DBA::lock('mail');
if (DBA::exists('mail', ['guid' => $msg_guid, 'uid' => $importer["uid"]])) {
- Logger::log("duplicate message already delivered.", LOGGER_DEBUG);
+ Logger::log("duplicate message already delivered.", Logger::DEBUG);
return false;
}
}
if ($message_id) {
- Logger::log("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
+ Logger::log("Stored like ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG);
if ($datarray['uid'] == 0) {
Item::distribute($message_id, json_encode($data));
}
DBA::lock('mail');
if (DBA::exists('mail', ['guid' => $guid, 'uid' => $importer["uid"]])) {
- Logger::log("duplicate message already delivered.", LOGGER_DEBUG);
+ Logger::log("duplicate message already delivered.", Logger::DEBUG);
return false;
}
$server = $author;
}
- Logger::log('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG);
+ Logger::log('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, Logger::DEBUG);
if (!DBA::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
DBA::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
} else {
$cmd = $comment['self'] ? 'like' : 'comment-import';
}
- Logger::log("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, LOGGER_DEBUG);
+ Logger::log("Send ".$cmd." for item ".$comment['id']." to contact ".$contact_id, Logger::DEBUG);
Worker::add(PRIORITY_HIGH, 'Delivery', $cmd, $comment['id'], $contact_id);
}
DBA::close($comments);
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;
}
// That makes us friends.
if ($contact) {
if ($following) {
- Logger::log("Author ".$author." (Contact ".$contact["id"].") wants to follow us.", LOGGER_DEBUG);
+ Logger::log("Author ".$author." (Contact ".$contact["id"].") wants to follow us.", Logger::DEBUG);
self::receiveRequestMakeFriend($importer, $contact);
// refetch the contact array
if (in_array($contact["rel"], [Contact::FRIEND])) {
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
if (DBA::isResult($user)) {
- Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
+ Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], Logger::DEBUG);
$ret = self::sendShare($user, $contact);
}
}
return true;
} else {
- Logger::log("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG);
+ Logger::log("Author ".$author." doesn't want to follow us anymore.", Logger::DEBUG);
Contact::removeFollower($importer, $contact);
return true;
}
}
if (!$following && $sharing && in_array($importer["page-flags"], [Contact::PAGE_SOAPBOX, Contact::PAGE_NORMAL])) {
- Logger::log("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", LOGGER_DEBUG);
+ Logger::log("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", Logger::DEBUG);
return false;
} elseif (!$following && !$sharing) {
- Logger::log("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", LOGGER_DEBUG);
+ Logger::log("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", Logger::DEBUG);
return false;
} elseif (!$following && $sharing) {
- Logger::log("Author ".$author." wants to share with us.", LOGGER_DEBUG);
+ Logger::log("Author ".$author." wants to share with us.", Logger::DEBUG);
} elseif ($following && $sharing) {
- Logger::log("Author ".$author." wants to have a bidirectional conection.", LOGGER_DEBUG);
+ Logger::log("Author ".$author." wants to have a bidirectional conection.", Logger::DEBUG);
} elseif ($following && !$sharing) {
- Logger::log("Author ".$author." wants to listen to us.", LOGGER_DEBUG);
+ Logger::log("Author ".$author." wants to listen to us.", Logger::DEBUG);
}
$ret = self::personByHandle($author);
return;
}
- Logger::log("Author ".$author." was added as contact number ".$contact_record["id"].".", LOGGER_DEBUG);
+ Logger::log("Author ".$author." was added as contact number ".$contact_record["id"].".", Logger::DEBUG);
Group::addMember(User::getDefaultGroup($importer['uid'], $ret["network"]), $contact_record['id']);
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
if (in_array($importer["page-flags"], [Contact::PAGE_NORMAL, Contact::PAGE_PRVGROUP])) {
- Logger::log("Sending intra message for author ".$author.".", LOGGER_DEBUG);
+ Logger::log("Sending intra message for author ".$author.".", Logger::DEBUG);
$hash = random_string().(string)time(); // Generate a confirm_key
} else {
// automatic friend approval
- Logger::log("Does an automatic friend approval for author ".$author.".", LOGGER_DEBUG);
+ Logger::log("Does an automatic friend approval for author ".$author.".", Logger::DEBUG);
Contact::updateAvatar($contact_record["photo"], $importer["uid"], $contact_record["id"]);
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
if (DBA::isResult($user)) {
- Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
+ Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], Logger::DEBUG);
$ret = self::sendShare($user, $contact_record);
// Send the profile data, maybe it weren't transmitted before
self::sendParticipation($contact, $datarray);
if ($message_id) {
- Logger::log("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
+ Logger::log("Stored reshare ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG);
if ($datarray['uid'] == 0) {
Item::distribute($message_id);
}
while ($item = Item::fetch($r)) {
if (strstr($item['file'], '[')) {
- Logger::log("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.", LOGGER_DEBUG);
+ Logger::log("Target guid " . $target_guid . " for user " . $item['uid'] . " is filed. So it won't be deleted.", Logger::DEBUG);
continue;
}
// Only delete it if the parent author really fits
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
- Logger::log("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], LOGGER_DEBUG);
+ Logger::log("Thread author ".$parent["author-link"]." and item author ".$item["author-link"]." don't fit to expected contact ".$contact["url"], Logger::DEBUG);
continue;
}
Item::delete(['id' => $item['id']]);
- Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG);
+ Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], Logger::DEBUG);
}
return true;
$contact = [];
}
- Logger::log("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], LOGGER_DEBUG);
+ Logger::log("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], Logger::DEBUG);
switch ($target_type) {
case "Comment":
self::sendParticipation($contact, $datarray);
if ($message_id) {
- Logger::log("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
+ Logger::log("Stored item ".$datarray["guid"]." with message id ".$message_id, Logger::DEBUG);
if ($datarray['uid'] == 0) {
Item::distribute($message_id);
}
*/
public static function encodePrivateData($msg, array $user, array $contact, $prvkey, $pubkey)
{
- Logger::log("Message: ".$msg, LOGGER_DATA);
+ Logger::log("Message: ".$msg, Logger::DATA);
// without a public key nothing will work
if (!$pubkey) {
{
$msg = self::buildPostXml($type, $message);
- Logger::log('message: '.$msg, LOGGER_DATA);
- Logger::log('send guid '.$guid, LOGGER_DEBUG);
+ Logger::log('message: '.$msg, Logger::DATA);
+ Logger::log('send guid '.$guid, Logger::DEBUG);
// Fallback if the private key wasn't transmitted in the expected field
if (empty($owner['uprvkey'])) {
$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;
}
"parent_type" => "Post",
"parent_guid" => $item["guid"]];
- Logger::log("Send participation for ".$item["guid"]." by ".$author, LOGGER_DEBUG);
+ Logger::log("Send participation for ".$item["guid"]." by ".$author, Logger::DEBUG);
// It doesn't matter what we store, we only want to avoid sending repeated notifications for the same item
Cache::set($cachekey, $item["guid"], Cache::QUARTER_HOUR);
"profile" => $profile,
"signature" => $signature];
- Logger::log("Send account migration ".print_r($message, true), LOGGER_DEBUG);
+ Logger::log("Send account migration ".print_r($message, true), Logger::DEBUG);
return self::buildAndTransmit($owner, $contact, "account_migration", $message);
}
"following" => "true",
"sharing" => "true"];
- Logger::log("Send share ".print_r($message, true), LOGGER_DEBUG);
+ Logger::log("Send share ".print_r($message, true), Logger::DEBUG);
return self::buildAndTransmit($owner, $contact, "contact", $message);
}
"following" => "false",
"sharing" => "false"];
- Logger::log("Send unshare ".print_r($message, true), LOGGER_DEBUG);
+ Logger::log("Send unshare ".print_r($message, true), Logger::DEBUG);
return self::buildAndTransmit($owner, $contact, "contact", $message);
}
$type = "comment";
}
- Logger::log("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
+ Logger::log("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", Logger::DEBUG);
// Old way - is used by the internal Friendica functions
/// @todo Change all signatur storing functions to the new format
$message[$field] = $data;
}
} else {
- Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], LOGGER_DEBUG);
+ Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], Logger::DEBUG);
}
}
$message["parent_author_signature"] = self::signature($owner, $message);
- Logger::log("Relayed data ".print_r($message, true), LOGGER_DEBUG);
+ Logger::log("Relayed data ".print_r($message, true), Logger::DEBUG);
return self::buildAndTransmit($owner, $contact, $type, $message, $public_batch, $item["guid"]);
}
"target_guid" => $item['guid'],
"target_type" => $target_type];
- Logger::log("Got message ".print_r($message, true), LOGGER_DEBUG);
+ Logger::log("Got message ".print_r($message, true), Logger::DEBUG);
return self::buildAndTransmit($owner, $contact, $msg_type, $message, $public_batch, $item["guid"]);
}
$message = self::createProfileData($uid);
foreach ($recips as $recip) {
- Logger::log("Send updated profile data for user ".$uid." to contact ".$recip["id"], LOGGER_DEBUG);
+ Logger::log("Send updated profile data for user ".$uid." to contact ".$recip["id"], Logger::DEBUG);
self::buildAndTransmit($owner, $recip, "profile", $message, false, "", false);
}
}
{
$owner = User::getOwnerDataById($uid);
if (empty($owner)) {
- Logger::log("No owner post, so not storing signature", LOGGER_DEBUG);
+ Logger::log("No owner post, so not storing signature", Logger::DEBUG);
return false;
}
{
$owner = User::getOwnerDataById($uid);
if (empty($owner)) {
- Logger::log("No owner post, so not storing signature", LOGGER_DEBUG);
+ Logger::log("No owner post, so not storing signature", Logger::DEBUG);
return false;
}
if (!$search1) {
$search1 = [];
} else {
- Logger::log("Found mails from ".$email_addr, LOGGER_DEBUG);
+ Logger::log("Found mails from ".$email_addr, Logger::DEBUG);
}
$search2 = @imap_search($mbox, 'TO "' . $email_addr . '"', SE_UID);
if (!$search2) {
$search2 = [];
} else {
- Logger::log("Found mails to ".$email_addr, LOGGER_DEBUG);
+ Logger::log("Found mails to ".$email_addr, Logger::DEBUG);
}
$search3 = @imap_search($mbox, 'CC "' . $email_addr . '"', SE_UID);
if (!$search3) {
$search3 = [];
} else {
- Logger::log("Found mails cc ".$email_addr, LOGGER_DEBUG);
+ Logger::log("Found mails cc ".$email_addr, Logger::DEBUG);
}
$res = array_unique(array_merge($search1, $search2, $search3));
$a = get_app();
if (!$simulate) {
- Logger::log("Import Atom/RSS feed '".$contact["name"]."' (Contact ".$contact["id"].") for user ".$importer["uid"], LOGGER_DEBUG);
+ Logger::log("Import Atom/RSS feed '".$contact["name"]."' (Contact ".$contact["id"].") for user ".$importer["uid"], Logger::DEBUG);
} else {
- Logger::log("Test Atom/RSS feed", LOGGER_DEBUG);
+ Logger::log("Test Atom/RSS feed", Logger::DEBUG);
}
if (empty($xml)) {
- Logger::log('XML is empty.', LOGGER_DEBUG);
+ Logger::log('XML is empty.', Logger::DEBUG);
return;
}
$header["contact-id"] = $contact["id"];
if (!is_object($entries)) {
- Logger::log("There are no entries in this feed.", LOGGER_DEBUG);
+ Logger::log("There are no entries in this feed.", Logger::DEBUG);
return;
}
$importer["uid"], $item["uri"], Protocol::FEED, Protocol::DFRN];
$previous = Item::selectFirst(['id'], $condition);
if (DBA::isResult($previous)) {
- Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
+ Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], Logger::DEBUG);
continue;
}
}
}
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);
DBA::update('contact', $contact, ['id' => $contact["id"]], $current);
if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) {
- Logger::log("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
+ Logger::log("Update profile picture for contact ".$contact["id"], Logger::DEBUG);
Contact::updateAvatar($author["author-avatar"], $importer["uid"], $contact["id"]);
}
self::$conv_list = [];
}
- Logger::log('Import OStatus message for user ' . $importer['uid'], LOGGER_DEBUG);
+ Logger::log('Import OStatus message for user ' . $importer['uid'], Logger::DEBUG);
if ($xml == "") {
return false;
foreach ($hub_attributes as $hub_attribute) {
if ($hub_attribute->name == "href") {
$hub = $hub_attribute->textContent;
- Logger::log("Found hub ".$hub, LOGGER_DEBUG);
+ Logger::log("Found hub ".$hub, Logger::DEBUG);
}
}
}
if (in_array($item["verb"], [NAMESPACE_OSTATUS."/unfavorite", ACTIVITY_UNFAVORITE])) {
// Ignore "Unfavorite" message
- Logger::log("Ignore unfavorite message ".print_r($item, true), LOGGER_DEBUG);
+ Logger::log("Ignore unfavorite message ".print_r($item, true), Logger::DEBUG);
continue;
}
// Deletions come with the same uri, so we check for duplicates after processing deletions
if (Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]])) {
- Logger::log('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', LOGGER_DEBUG);
+ Logger::log('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', Logger::DEBUG);
continue;
} else {
- Logger::log('Processing post with URI '.$item["uri"].' for user '.$importer["uid"].'.', LOGGER_DEBUG);
+ Logger::log('Processing post with URI '.$item["uri"].' for user '.$importer["uid"].'.', Logger::DEBUG);
}
if ($item["verb"] == ACTIVITY_JOIN) {
// ignore "Join" messages
- Logger::log("Ignore join message ".print_r($item, true), LOGGER_DEBUG);
+ Logger::log("Ignore join message ".print_r($item, true), Logger::DEBUG);
continue;
}
if ($item["verb"] == "http://mastodon.social/schema/1.0/block") {
// ignore mastodon "block" messages
- Logger::log("Ignore block message ".print_r($item, true), LOGGER_DEBUG);
+ Logger::log("Ignore block message ".print_r($item, true), Logger::DEBUG);
continue;
}
// http://activitystrea.ms/schema/1.0/rsvp-yes
if (!in_array($item["verb"], [ACTIVITY_POST, ACTIVITY_LIKE, ACTIVITY_SHARE])) {
- Logger::log("Unhandled verb ".$item["verb"]." ".print_r($item, true), LOGGER_DEBUG);
+ Logger::log("Unhandled verb ".$item["verb"]." ".print_r($item, true), Logger::DEBUG);
}
self::processPost($xpath, $entry, $item, $importer);
// If not, then it depends on this setting
$valid = !Config::get('system', 'ostatus_full_threads');
if ($valid) {
- Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", LOGGER_DEBUG);
+ Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", Logger::DEBUG);
}
} else {
- Logger::log("Item with uri ".self::$itemlist[0]['uri']." belongs to a contact (".self::$itemlist[0]['contact-id']."). It will be imported.", LOGGER_DEBUG);
+ Logger::log("Item with uri ".self::$itemlist[0]['uri']." belongs to a contact (".self::$itemlist[0]['contact-id']."). It will be imported.", Logger::DEBUG);
}
if ($valid) {
// Never post a thread when the only interaction by our contact was a like
}
}
if ($valid) {
- Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", LOGGER_DEBUG);
+ Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", Logger::DEBUG);
}
}
} else {
// But we will only import complete threads
$valid = Item::exists(['uid' => $importer["uid"], 'uri' => self::$itemlist[0]['parent-uri']]);
if ($valid) {
- Logger::log("Item with uri ".self::$itemlist[0]["uri"]." belongs to parent ".self::$itemlist[0]['parent-uri']." of user ".$importer["uid"].". It will be imported.", LOGGER_DEBUG);
+ Logger::log("Item with uri ".self::$itemlist[0]["uri"]." belongs to parent ".self::$itemlist[0]['parent-uri']." of user ".$importer["uid"].". It will be imported.", Logger::DEBUG);
}
}
foreach (self::$itemlist as $item) {
$found = Item::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]]);
if ($found) {
- Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already exists.", LOGGER_DEBUG);
+ Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already exists.", Logger::DEBUG);
} elseif ($item['contact-id'] < 0) {
- Logger::log("Item with uri ".$item["uri"]." is from a blocked contact.", LOGGER_DEBUG);
+ Logger::log("Item with uri ".$item["uri"]." is from a blocked contact.", Logger::DEBUG);
} else {
// We are having duplicated entries. Hopefully this solves it.
if (Lock::acquire('ostatus_process_item_insert')) {
}
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;
}
self::fetchRelated($related, $item["parent-uri"], $importer);
}
} else {
- Logger::log('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', LOGGER_DEBUG);
+ Logger::log('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', Logger::DEBUG);
}
} else {
$item["parent-uri"] = $item["uri"];
$condition = ['item-uri' => $conv_data['uri'],'protocol' => Conversation::PARCEL_FEED];
if (DBA::exists('conversation', $condition)) {
- Logger::log('Delete deprecated entry for URI '.$conv_data['uri'], LOGGER_DEBUG);
+ Logger::log('Delete deprecated entry for URI '.$conv_data['uri'], Logger::DEBUG);
DBA::delete('conversation', ['item-uri' => $conv_data['uri']]);
}
- Logger::log('Store conversation data for uri '.$conv_data['uri'], LOGGER_DEBUG);
+ Logger::log('Store conversation data for uri '.$conv_data['uri'], Logger::DEBUG);
Conversation::insert($conv_data);
}
}
{
$condition = ['`item-uri` = ? AND `protocol` IN (?, ?)', $self, Conversation::PARCEL_DFRN, Conversation::PARCEL_SALMON];
if (DBA::exists('conversation', $condition)) {
- Logger::log('Conversation '.$item['uri'].' is already stored.', LOGGER_DEBUG);
+ Logger::log('Conversation '.$item['uri'].' is already stored.', Logger::DEBUG);
return;
}
$item["protocol"] = Conversation::PARCEL_SALMON;
$item["source"] = $xml;
- Logger::log('Conversation '.$item['uri'].' is now fetched.', LOGGER_DEBUG);
+ Logger::log('Conversation '.$item['uri'].' is now fetched.', Logger::DEBUG);
}
/**
$stored = true;
$xml = $conversation['source'];
if (self::process($xml, $importer, $contact, $hub, $stored, false)) {
- Logger::log('Got valid cached XML for URI '.$related_uri, LOGGER_DEBUG);
+ Logger::log('Got valid cached XML for URI '.$related_uri, Logger::DEBUG);
return;
}
if ($conversation['protocol'] == Conversation::PARCEL_SALMON) {
- Logger::log('Delete invalid cached XML for URI '.$related_uri, LOGGER_DEBUG);
+ Logger::log('Delete invalid cached XML for URI '.$related_uri, Logger::DEBUG);
DBA::delete('conversation', ['item-uri' => $related_uri]);
}
}
$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();
}
$curlResult = Network::curl($atom_file);
if ($curlResult->isSuccess()) {
- Logger::log('Fetched XML for URI ' . $related_uri, LOGGER_DEBUG);
+ Logger::log('Fetched XML for URI ' . $related_uri, Logger::DEBUG);
$xml = $curlResult->getBody();
}
}
$curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related).'.atom');
if ($curlResult->isSuccess()) {
- Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, LOGGER_DEBUG);
+ Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, Logger::DEBUG);
$xml = $curlResult->getBody();
}
}
$curlResult = Network::curl(str_replace('/notice/', '/api/statuses/show/', $related_guess).'.atom');
if ($curlResult->isSuccess()) {
- Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, LOGGER_DEBUG);
+ Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, Logger::DEBUG);
$xml = $curlResult->getBody();
}
}
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
if (DBA::isResult($conversation)) {
$stored = true;
- Logger::log('Got cached XML from conversation for URI '.$related_uri, LOGGER_DEBUG);
+ Logger::log('Got cached XML from conversation for URI '.$related_uri, Logger::DEBUG);
$xml = $conversation['source'];
}
}
if ($xml != '') {
self::process($xml, $importer, $contact, $hub, $stored, false);
} else {
- Logger::log("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related, LOGGER_DEBUG);
+ Logger::log("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related, Logger::DEBUG);
}
return;
}
private static function reshareEntry(DOMDocument $doc, array $item, array $owner, $repeated_guid, $toplevel)
{
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
- Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
+ Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
}
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
private static function likeEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
{
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
- Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
+ Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
}
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
private static function noteEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
{
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
- Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
+ Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
}
$title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
if ((time() - strtotime($owner['last-item'])) < 15*60) {
$result = Cache::get($cachekey);
if (!$nocache && !is_null($result)) {
- Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)', LOGGER_DEBUG);
+ Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)', Logger::DEBUG);
$last_update = $result['last_update'];
return $result['feed'];
}
$msg = ['feed' => $feeddata, 'last_update' => $last_update];
Cache::set($cachekey, $msg, Cache::QUARTER_HOUR);
- Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, LOGGER_DEBUG);
+ Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, Logger::DEBUG);
return $feeddata;
}
$url = $url . (($uid) ? '/@me/@all?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation' : '?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation') ;
- Logger::log('load: ' . $url, LOGGER_DEBUG);
+ Logger::log('load: ' . $url, Logger::DEBUG);
$fetchresult = Network::fetchUrlFull($url);
$s = $fetchresult->getBody();
- Logger::log('load: returns ' . $s, LOGGER_DATA);
+ Logger::log('load: returns ' . $s, Logger::DATA);
- Logger::log('load: return code: ' . $fetchresult->getReturnCode(), LOGGER_DEBUG);
+ Logger::log('load: return code: ' . $fetchresult->getReturnCode(), Logger::DEBUG);
if (($fetchresult->getReturnCode() > 299) || (! $s)) {
return;
$j = json_decode($s, true);
- Logger::log('load: json: ' . print_r($j, true), LOGGER_DATA);
+ Logger::log('load: json: ' . print_r($j, true), Logger::DATA);
if (!isset($j['entry'])) {
return;
GContact::link($gcid, $uid, $cid, $zcid);
} catch (Exception $e) {
- Logger::log($e->getMessage(), LOGGER_DEBUG);
+ Logger::log($e->getMessage(), Logger::DEBUG);
}
}
- Logger::log("load: loaded $total entries", LOGGER_DEBUG);
+ Logger::log("load: loaded $total entries", Logger::DEBUG);
$condition = ["`cid` = ? AND `uid` = ? AND `zcid` = ? AND `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY", $cid, $uid, $zcid];
DBA::delete('glink', $condition);
}
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;
}
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
}
- Logger::log("Profile ".$profile.": Server ".$server_url." wasn't reachable.", LOGGER_DEBUG);
+ Logger::log("Profile ".$profile.": Server ".$server_url." wasn't reachable.", Logger::DEBUG);
return false;
}
$contact['server_url'] = $server_url;
$fields = ['last_contact' => DateTimeFormat::utcNow()];
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
- Logger::log("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", LOGGER_DEBUG);
+ Logger::log("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", Logger::DEBUG);
return $noscrape["updated"];
}
// If we only can poll the feed, then we only do this once a while
if (!$force && !self::updateNeeded($gcontacts[0]["created"], $gcontacts[0]["updated"], $gcontacts[0]["last_failure"], $gcontacts[0]["last_contact"])) {
- Logger::log("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG);
+ Logger::log("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", Logger::DEBUG);
GContact::update($contact);
return $gcontacts[0]["updated"];
self::lastUpdated($data["url"], $force);
} catch (Exception $e) {
- Logger::log($e->getMessage(), LOGGER_DEBUG);
+ Logger::log($e->getMessage(), Logger::DEBUG);
}
- Logger::log("Profile ".$profile." was deleted", LOGGER_DEBUG);
+ Logger::log("Profile ".$profile." was deleted", Logger::DEBUG);
return false;
}
$fields = ['last_failure' => DateTimeFormat::utcNow()];
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
- Logger::log("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG);
+ Logger::log("Profile ".$profile." wasn't reachable (profile)", Logger::DEBUG);
return false;
}
$fields = ['last_failure' => DateTimeFormat::utcNow()];
DBA::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
- Logger::log("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG);
+ Logger::log("Profile ".$profile." wasn't reachable (no feed)", Logger::DEBUG);
return false;
}
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;
}
foreach ($nodeinfo['links'] as $link) {
if (!is_array($link) || empty($link['rel'])) {
- Logger::log('Invalid nodeinfo format for ' . $server_url, LOGGER_DEBUG);
+ Logger::log('Invalid nodeinfo format for ' . $server_url, Logger::DEBUG);
continue;
}
if ($link['rel'] == 'http://nodeinfo.diaspora.software/ns/schema/1.0') {
}
if (!$force && !self::updateNeeded($gserver["created"], "", $last_failure, $last_contact)) {
- Logger::log("Use cached data for server ".$server_url, LOGGER_DEBUG);
+ Logger::log("Use cached data for server ".$server_url, Logger::DEBUG);
return ($last_contact >= $last_failure);
}
} else {
$last_contact = DBA::NULL_DATETIME;
$last_failure = DBA::NULL_DATETIME;
}
- Logger::log("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$gserver["created"]." Failure: ".$last_failure." Contact: ".$last_contact, LOGGER_DEBUG);
+ Logger::log("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$gserver["created"]." Failure: ".$last_failure." Contact: ".$last_contact, Logger::DEBUG);
$failure = false;
$possible_failure = false;
// But we want to make sure to only quit if we are mostly sure that this server url fits.
if (DBA::isResult($gserver) && ($orig_server_url == $server_url) &&
($curlResult->isTimeout())) {
- Logger::log("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
+ Logger::log("Connection to server ".$server_url." timed out.", Logger::DEBUG);
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
return false;
}
// Quit if there is a timeout
if ($curlResult->isTimeout()) {
- Logger::log("Connection to server " . $server_url . " timed out.", LOGGER_DEBUG);
+ Logger::log("Connection to server " . $server_url . " timed out.", Logger::DEBUG);
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
return false;
}
}
if (($last_contact <= $last_failure) && !$failure) {
- Logger::log("Server ".$server_url." seems to be alive, but last contact wasn't set - could be a bug", LOGGER_DEBUG);
+ Logger::log("Server ".$server_url." seems to be alive, but last contact wasn't set - could be a bug", Logger::DEBUG);
} elseif (($last_contact >= $last_failure) && $failure) {
- Logger::log("Server ".$server_url." seems to be dead, but last failure wasn't set - could be a bug", LOGGER_DEBUG);
+ Logger::log("Server ".$server_url." seems to be dead, but last failure wasn't set - could be a bug", Logger::DEBUG);
}
// Check again if the server exists
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;
}
*/
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");
$r = q("SELECT `nurl` FROM `gserver` WHERE `nurl` = '%s'", DBA::escape(normalise_link($server_url)));
if (!DBA::isResult($r)) {
- Logger::log("Call server check for server ".$server_url, LOGGER_DEBUG);
+ Logger::log("Call server check for server ".$server_url, Logger::DEBUG);
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server_url);
}
}
// Fetch all users from the other server
$url = $server["poco"] . "/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation";
- Logger::log("Fetch all users from the server " . $server["url"], LOGGER_DEBUG);
+ Logger::log("Fetch all users from the server " . $server["url"], Logger::DEBUG);
$curlResult = Network::curl($url);
$curlResult = Network::curl($url);
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
- Logger::log("Fetch all global contacts from the server " . $server["nurl"], LOGGER_DEBUG);
+ Logger::log("Fetch all global contacts from the server " . $server["nurl"], Logger::DEBUG);
$data = json_decode($curlResult->getBody(), true);
if (!empty($data)) {
}
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);
}
}
continue;
}
- Logger::log('Update directory from server ' . $gserver['url'] . ' with ID ' . $gserver['id'], LOGGER_DEBUG);
+ Logger::log('Update directory from server ' . $gserver['url'] . ' with ID ' . $gserver['id'], Logger::DEBUG);
Worker::add(PRIORITY_LOW, 'DiscoverPoCo', 'update_server_directory', (int) $gserver['id']);
if (!$complete && ( --$no_of_queries == 0)) {
}
if ($username != '') {
- Logger::log('Fetch contacts for the user ' . $username . ' from the server ' . $server['nurl'], LOGGER_DEBUG);
+ Logger::log('Fetch contacts for the user ' . $username . ' from the server ' . $server['nurl'], Logger::DEBUG);
// Fetch all contacts from a given user from the other server
$url = $server['poco'] . '/' . $username . '/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation';
if ($generation > 0) {
$success = true;
- Logger::log("Store profile ".$profile_url, LOGGER_DEBUG);
+ Logger::log("Store profile ".$profile_url, Logger::DEBUG);
$gcontact = ["url" => $profile_url,
"name" => $name,
$gcontact = GContact::sanitize($gcontact);
GContact::update($gcontact);
} catch (Exception $e) {
- Logger::log($e->getMessage(), LOGGER_DEBUG);
+ Logger::log($e->getMessage(), Logger::DEBUG);
}
- Logger::log("Done for profile ".$profile_url, LOGGER_DEBUG);
+ Logger::log("Done for profile ".$profile_url, Logger::DEBUG);
}
}
return $success;
$hookdata['headers'],
$hookdata['parameters']
);
- Logger::log("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
- Logger::log("return value " . (($res)?"true":"false"), LOGGER_DEBUG);
+ Logger::log("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, Logger::DEBUG);
+ Logger::log("return value " . (($res)?"true":"false"), Logger::DEBUG);
return $res;
}
}
$x = Crypto::rsaVerify($signed_data, $sig_block['signature'], $key, $algorithm);
- Logger::log('verified: ' . $x, LOGGER_DEBUG);
+ Logger::log('verified: ' . $x, Logger::DEBUG);
if (!$x) {
return $result;
$profile = APContact::getByURL($url);
if (!empty($profile)) {
- Logger::log('Taking key from id ' . $id, LOGGER_DEBUG);
+ Logger::log('Taking key from id ' . $id, Logger::DEBUG);
return ['url' => $url, 'pubkey' => $profile['pubkey']];
} elseif ($url != $actor) {
$profile = APContact::getByURL($actor);
if (!empty($profile)) {
- Logger::log('Taking key from actor ' . $actor, LOGGER_DEBUG);
+ Logger::log('Taking key from actor ' . $actor, Logger::DEBUG);
return ['url' => $actor, 'pubkey' => $profile['pubkey']];
}
}
}
catch (Exception $e) {
$normalized = false;
- Logger::log('normalise error:' . print_r($e, true), LOGGER_DEBUG);
+ Logger::log('normalise error:' . print_r($e, true), Logger::DEBUG);
}
return $normalized;
}
catch (Exception $e) {
$compacted = false;
- Logger::log('compacting error:' . print_r($e, true), LOGGER_DEBUG);
+ Logger::log('compacting error:' . print_r($e, true), Logger::DEBUG);
}
return json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true);
$url = self::unparseURL($parts);
if (self::isUrlBlocked($url)) {
- Logger::log('domain of ' . $url . ' is blocked', LOGGER_DATA);
+ Logger::log('domain of ' . $url . ' is blocked', Logger::DATA);
return CurlResult::createErrorCurl($url);
}
$stamp1 = microtime(true);
if (self::isUrlBlocked($url)) {
- Logger::log('post_url: domain of ' . $url . ' is blocked', LOGGER_DATA);
+ Logger::log('post_url: domain of ' . $url . ' is blocked', Logger::DATA);
return CurlResult::createErrorCurl($url);
}
return CurlResult::createErrorCurl($url);
}
- Logger::log('post_url: start ' . $url, LOGGER_DATA);
+ Logger::log('post_url: start ' . $url, Logger::DATA);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$a->saveTimestamp($stamp1, 'network');
- Logger::log('post_url: end ' . $url, LOGGER_DATA);
+ Logger::log('post_url: end ' . $url, Logger::DATA);
return $curlResponse;
}
$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'];
}
}
if ($count > 10) {
- Logger::log('Endless loop detected for ' . $url, LOGGER_DEBUG);
+ Logger::log('Endless loop detected for ' . $url, Logger::DEBUG);
return $siteinfo;
}
}
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);
}
}
}
- 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);
@xml_parser_free($parser);
if (! $xml_values) {
- Logger::log('Xml::toArray: libxml: parse error: ' . $contents, LOGGER_DATA);
+ Logger::log('Xml::toArray: libxml: parse error: ' . $contents, Logger::DATA);
foreach (libxml_get_errors() as $err) {
- Logger::log('libxml: parse: ' . $err->code . " at " . $err->line . ":" . $err->column . " : " . $err->message, LOGGER_DATA);
+ Logger::log('libxml: parse: ' . $err->code . " at " . $err->line . ":" . $err->column . " : " . $err->message, Logger::DATA);
}
libxml_clear_errors();
return;
$x = @simplexml_load_string($s);
if (!$x) {
- Logger::log('libxml: parse: error: ' . $s, LOGGER_DATA);
+ Logger::log('libxml: parse: error: ' . $s, Logger::DATA);
foreach (libxml_get_errors() as $err) {
- Logger::log('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA);
+ Logger::log('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, Logger::DATA);
}
libxml_clear_errors();
}
*/
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;
// don't check
return;
}
- Logger::log("Checking VERSION from: ".$checked_url, LOGGER_DEBUG);
+ Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG);
// fetch the VERSION file
$gitversion = DBA::escape(trim(Network::fetchUrl($checked_url)));
- Logger::log("Upstream VERSION is: ".$gitversion, LOGGER_DEBUG);
+ Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
Config::set('system', 'git_friendica_version', $gitversion);
return;
}
- Logger::log("Starting cronjob " . $command, LOGGER_DEBUG);
+ Logger::log("Starting cronjob " . $command, Logger::DEBUG);
// Call possible post update functions
// see src/Database/PostUpdate.php for more details
return;
}
- Logger::log("Xronjob " . $command . " is unknown.", LOGGER_DEBUG);
+ Logger::log("Xronjob " . $command . " is unknown.", Logger::DEBUG);
return;
}
// Calculate fragmentation
$fragmentation = $table["Data_free"] / ($table["Data_length"] + $table["Index_length"]);
- Logger::log("Table " . $table["Name"] . " - Fragmentation level: " . round($fragmentation * 100, 2), LOGGER_DEBUG);
+ Logger::log("Table " . $table["Name"] . " - Fragmentation level: " . round($fragmentation * 100, 2), Logger::DEBUG);
// Don't optimize tables that needn't to be optimized
if ($fragmentation < $fragmentation_level) {
}
// 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"]));
}
}
continue;
}
- Logger::log("Repair contact " . $contact["id"] . " " . $contact["url"], LOGGER_DEBUG);
+ Logger::log("Repair contact " . $contact["id"] . " " . $contact["url"], Logger::DEBUG);
q("UPDATE `contact` SET `batch` = '%s', `notify` = '%s', `poll` = '%s', pubkey = '%s' WHERE `id` = %d",
DBA::escape($data["batch"]), DBA::escape($data["notify"]), DBA::escape($data["poll"]), DBA::escape($data["pubkey"]),
intval($contact["id"]));
public static function execute($cmd, $item_id, $contact_id)
{
- Logger::log('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $contact_id, LOGGER_DEBUG);
+ Logger::log('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $contact_id, Logger::DEBUG);
$top_level = false;
$followup = false;
*/
if (!$top_level && ($parent['wall'] == 0) && stristr($target_item['uri'], $localhost)) {
- Logger::log('Followup ' . $target_item["guid"], LOGGER_DEBUG);
+ Logger::log('Followup ' . $target_item["guid"], Logger::DEBUG);
// local followup to remote post
$followup = true;
}
$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));
Addon::callHooks('globaldir_update', $arr);
- Logger::log('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
+ Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG);
if (strlen($arr['url'])) {
Network::fetchUrl($dir . '?url=' . bin2hex($arr['url']));
}
} else {
$result .= "failed";
}
- Logger::log($result, LOGGER_DEBUG);
+ Logger::log($result, Logger::DEBUG);
} elseif ($mode == 3) {
GContact::updateSuggestions();
} elseif (($mode == 2) && Config::get('system', 'poco_completion')) {
if (!PortableContact::updateNeeded($server["created"], "", $server["last_failure"], $server["last_contact"])) {
continue;
}
- Logger::log('Update server status for server '.$server["url"], LOGGER_DEBUG);
+ Logger::log('Update server status for server '.$server["url"], Logger::DEBUG);
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $server["url"]);
}
private static function discoverUsers() {
- Logger::log("Discover users", LOGGER_DEBUG);
+ Logger::log("Discover users", Logger::DEBUG);
$starttime = time();
if (!is_null($data)) {
// Only search for the same item every 24 hours
if (time() < $data + (60 * 60 * 24)) {
- Logger::log("Already searched for ".$search." in the last 24 hours", LOGGER_DEBUG);
+ Logger::log("Already searched for ".$search." in the last 24 hours", Logger::DEBUG);
return;
}
}
// Check if the contact already exists
$exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url));
if (DBA::isResult($exists)) {
- Logger::log("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG);
+ Logger::log("Profile ".$jj->url." already exists (".$search.")", Logger::DEBUG);
if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) &&
($exists[0]["updated"] < $exists[0]["last_failure"])) {
$server_url = PortableContact::detectServer($jj->url);
if ($server_url != '') {
if (!PortableContact::checkServer($server_url)) {
- Logger::log("Friendica server ".$server_url." doesn't answer.", LOGGER_DEBUG);
+ Logger::log("Friendica server ".$server_url." doesn't answer.", Logger::DEBUG);
continue;
}
- Logger::log("Friendica server ".$server_url." seems to be okay.", LOGGER_DEBUG);
+ Logger::log("Friendica server ".$server_url." seems to be okay.", Logger::DEBUG);
}
$data = Probe::uri($jj->url);
if ($data["network"] == Protocol::DFRN) {
- Logger::log("Profile ".$jj->url." is reachable (".$search.")", LOGGER_DEBUG);
- Logger::log("Add profile ".$jj->url." to local directory (".$search.")", LOGGER_DEBUG);
+ Logger::log("Profile ".$jj->url." is reachable (".$search.")", Logger::DEBUG);
+ Logger::log("Add profile ".$jj->url." to local directory (".$search.")", Logger::DEBUG);
if ($jj->tags != "") {
$data["keywords"] = $jj->tags;
GContact::update($data);
} else {
- Logger::log("Profile ".$jj->url." is not responding or no Friendica contact - but network ".$data["network"], LOGGER_DEBUG);
+ Logger::log("Profile ".$jj->url." is not responding or no Friendica contact - but network ".$data["network"], Logger::DEBUG);
}
}
}
Hook::loadHooks();
if ($param == 'delete') {
- Logger::log('Delete expired items', LOGGER_DEBUG);
+ Logger::log('Delete expired items', Logger::DEBUG);
// physically remove anything that has been deleted for more than two months
$condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"];
$rows = DBA::select('item', ['id'], $condition);
// Normally we shouldn't have orphaned data at all.
// If we do have some, then we have to check why.
- Logger::log('Deleting orphaned item activities - start', LOGGER_DEBUG);
+ Logger::log('Deleting orphaned item activities - start', Logger::DEBUG);
$condition = ["NOT EXISTS (SELECT `iaid` FROM `item` WHERE `item`.`iaid` = `item-activity`.`id`)"];
DBA::delete('item-activity', $condition);
- Logger::log('Orphaned item activities deleted: ' . DBA::affectedRows(), LOGGER_DEBUG);
+ Logger::log('Orphaned item activities deleted: ' . DBA::affectedRows(), Logger::DEBUG);
- Logger::log('Deleting orphaned item content - start', LOGGER_DEBUG);
+ Logger::log('Deleting orphaned item content - start', Logger::DEBUG);
$condition = ["NOT EXISTS (SELECT `icid` FROM `item` WHERE `item`.`icid` = `item-content`.`id`)"];
DBA::delete('item-content', $condition);
- Logger::log('Orphaned item content deleted: ' . DBA::affectedRows(), LOGGER_DEBUG);
+ Logger::log('Orphaned item content deleted: ' . DBA::affectedRows(), Logger::DEBUG);
// make this optional as it could have a performance impact on large sites
if (intval(Config::get('system', 'optimize_items'))) {
DBA::e("OPTIMIZE TABLE `item`");
}
- Logger::log('Delete expired items - done', LOGGER_DEBUG);
+ Logger::log('Delete expired items - done', Logger::DEBUG);
return;
} elseif (intval($param) > 0) {
$user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
if (DBA::isResult($user)) {
- Logger::log('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
+ Logger::log('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], Logger::DEBUG);
Item::expire($user['uid'], $user['expire']);
- Logger::log('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG);
+ Logger::log('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', Logger::DEBUG);
}
return;
} elseif ($param == 'hook' && !empty($hook_function)) {
foreach (Hook::getByName('expire') as $hook) {
if ($hook[1] == $hook_function) {
- Logger::log("Calling expire hook '" . $hook[1] . "'", LOGGER_DEBUG);
+ Logger::log("Calling expire hook '" . $hook[1] . "'", Logger::DEBUG);
Hook::callSingle($a, 'expire', $hook, $data);
}
}
$r = DBA::p("SELECT `uid`, `username` FROM `user` WHERE `expire` != 0");
while ($row = DBA::fetch($r)) {
- Logger::log('Calling expiry for user '.$row['uid'].' ('.$row['username'].')', LOGGER_DEBUG);
+ Logger::log('Calling expiry for user '.$row['uid'].' ('.$row['username'].')', Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Expire', (int)$row['uid']);
}
Logger::log('expire: calling hooks');
foreach (Hook::getByName('expire') as $hook) {
- Logger::log("Calling expire hook for '" . $hook[1] . "'", LOGGER_DEBUG);
+ Logger::log("Calling expire hook for '" . $hook[1] . "'", Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Expire', 'hook', $hook[1]);
}
DBA::escape(normalise_link($url))
);
- Logger::log("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
+ Logger::log("gprobe start for ".normalise_link($url), Logger::DEBUG);
if (!DBA::isResult($r)) {
// Is it a DDoS attempt?
$result = Cache::get("gprobe:".$urlparts["host"]);
if (!is_null($result)) {
if (in_array($result["network"], [Protocol::FEED, Protocol::PHANTOM])) {
- Logger::log("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG);
+ Logger::log("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), Logger::DEBUG);
return;
}
}
}
}
- Logger::log("gprobe end for ".normalise_link($url), LOGGER_DEBUG);
+ Logger::log("gprobe end for ".normalise_link($url), Logger::DEBUG);
return;
}
}
{
$a = BaseObject::getApp();
- Logger::log('notifier: invoked: '.$cmd.': '.$item_id, LOGGER_DEBUG);
+ Logger::log('notifier: invoked: '.$cmd.': '.$item_id, Logger::DEBUG);
$top_level = false;
$recipients = [];
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser(0);
foreach ($inboxes as $inbox) {
- Logger::log('Account removal for user ' . $item_id . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);
+ Logger::log('Account removal for user ' . $item_id . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'APDelivery', Delivery::REMOVAL, '', $inbox, $item_id);
}
$condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];
$thr_parent = Item::selectFirst($fields, $condition);
- Logger::log('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent['network'], LOGGER_DEBUG);
+ Logger::log('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent['network'], Logger::DEBUG);
// This is IMPORTANT!!!!
$recipients = [$parent['contact-id']];
$recipients_followup = [$parent['contact-id']];
- Logger::log('notifier: followup '.$target_item["guid"].' to '.$conversant_str, LOGGER_DEBUG);
+ Logger::log('notifier: followup '.$target_item["guid"].' to '.$conversant_str, Logger::DEBUG);
//if (!$target_item['private'] && $target_item['wall'] &&
if (!$target_item['private'] &&
$push_notify = false;
}
- Logger::log("Notify ".$target_item["guid"]." via PuSH: ".($push_notify?"Yes":"No"), LOGGER_DEBUG);
+ Logger::log("Notify ".$target_item["guid"]." via PuSH: ".($push_notify?"Yes":"No"), Logger::DEBUG);
} else {
$followup = false;
- Logger::log('Distributing directly '.$target_item["guid"], LOGGER_DEBUG);
+ Logger::log('Distributing directly '.$target_item["guid"], Logger::DEBUG);
// don't send deletions onward for other people's stuff
if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) {
$diaspora_delivery = false;
- Logger::log('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG);
+ Logger::log('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], Logger::DEBUG);
// Send a salmon to the parent author
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
// Send a salmon notification to every person we mentioned in the post
$arr = explode(',',$target_item['tag']);
foreach ($arr as $x) {
- //Logger::log('Checking tag '.$x, LOGGER_DEBUG);
+ //Logger::log('Checking tag '.$x, Logger::DEBUG);
$matches = null;
if (preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) {
$probed_contact = Probe::uri($matches[1]);
// delivery loop
if (DBA::isResult($r)) {
foreach ($r as $contact) {
- Logger::log("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
+ Logger::log("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Delivery', $cmd, $item_id, (int)$contact['id']);
$r = array_merge($r2, $r1);
if (DBA::isResult($r)) {
- Logger::log('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
+ Logger::log('pubdeliver '.$target_item["guid"].': '.print_r($r,true), Logger::DEBUG);
foreach ($r as $rr) {
// except for Diaspora batch jobs
// Notify PuSH subscribers (Used for OStatus distribution of regular posts)
if ($push_notify) {
- Logger::log('Activating internal PuSH for item '.$item_id, LOGGER_DEBUG);
+ Logger::log('Activating internal PuSH for item '.$item_id, Logger::DEBUG);
// Handling the pubsubhubbub requests
PushSubscriber::publishFeed($owner['uid'], $a->queue['priority']);
}
- Logger::log('notifier: calling hooks for ' . $cmd . ' ' . $item_id, LOGGER_DEBUG);
+ Logger::log('notifier: calling hooks for ' . $cmd . ' ' . $item_id, Logger::DEBUG);
if ($normal_mode) {
Hook::fork($a->queue['priority'], 'notifier_normal', $target_item);
if ($target_item['origin']) {
$inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid);
- Logger::log('Origin item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', LOGGER_DEBUG);
+ Logger::log('Origin item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', Logger::DEBUG);
} elseif (!DBA::exists('conversation', ['item-uri' => $target_item['uri'], 'protocol' => Conversation::PARCEL_ACTIVITYPUB])) {
- Logger::log('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' is no AP post. It will not be distributed.', LOGGER_DEBUG);
+ Logger::log('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' is no AP post. It will not be distributed.', Logger::DEBUG);
return;
} else {
// Remote items are transmitted via the personal inboxes.
// Doing so ensures that the dedicated receiver will get the message.
$personal = true;
- Logger::log('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', LOGGER_DEBUG);
+ Logger::log('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', Logger::DEBUG);
}
if ($parent['origin']) {
}
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;
}
ActivityPub\Transmitter::createCachedActivityFromItem($item_id, true);
foreach ($inboxes as $inbox) {
- Logger::log('Deliver ' . $item_id .' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);
+ Logger::log('Deliver ' . $item_id .' to ' . $inbox .' via ActivityPub', Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'APDelivery', $cmd, $item_id, $inbox, $uid);
$updated = DateTimeFormat::utcNow();
if ($last_updated) {
- Logger::log('Contact '.$contact['id'].' had last update on '.$last_updated, LOGGER_DEBUG);
+ Logger::log('Contact '.$contact['id'].' had last update on '.$last_updated, Logger::DEBUG);
// The last public item can be older than the last item we got
if ($last_updated < $contact['last-item']) {
} else {
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
Contact::markForArchival($contact);
- Logger::log('Contact '.$contact['id'].' is marked for archival', LOGGER_DEBUG);
+ Logger::log('Contact '.$contact['id'].' is marked for archival', Logger::DEBUG);
}
return;
$handshake_xml = $curlResult->getBody();
$html_code = $curlResult->getReturnCode();
- Logger::log('handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA);
+ Logger::log('handshake with url ' . $url . ' returns xml: ' . $handshake_xml, Logger::DATA);
if (!strlen($handshake_xml) || ($html_code >= 400) || !$html_code) {
Logger::log("$url appears to be dead - marking for death ");
$xml = $curlResult->getBody();
} elseif ($contact['network'] === Protocol::MAIL) {
- Logger::log("Mail: Fetching for ".$contact['addr'], LOGGER_DEBUG);
+ Logger::log("Mail: Fetching for ".$contact['addr'], Logger::DEBUG);
$mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1);
if ($mail_disabled) {
return;
}
- Logger::log("Mail: Enabled", LOGGER_DEBUG);
+ Logger::log("Mail: Enabled", Logger::DEBUG);
$mbox = null;
$user = DBA::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
$msgs = Email::poll($mbox, $contact['addr']);
if (count($msgs)) {
- Logger::log("Mail: Parsing ".count($msgs)." mails from ".$contact['addr']." for ".$mailconf['user'], LOGGER_DEBUG);
+ Logger::log("Mail: Parsing ".count($msgs)." mails from ".$contact['addr']." for ".$mailconf['user'], Logger::DEBUG);
$metas = Email::messageMeta($mbox, implode(',', $msgs));
if (count($metas) != count($msgs)) {
- Logger::log("for " . $mailconf['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", LOGGER_DEBUG);
+ Logger::log("for " . $mailconf['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", Logger::DEBUG);
} else {
$msgs = array_combine($msgs, $metas);
foreach ($msgs as $msg_uid => $meta) {
- Logger::log("Mail: Parsing mail ".$msg_uid, LOGGER_DATA);
+ Logger::log("Mail: Parsing mail ".$msg_uid, Logger::DATA);
$datarray = [];
$datarray['verb'] = ACTIVITY_POST;
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
$item = Item::selectFirst($fields, $condition);
if (DBA::isResult($item)) {
- Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
+ Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],Logger::DEBUG);
// Only delete when mails aren't automatically moved or deleted
if (($mailconf['action'] != 1) && ($mailconf['action'] != 3))
switch ($mailconf['action']) {
case 0:
- Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", LOGGER_DEBUG);
+ Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", Logger::DEBUG);
break;
case 1:
Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']);
switch ($mailconf['action']) {
case 0:
- Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", LOGGER_DEBUG);
+ Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", Logger::DEBUG);
break;
case 1:
Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']);
}
if ($xml) {
- Logger::log('received xml : ' . $xml, LOGGER_DATA);
+ Logger::log('received xml : ' . $xml, Logger::DATA);
if (!strstr($xml, '<')) {
Logger::log('post_handshake: response from ' . $url . ' did not contain XML.');
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
foreach ($inboxes as $inbox) {
- Logger::log('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);
+ Logger::log('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'APDelivery', Delivery::PROFILEUPDATE, '', $inbox, $uid);
}
/// @todo Check server status with PortableContact::checkServer()
// Before this can be done we need a way to safely detect the server url.
- Logger::log("Generate feed of user " . $subscriber['nickname']. " to " . $subscriber['callback_url']. " - last updated " . $subscriber['last_update'], LOGGER_DEBUG);
+ Logger::log("Generate feed of user " . $subscriber['nickname']. " to " . $subscriber['callback_url']. " - last updated " . $subscriber['last_update'], Logger::DEBUG);
$last_update = $subscriber['last_update'];
$params = OStatus::feed($subscriber['nickname'], $last_update);
$subscriber['topic']),
"X-Hub-Signature: sha1=" . $hmac_sig];
- Logger::log('POST ' . print_r($headers, true) . "\n" . $params, LOGGER_DATA);
+ Logger::log('POST ' . print_r($headers, true) . "\n" . $params, Logger::DATA);
$postResult = Network::post($subscriber['callback_url'], $params, $headers);
$ret = $postResult->getReturnCode();
$result = Item::insert($arr);
- Logger::log("Spool file ".$file." stored: ".$result, LOGGER_DEBUG);
+ Logger::log("Spool file ".$file." stored: ".$result, Logger::DEBUG);
unlink($fullfile);
}
closedir($dh);
$modified = $stylemodified;
}
} else {
- //TODO: use LOGGER_ERROR?
+ //TODO: use Logger::ERROR?
Logger::log('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')');
}
}