1
0
Fork 0

Replace deprecated log calls

This commit is contained in:
Michael 2021-10-20 18:53:52 +00:00
commit f6faae5bb1
28 changed files with 163 additions and 163 deletions

View file

@ -99,7 +99,7 @@ function display_init(App $a)
}
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
Logger::log('Directly serving XML for uri-id '.$item['uri-id'], Logger::DEBUG);
Logger::info('Directly serving XML for uri-id '.$item['uri-id']);
displayShowFeed($item['uri-id'], $item['uid'], false);
}

View file

@ -59,14 +59,14 @@ function pubsub_init(App $a)
$hub_challenge = Strings::escapeTags(trim($_GET['hub_challenge'] ?? ''));
$hub_verify = Strings::escapeTags(trim($_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::notice('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);
Logger::debug('Data: ', ['get' => $_GET]);
$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
$owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (!DBA::isResult($owner)) {
Logger::log('Local account not found: ' . $nick);
Logger::notice('Local account not found: ' . $nick);
hub_return(false, '');
}
@ -78,12 +78,12 @@ function pubsub_init(App $a)
$contact = DBA::selectFirst('contact', ['id', 'poll'], $condition);
if (!DBA::isResult($contact)) {
Logger::log('Contact ' . $contact_id . ' not found.');
Logger::notice('Contact ' . $contact_id . ' not found.');
hub_return(false, '');
}
if (!empty($hub_topic) && !Strings::compareLink($hub_topic, $contact['poll'])) {
Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
Logger::notice('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
hub_return(false, '');
}
@ -91,13 +91,13 @@ function pubsub_init(App $a)
// Don't allow outsiders to unsubscribe us.
if (($hub_mode === 'unsubscribe') && empty($hub_verify)) {
Logger::log('Bogus unsubscribe');
Logger::notice('Bogus unsubscribe');
hub_return(false, '');
}
if (!empty($hub_mode)) {
Contact::update(['subhub' => $subscribe], ['id' => $contact['id']]);
Logger::log($hub_mode . ' success for contact ' . $contact_id . '.');
Logger::notice($hub_mode . ' success for contact ' . $contact_id . '.');
}
hub_return(true, $hub_challenge);
}
@ -107,8 +107,8 @@ function pubsub_post(App $a)
{
$xml = Network::postdata();
Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . DI::args()->getCommand() . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
Logger::log('Data: ' . $xml, Logger::DATA);
Logger::notice('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . DI::args()->getCommand() . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
Logger::debug('Data: ' . $xml);
$nick = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : '');
$contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2]) : 0 );
@ -126,10 +126,10 @@ function pubsub_post(App $a)
if (!empty($author['contact-id'])) {
$condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
$contact = DBA::selectFirst('contact', [], $condition);
Logger::log('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
Logger::notice('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
}
if (!DBA::isResult($contact)) {
Logger::log('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml);
Logger::notice('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml);
hub_post_return();
}
}
@ -139,7 +139,7 @@ function pubsub_post(App $a)
}
if (!in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]) && ($contact['network'] != Protocol::FEED)) {
Logger::log('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.');
Logger::notice('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.');
hub_post_return();
}
@ -149,7 +149,7 @@ function pubsub_post(App $a)
hub_post_return();
}
Logger::log('Import item for ' . $nick . ' from ' . $contact['nick'] . ' (' . $contact['id'] . ')');
Logger::notice('Import item for ' . $nick . ' from ' . $contact['nick'] . ' (' . $contact['id'] . ')');
$feedhub = '';
OStatus::import($xml, $importer, $contact, $feedhub);

View file

@ -60,11 +60,11 @@ function pubsubhubbub_init(App $a) {
} elseif ($hub_mode === 'unsubscribe') {
$subscribe = 0;
} else {
Logger::log("Invalid hub_mode=$hub_mode, ignoring.");
Logger::notice("Invalid hub_mode=$hub_mode, ignoring.");
throw new \Friendica\Network\HTTPException\NotFoundException();
}
Logger::log("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
Logger::notice("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
if (DI::args()->getArgc() > 1) {
// Normally the url should now contain the nick name as last part of the url
@ -77,7 +77,7 @@ function pubsubhubbub_init(App $a) {
$nick = basename($nick, '.atom');
if (!$nick) {
Logger::log('Bad hub_topic=$hub_topic, ignoring.');
Logger::notice('Bad hub_topic=$hub_topic, ignoring.');
throw new \Friendica\Network\HTTPException\NotFoundException();
}
@ -85,7 +85,7 @@ function pubsubhubbub_init(App $a) {
$condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
$owner = DBA::selectFirst('user', ['uid', 'nickname'], $condition);
if (!DBA::isResult($owner)) {
Logger::log('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
Logger::notice('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
throw new \Friendica\Network\HTTPException\NotFoundException();
}
@ -94,7 +94,7 @@ function pubsubhubbub_init(App $a) {
'pending' => false, 'self' => true];
$contact = DBA::selectFirst('contact', ['poll'], $condition);
if (!DBA::isResult($contact)) {
Logger::log('Self contact for user ' . $owner['uid'] . ' not found.');
Logger::notice('Self contact for user ' . $owner['uid'] . ' not found.');
throw new \Friendica\Network\HTTPException\NotFoundException();
}
@ -103,7 +103,7 @@ function pubsubhubbub_init(App $a) {
$self = DI::baseUrl() . '/api/statuses/user_timeline/' . $owner['nickname'] . '.atom';
if (!Strings::compareLink($hub_topic, $contact['poll']) && !Strings::compareLink($hub_topic2, $contact['poll']) && !Strings::compareLink($hub_topic, $self)) {
Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
Logger::notice('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
throw new \Friendica\Network\HTTPException\NotFoundException();
}
@ -131,14 +131,14 @@ function pubsubhubbub_init(App $a) {
// give up if the HTTP return code wasn't a success (2xx)
if ($ret < 200 || $ret > 299) {
Logger::log("Subscriber verification for $hub_topic at $hub_callback returned $ret, ignoring.");
Logger::notice("Subscriber verification for $hub_topic at $hub_callback returned $ret, ignoring.");
throw new \Friendica\Network\HTTPException\NotFoundException();
}
// check that the correct hub_challenge code was echoed back
if (trim($body) !== $hub_challenge) {
Logger::log("Subscriber did not echo back hub.challenge, ignoring.");
Logger::log("\"$hub_challenge\" != \"".trim($body)."\"");
Logger::notice("Subscriber did not echo back hub.challenge, ignoring.");
Logger::notice("\"$hub_challenge\" != \"".trim($body)."\"");
throw new \Friendica\Network\HTTPException\NotFoundException();
}

View file

@ -76,7 +76,7 @@ function redir_init(App $a) {
// Local user is already authenticated.
redir_check_url($contact_url, $url);
$target_url = $url ?: $contact_url;
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
Logger::info($contact['name'] . " is already authenticated. Redirecting to " . $target_url);
$a->redirect($target_url);
}
}
@ -93,7 +93,7 @@ function redir_init(App $a) {
// Remote user is already authenticated.
redir_check_url($contact_url, $url);
$target_url = $url ?: $contact_url;
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
Logger::info($contact['name'] . " is already authenticated. Redirecting to " . $target_url);
$a->redirect($target_url);
}
}
@ -112,7 +112,7 @@ function redir_init(App $a) {
$url .= $separator . 'zrl=' . urlencode($my_profile);
}
Logger::log('redirecting to ' . $url, Logger::DEBUG);
Logger::info('redirecting to ' . $url);
$a->redirect($url);
}

View file

@ -38,7 +38,7 @@ use Friendica\Util\Strings;
function wall_upload_post(App $a, $desktopmode = true)
{
Logger::log("wall upload: starting new upload", Logger::DEBUG);
Logger::info("wall upload: starting new upload");
$r_json = (!empty($_GET['response']) && $_GET['response'] == 'json');
$album = trim($_GET['album'] ?? '');
@ -156,8 +156,8 @@ function wall_upload_post(App $a, $desktopmode = true)
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
Logger::log("File upload src: " . $src . " - filename: " . $filename .
" - size: " . $filesize . " - type: " . $filetype, Logger::DEBUG);
Logger::info("File upload src: " . $src . " - filename: " . $filename .
" - size: " . $filesize . " - type: " . $filetype);
$imagedata = @file_get_contents($src);
$Image = new Image($imagedata, $filetype);
@ -183,7 +183,7 @@ function wall_upload_post(App $a, $desktopmode = true)
if ($max_length > 0) {
$Image->scaleDown($max_length);
$filesize = strlen($Image->asString());
Logger::log("File upload: Scaling picture to new size " . $max_length, Logger::DEBUG);
Logger::info("File upload: Scaling picture to new size " . $max_length);
}
$width = $Image->getWidth();
@ -278,11 +278,11 @@ function wall_upload_post(App $a, $desktopmode = true)
echo json_encode(['picture' => $picture]);
exit();
}
Logger::log("upload done", Logger::DEBUG);
Logger::info("upload done");
return $picture;
}
Logger::log("upload done", Logger::DEBUG);
Logger::info("upload done");
if ($r_json) {
echo json_encode(['ok' => true]);