Browse Source

Refactor dynamic App::getLogger() to static DI::logger()

pull/8019/head
nupplaPhil 1 year ago
parent
commit
e2b2778e0a
No known key found for this signature in database GPG Key ID: D8365C3D36B77D90
9 changed files with 11 additions and 22 deletions
  1. +1
    -1
      include/api.php
  2. +0
    -10
      src/App.php
  3. +1
    -1
      src/App/Authentication.php
  4. +2
    -2
      src/Core/Worker.php
  5. +1
    -2
      src/Model/Nodeinfo.php
  6. +3
    -3
      src/Module/Admin/Summary.php
  7. +1
    -1
      src/Module/Filer/RemoveTag.php
  8. +1
    -1
      src/Module/Filer/SaveTag.php
  9. +1
    -1
      src/Module/Statistics.php

+ 1
- 1
include/api.php View File

@ -328,7 +328,7 @@ function api_call(App $a)
Logger::info(API_LOG_PREFIX . 'username {username}', ['module' => 'api', 'action' => 'call', 'username' => $a->user['username'], 'duration' => round($duration, 2)]);
$a->getProfiler()->saveLog($a->getLogger(), API_LOG_PREFIX . 'performance');
$a->getProfiler()->saveLog(DI::logger(), API_LOG_PREFIX . 'performance');
if (false === $return) {
/*


+ 0
- 10
src/App.php View File

@ -155,16 +155,6 @@ class App
return $this->config->getCache()->get('system', 'basepath');
}
/**
* The Logger of this app
*
* @return LoggerInterface
*/
public function getLogger()
{
return $this->logger;
}
/**
* The profiler of this app
*


+ 1
- 1
src/App/Authentication.php View File

@ -351,7 +351,7 @@ class Authentication
* The week ensures that sessions will expire after some inactivity.
*/;
if ($this->session->get('remember')) {
$a->getLogger()->info('Injecting cookie for remembered user ' . $user_record['nickname']);
$this->logger->info('Injecting cookie for remembered user ' . $user_record['nickname']);
$this->cookie->set($user_record['uid'], $user_record['password'], $user_record['prvkey']);
$this->session->remove('remember');
}


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

@ -443,7 +443,7 @@ class Worker
Logger::info('Process done.', ['priority' => $queue["priority"], 'id' => $queue["id"], 'duration' => round($duration, 3)]);
$a->getProfiler()->saveLog($a->getLogger(), "ID " . $queue["id"] . ": " . $funcname);
$a->getProfiler()->saveLog(DI::logger(), "ID " . $queue["id"] . ": " . $funcname);
$cooldown = Config::get("system", "worker_cooldown", 0);
@ -1086,7 +1086,7 @@ class Worker
$args = ['no_cron' => !$do_cron];
$a = get_app();
$process = new Core\Process($a->getLogger(), $a->getMode(), DI::config(), $a->getBasePath());
$process = new Core\Process(DI::logger(), $a->getMode(), DI::config(), $a->getBasePath());
$process->run($command, $args);
// after spawning we have to remove the flag.


+ 1
- 2
src/Model/Nodeinfo.php View File

@ -18,9 +18,8 @@ class Nodeinfo
*/
public static function update()
{
$app = DI::app();
$config = DI::config();
$logger = $app->getLogger();
$logger = DI::logger();
// If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
if (Addon::isEnabled('statistics_json')) {


+ 3
- 3
src/Module/Admin/Summary.php View File

@ -118,7 +118,7 @@ class Summary extends BaseAdminModule
$currBasepath = DI::config()->get('system', 'basepath');
if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) {
if (is_dir($confBasepath) && Config::set('system', 'basepath', $confBasepath)) {
$a->getLogger()->info('Friendica\'s system.basepath was updated successfully.', [
DI::logger()->info('Friendica\'s system.basepath was updated successfully.', [
'from' => $currBasepath,
'to' => $confBasepath,
]);
@ -126,7 +126,7 @@ class Summary extends BaseAdminModule
$currBasepath,
$confBasepath);
} elseif (!is_dir($currBasepath)) {
$a->getLogger()->alert('Friendica\'s system.basepath is wrong.', [
DI::logger()->alert('Friendica\'s system.basepath is wrong.', [
'from' => $currBasepath,
'to' => $confBasepath,
]);
@ -134,7 +134,7 @@ class Summary extends BaseAdminModule
$currBasepath,
$confBasepath);
} else {
$a->getLogger()->alert('Friendica\'s system.basepath is wrong.', [
DI::logger()->alert('Friendica\'s system.basepath is wrong.', [
'from' => $currBasepath,
'to' => $confBasepath,
]);


+ 1
- 1
src/Module/Filer/RemoveTag.php View File

@ -20,7 +20,7 @@ class RemoveTag extends BaseModule
}
$app = DI::app();
$logger = $app->getLogger();
$logger = DI::logger();
$item_id = (($app->argc > 1) ? intval($app->argv[1]) : 0);


+ 1
- 1
src/Module/Filer/SaveTag.php View File

@ -26,7 +26,7 @@ class SaveTag extends BaseModule
public static function rawContent(array $parameters = [])
{
$a = DI::app();
$logger = $a->getLogger();
$logger = DI::logger();
$term = XML::unescape(trim($_GET['term'] ?? ''));
// @TODO: Replace with parameter from router


+ 1
- 1
src/Module/Statistics.php View File

@ -19,7 +19,7 @@ class Statistics extends BaseModule
public static function rawContent(array $parameters = [])
{
$config = DI::config();
$logger = DI::app()->getLogger();
$logger = DI::logger();
$registration_open =
intval($config->get('config', 'register_policy')) !== Register::CLOSED


Loading…
Cancel
Save