summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2023-09-26 12:09:21 +0200
committerGitHub <noreply@github.com>2023-09-26 12:09:21 +0200
commit3a56ecc8cb6556372d7615679f0ec84bc95e8af5 (patch)
tree1b0469ec77c8acfbf3d9bfe12972d72c91546b75 /lib
parentf18e73137c6112ac81b151c0670333aec88bf2ed (diff)
parentf68d4f7300af493d52c85a36561551ca6d6e63de (diff)
downloadnextcloud-server-3a56ecc8cb6556372d7615679f0ec84bc95e8af5.tar.gz
nextcloud-server-3a56ecc8cb6556372d7615679f0ec84bc95e8af5.zip
Merge pull request #40565 from nextcloud/fix/remove-writelog
Remove deprecated methods Util::writeLog and DIContainer::log
Diffstat (limited to 'lib')
-rw-r--r--lib/autoloader.php4
-rw-r--r--lib/base.php5
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php27
-rw-r--r--lib/private/Tags.php10
-rw-r--r--lib/private/legacy/OC_App.php13
-rw-r--r--lib/private/legacy/OC_User.php10
-rw-r--r--lib/public/Util.php13
7 files changed, 20 insertions, 62 deletions
diff --git a/lib/autoloader.php b/lib/autoloader.php
index a29b9aece79..26540b754a5 100644
--- a/lib/autoloader.php
+++ b/lib/autoloader.php
@@ -37,8 +37,8 @@ declare(strict_types=1);
namespace OC;
use \OCP\AutoloadNotAllowedException;
-use OCP\ILogger;
use OCP\ICache;
+use Psr\Log\LoggerInterface;
class Autoloader {
/** @var bool */
@@ -105,7 +105,7 @@ class Autoloader {
* Remove "apps/" from inclusion path for smooth migration to multi app dir
*/
if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
- \OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', ILogger::DEBUG);
+ \OCP\Server::get(LoggerInterface::class)->debug('include path for class "' . $class . '" starts with "apps/"', ['app' => 'core']);
$paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]);
}
} elseif (strpos($class, 'OC_') === 0) {
diff --git a/lib/base.php b/lib/base.php
index 26e88979a48..461ff8997a2 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -988,16 +988,17 @@ class OC {
// Check if Nextcloud is installed or in maintenance (update) mode
if (!$systemConfig->getValue('installed', false)) {
\OC::$server->getSession()->clear();
+ $logger = Server::get(\Psr\Log\LoggerInterface::class);
$setupHelper = new OC\Setup(
$systemConfig,
Server::get(\bantu\IniGetWrapper\IniGetWrapper::class),
Server::get(\OCP\L10N\IFactory::class)->get('lib'),
Server::get(\OCP\Defaults::class),
- Server::get(\Psr\Log\LoggerInterface::class),
+ $logger,
Server::get(\OCP\Security\ISecureRandom::class),
Server::get(\OC\Installer::class)
);
- $controller = new OC\Core\Controller\SetupController($setupHelper);
+ $controller = new OC\Core\Controller\SetupController($setupHelper, $logger);
$controller->run($_POST);
exit();
}
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index a012d1e8ea6..c342ea236e2 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -404,33 +404,6 @@ class DIContainer extends SimpleContainer implements IAppContainer {
}
/**
- * @deprecated use the ILogger instead
- * @param string $message
- * @param string $level
- * @return mixed
- */
- public function log($message, $level) {
- switch ($level) {
- case 'debug':
- $level = ILogger::DEBUG;
- break;
- case 'info':
- $level = ILogger::INFO;
- break;
- case 'warn':
- $level = ILogger::WARN;
- break;
- case 'fatal':
- $level = ILogger::FATAL;
- break;
- default:
- $level = ILogger::ERROR;
- break;
- }
- \OCP\Util::writeLog($this->getAppName(), $message, $level);
- }
-
- /**
* Register a capability
*
* @param string $serviceName e.g. 'OCA\Files\Capabilities'
diff --git a/lib/private/Tags.php b/lib/private/Tags.php
index 8da1e7edc3b..766166beadd 100644
--- a/lib/private/Tags.php
+++ b/lib/private/Tags.php
@@ -529,7 +529,7 @@ class Tags implements ITags {
if (is_string($tag) && !is_numeric($tag)) {
$tag = trim($tag);
if ($tag === '') {
- \OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG);
+ $this->logger->debug(__METHOD__.', Cannot add an empty tag');
return false;
}
if (!$this->hasTag($tag)) {
@@ -569,7 +569,7 @@ class Tags implements ITags {
if (is_string($tag) && !is_numeric($tag)) {
$tag = trim($tag);
if ($tag === '') {
- \OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', ILogger::DEBUG);
+ $this->logger->debug(__METHOD__.', Tag name is empty');
return false;
}
$tagId = $this->getTagId($tag);
@@ -609,8 +609,7 @@ class Tags implements ITags {
$names = array_map('trim', $names);
array_filter($names);
- \OCP\Util::writeLog('core', __METHOD__ . ', before: '
- . print_r($this->tags, true), ILogger::DEBUG);
+ $this->logger->debug(__METHOD__ . ', before: ' . print_r($this->tags, true));
foreach ($names as $name) {
$id = null;
@@ -625,8 +624,7 @@ class Tags implements ITags {
unset($this->tags[$key]);
$this->mapper->delete($tag);
} else {
- \OCP\Util::writeLog('core', __METHOD__ . 'Cannot delete tag ' . $name
- . ': not found.', ILogger::ERROR);
+ $this->logger->error(__METHOD__ . 'Cannot delete tag ' . $name . ': not found.');
}
if (!is_null($id) && $id !== false) {
try {
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index ac449a62a4f..64c125d33a2 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -56,7 +56,6 @@ use OCP\App\IAppManager;
use OCP\App\ManagerEvent;
use OCP\Authentication\IAlternativeLogin;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\ILogger;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\App\DependencyAnalyzer;
use OC\App\Platform;
@@ -292,7 +291,7 @@ class OC_App {
}
}
- \OCP\Util::writeLog('core', 'No application directories are marked as writable.', ILogger::ERROR);
+ \OCP\Server::get(LoggerInterface::class)->error('No application directories are marked as writable.', ['app' => 'core']);
return null;
}
@@ -517,7 +516,7 @@ class OC_App {
foreach (OC::$APPSROOTS as $apps_dir) {
if (!is_readable($apps_dir['path'])) {
- \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN);
+ \OCP\Server::get(LoggerInterface::class)->warning('unable to read app folder : ' . $apps_dir['path'], ['app' => 'core']);
continue;
}
$dh = opendir($apps_dir['path']);
@@ -568,12 +567,12 @@ class OC_App {
if (array_search($app, $blacklist) === false) {
$info = $appManager->getAppInfo($app, false, $langCode);
if (!is_array($info)) {
- \OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
+ \OCP\Server::get(LoggerInterface::class)->error('Could not read app info file for app "' . $app . '"', ['app' => 'core']);
continue;
}
if (!isset($info['name'])) {
- \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR);
+ \OCP\Server::get(LoggerInterface::class)->error('App id "' . $app . '" has no name in appinfo', ['app' => 'core']);
continue;
}
@@ -870,11 +869,11 @@ class OC_App {
}
return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
} else {
- \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR);
+ \OCP\Server::get(LoggerInterface::class)->error('Can\'t get app storage, app ' . $appId . ', user not logged in', ['app' => 'core']);
return false;
}
} else {
- \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR);
+ \OCP\Server::get(LoggerInterface::class)->error('Can\'t get app storage, app ' . $appId . ' not enabled', ['app' => 'core']);
return false;
}
}
diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php
index caa4f5dca65..5751b813f2c 100644
--- a/lib/private/legacy/OC_User.php
+++ b/lib/private/legacy/OC_User.php
@@ -38,10 +38,10 @@
use OC\User\LoginException;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\ILogger;
use OCP\IUserManager;
use OCP\User\Events\BeforeUserLoggedInEvent;
use OCP\User\Events\UserLoggedInEvent;
+use Psr\Log\LoggerInterface;
/**
* This class provides wrapper methods for user management. Multiple backends are
@@ -93,7 +93,7 @@ class OC_User {
case 'database':
case 'mysql':
case 'sqlite':
- \OCP\Util::writeLog('core', 'Adding user backend ' . $backend . '.', ILogger::DEBUG);
+ \OCP\Server::get(LoggerInterface::class)->debug('Adding user backend ' . $backend . '.', ['app' => 'core']);
self::$_usedBackends[$backend] = new \OC\User\Database();
\OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
break;
@@ -102,7 +102,7 @@ class OC_User {
\OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
break;
default:
- \OCP\Util::writeLog('core', 'Adding default user backend ' . $backend . '.', ILogger::DEBUG);
+ \OCP\Server::get(LoggerInterface::class)->debug('Adding default user backend ' . $backend . '.', ['app' => 'core']);
$className = 'OC_USER_' . strtoupper($backend);
self::$_usedBackends[$backend] = new $className();
\OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
@@ -147,10 +147,10 @@ class OC_User {
self::useBackend($backend);
self::$_setupedBackends[] = $i;
} else {
- \OCP\Util::writeLog('core', 'User backend ' . $class . ' already initialized.', ILogger::DEBUG);
+ \OCP\Server::get(LoggerInterface::class)->debug('User backend ' . $class . ' already initialized.', ['app' => 'core']);
}
} else {
- \OCP\Util::writeLog('core', 'User backend ' . $class . ' not found.', ILogger::ERROR);
+ \OCP\Server::get(LoggerInterface::class)->error('User backend ' . $class . ' not found.', ['app' => 'core']);
}
}
}
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 781aa87d66b..cabb84c0cf6 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -105,19 +105,6 @@ class Util {
}
/**
- * write a message in the log
- * @param string $app
- * @param string $message
- * @param int $level
- * @since 4.0.0
- * @deprecated 13.0.0 use log of \OCP\ILogger
- */
- public static function writeLog($app, $message, $level) {
- $context = ['app' => $app];
- \OC::$server->getLogger()->log($level, $message, $context);
- }
-
- /**
* check if sharing is disabled for the current user
*
* @return boolean
ass="w"> "Non ten permiso para compartir %s", "Sharing %s failed, because the user %s is the item owner" : "Fallou a compartición de %s, o propietario do elemento é o usuario %s", "Sharing %s failed, because the user %s does not exist" : "Fallou a compartición de %s, o usuario %s non existe", "Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Fallou a compartición de %s, o usuario %s non é membro de ningún grupo que sexa membro de %s", "Sharing %s failed, because this item is already shared with %s" : "Fallou a compartición de %s, este elemento xa está compartido con %s", "Sharing %s failed, because the group %s does not exist" : "Fallou a compartición de %s, o grupo %s non existe", "Sharing %s failed, because %s is not a member of the group %s" : "Fallou a compartición de %s, %s non é membro do grupo %s", "You need to provide a password to create a public link, only protected links are allowed" : "Ten que fornecer un contrasinal para a ligazón pública, só se permiten ligazóns protexidas", "Sharing %s failed, because sharing with links is not allowed" : "Fallou a compartición de %s, non está permitido compartir con ligazóns", "Share type %s is not valid for %s" : "Non se admite a compartición do tipo %s para %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "Non é posíbel estabelecer permisos para %s, os permisos superan os permisos concedidos a %s", "Setting permissions for %s failed, because the item was not found" : "Non é posíbel estabelecer permisos para %s, non se atopa o elemento", "Cannot set expiration date. Shares cannot expire later than %s after they have been shared" : "Non é posíbel estabelecer a data de caducidade. As comparticións non poden caducar máis aló de %s após de seren compartidas", "Cannot set expiration date. Expiration date is in the past" : "Non é posíbel estabelecer a data de caducidade. A data de caducidade está no pasado.", "Sharing backend %s must implement the interface OCP\\Share_Backend" : "A infraestrutura de compartición %s ten que implementar a interface OCP\\Share_Backend", "Sharing backend %s not found" : "Non se atopou a infraestrutura de compartición %s", "Sharing backend for %s not found" : "Non se atopou a infraestrutura de compartición para %s", "Sharing %s failed, because the user %s is the original sharer" : "Fallou a compartición de %s, a compartición orixinal é do usuario %s", "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Fallou a compartición de %s, os permisos superan os permisos concedidos a %s", "Sharing %s failed, because resharing is not allowed" : "Fallou a compartición de %s, non está permitido repetir a compartción", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Fallou a compartición de %s, a infraestrutura de compartición para %s non foi quen de atopar a orixe", "Sharing %s failed, because the file could not be found in the file cache" : "Fallou a compartición de %s, non foi posíbel atopar o ficheiro na caché de ficheiros", "Could not find category \"%s\"" : "Non foi posíbel atopar a categoría «%s»", "seconds ago" : "segundos atrás", "_%n minute ago_::_%n minutes ago_" : ["hai %n minuto","hai %n minutos"], "_%n hour ago_::_%n hours ago_" : ["hai %n hora","hai %n horas"], "today" : "hoxe", "yesterday" : "onte", "_%n day go_::_%n days ago_" : ["hai %n día","vai %n días"], "last month" : "último mes", "_%n month ago_::_%n months ago_" : ["hai %n mes","hai %n meses"], "last year" : "último ano", "years ago" : "anos atrás", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Só se permiten os seguintes caracteres no nome de usuario: «a-z», «A-Z», «0-9», e «_.@-»", "A valid username must be provided" : "Debe fornecer un nome de usuario", "A valid password must be provided" : "Debe fornecer un contrasinal", "The username is already being used" : "Este nome de usuario xa está a ser usado", "No database drivers (sqlite, mysql, or postgresql) installed." : "Non hay controladores de base de datos (sqlite, mysql, ou postgresql) instalados.", "Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." : "Polo xeral, isto pode ser fixado para %spermitirlle ao servidor web acceso de escritura ao directorio «root»%s.", "Cannot write into \"config\" directory" : "Non é posíbel escribir no directorio «config»", "Cannot write into \"apps\" directory" : "Non é posíbel escribir no directorio «apps»", "This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "Polo xeral, isto pode ser fixado para %spermitirlle ao servidor web acceso de escritura ao directorio «apps»%s ou a desactivación da «appstore» no ficheiro de configuración.", "Cannot create \"data\" directory (%s)" : "Non é posíbel crear o directorio «data» (%s)", "This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." : "Polo xeral, isto pode ser fixado para <a href=\"%s\" target=\"_blank\">permitirlle ao servidor web acceso de escritura ao directorio «root»</a>.", "Setting locale to %s failed" : "Fallou o axuste da configuración local a %s", "Please install one of these locales on your system and restart your webserver." : "Instale unha destas configuracións locais no seu sistema e reinicie o servidor web.", "Please ask your server administrator to install the module." : "Pregúntelle ao administrador do servidor pola instalación do módulo.", "PHP module %s not installed." : "O módulo PHP %s non está instalado.", "PHP %s or higher is required." : "Requirese PHP %s ou superior.", "Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." : "Pregúntelle ao administrador do servidor pola actualización de PHP á versión máis recente. A súa versión de PHP xa non é asistida polas comunidades de ownCloud e PHP.", "PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly." : "O modo seguro de PHP está activado. ownCloud precisa que estea desactivado para traballar doadamente.", "PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." : "O modo seguro de PHP é un entorno en desuso e maiormente inútil que ten que seren desactivado. Pregúntelle ao administrador do servidor pola desactivación en php.ini ou na configuración do servidor web.", "Magic Quotes is enabled. ownCloud requires that it is disabled to work properly." : "«Magic Quotes» está activado. ownCloud precisa que estea desactivado para traballar doadamente.", "Magic Quotes is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." : "«Magic Quotes» é un entorno en desuso e maiormente inútil que ten que seren desactivado. Pregúntelle ao administrador do servidor pola desactivación en php.ini ou na configuración do servidor web.", "PHP modules have been installed, but they are still listed as missing?" : "Instaláronse os módulos de PHP, mais aínda aparecen listados como perdidos?", "Please ask your server administrator to restart the web server." : "Pregúntelle ao administrador do servidor polo reinicio do servidor web..", "PostgreSQL >= 9 required" : "Requírese PostgreSQL >= 9", "Please upgrade your database version" : "Anove a versión da súa base de datos", "Error occurred while checking PostgreSQL version" : "Produciuse un erro mentres comprobaba a versión de PostgreSQL", "Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error" : "Asegúrese de que dispón do PostgreSQL >= 9 ou comprobe os rexistros para obter máis información sobre este erro", "Please change the permissions to 0770 so that the directory cannot be listed by other users." : "Cambie os permisos a 0770 para que o directorio non poida seren listado por outros usuarios.", "Data directory (%s) is readable by other users" : "O directorio de datos (%s) é lexíbel por outros usuarios", "Data directory (%s) is invalid" : "O directorio de datos (%s) non é correcto", "Please check that the data directory contains a file \".ocdata\" in its root." : "Comprobe que o directorio de datos conten un ficheiro «.ocdata» na súa raíz.", "Could not obtain lock type %d on \"%s\"." : "Non foi posíbel obter un bloqueo do tipo %d en «%s»." }, "nplurals=2; plural=(n != 1);");