Merge pull request #26591 from nextcloud/techdebt/noid/less-ilogger
Less ILogger
This commit is contained in:
commit
99f0b10421
|
@ -187,7 +187,7 @@ abstract class TestCase extends \Test\TestCase {
|
|||
$userObject = $userManager->createUser($user, $password);
|
||||
$group = $groupManager->createGroup('group');
|
||||
|
||||
if ($group and $userObject) {
|
||||
if ($group && $userObject) {
|
||||
$group->addUser($userObject);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ try {
|
|||
\OC::$server->getConfig(),
|
||||
\OC::$server->getEventDispatcher(),
|
||||
\OC::$server->getRequest(),
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(\Psr\Log\LoggerInterface::class),
|
||||
\OC::$server->query(\OC\MemoryInfo::class)
|
||||
);
|
||||
$application->loadCommands(new ArgvInput(), new ConsoleOutput());
|
||||
|
|
|
@ -37,6 +37,7 @@ use OC\Installer;
|
|||
use OC\Setup;
|
||||
use OC\SystemConfig;
|
||||
use OCP\Defaults;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -85,7 +86,7 @@ class Install extends Command {
|
|||
$this->iniGetWrapper,
|
||||
$server->getL10N('lib'),
|
||||
$server->query(Defaults::class),
|
||||
$server->getLogger(),
|
||||
$server->get(LoggerInterface::class),
|
||||
$server->getSecureRandom(),
|
||||
\OC::$server->query(Installer::class)
|
||||
);
|
||||
|
|
|
@ -37,8 +37,8 @@ use OC\Console\TimestampFormatter;
|
|||
use OC\Installer;
|
||||
use OC\Updater;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -56,15 +56,13 @@ class Upgrade extends Command {
|
|||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
* @param ILogger $logger
|
||||
* @param Installer $installer
|
||||
*/
|
||||
public function __construct(IConfig $config, ILogger $logger, Installer $installer) {
|
||||
/** @var Installer */
|
||||
private $installer;
|
||||
|
||||
public function __construct(IConfig $config, LoggerInterface $logger, Installer $installer) {
|
||||
parent::__construct();
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
|
|
|
@ -117,7 +117,7 @@ if (\OCP\Util::needUpgrade()) {
|
|||
// avoid side effects
|
||||
\OC_User::setIncognitoMode(true);
|
||||
|
||||
$logger = \OC::$server->getLogger();
|
||||
$logger = \OC::$server->get(\Psr\Log\LoggerInterface::class);
|
||||
$config = \OC::$server->getConfig();
|
||||
$updater = new \OC\Updater(
|
||||
$config,
|
||||
|
|
|
@ -160,7 +160,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
|
|||
$application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
|
||||
$application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
|
||||
|
||||
$application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class)));
|
||||
$application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->query(\OC\Installer::class)));
|
||||
$application->add(new OC\Core\Command\Maintenance\Repair(
|
||||
new \OC\Repair([], \OC::$server->getEventDispatcher(), \OC::$server->get(LoggerInterface::class)),
|
||||
\OC::$server->getConfig(),
|
||||
|
|
|
@ -929,7 +929,7 @@ class OC {
|
|||
\OC::$server->get(\bantu\IniGetWrapper\IniGetWrapper::class),
|
||||
\OC::$server->getL10N('lib'),
|
||||
\OC::$server->query(\OCP\Defaults::class),
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(\Psr\Log\LoggerInterface::class),
|
||||
\OC::$server->getSecureRandom(),
|
||||
\OC::$server->query(\OC\Installer::class)
|
||||
);
|
||||
|
|
|
@ -46,9 +46,9 @@ use OCP\ICacheFactory;
|
|||
use OCP\IConfig;
|
||||
use OCP\IGroup;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class AppManager implements IAppManager {
|
||||
|
@ -83,7 +83,7 @@ class AppManager implements IAppManager {
|
|||
/** @var EventDispatcherInterface */
|
||||
private $dispatcher;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var string[] $appId => $enabled */
|
||||
|
@ -104,21 +104,13 @@ class AppManager implements IAppManager {
|
|||
/** @var array */
|
||||
private $autoDisabledApps = [];
|
||||
|
||||
/**
|
||||
* @param IUserSession $userSession
|
||||
* @param IConfig $config
|
||||
* @param AppConfig $appConfig
|
||||
* @param IGroupManager $groupManager
|
||||
* @param ICacheFactory $memCacheFactory
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
*/
|
||||
public function __construct(IUserSession $userSession,
|
||||
IConfig $config,
|
||||
AppConfig $appConfig,
|
||||
IGroupManager $groupManager,
|
||||
ICacheFactory $memCacheFactory,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
$this->userSession = $userSession;
|
||||
$this->config = $config;
|
||||
$this->appConfig = $appConfig;
|
||||
|
@ -249,7 +241,7 @@ class AppManager implements IAppManager {
|
|||
|
||||
if (!is_array($groupIds)) {
|
||||
$jsonError = json_last_error();
|
||||
$this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
|
||||
$this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -282,7 +274,7 @@ class AppManager implements IAppManager {
|
|||
|
||||
if (!is_array($groupIds)) {
|
||||
$jsonError = json_last_error();
|
||||
$this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']);
|
||||
$this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ use OC\Files\AppData\Factory;
|
|||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class AppFetcher extends Fetcher {
|
||||
|
||||
|
@ -46,20 +46,12 @@ class AppFetcher extends Fetcher {
|
|||
/** @var bool */
|
||||
private $ignoreMaxVersion;
|
||||
|
||||
/**
|
||||
* @param Factory $appDataFactory
|
||||
* @param IClientService $clientService
|
||||
* @param ITimeFactory $timeFactory
|
||||
* @param IConfig $config
|
||||
* @param CompareVersion $compareVersion
|
||||
* @param ILogger $logger
|
||||
*/
|
||||
public function __construct(Factory $appDataFactory,
|
||||
IClientService $clientService,
|
||||
ITimeFactory $timeFactory,
|
||||
IConfig $config,
|
||||
CompareVersion $compareVersion,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
parent::__construct(
|
||||
$appDataFactory,
|
||||
$clientService,
|
||||
|
@ -86,7 +78,7 @@ class AppFetcher extends Fetcher {
|
|||
protected function fetch($ETag, $content, $allowUnstable = false) {
|
||||
/** @var mixed[] $response */
|
||||
$response = parent::fetch($ETag, $content);
|
||||
|
||||
|
||||
if (empty($response)) {
|
||||
return [];
|
||||
}
|
||||
|
@ -134,7 +126,9 @@ class AppFetcher extends Fetcher {
|
|||
$releases[] = $release;
|
||||
}
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::WARN]);
|
||||
$this->logger->warning($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,21 +31,14 @@ use OC\Files\AppData\Factory;
|
|||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CategoryFetcher extends Fetcher {
|
||||
/**
|
||||
* @param Factory $appDataFactory
|
||||
* @param IClientService $clientService
|
||||
* @param ITimeFactory $timeFactory
|
||||
* @param IConfig $config
|
||||
* @param ILogger $logger
|
||||
*/
|
||||
public function __construct(Factory $appDataFactory,
|
||||
IClientService $clientService,
|
||||
ITimeFactory $timeFactory,
|
||||
IConfig $config,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
parent::__construct(
|
||||
$appDataFactory,
|
||||
$clientService,
|
||||
|
|
|
@ -39,7 +39,7 @@ use OCP\Files\IAppData;
|
|||
use OCP\Files\NotFoundException;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class Fetcher {
|
||||
public const INVALIDATE_AFTER_SECONDS = 3600;
|
||||
|
@ -53,7 +53,7 @@ abstract class Fetcher {
|
|||
protected $timeFactory;
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
/** @var Ilogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var string */
|
||||
protected $fileName;
|
||||
|
@ -64,18 +64,11 @@ abstract class Fetcher {
|
|||
/** @var string */
|
||||
protected $channel;
|
||||
|
||||
/**
|
||||
* @param Factory $appDataFactory
|
||||
* @param IClientService $clientService
|
||||
* @param ITimeFactory $timeFactory
|
||||
* @param IConfig $config
|
||||
* @param ILogger $logger
|
||||
*/
|
||||
public function __construct(Factory $appDataFactory,
|
||||
IClientService $clientService,
|
||||
ITimeFactory $timeFactory,
|
||||
IConfig $config,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
$this->appData = $appDataFactory->get('appstore');
|
||||
$this->clientService = $clientService;
|
||||
$this->timeFactory = $timeFactory;
|
||||
|
@ -202,7 +195,10 @@ abstract class Fetcher {
|
|||
$this->logger->warning('Could not connect to appstore: ' . $e->getMessage(), ['app' => 'appstoreFetcher']);
|
||||
return [];
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::WARN]);
|
||||
$this->logger->warning($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'appstoreFetcher',
|
||||
]);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ use OCP\AppFramework\Bootstrap\IBootstrap;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Dashboard\IManager;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\ILogger;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Throwable;
|
||||
use function class_exists;
|
||||
use function class_implements;
|
||||
|
@ -57,7 +57,7 @@ class Coordinator {
|
|||
/** @var IEventDispatcher */
|
||||
private $eventDispatcher;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var RegistrationContext|null */
|
||||
|
@ -70,7 +70,7 @@ class Coordinator {
|
|||
Registry $registry,
|
||||
IManager $dashboardManager,
|
||||
IEventDispatcher $eventListener,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
$this->serverContainer = $container;
|
||||
$this->registry = $registry;
|
||||
$this->dashboardManager = $dashboardManager;
|
||||
|
@ -124,9 +124,8 @@ class Coordinator {
|
|||
try {
|
||||
$application->register($this->registrationContext->for($appId));
|
||||
} catch (Throwable $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Error during app service registration: ' . $e->getMessage(),
|
||||
'level' => ILogger::FATAL,
|
||||
$this->logger->emergency('Error during app service registration: ' . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -176,13 +175,12 @@ class Coordinator {
|
|||
$application->boot($context);
|
||||
}
|
||||
} catch (QueryException $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Could not boot $appId" . $e->getMessage(),
|
||||
$this->logger->error("Could not boot $appId" . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Could not boot $appId" . $e->getMessage(),
|
||||
'level' => ILogger::FATAL,
|
||||
$this->logger->emergency("Could not boot $appId" . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,10 @@ use OCP\Dashboard\IWidget;
|
|||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Template\ICustomTemplateProvider;
|
||||
use OCP\Http\WellKnown\IHandler;
|
||||
use OCP\ILogger;
|
||||
use OCP\Notification\INotifier;
|
||||
use OCP\Search\IProvider;
|
||||
use OCP\Support\CrashReport\IReporter;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Throwable;
|
||||
use function array_shift;
|
||||
|
||||
|
@ -97,10 +97,10 @@ class RegistrationContext {
|
|||
/** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */
|
||||
private $twoFactorProviders = [];
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(ILogger $logger) {
|
||||
public function __construct(LoggerInterface $logger) {
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
@ -313,9 +313,8 @@ class RegistrationContext {
|
|||
->registerCapability($registration->getService());
|
||||
} catch (Throwable $e) {
|
||||
$appId = $registration->getAppId();
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Error during capability registration of $appId: " . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -330,9 +329,8 @@ class RegistrationContext {
|
|||
$registry->registerLazy($registration->getService());
|
||||
} catch (Throwable $e) {
|
||||
$appId = $registration->getAppId();
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error("Error during crash reporter registration of $appId: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -347,9 +345,8 @@ class RegistrationContext {
|
|||
$dashboardManager->lazyRegisterWidget($panel->getService());
|
||||
} catch (Throwable $e) {
|
||||
$appId = $panel->getAppId();
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Error during dashboard registration of $appId: " . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error("Error during dashboard registration of $appId: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -365,9 +362,8 @@ class RegistrationContext {
|
|||
);
|
||||
} catch (Throwable $e) {
|
||||
$appId = $registration->getAppId();
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Error during event listener registration of $appId: " . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error("Error during event listener registration of $appId: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -391,9 +387,8 @@ class RegistrationContext {
|
|||
);
|
||||
} catch (Throwable $e) {
|
||||
$appId = $registration->getAppId();
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Error during service registration of $appId: " . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error("Error during service registration of $appId: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -408,9 +403,8 @@ class RegistrationContext {
|
|||
);
|
||||
} catch (Throwable $e) {
|
||||
$appId = $registration->getAppId();
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -425,9 +419,8 @@ class RegistrationContext {
|
|||
);
|
||||
} catch (Throwable $e) {
|
||||
$appId = $registration->getAppId();
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -444,9 +437,8 @@ class RegistrationContext {
|
|||
->registerMiddleWare($middleware->getService());
|
||||
} catch (Throwable $e) {
|
||||
$appId = $middleware->getAppId();
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Error during capability registration of $appId: " . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
$c->get(IControllerMethodReflector::class),
|
||||
$c->get(INavigationManager::class),
|
||||
$c->get(IURLGenerator::class),
|
||||
$server->query(ILogger::class),
|
||||
$server->get(LoggerInterface::class),
|
||||
$c->get('AppName'),
|
||||
$server->getUserSession()->isLoggedIn(),
|
||||
$this->getUserId() !== null && $server->getGroupManager()->isAdmin($this->getUserId()),
|
||||
|
|
|
@ -55,11 +55,11 @@ use OCP\AppFramework\Http\TemplateResponse;
|
|||
use OCP\AppFramework\Middleware;
|
||||
use OCP\AppFramework\OCSController;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\INavigationManager;
|
||||
use OCP\IRequest;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Used to do all the authentication and checking stuff for a controller method
|
||||
|
@ -78,7 +78,7 @@ class SecurityMiddleware extends Middleware {
|
|||
private $appName;
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
/** @var bool */
|
||||
private $isLoggedIn;
|
||||
|
@ -95,7 +95,7 @@ class SecurityMiddleware extends Middleware {
|
|||
ControllerMethodReflector $reflector,
|
||||
INavigationManager $navigationManager,
|
||||
IURLGenerator $urlGenerator,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
string $appName,
|
||||
bool $isLoggedIn,
|
||||
bool $isAdminUser,
|
||||
|
@ -233,9 +233,8 @@ class SecurityMiddleware extends Middleware {
|
|||
}
|
||||
}
|
||||
|
||||
$this->logger->logException($exception, [
|
||||
'level' => ILogger::DEBUG,
|
||||
'app' => 'core',
|
||||
$this->logger->debug($exception->getMessage(), [
|
||||
'exception' => $exception,
|
||||
]);
|
||||
return $response;
|
||||
}
|
||||
|
|
|
@ -43,14 +43,14 @@ use OC\Color;
|
|||
use OC_Image;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\IAvatar;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* This class gets and sets users avatars.
|
||||
*/
|
||||
abstract class Avatar implements IAvatar {
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
|
@ -69,12 +69,7 @@ abstract class Avatar implements IAvatar {
|
|||
<text x="50%" y="350" style="font-weight:normal;font-size:280px;font-family:\'Noto Sans\';text-anchor:middle;fill:#fff">{letter}</text>
|
||||
</svg>';
|
||||
|
||||
/**
|
||||
* The base avatar constructor.
|
||||
*
|
||||
* @param ILogger $logger The logger
|
||||
*/
|
||||
public function __construct(ILogger $logger) {
|
||||
public function __construct(LoggerInterface $logger) {
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ use OCP\IAvatar;
|
|||
use OCP\IAvatarManager;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUserSession;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* This class implements methods to access Avatar functionality
|
||||
|
@ -65,7 +65,7 @@ class AvatarManager implements IAvatarManager {
|
|||
/** @var IL10N */
|
||||
private $l;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var IConfig */
|
||||
|
@ -77,22 +77,12 @@ class AvatarManager implements IAvatarManager {
|
|||
/** @var KnownUserService */
|
||||
private $knownUserService;
|
||||
|
||||
/**
|
||||
* AvatarManager constructor.
|
||||
*
|
||||
* @param Manager $userManager
|
||||
* @param IAppData $appData
|
||||
* @param IL10N $l
|
||||
* @param ILogger $logger
|
||||
* @param IConfig $config
|
||||
* @param IUserSession $userSession
|
||||
*/
|
||||
public function __construct(
|
||||
IUserSession $userSession,
|
||||
Manager $userManager,
|
||||
IAppData $appData,
|
||||
IL10N $l,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
IConfig $config,
|
||||
IAccountManager $accountManager,
|
||||
KnownUserService $knownUserService
|
||||
|
|
|
@ -27,7 +27,7 @@ declare(strict_types=1);
|
|||
namespace OC\Avatar;
|
||||
|
||||
use OCP\Files\SimpleFS\InMemoryFile;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* This class represents a guest user's avatar.
|
||||
|
@ -44,9 +44,9 @@ class GuestAvatar extends Avatar {
|
|||
* GuestAvatar constructor.
|
||||
*
|
||||
* @param string $userDisplayName The guest user display name
|
||||
* @param ILogger $logger The logger
|
||||
* @param LoggerInterface $logger The logger
|
||||
*/
|
||||
public function __construct(string $userDisplayName, ILogger $logger) {
|
||||
public function __construct(string $userDisplayName, LoggerInterface $logger) {
|
||||
parent::__construct($logger);
|
||||
$this->userDisplayName = $userDisplayName;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ use OCP\Files\SimpleFS\ISimpleFolder;
|
|||
use OCP\IConfig;
|
||||
use OCP\IImage;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* This class represents a registered user's placeholder avatar.
|
||||
|
@ -60,12 +60,12 @@ class PlaceholderAvatar extends Avatar {
|
|||
* @param ISimpleFolder $folder The avatar files folder
|
||||
* @param IL10N $l The localization helper
|
||||
* @param User $user The user this class manages the avatar for
|
||||
* @param ILogger $logger The logger
|
||||
* @param LoggerInterface $logger The logger
|
||||
*/
|
||||
public function __construct(
|
||||
ISimpleFolder $folder,
|
||||
$user,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
parent::__construct($logger);
|
||||
|
||||
$this->folder = $folder;
|
||||
|
|
|
@ -39,7 +39,7 @@ use OCP\Files\SimpleFS\ISimpleFolder;
|
|||
use OCP\IConfig;
|
||||
use OCP\IImage;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* This class represents a registered user's avatar.
|
||||
|
@ -64,13 +64,13 @@ class UserAvatar extends Avatar {
|
|||
* @param ISimpleFolder $folder The avatar files folder
|
||||
* @param IL10N $l The localization helper
|
||||
* @param User $user The user this class manages the avatar for
|
||||
* @param ILogger $logger The logger
|
||||
* @param LoggerInterface $logger The logger
|
||||
*/
|
||||
public function __construct(
|
||||
ISimpleFolder $folder,
|
||||
IL10N $l,
|
||||
$user,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
IConfig $config) {
|
||||
parent::__construct($logger);
|
||||
$this->folder = $folder;
|
||||
|
|
|
@ -32,17 +32,17 @@ namespace OC;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Capabilities\ICapability;
|
||||
use OCP\Capabilities\IPublicCapability;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CapabilitiesManager {
|
||||
|
||||
/** @var \Closure[] */
|
||||
private $capabilities = [];
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(ILogger $logger) {
|
||||
public function __construct(LoggerInterface $logger) {
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
@ -59,10 +59,8 @@ class CapabilitiesManager {
|
|||
try {
|
||||
$c = $capability();
|
||||
} catch (QueryException $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'CapabilitiesManager',
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
$this->logger->error('CapabilitiesManager', [
|
||||
'exception' => $e,
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -33,9 +33,9 @@ use OCP\Collaboration\Collaborators\SearchResultType;
|
|||
use OCP\Federation\ICloudIdManager;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Share\IShare;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class LookupPlugin implements ISearchPlugin {
|
||||
|
||||
|
@ -47,14 +47,14 @@ class LookupPlugin implements ISearchPlugin {
|
|||
private $currentUserRemote;
|
||||
/** @var ICloudIdManager */
|
||||
private $cloudIdManager;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
IClientService $clientService,
|
||||
IUserSession $userSession,
|
||||
ICloudIdManager $cloudIdManager,
|
||||
ILogger $logger) {
|
||||
LoggerInterface $logger) {
|
||||
$this->config = $config;
|
||||
$this->clientService = $clientService;
|
||||
$this->cloudIdManager = $cloudIdManager;
|
||||
|
@ -96,8 +96,9 @@ class LookupPlugin implements ISearchPlugin {
|
|||
try {
|
||||
$remote = $this->cloudIdManager->resolveCloudId($lookup['federationId'])->getRemote();
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Can not parse federated cloud ID "' . $lookup['federationId'] . '"');
|
||||
$this->logger->error($e->getMessage());
|
||||
$this->logger->error('Can not parse federated cloud ID "' . $lookup['federationId'] . '"', [
|
||||
'exception' => $e,
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
if ($this->currentUserRemote === $remote) {
|
||||
|
|
|
@ -38,8 +38,8 @@ use OCP\Collaboration\Resources\IResource;
|
|||
use OCP\Collaboration\Resources\ResourceException;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Manager implements IManager {
|
||||
public const TABLE_COLLECTIONS = 'collres_collections';
|
||||
|
@ -50,14 +50,14 @@ class Manager implements IManager {
|
|||
protected $connection;
|
||||
/** @var IProviderManager */
|
||||
protected $providerManager;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
||||
/** @var string[] */
|
||||
protected $providers = [];
|
||||
|
||||
|
||||
public function __construct(IDBConnection $connection, IProviderManager $providerManager, ILogger $logger) {
|
||||
public function __construct(IDBConnection $connection, IProviderManager $providerManager, LoggerInterface $logger) {
|
||||
$this->connection = $connection;
|
||||
$this->providerManager = $providerManager;
|
||||
$this->logger = $logger;
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace OC\Collaboration\Resources;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Collaboration\Resources\IProvider;
|
||||
use OCP\Collaboration\Resources\IProviderManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ProviderManager implements IProviderManager {
|
||||
|
||||
|
@ -43,10 +43,10 @@ class ProviderManager implements IProviderManager {
|
|||
/** @var IServerContainer */
|
||||
protected $serverContainer;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
|
||||
public function __construct(IServerContainer $serverContainer, ILogger $logger) {
|
||||
public function __construct(IServerContainer $serverContainer, LoggerInterface $logger) {
|
||||
$this->serverContainer = $serverContainer;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ class ProviderManager implements IProviderManager {
|
|||
try {
|
||||
$this->providerInstances[] = $this->serverContainer->query($provider);
|
||||
} catch (QueryException $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Could not query resource provider $provider: " . $e->getMessage()
|
||||
$this->logger->error("Could not query resource provider $provider: " . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ use OC_App;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Console\ConsoleEvent;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Application as SymfonyApplication;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -53,22 +53,15 @@ class Application {
|
|||
private $dispatcher;
|
||||
/** @var IRequest */
|
||||
private $request;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
/** @var MemoryInfo */
|
||||
private $memoryInfo;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
* @param IRequest $request
|
||||
* @param ILogger $logger
|
||||
* @param MemoryInfo $memoryInfo
|
||||
*/
|
||||
public function __construct(IConfig $config,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
IRequest $request,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
MemoryInfo $memoryInfo) {
|
||||
$defaults = \OC::$server->getThemingDefaults();
|
||||
$this->config = $config;
|
||||
|
@ -142,7 +135,9 @@ class Application {
|
|||
try {
|
||||
require $file;
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ use OC\AppFramework\Bootstrap\Coordinator;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\AppFramework\Services\InitialStateProvider;
|
||||
use OCP\IInitialStateService;
|
||||
use OCP\ILogger;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class InitialStateService implements IInitialStateService {
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/** @var string[][] */
|
||||
|
@ -53,7 +53,7 @@ class InitialStateService implements IInitialStateService {
|
|||
/** @var IServerContainer */
|
||||
private $container;
|
||||
|
||||
public function __construct(ILogger $logger, Coordinator $bootstrapCoordinator, IServerContainer $container) {
|
||||
public function __construct(LoggerInterface $logger, Coordinator $bootstrapCoordinator, IServerContainer $container) {
|
||||
$this->logger = $logger;
|
||||
$this->bootstrapCoordinator = $bootstrapCoordinator;
|
||||
$this->container = $container;
|
||||
|
@ -118,9 +118,8 @@ class InitialStateService implements IInitialStateService {
|
|||
$provider = $this->container->query($initialState->getService());
|
||||
} catch (QueryException $e) {
|
||||
// Log an continue. We can be fault tolerant here.
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Could not load initial state provider dynamically: ' . $e->getMessage(),
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error('Could not load initial state provider dynamically: ' . $e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => $initialState->getAppId(),
|
||||
]);
|
||||
continue;
|
||||
|
|
|
@ -54,6 +54,7 @@ use OCP\IConfig;
|
|||
use OCP\ILogger;
|
||||
use OCP\ITempManager;
|
||||
use phpseclib\File\X509;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* This class provides the functionality needed to install, update and remove apps
|
||||
|
@ -65,7 +66,7 @@ class Installer {
|
|||
private $clientService;
|
||||
/** @var ITempManager */
|
||||
private $tempManager;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
@ -76,18 +77,11 @@ class Installer {
|
|||
/** @var bool */
|
||||
private $isCLI;
|
||||
|
||||
/**
|
||||
* @param AppFetcher $appFetcher
|
||||
* @param IClientService $clientService
|
||||
* @param ITempManager $tempManager
|
||||
* @param ILogger $logger
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(
|
||||
AppFetcher $appFetcher,
|
||||
IClientService $clientService,
|
||||
ITempManager $tempManager,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
IConfig $config,
|
||||
bool $isCLI
|
||||
) {
|
||||
|
@ -201,9 +195,8 @@ class Installer {
|
|||
try {
|
||||
$this->downloadApp($appId, $allowUnstable);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ use OC\Template\JSCombiner;
|
|||
use OCA\Theming\ImageManager;
|
||||
use OCA\Theming\ThemingDefaults;
|
||||
use OCA\Theming\Util;
|
||||
use OCA\WorkflowEngine\Service\Logger;
|
||||
use OCP\Accounts\IAccountManager;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\Authentication\LoginCredentials\IStore;
|
||||
|
@ -731,7 +732,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$c->get(\OC\User\Manager::class),
|
||||
$c->getAppDataDir('avatar'),
|
||||
$c->getL10N('lib'),
|
||||
$c->get(ILogger::class),
|
||||
$c->get(LoggerInterface::class),
|
||||
$c->get(\OCP\IConfig::class),
|
||||
$c->get(IAccountManager::class),
|
||||
$c->get(KnownUserService::class)
|
||||
|
@ -877,7 +878,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$c->get(IGroupManager::class),
|
||||
$c->get(ICacheFactory::class),
|
||||
$c->get(SymfonyAdapter::class),
|
||||
$c->get(ILogger::class)
|
||||
$c->get(LoggerInterface::class)
|
||||
);
|
||||
});
|
||||
/** @deprecated 19.0.0 */
|
||||
|
@ -1091,7 +1092,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class);
|
||||
|
||||
$this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) {
|
||||
$manager = new CapabilitiesManager($c->get(ILogger::class));
|
||||
$manager = new CapabilitiesManager($c->get(LoggerInterface::class));
|
||||
$manager->registerCapability(function () use ($c) {
|
||||
return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class));
|
||||
});
|
||||
|
@ -1334,7 +1335,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$c->get(AppFetcher::class),
|
||||
$c->get(IClientService::class),
|
||||
$c->get(ITempManager::class),
|
||||
$c->get(ILogger::class),
|
||||
$c->get(LoggerInterface::class),
|
||||
$c->get(\OCP\IConfig::class),
|
||||
\OC::$CLI
|
||||
);
|
||||
|
|
|
@ -60,8 +60,8 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
|||
use OCP\Defaults;
|
||||
use OCP\IGroup;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Setup {
|
||||
/** @var SystemConfig */
|
||||
|
@ -72,28 +72,19 @@ class Setup {
|
|||
protected $l10n;
|
||||
/** @var Defaults */
|
||||
protected $defaults;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var ISecureRandom */
|
||||
protected $random;
|
||||
/** @var Installer */
|
||||
protected $installer;
|
||||
|
||||
/**
|
||||
* @param SystemConfig $config
|
||||
* @param IniGetWrapper $iniWrapper
|
||||
* @param IL10N $l10n
|
||||
* @param Defaults $defaults
|
||||
* @param ILogger $logger
|
||||
* @param ISecureRandom $random
|
||||
* @param Installer $installer
|
||||
*/
|
||||
public function __construct(
|
||||
SystemConfig $config,
|
||||
IniGetWrapper $iniWrapper,
|
||||
IL10N $l10n,
|
||||
Defaults $defaults,
|
||||
ILogger $logger,
|
||||
LoggerInterface $logger,
|
||||
ISecureRandom $random,
|
||||
Installer $installer
|
||||
) {
|
||||
|
@ -511,7 +502,7 @@ class Setup {
|
|||
\OC::$server->get(IniGetWrapper::class),
|
||||
\OC::$server->getL10N('lib'),
|
||||
\OC::$server->query(Defaults::class),
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(LoggerInterface::class),
|
||||
\OC::$server->getSecureRandom(),
|
||||
\OC::$server->query(Installer::class)
|
||||
);
|
||||
|
|
|
@ -34,8 +34,8 @@ use OC\DB\ConnectionFactory;
|
|||
use OC\DB\MigrationService;
|
||||
use OC\SystemConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class AbstractDatabase {
|
||||
|
||||
|
@ -55,12 +55,12 @@ abstract class AbstractDatabase {
|
|||
protected $tablePrefix;
|
||||
/** @var SystemConfig */
|
||||
protected $config;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var ISecureRandom */
|
||||
protected $random;
|
||||
|
||||
public function __construct(IL10N $trans, SystemConfig $config, ILogger $logger, ISecureRandom $random) {
|
||||
public function __construct(IL10N $trans, SystemConfig $config, LoggerInterface $logger, ISecureRandom $random) {
|
||||
$this->trans = $trans;
|
||||
$this->config = $config;
|
||||
$this->logger = $logger;
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace OC\Setup;
|
|||
use OC\DB\ConnectionAdapter;
|
||||
use OC\DB\MySqlTools;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\ILogger;
|
||||
use Doctrine\DBAL\Platforms\MySQL80Platform;
|
||||
use OCP\Security\ISecureRandom;
|
||||
|
||||
|
@ -66,7 +65,9 @@ class MySQL extends AbstractDatabase {
|
|||
try {
|
||||
$connection->connect();
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
throw new \OC\DatabaseSetupException($this->trans->t('MySQL username and/or password not valid'),
|
||||
$this->trans->t('You need to enter details of an existing account.'), 0, $e);
|
||||
}
|
||||
|
@ -84,9 +85,8 @@ class MySQL extends AbstractDatabase {
|
|||
$query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET $characterSet COLLATE ${characterSet}_bin;";
|
||||
$connection->executeUpdate($query);
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => 'Database creation failed.',
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error('Database creation failed.', [
|
||||
'exception' => $ex,
|
||||
'app' => 'mysql.setup',
|
||||
]);
|
||||
return;
|
||||
|
@ -97,9 +97,8 @@ class MySQL extends AbstractDatabase {
|
|||
$query = "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `$name` . * TO '$user'";
|
||||
$connection->executeUpdate($query);
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => 'Could not automatically grant privileges, this can be ignored if database user already had privileges.',
|
||||
'level' => ILogger::DEBUG,
|
||||
$this->logger->debug('Could not automatically grant privileges, this can be ignored if database user already had privileges.', [
|
||||
'exception' => $ex,
|
||||
'app' => 'mysql.setup',
|
||||
]);
|
||||
}
|
||||
|
@ -128,9 +127,8 @@ class MySQL extends AbstractDatabase {
|
|||
$connection->executeUpdate($query);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => 'Database user creation failed.',
|
||||
'level' => ILogger::ERROR,
|
||||
$this->logger->error('Database user creation failed.',[
|
||||
'exception' => $ex,
|
||||
'app' => 'mysql.setup',
|
||||
]);
|
||||
}
|
||||
|
@ -180,9 +178,8 @@ class MySQL extends AbstractDatabase {
|
|||
}
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => 'Can not create a new MySQL user, will continue with the provided user.',
|
||||
'level' => ILogger::INFO,
|
||||
$this->logger->info('Can not create a new MySQL user, will continue with the provided user.', [
|
||||
'exception' => $ex,
|
||||
'app' => 'mysql.setup',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -82,8 +82,9 @@ class PostgreSQL extends AbstractDatabase {
|
|||
// the connection to dbname=postgres is not needed anymore
|
||||
$connection->close();
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->warning('Error trying to connect as "postgres", assuming database is setup and tables need to be created');
|
||||
$this->logger->warning('Error trying to connect as "postgres", assuming database is setup and tables need to be created', [
|
||||
'exception' => $e,
|
||||
]);
|
||||
$this->config->setValues([
|
||||
'dbuser' => $this->dbUser,
|
||||
'dbpassword' => $this->dbPassword,
|
||||
|
@ -97,7 +98,9 @@ class PostgreSQL extends AbstractDatabase {
|
|||
try {
|
||||
$connection->connect();
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e);
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
]);
|
||||
throw new \OC\DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),
|
||||
$this->trans->t('You need to enter details of an existing account.'), 0, $e);
|
||||
}
|
||||
|
@ -110,16 +113,18 @@ class PostgreSQL extends AbstractDatabase {
|
|||
try {
|
||||
$query->execute();
|
||||
} catch (DatabaseException $e) {
|
||||
$this->logger->error('Error while trying to create database');
|
||||
$this->logger->logException($e);
|
||||
$this->logger->error('Error while trying to create database', [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE " . addslashes($this->dbName) . " FROM PUBLIC");
|
||||
try {
|
||||
$query->execute();
|
||||
} catch (DatabaseException $e) {
|
||||
$this->logger->error('Error while trying to restrict database permissions');
|
||||
$this->logger->logException($e);
|
||||
$this->logger->error('Error while trying to restrict database permissions', [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,8 +166,9 @@ class PostgreSQL extends AbstractDatabase {
|
|||
$query->execute();
|
||||
}
|
||||
} catch (DatabaseException $e) {
|
||||
$this->logger->error('Error while trying to create database user');
|
||||
$this->logger->logException($e);
|
||||
$this->logger->error('Error while trying to create database user', [
|
||||
'exception' => $e,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
*/
|
||||
class Updater extends BasicEmitter {
|
||||
|
||||
/** @var ILogger $log */
|
||||
/** @var LoggerInterface */
|
||||
private $log;
|
||||
|
||||
/** @var IConfig */
|
||||
|
@ -79,15 +79,9 @@ class Updater extends BasicEmitter {
|
|||
4 => 'Fatal',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
* @param Checker $checker
|
||||
* @param ILogger $log
|
||||
* @param Installer $installer
|
||||
*/
|
||||
public function __construct(IConfig $config,
|
||||
Checker $checker,
|
||||
ILogger $log = null,
|
||||
?LoggerInterface $log,
|
||||
Installer $installer) {
|
||||
$this->log = $log;
|
||||
$this->config = $config;
|
||||
|
@ -132,11 +126,15 @@ class Updater extends BasicEmitter {
|
|||
try {
|
||||
$this->doUpgrade($currentVersion, $installedVersion);
|
||||
} catch (HintException $exception) {
|
||||
$this->log->logException($exception, ['app' => 'core']);
|
||||
$this->log->error($exception->getMessage(), [
|
||||
'exception' => $exception,
|
||||
]);
|
||||
$this->emit('\OC\Updater', 'failure', [$exception->getMessage() . ': ' .$exception->getHint()]);
|
||||
$success = false;
|
||||
} catch (\Exception $exception) {
|
||||
$this->log->logException($exception, ['app' => 'core']);
|
||||
$this->log->error($exception->getMessage(), [
|
||||
'exception' => $exception,
|
||||
]);
|
||||
$this->emit('\OC\Updater', 'failure', [get_class($exception) . ': ' .$exception->getMessage()]);
|
||||
$success = false;
|
||||
}
|
||||
|
@ -272,7 +270,10 @@ class Updater extends BasicEmitter {
|
|||
$errors = Installer::installShippedApps(true);
|
||||
foreach ($errors as $appId => $exception) {
|
||||
/** @var \Exception $exception */
|
||||
$this->log->logException($exception, ['app' => $appId]);
|
||||
$this->log->error($exception->getMessage(), [
|
||||
'exception' => $exception,
|
||||
'app' => $appId,
|
||||
]);
|
||||
$this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]);
|
||||
}
|
||||
|
||||
|
@ -424,7 +425,9 @@ class Updater extends BasicEmitter {
|
|||
$ocApp->enable($app);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->log->logException($ex, ['app' => 'core']);
|
||||
$this->log->error($ex->getMessage(), [
|
||||
'exception' => $ex,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -747,10 +747,10 @@ class OC_Util {
|
|||
$config,
|
||||
\OC::$server->get(IniGetWrapper::class),
|
||||
\OC::$server->getL10N('lib'),
|
||||
\OC::$server->query(\OCP\Defaults::class),
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(\OCP\Defaults::class),
|
||||
\OC::$server->get(LoggerInterface::class),
|
||||
\OC::$server->getSecureRandom(),
|
||||
\OC::$server->query(\OC\Installer::class)
|
||||
\OC::$server->get(\OC\Installer::class)
|
||||
);
|
||||
|
||||
$urlGenerator = \OC::$server->getURLGenerator();
|
||||
|
|
|
@ -20,10 +20,10 @@ use OCP\ICacheFactory;
|
|||
use OCP\IConfig;
|
||||
use OCP\IGroup;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
|
@ -93,7 +93,7 @@ class AppManagerTest extends TestCase {
|
|||
/** @var EventDispatcherInterface|MockObject */
|
||||
protected $eventDispatcher;
|
||||
|
||||
/** @var ILogger|MockObject */
|
||||
/** @var LoggerInterface|MockObject */
|
||||
protected $logger;
|
||||
|
||||
/** @var IAppManager */
|
||||
|
@ -109,7 +109,7 @@ class AppManagerTest extends TestCase {
|
|||
$this->cacheFactory = $this->createMock(ICacheFactory::class);
|
||||
$this->cache = $this->createMock(ICache::class);
|
||||
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->cacheFactory->expects($this->any())
|
||||
->method('createDistributed')
|
||||
->with('settings')
|
||||
|
|
|
@ -34,7 +34,7 @@ use OCP\Http\Client\IClient;
|
|||
use OCP\Http\Client\IClientService;
|
||||
use OCP\Http\Client\IResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class AppFetcherTest extends TestCase {
|
||||
|
@ -48,7 +48,7 @@ class AppFetcherTest extends TestCase {
|
|||
protected $config;
|
||||
/** @var CompareVersion|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $compareVersion;
|
||||
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $logger;
|
||||
/** @var AppFetcher */
|
||||
protected $fetcher;
|
||||
|
@ -1848,7 +1848,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
|
|||
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->compareVersion = new CompareVersion();
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->fetcher = new AppFetcher(
|
||||
$factory,
|
||||
|
|
|
@ -33,7 +33,7 @@ use OCP\Http\Client\IClient;
|
|||
use OCP\Http\Client\IClientService;
|
||||
use OCP\Http\Client\IResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
abstract class FetcherBase extends TestCase {
|
||||
|
@ -47,7 +47,7 @@ abstract class FetcherBase extends TestCase {
|
|||
protected $timeFactory;
|
||||
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $config;
|
||||
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $logger;
|
||||
/** @var Fetcher */
|
||||
protected $fetcher;
|
||||
|
@ -67,7 +67,7 @@ abstract class FetcherBase extends TestCase {
|
|||
$this->clientService = $this->createMock(IClientService::class);
|
||||
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
}
|
||||
|
||||
public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() {
|
||||
|
|
|
@ -35,9 +35,9 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Dashboard\IManager;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\ILogger;
|
||||
use OCP\IServerContainer;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class CoordinatorTest extends TestCase {
|
||||
|
@ -57,7 +57,7 @@ class CoordinatorTest extends TestCase {
|
|||
/** @var IEventDispatcher|MockObject */
|
||||
private $eventDispatcher;
|
||||
|
||||
/** @var ILogger|MockObject */
|
||||
/** @var LoggerInterface|MockObject */
|
||||
private $logger;
|
||||
|
||||
/** @var Coordinator */
|
||||
|
@ -71,7 +71,7 @@ class CoordinatorTest extends TestCase {
|
|||
$this->crashReporterRegistry = $this->createMock(Registry::class);
|
||||
$this->dashboardManager = $this->createMock(IManager::class);
|
||||
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->coordinator = new Coordinator(
|
||||
$this->serverContainer,
|
||||
|
|
|
@ -29,13 +29,13 @@ use OC\AppFramework\Bootstrap\RegistrationContext;
|
|||
use OCP\AppFramework\App;
|
||||
use OCP\AppFramework\IAppContainer;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\ILogger;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class RegistrationContextTest extends TestCase {
|
||||
|
||||
/** @var ILogger|MockObject */
|
||||
/** @var LoggerInterface|MockObject */
|
||||
private $logger;
|
||||
|
||||
/** @var RegistrationContext */
|
||||
|
@ -44,7 +44,7 @@ class RegistrationContextTest extends TestCase {
|
|||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->context = new RegistrationContext(
|
||||
$this->logger
|
||||
|
|
|
@ -39,11 +39,11 @@ use OCP\AppFramework\Http\RedirectResponse;
|
|||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\INavigationManager;
|
||||
use OCP\IRequest;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class SecurityMiddlewareTest extends \Test\TestCase {
|
||||
|
||||
|
@ -59,7 +59,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
|
|||
private $request;
|
||||
/** @var ControllerMethodReflector */
|
||||
private $reader;
|
||||
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $logger;
|
||||
/** @var INavigationManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $navigationManager;
|
||||
|
@ -75,7 +75,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
|
|||
|
||||
$this->controller = $this->createMock(Controller::class);
|
||||
$this->reader = new ControllerMethodReflector();
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->navigationManager = $this->createMock(INavigationManager::class);
|
||||
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
||||
$this->request = $this->createMock(IRequest::class);
|
||||
|
|
|
@ -13,6 +13,7 @@ use OC\App\AppManager;
|
|||
use OC\App\InfoParser;
|
||||
use OC\AppConfig;
|
||||
use OCP\IAppConfig;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Class AppTest
|
||||
|
@ -477,7 +478,7 @@ class AppTest extends \Test\TestCase {
|
|||
'appforgroup2' => '["group2"]',
|
||||
'appforgroup12' => '["group2","group1"]',
|
||||
]
|
||||
|
||||
|
||||
);
|
||||
|
||||
$apps = \OC_App::getEnabledApps(false, $forceAll);
|
||||
|
@ -512,7 +513,7 @@ class AppTest extends \Test\TestCase {
|
|||
'app3' => 'yes',
|
||||
'app2' => 'no',
|
||||
]
|
||||
|
||||
|
||||
);
|
||||
|
||||
$apps = \OC_App::getEnabledApps();
|
||||
|
@ -554,7 +555,7 @@ class AppTest extends \Test\TestCase {
|
|||
\OC::$server->getGroupManager(),
|
||||
\OC::$server->getMemCacheFactory(),
|
||||
\OC::$server->getEventDispatcher(),
|
||||
\OC::$server->getLogger()
|
||||
\OC::$server->get(LoggerInterface::class)
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ use OCP\Files\IAppData;
|
|||
use OCP\Files\SimpleFS\ISimpleFolder;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Class AvatarManagerTest
|
||||
|
@ -52,7 +52,7 @@ class AvatarManagerTest extends \Test\TestCase {
|
|||
private $appData;
|
||||
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $l10n;
|
||||
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $logger;
|
||||
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $config;
|
||||
|
@ -70,7 +70,7 @@ class AvatarManagerTest extends \Test\TestCase {
|
|||
$this->userManager = $this->createMock(Manager::class);
|
||||
$this->appData = $this->createMock(IAppData::class);
|
||||
$this->l10n = $this->createMock(IL10N::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->accountManager = $this->createMock(IAccountManager::class);
|
||||
$this->knownUserService = $this->createMock(KnownUserService::class);
|
||||
|
@ -247,7 +247,7 @@ class AvatarManagerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
if ($expectedPlaceholder) {
|
||||
$expected = new PlaceholderAvatar($folder, $user, $this->createMock(ILogger::class));
|
||||
$expected = new PlaceholderAvatar($folder, $user, $this->createMock(LoggerInterface::class));
|
||||
} else {
|
||||
$expected = new UserAvatar($folder, $this->l10n, $user, $this->logger, $this->config);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace Test\Avatar;
|
|||
|
||||
use OC\Avatar\GuestAvatar;
|
||||
use OCP\Files\SimpleFS\InMemoryFile;
|
||||
use OCP\ILogger;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
/**
|
||||
|
@ -48,8 +48,8 @@ class GuestAvatarTest extends TestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setupGuestAvatar() {
|
||||
/* @var MockObject|ILogger $logger */
|
||||
$logger = $this->getMockBuilder(ILogger::class)->getMock();
|
||||
/* @var MockObject|LoggerInterface $logger */
|
||||
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
|
||||
$this->guestAvatar = new GuestAvatar('einstein', $logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ use OCP\Files\NotFoundException;
|
|||
use OCP\Files\SimpleFS\ISimpleFile;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserAvatarTest extends \Test\TestCase {
|
||||
/** @var Folder | \PHPUnit\Framework\MockObject\MockObject */
|
||||
|
@ -309,7 +309,7 @@ class UserAvatarTest extends \Test\TestCase {
|
|||
$this->folder,
|
||||
$l,
|
||||
$user,
|
||||
$this->createMock(ILogger::class),
|
||||
$this->createMock(LoggerInterface::class),
|
||||
$this->config
|
||||
);
|
||||
}
|
||||
|
|
|
@ -25,19 +25,19 @@ use OC\CapabilitiesManager;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Capabilities\ICapability;
|
||||
use OCP\Capabilities\IPublicCapability;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CapabilitiesManagerTest extends TestCase {
|
||||
|
||||
/** @var CapabilitiesManager */
|
||||
private $manager;
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
|
||||
$this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
|
||||
$this->manager = new CapabilitiesManager($this->logger);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ class CapabilitiesManagerTest extends TestCase {
|
|||
]
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
$this->assertEquals($expected, $res);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,25 +33,26 @@ use OCP\Http\Client\IClient;
|
|||
use OCP\Http\Client\IClientService;
|
||||
use OCP\Http\Client\IResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Share\IShare;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class LookupPluginTest extends TestCase {
|
||||
|
||||
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var IConfig|MockObject */
|
||||
protected $config;
|
||||
/** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var IClientService|MockObject */
|
||||
protected $clientService;
|
||||
/** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var IUserSession|MockObject */
|
||||
protected $userSession;
|
||||
/** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var ICloudIdManager|MockObject */
|
||||
protected $cloudIdManager;
|
||||
/** @var LookupPlugin */
|
||||
protected $plugin;
|
||||
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LoggerInterface|MockObject */
|
||||
protected $logger;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
@ -60,7 +61,7 @@ class LookupPluginTest extends TestCase {
|
|||
$this->userSession = $this->createMock(IUserSession::class);
|
||||
$this->cloudIdManager = $this->createMock(ICloudIdManager::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->clientService = $this->createMock(IClientService::class);
|
||||
$cloudId = $this->createMock(ICloudId::class);
|
||||
$cloudId->expects($this->any())->method('getRemote')->willReturn('myNextcloud.net');
|
||||
|
@ -108,7 +109,7 @@ class LookupPluginTest extends TestCase {
|
|||
$this->clientService->expects($this->never())
|
||||
->method('newClient');
|
||||
|
||||
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
|
||||
/** @var ISearchResult|MockObject $searchResult */
|
||||
$searchResult = $this->createMock(ISearchResult::class);
|
||||
|
||||
$this->plugin->search('foobar', 10, 0, $searchResult);
|
||||
|
@ -132,7 +133,7 @@ class LookupPluginTest extends TestCase {
|
|||
$this->clientService->expects($this->never())
|
||||
->method('newClient');
|
||||
|
||||
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
|
||||
/** @var ISearchResult|MockObject $searchResult */
|
||||
$searchResult = $this->createMock(ISearchResult::class);
|
||||
|
||||
$this->plugin->search('foobar', 10, 0, $searchResult);
|
||||
|
@ -145,7 +146,7 @@ class LookupPluginTest extends TestCase {
|
|||
public function testSearch(array $searchParams) {
|
||||
$type = new SearchResultType('lookup');
|
||||
|
||||
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
|
||||
/** @var ISearchResult|MockObject $searchResult */
|
||||
$searchResult = $this->createMock(ISearchResult::class);
|
||||
$searchResult->expects($this->once())
|
||||
->method('addResultSet')
|
||||
|
@ -207,7 +208,7 @@ class LookupPluginTest extends TestCase {
|
|||
public function testSearchEnableDisableLookupServer(array $searchParams, $GSEnabled, $LookupEnabled) {
|
||||
$type = new SearchResultType('lookup');
|
||||
|
||||
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
|
||||
/** @var ISearchResult|MockObject $searchResult */
|
||||
$searchResult = $this->createMock(ISearchResult::class);
|
||||
|
||||
$this->config->expects($this->once())
|
||||
|
@ -269,7 +270,7 @@ class LookupPluginTest extends TestCase {
|
|||
->with('files_sharing', 'lookupServerEnabled', 'yes')
|
||||
->willReturn('no');
|
||||
|
||||
/** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
|
||||
/** @var ISearchResult|MockObject $searchResult */
|
||||
$searchResult = $this->createMock(ISearchResult::class);
|
||||
$searchResult->expects($this->never())
|
||||
->method('addResultSet');
|
||||
|
|
|
@ -27,12 +27,12 @@ use OC\Collaboration\Resources\Manager;
|
|||
use OCP\Collaboration\Resources\IManager;
|
||||
use OCP\Collaboration\Resources\IProviderManager;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ManagerTest extends TestCase {
|
||||
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var IProviderManager */
|
||||
protected $providerManager;
|
||||
|
@ -42,14 +42,14 @@ class ManagerTest extends TestCase {
|
|||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->providerManager = $this->createMock(IProviderManager::class);
|
||||
|
||||
/** @var IDBConnection $connection */
|
||||
$connection = $this->createMock(IDBConnection::class);
|
||||
$this->manager = new Manager($connection, $this->providerManager, $this->logger);
|
||||
}
|
||||
|
||||
|
||||
public function testRegisterResourceProvider(): void {
|
||||
$this->logger->expects($this->once())
|
||||
->method('debug')
|
||||
|
|
|
@ -27,15 +27,15 @@ use OC\Collaboration\Resources\ProviderManager;
|
|||
use OCA\Files\Collaboration\Resources\ResourceProvider;
|
||||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Collaboration\Resources\IProviderManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class ProviderManagerTest extends TestCase {
|
||||
|
||||
/** @var IServerContainer */
|
||||
protected $serverContainer;
|
||||
/** @var ILogger */
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var IProviderManager */
|
||||
protected $providerManager;
|
||||
|
@ -44,7 +44,7 @@ class ProviderManagerTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
$this->serverContainer = $this->createMock(IServerContainer::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->providerManager = new class($this->serverContainer, $this->logger) extends ProviderManager {
|
||||
public function countProviders(): int {
|
||||
|
|
|
@ -27,10 +27,10 @@ namespace Test;
|
|||
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
use OCP\IServerContainer;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use function json_encode;
|
||||
use JsonSerializable;
|
||||
use OC\InitialStateService;
|
||||
use OCP\ILogger;
|
||||
use stdClass;
|
||||
|
||||
class InitialStateServiceTest extends TestCase {
|
||||
|
@ -42,7 +42,7 @@ class InitialStateServiceTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
$this->service = new InitialStateService(
|
||||
$this->createMock(ILogger::class),
|
||||
$this->createMock(LoggerInterface::class),
|
||||
$this->createMock(Coordinator::class),
|
||||
$this->createMock(IServerContainer::class)
|
||||
);
|
||||
|
|
|
@ -14,8 +14,8 @@ use OC\Installer;
|
|||
use OCP\Http\Client\IClient;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\ITempManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Class InstallerTest
|
||||
|
@ -32,7 +32,7 @@ class InstallerTest extends TestCase {
|
|||
private $clientService;
|
||||
/** @var ITempManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $tempManager;
|
||||
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $logger;
|
||||
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $config;
|
||||
|
@ -43,7 +43,7 @@ class InstallerTest extends TestCase {
|
|||
$this->appFetcher = $this->createMock(AppFetcher::class);
|
||||
$this->clientService = $this->createMock(IClientService::class);
|
||||
$this->tempManager = $this->createMock(ITempManager::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
|
||||
$config = \OC::$server->getConfig();
|
||||
|
@ -53,7 +53,7 @@ class InstallerTest extends TestCase {
|
|||
\OC::$server->getAppFetcher(),
|
||||
\OC::$server->getHTTPClientService(),
|
||||
\OC::$server->getTempManager(),
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(LoggerInterface::class),
|
||||
$config,
|
||||
false
|
||||
);
|
||||
|
@ -76,7 +76,7 @@ class InstallerTest extends TestCase {
|
|||
\OC::$server->getAppFetcher(),
|
||||
\OC::$server->getHTTPClientService(),
|
||||
\OC::$server->getTempManager(),
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(LoggerInterface::class),
|
||||
\OC::$server->getConfig(),
|
||||
false
|
||||
);
|
||||
|
@ -100,7 +100,7 @@ class InstallerTest extends TestCase {
|
|||
\OC::$server->getAppFetcher(),
|
||||
\OC::$server->getHTTPClientService(),
|
||||
\OC::$server->getTempManager(),
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(LoggerInterface::class),
|
||||
\OC::$server->getConfig(),
|
||||
false
|
||||
);
|
||||
|
|
|
@ -14,26 +14,27 @@ use OC\Setup;
|
|||
use OC\SystemConfig;
|
||||
use OCP\Defaults;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class SetupTest extends \Test\TestCase {
|
||||
|
||||
/** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var SystemConfig|MockObject */
|
||||
protected $config;
|
||||
/** @var \bantu\IniGetWrapper\IniGetWrapper|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var \bantu\IniGetWrapper\IniGetWrapper|MockObject */
|
||||
private $iniWrapper;
|
||||
/** @var \OCP\IL10N|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var \OCP\IL10N|MockObject */
|
||||
private $l10n;
|
||||
/** @var Defaults|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var Defaults|MockObject */
|
||||
private $defaults;
|
||||
/** @var \OC\Setup|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var \OC\Setup|MockObject */
|
||||
protected $setupClass;
|
||||
/** @var \OCP\ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LoggerInterface|MockObject */
|
||||
protected $logger;
|
||||
/** @var \OCP\Security\ISecureRandom|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var \OCP\Security\ISecureRandom|MockObject */
|
||||
protected $random;
|
||||
/** @var Installer|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var Installer|MockObject */
|
||||
protected $installer;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
@ -43,7 +44,7 @@ class SetupTest extends \Test\TestCase {
|
|||
$this->iniWrapper = $this->createMock(IniGetWrapper::class);
|
||||
$this->l10n = $this->createMock(IL10N::class);
|
||||
$this->defaults = $this->createMock(Defaults::class);
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->random = $this->createMock(ISecureRandom::class);
|
||||
$this->installer = $this->createMock(Installer::class);
|
||||
$this->setupClass = $this->getMockBuilder(Setup::class)
|
||||
|
|
|
@ -22,22 +22,23 @@
|
|||
|
||||
namespace Test;
|
||||
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use OC\Installer;
|
||||
use OC\IntegrityCheck\Checker;
|
||||
use OC\Updater;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
|
||||
class UpdaterTest extends TestCase {
|
||||
/** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var IConfig|MockObject */
|
||||
private $config;
|
||||
/** @var ILogger | \PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LoggerInterface|MockObject */
|
||||
private $logger;
|
||||
/** @var Updater */
|
||||
private $updater;
|
||||
/** @var Checker | \PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var Checker|MockObject */
|
||||
private $checker;
|
||||
/** @var Installer|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var Installer|MockObject */
|
||||
private $installer;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
@ -45,7 +46,7 @@ class UpdaterTest extends TestCase {
|
|||
$this->config = $this->getMockBuilder(IConfig::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->logger = $this->getMockBuilder(ILogger::class)
|
||||
$this->logger = $this->getMockBuilder(LoggerInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->checker = $this->getMockBuilder(Checker::class)
|
||||
|
|
Loading…
Reference in New Issue