Less ILogger
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
bf1c875425
commit
56ae87c281
|
@ -46,9 +46,9 @@ use OCP\ICacheFactory;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IGroup;
|
use OCP\IGroup;
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
|
||||||
class AppManager implements IAppManager {
|
class AppManager implements IAppManager {
|
||||||
|
@ -83,7 +83,7 @@ class AppManager implements IAppManager {
|
||||||
/** @var EventDispatcherInterface */
|
/** @var EventDispatcherInterface */
|
||||||
private $dispatcher;
|
private $dispatcher;
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
/** @var string[] $appId => $enabled */
|
/** @var string[] $appId => $enabled */
|
||||||
|
@ -104,21 +104,13 @@ class AppManager implements IAppManager {
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $autoDisabledApps = [];
|
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,
|
public function __construct(IUserSession $userSession,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
AppConfig $appConfig,
|
AppConfig $appConfig,
|
||||||
IGroupManager $groupManager,
|
IGroupManager $groupManager,
|
||||||
ICacheFactory $memCacheFactory,
|
ICacheFactory $memCacheFactory,
|
||||||
EventDispatcherInterface $dispatcher,
|
EventDispatcherInterface $dispatcher,
|
||||||
ILogger $logger) {
|
LoggerInterface $logger) {
|
||||||
$this->userSession = $userSession;
|
$this->userSession = $userSession;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->appConfig = $appConfig;
|
$this->appConfig = $appConfig;
|
||||||
|
@ -249,7 +241,7 @@ class AppManager implements IAppManager {
|
||||||
|
|
||||||
if (!is_array($groupIds)) {
|
if (!is_array($groupIds)) {
|
||||||
$jsonError = json_last_error();
|
$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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +274,7 @@ class AppManager implements IAppManager {
|
||||||
|
|
||||||
if (!is_array($groupIds)) {
|
if (!is_array($groupIds)) {
|
||||||
$jsonError = json_last_error();
|
$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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
||||||
use OCP\Http\Client\IClientService;
|
use OCP\Http\Client\IClientService;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class AppFetcher extends Fetcher {
|
class AppFetcher extends Fetcher {
|
||||||
|
|
||||||
|
@ -46,20 +47,12 @@ class AppFetcher extends Fetcher {
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
private $ignoreMaxVersion;
|
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,
|
public function __construct(Factory $appDataFactory,
|
||||||
IClientService $clientService,
|
IClientService $clientService,
|
||||||
ITimeFactory $timeFactory,
|
ITimeFactory $timeFactory,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
CompareVersion $compareVersion,
|
CompareVersion $compareVersion,
|
||||||
ILogger $logger) {
|
LoggerInterface $logger) {
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
$appDataFactory,
|
$appDataFactory,
|
||||||
$clientService,
|
$clientService,
|
||||||
|
@ -86,7 +79,7 @@ class AppFetcher extends Fetcher {
|
||||||
protected function fetch($ETag, $content, $allowUnstable = false) {
|
protected function fetch($ETag, $content, $allowUnstable = false) {
|
||||||
/** @var mixed[] $response */
|
/** @var mixed[] $response */
|
||||||
$response = parent::fetch($ETag, $content);
|
$response = parent::fetch($ETag, $content);
|
||||||
|
|
||||||
if (empty($response)) {
|
if (empty($response)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -134,7 +127,9 @@ class AppFetcher extends Fetcher {
|
||||||
$releases[] = $release;
|
$releases[] = $release;
|
||||||
}
|
}
|
||||||
} catch (\InvalidArgumentException $e) {
|
} 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\AppFramework\Utility\ITimeFactory;
|
||||||
use OCP\Http\Client\IClientService;
|
use OCP\Http\Client\IClientService;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\ILogger;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class CategoryFetcher extends Fetcher {
|
class CategoryFetcher extends Fetcher {
|
||||||
/**
|
|
||||||
* @param Factory $appDataFactory
|
|
||||||
* @param IClientService $clientService
|
|
||||||
* @param ITimeFactory $timeFactory
|
|
||||||
* @param IConfig $config
|
|
||||||
* @param ILogger $logger
|
|
||||||
*/
|
|
||||||
public function __construct(Factory $appDataFactory,
|
public function __construct(Factory $appDataFactory,
|
||||||
IClientService $clientService,
|
IClientService $clientService,
|
||||||
ITimeFactory $timeFactory,
|
ITimeFactory $timeFactory,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
ILogger $logger) {
|
LoggerInterface $logger) {
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
$appDataFactory,
|
$appDataFactory,
|
||||||
$clientService,
|
$clientService,
|
||||||
|
|
|
@ -39,7 +39,7 @@ use OCP\Files\IAppData;
|
||||||
use OCP\Files\NotFoundException;
|
use OCP\Files\NotFoundException;
|
||||||
use OCP\Http\Client\IClientService;
|
use OCP\Http\Client\IClientService;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\ILogger;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
abstract class Fetcher {
|
abstract class Fetcher {
|
||||||
public const INVALIDATE_AFTER_SECONDS = 3600;
|
public const INVALIDATE_AFTER_SECONDS = 3600;
|
||||||
|
@ -53,7 +53,7 @@ abstract class Fetcher {
|
||||||
protected $timeFactory;
|
protected $timeFactory;
|
||||||
/** @var IConfig */
|
/** @var IConfig */
|
||||||
protected $config;
|
protected $config;
|
||||||
/** @var Ilogger */
|
/** @var LoggerInterface */
|
||||||
protected $logger;
|
protected $logger;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $fileName;
|
protected $fileName;
|
||||||
|
@ -64,18 +64,11 @@ abstract class Fetcher {
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $channel;
|
protected $channel;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Factory $appDataFactory
|
|
||||||
* @param IClientService $clientService
|
|
||||||
* @param ITimeFactory $timeFactory
|
|
||||||
* @param IConfig $config
|
|
||||||
* @param ILogger $logger
|
|
||||||
*/
|
|
||||||
public function __construct(Factory $appDataFactory,
|
public function __construct(Factory $appDataFactory,
|
||||||
IClientService $clientService,
|
IClientService $clientService,
|
||||||
ITimeFactory $timeFactory,
|
ITimeFactory $timeFactory,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
ILogger $logger) {
|
LoggerInterface $logger) {
|
||||||
$this->appData = $appDataFactory->get('appstore');
|
$this->appData = $appDataFactory->get('appstore');
|
||||||
$this->clientService = $clientService;
|
$this->clientService = $clientService;
|
||||||
$this->timeFactory = $timeFactory;
|
$this->timeFactory = $timeFactory;
|
||||||
|
@ -202,7 +195,10 @@ abstract class Fetcher {
|
||||||
$this->logger->warning('Could not connect to appstore: ' . $e->getMessage(), ['app' => 'appstoreFetcher']);
|
$this->logger->warning('Could not connect to appstore: ' . $e->getMessage(), ['app' => 'appstoreFetcher']);
|
||||||
return [];
|
return [];
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::WARN]);
|
$this->logger->warning($e->getMessage(), [
|
||||||
|
'exception' => $e,
|
||||||
|
'app' => 'appstoreFetcher',
|
||||||
|
]);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||||
use OCP\AppFramework\QueryException;
|
use OCP\AppFramework\QueryException;
|
||||||
use OCP\Dashboard\IManager;
|
use OCP\Dashboard\IManager;
|
||||||
use OCP\EventDispatcher\IEventDispatcher;
|
use OCP\EventDispatcher\IEventDispatcher;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IServerContainer;
|
use OCP\IServerContainer;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use function class_exists;
|
use function class_exists;
|
||||||
use function class_implements;
|
use function class_implements;
|
||||||
|
@ -57,7 +57,7 @@ class Coordinator {
|
||||||
/** @var IEventDispatcher */
|
/** @var IEventDispatcher */
|
||||||
private $eventDispatcher;
|
private $eventDispatcher;
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
/** @var RegistrationContext|null */
|
/** @var RegistrationContext|null */
|
||||||
|
@ -70,7 +70,7 @@ class Coordinator {
|
||||||
Registry $registry,
|
Registry $registry,
|
||||||
IManager $dashboardManager,
|
IManager $dashboardManager,
|
||||||
IEventDispatcher $eventListener,
|
IEventDispatcher $eventListener,
|
||||||
ILogger $logger) {
|
LoggerInterface $logger) {
|
||||||
$this->serverContainer = $container;
|
$this->serverContainer = $container;
|
||||||
$this->registry = $registry;
|
$this->registry = $registry;
|
||||||
$this->dashboardManager = $dashboardManager;
|
$this->dashboardManager = $dashboardManager;
|
||||||
|
@ -124,9 +124,8 @@ class Coordinator {
|
||||||
try {
|
try {
|
||||||
$application->register($this->registrationContext->for($appId));
|
$application->register($this->registrationContext->for($appId));
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$this->logger->logException($e, [
|
$this->logger->emergency('Error during app service registration: ' . $e->getMessage(), [
|
||||||
'message' => 'Error during app service registration: ' . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::FATAL,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@ use OCP\Dashboard\IWidget;
|
||||||
use OCP\EventDispatcher\IEventDispatcher;
|
use OCP\EventDispatcher\IEventDispatcher;
|
||||||
use OCP\Files\Template\ICustomTemplateProvider;
|
use OCP\Files\Template\ICustomTemplateProvider;
|
||||||
use OCP\Http\WellKnown\IHandler;
|
use OCP\Http\WellKnown\IHandler;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\Notification\INotifier;
|
use OCP\Notification\INotifier;
|
||||||
use OCP\Search\IProvider;
|
use OCP\Search\IProvider;
|
||||||
use OCP\Support\CrashReport\IReporter;
|
use OCP\Support\CrashReport\IReporter;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use function array_shift;
|
use function array_shift;
|
||||||
|
|
||||||
|
@ -97,10 +97,10 @@ class RegistrationContext {
|
||||||
/** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */
|
/** @var ServiceRegistration<\OCP\Authentication\TwoFactorAuth\IProvider>[] */
|
||||||
private $twoFactorProviders = [];
|
private $twoFactorProviders = [];
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(ILogger $logger) {
|
public function __construct(LoggerInterface $logger) {
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,9 +313,8 @@ class RegistrationContext {
|
||||||
->registerCapability($registration->getService());
|
->registerCapability($registration->getService());
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$appId = $registration->getAppId();
|
$appId = $registration->getAppId();
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [
|
||||||
'message' => "Error during capability registration of $appId: " . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,9 +329,8 @@ class RegistrationContext {
|
||||||
$registry->registerLazy($registration->getService());
|
$registry->registerLazy($registration->getService());
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$appId = $registration->getAppId();
|
$appId = $registration->getAppId();
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Error during crash reporter registration of $appId: " . $e->getMessage(), [
|
||||||
'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,9 +345,8 @@ class RegistrationContext {
|
||||||
$dashboardManager->lazyRegisterWidget($panel->getService());
|
$dashboardManager->lazyRegisterWidget($panel->getService());
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$appId = $panel->getAppId();
|
$appId = $panel->getAppId();
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Error during dashboard registration of $appId: " . $e->getMessage(), [
|
||||||
'message' => "Error during dashboard registration of $appId: " . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,9 +362,8 @@ class RegistrationContext {
|
||||||
);
|
);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$appId = $registration->getAppId();
|
$appId = $registration->getAppId();
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Error during event listener registration of $appId: " . $e->getMessage(), [
|
||||||
'message' => "Error during event listener registration of $appId: " . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,9 +387,8 @@ class RegistrationContext {
|
||||||
);
|
);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$appId = $registration->getAppId();
|
$appId = $registration->getAppId();
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Error during service registration of $appId: " . $e->getMessage(), [
|
||||||
'message' => "Error during service registration of $appId: " . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,9 +403,8 @@ class RegistrationContext {
|
||||||
);
|
);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$appId = $registration->getAppId();
|
$appId = $registration->getAppId();
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [
|
||||||
'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,9 +419,8 @@ class RegistrationContext {
|
||||||
);
|
);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$appId = $registration->getAppId();
|
$appId = $registration->getAppId();
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Error during service alias registration of $appId: " . $e->getMessage(), [
|
||||||
'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,9 +437,8 @@ class RegistrationContext {
|
||||||
->registerMiddleWare($middleware->getService());
|
->registerMiddleWare($middleware->getService());
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$appId = $middleware->getAppId();
|
$appId = $middleware->getAppId();
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Error during capability registration of $appId: " . $e->getMessage(), [
|
||||||
'message' => "Error during capability registration of $appId: " . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,11 +55,11 @@ use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\AppFramework\Middleware;
|
use OCP\AppFramework\Middleware;
|
||||||
use OCP\AppFramework\OCSController;
|
use OCP\AppFramework\OCSController;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\INavigationManager;
|
use OCP\INavigationManager;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to do all the authentication and checking stuff for a controller method
|
* Used to do all the authentication and checking stuff for a controller method
|
||||||
|
@ -78,7 +78,7 @@ class SecurityMiddleware extends Middleware {
|
||||||
private $appName;
|
private $appName;
|
||||||
/** @var IURLGenerator */
|
/** @var IURLGenerator */
|
||||||
private $urlGenerator;
|
private $urlGenerator;
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
private $isLoggedIn;
|
private $isLoggedIn;
|
||||||
|
@ -95,7 +95,7 @@ class SecurityMiddleware extends Middleware {
|
||||||
ControllerMethodReflector $reflector,
|
ControllerMethodReflector $reflector,
|
||||||
INavigationManager $navigationManager,
|
INavigationManager $navigationManager,
|
||||||
IURLGenerator $urlGenerator,
|
IURLGenerator $urlGenerator,
|
||||||
ILogger $logger,
|
LoggerInterface $logger,
|
||||||
string $appName,
|
string $appName,
|
||||||
bool $isLoggedIn,
|
bool $isLoggedIn,
|
||||||
bool $isAdminUser,
|
bool $isAdminUser,
|
||||||
|
@ -233,9 +233,8 @@ class SecurityMiddleware extends Middleware {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->logException($exception, [
|
$this->logger->debug($exception->getMessage(), [
|
||||||
'level' => ILogger::DEBUG,
|
'exception' => $exception,
|
||||||
'app' => 'core',
|
|
||||||
]);
|
]);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,14 +43,14 @@ use OC\Color;
|
||||||
use OC_Image;
|
use OC_Image;
|
||||||
use OCP\Files\NotFoundException;
|
use OCP\Files\NotFoundException;
|
||||||
use OCP\IAvatar;
|
use OCP\IAvatar;
|
||||||
use OCP\ILogger;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class gets and sets users avatars.
|
* This class gets and sets users avatars.
|
||||||
*/
|
*/
|
||||||
abstract class Avatar implements IAvatar {
|
abstract class Avatar implements IAvatar {
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
protected $logger;
|
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>
|
<text x="50%" y="350" style="font-weight:normal;font-size:280px;font-family:\'Noto Sans\';text-anchor:middle;fill:#fff">{letter}</text>
|
||||||
</svg>';
|
</svg>';
|
||||||
|
|
||||||
/**
|
public function __construct(LoggerInterface $logger) {
|
||||||
* The base avatar constructor.
|
|
||||||
*
|
|
||||||
* @param ILogger $logger The logger
|
|
||||||
*/
|
|
||||||
public function __construct(ILogger $logger) {
|
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ use OCP\IAvatar;
|
||||||
use OCP\IAvatarManager;
|
use OCP\IAvatarManager;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements methods to access Avatar functionality
|
* This class implements methods to access Avatar functionality
|
||||||
|
@ -65,7 +65,7 @@ class AvatarManager implements IAvatarManager {
|
||||||
/** @var IL10N */
|
/** @var IL10N */
|
||||||
private $l;
|
private $l;
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
/** @var IConfig */
|
/** @var IConfig */
|
||||||
|
@ -77,22 +77,12 @@ class AvatarManager implements IAvatarManager {
|
||||||
/** @var KnownUserService */
|
/** @var KnownUserService */
|
||||||
private $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(
|
public function __construct(
|
||||||
IUserSession $userSession,
|
IUserSession $userSession,
|
||||||
Manager $userManager,
|
Manager $userManager,
|
||||||
IAppData $appData,
|
IAppData $appData,
|
||||||
IL10N $l,
|
IL10N $l,
|
||||||
ILogger $logger,
|
LoggerInterface $logger,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
IAccountManager $accountManager,
|
IAccountManager $accountManager,
|
||||||
KnownUserService $knownUserService
|
KnownUserService $knownUserService
|
||||||
|
|
|
@ -27,7 +27,7 @@ declare(strict_types=1);
|
||||||
namespace OC\Avatar;
|
namespace OC\Avatar;
|
||||||
|
|
||||||
use OCP\Files\SimpleFS\InMemoryFile;
|
use OCP\Files\SimpleFS\InMemoryFile;
|
||||||
use OCP\ILogger;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a guest user's avatar.
|
* This class represents a guest user's avatar.
|
||||||
|
@ -44,9 +44,9 @@ class GuestAvatar extends Avatar {
|
||||||
* GuestAvatar constructor.
|
* GuestAvatar constructor.
|
||||||
*
|
*
|
||||||
* @param string $userDisplayName The guest user display name
|
* @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);
|
parent::__construct($logger);
|
||||||
$this->userDisplayName = $userDisplayName;
|
$this->userDisplayName = $userDisplayName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ use OCP\Files\SimpleFS\ISimpleFolder;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IImage;
|
use OCP\IImage;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a registered user's placeholder avatar.
|
* 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 ISimpleFolder $folder The avatar files folder
|
||||||
* @param IL10N $l The localization helper
|
* @param IL10N $l The localization helper
|
||||||
* @param User $user The user this class manages the avatar for
|
* @param User $user The user this class manages the avatar for
|
||||||
* @param ILogger $logger The logger
|
* @param LoggerInterface $logger The logger
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ISimpleFolder $folder,
|
ISimpleFolder $folder,
|
||||||
$user,
|
$user,
|
||||||
ILogger $logger) {
|
LoggerInterface $logger) {
|
||||||
parent::__construct($logger);
|
parent::__construct($logger);
|
||||||
|
|
||||||
$this->folder = $folder;
|
$this->folder = $folder;
|
||||||
|
|
|
@ -39,7 +39,7 @@ use OCP\Files\SimpleFS\ISimpleFolder;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IImage;
|
use OCP\IImage;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a registered user's avatar.
|
* This class represents a registered user's avatar.
|
||||||
|
@ -64,13 +64,13 @@ class UserAvatar extends Avatar {
|
||||||
* @param ISimpleFolder $folder The avatar files folder
|
* @param ISimpleFolder $folder The avatar files folder
|
||||||
* @param IL10N $l The localization helper
|
* @param IL10N $l The localization helper
|
||||||
* @param User $user The user this class manages the avatar for
|
* @param User $user The user this class manages the avatar for
|
||||||
* @param ILogger $logger The logger
|
* @param LoggerInterface $logger The logger
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ISimpleFolder $folder,
|
ISimpleFolder $folder,
|
||||||
IL10N $l,
|
IL10N $l,
|
||||||
$user,
|
$user,
|
||||||
ILogger $logger,
|
LoggerInterface $logger,
|
||||||
IConfig $config) {
|
IConfig $config) {
|
||||||
parent::__construct($logger);
|
parent::__construct($logger);
|
||||||
$this->folder = $folder;
|
$this->folder = $folder;
|
||||||
|
|
|
@ -32,17 +32,17 @@ namespace OC;
|
||||||
use OCP\AppFramework\QueryException;
|
use OCP\AppFramework\QueryException;
|
||||||
use OCP\Capabilities\ICapability;
|
use OCP\Capabilities\ICapability;
|
||||||
use OCP\Capabilities\IPublicCapability;
|
use OCP\Capabilities\IPublicCapability;
|
||||||
use OCP\ILogger;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class CapabilitiesManager {
|
class CapabilitiesManager {
|
||||||
|
|
||||||
/** @var \Closure[] */
|
/** @var \Closure[] */
|
||||||
private $capabilities = [];
|
private $capabilities = [];
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(ILogger $logger) {
|
public function __construct(LoggerInterface $logger) {
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,10 +59,8 @@ class CapabilitiesManager {
|
||||||
try {
|
try {
|
||||||
$c = $capability();
|
$c = $capability();
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
$this->logger->logException($e, [
|
$this->logger->error('CapabilitiesManager', [
|
||||||
'message' => 'CapabilitiesManager',
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
'app' => 'core',
|
|
||||||
]);
|
]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ use OCP\Collaboration\Collaborators\SearchResultType;
|
||||||
use OCP\Federation\ICloudIdManager;
|
use OCP\Federation\ICloudIdManager;
|
||||||
use OCP\Http\Client\IClientService;
|
use OCP\Http\Client\IClientService;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
use OCP\Share\IShare;
|
use OCP\Share\IShare;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class LookupPlugin implements ISearchPlugin {
|
class LookupPlugin implements ISearchPlugin {
|
||||||
|
|
||||||
|
@ -47,14 +47,14 @@ class LookupPlugin implements ISearchPlugin {
|
||||||
private $currentUserRemote;
|
private $currentUserRemote;
|
||||||
/** @var ICloudIdManager */
|
/** @var ICloudIdManager */
|
||||||
private $cloudIdManager;
|
private $cloudIdManager;
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(IConfig $config,
|
public function __construct(IConfig $config,
|
||||||
IClientService $clientService,
|
IClientService $clientService,
|
||||||
IUserSession $userSession,
|
IUserSession $userSession,
|
||||||
ICloudIdManager $cloudIdManager,
|
ICloudIdManager $cloudIdManager,
|
||||||
ILogger $logger) {
|
LoggerInterface $logger) {
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->clientService = $clientService;
|
$this->clientService = $clientService;
|
||||||
$this->cloudIdManager = $cloudIdManager;
|
$this->cloudIdManager = $cloudIdManager;
|
||||||
|
@ -96,8 +96,9 @@ class LookupPlugin implements ISearchPlugin {
|
||||||
try {
|
try {
|
||||||
$remote = $this->cloudIdManager->resolveCloudId($lookup['federationId'])->getRemote();
|
$remote = $this->cloudIdManager->resolveCloudId($lookup['federationId'])->getRemote();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->error('Can not parse federated cloud ID "' . $lookup['federationId'] . '"');
|
$this->logger->error('Can not parse federated cloud ID "' . $lookup['federationId'] . '"', [
|
||||||
$this->logger->error($e->getMessage());
|
'exception' => $e,
|
||||||
|
]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($this->currentUserRemote === $remote) {
|
if ($this->currentUserRemote === $remote) {
|
||||||
|
|
|
@ -38,8 +38,8 @@ use OCP\Collaboration\Resources\IResource;
|
||||||
use OCP\Collaboration\Resources\ResourceException;
|
use OCP\Collaboration\Resources\ResourceException;
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class Manager implements IManager {
|
class Manager implements IManager {
|
||||||
public const TABLE_COLLECTIONS = 'collres_collections';
|
public const TABLE_COLLECTIONS = 'collres_collections';
|
||||||
|
@ -50,14 +50,14 @@ class Manager implements IManager {
|
||||||
protected $connection;
|
protected $connection;
|
||||||
/** @var IProviderManager */
|
/** @var IProviderManager */
|
||||||
protected $providerManager;
|
protected $providerManager;
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
protected $providers = [];
|
protected $providers = [];
|
||||||
|
|
||||||
|
|
||||||
public function __construct(IDBConnection $connection, IProviderManager $providerManager, ILogger $logger) {
|
public function __construct(IDBConnection $connection, IProviderManager $providerManager, LoggerInterface $logger) {
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
$this->providerManager = $providerManager;
|
$this->providerManager = $providerManager;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace OC\Collaboration\Resources;
|
||||||
use OCP\AppFramework\QueryException;
|
use OCP\AppFramework\QueryException;
|
||||||
use OCP\Collaboration\Resources\IProvider;
|
use OCP\Collaboration\Resources\IProvider;
|
||||||
use OCP\Collaboration\Resources\IProviderManager;
|
use OCP\Collaboration\Resources\IProviderManager;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IServerContainer;
|
use OCP\IServerContainer;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class ProviderManager implements IProviderManager {
|
class ProviderManager implements IProviderManager {
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ class ProviderManager implements IProviderManager {
|
||||||
/** @var IServerContainer */
|
/** @var IServerContainer */
|
||||||
protected $serverContainer;
|
protected $serverContainer;
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
public function __construct(IServerContainer $serverContainer, ILogger $logger) {
|
public function __construct(IServerContainer $serverContainer, LoggerInterface $logger) {
|
||||||
$this->serverContainer = $serverContainer;
|
$this->serverContainer = $serverContainer;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ class ProviderManager implements IProviderManager {
|
||||||
try {
|
try {
|
||||||
$this->providerInstances[] = $this->serverContainer->query($provider);
|
$this->providerInstances[] = $this->serverContainer->query($provider);
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
$this->logger->logException($e, [
|
$this->logger->error("Could not query resource provider $provider: " . $e->getMessage(), [
|
||||||
'message' => "Could not query resource provider $provider: " . $e->getMessage()
|
'exception' => $e,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ use OC_App;
|
||||||
use OCP\AppFramework\QueryException;
|
use OCP\AppFramework\QueryException;
|
||||||
use OCP\Console\ConsoleEvent;
|
use OCP\Console\ConsoleEvent;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Console\Application as SymfonyApplication;
|
use Symfony\Component\Console\Application as SymfonyApplication;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
@ -53,22 +53,15 @@ class Application {
|
||||||
private $dispatcher;
|
private $dispatcher;
|
||||||
/** @var IRequest */
|
/** @var IRequest */
|
||||||
private $request;
|
private $request;
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
/** @var MemoryInfo */
|
/** @var MemoryInfo */
|
||||||
private $memoryInfo;
|
private $memoryInfo;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IConfig $config
|
|
||||||
* @param EventDispatcherInterface $dispatcher
|
|
||||||
* @param IRequest $request
|
|
||||||
* @param ILogger $logger
|
|
||||||
* @param MemoryInfo $memoryInfo
|
|
||||||
*/
|
|
||||||
public function __construct(IConfig $config,
|
public function __construct(IConfig $config,
|
||||||
EventDispatcherInterface $dispatcher,
|
EventDispatcherInterface $dispatcher,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
ILogger $logger,
|
LoggerInterface $logger,
|
||||||
MemoryInfo $memoryInfo) {
|
MemoryInfo $memoryInfo) {
|
||||||
$defaults = \OC::$server->getThemingDefaults();
|
$defaults = \OC::$server->getThemingDefaults();
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -142,7 +135,9 @@ class Application {
|
||||||
try {
|
try {
|
||||||
require $file;
|
require $file;
|
||||||
} catch (\Exception $e) {
|
} 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\QueryException;
|
||||||
use OCP\AppFramework\Services\InitialStateProvider;
|
use OCP\AppFramework\Services\InitialStateProvider;
|
||||||
use OCP\IInitialStateService;
|
use OCP\IInitialStateService;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IServerContainer;
|
use OCP\IServerContainer;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class InitialStateService implements IInitialStateService {
|
class InitialStateService implements IInitialStateService {
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
/** @var string[][] */
|
/** @var string[][] */
|
||||||
|
@ -53,7 +53,7 @@ class InitialStateService implements IInitialStateService {
|
||||||
/** @var IServerContainer */
|
/** @var IServerContainer */
|
||||||
private $container;
|
private $container;
|
||||||
|
|
||||||
public function __construct(ILogger $logger, Coordinator $bootstrapCoordinator, IServerContainer $container) {
|
public function __construct(LoggerInterface $logger, Coordinator $bootstrapCoordinator, IServerContainer $container) {
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->bootstrapCoordinator = $bootstrapCoordinator;
|
$this->bootstrapCoordinator = $bootstrapCoordinator;
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
|
@ -118,9 +118,8 @@ class InitialStateService implements IInitialStateService {
|
||||||
$provider = $this->container->query($initialState->getService());
|
$provider = $this->container->query($initialState->getService());
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
// Log an continue. We can be fault tolerant here.
|
// Log an continue. We can be fault tolerant here.
|
||||||
$this->logger->logException($e, [
|
$this->logger->error('Could not load initial state provider dynamically: ' . $e->getMessage(), [
|
||||||
'message' => 'Could not load initial state provider dynamically: ' . $e->getMessage(),
|
'exception' => $e,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
'app' => $initialState->getAppId(),
|
'app' => $initialState->getAppId(),
|
||||||
]);
|
]);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -54,6 +54,7 @@ use OCP\IConfig;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OCP\ITempManager;
|
use OCP\ITempManager;
|
||||||
use phpseclib\File\X509;
|
use phpseclib\File\X509;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides the functionality needed to install, update and remove apps
|
* This class provides the functionality needed to install, update and remove apps
|
||||||
|
@ -65,7 +66,7 @@ class Installer {
|
||||||
private $clientService;
|
private $clientService;
|
||||||
/** @var ITempManager */
|
/** @var ITempManager */
|
||||||
private $tempManager;
|
private $tempManager;
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
/** @var IConfig */
|
/** @var IConfig */
|
||||||
private $config;
|
private $config;
|
||||||
|
@ -76,18 +77,11 @@ class Installer {
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
private $isCLI;
|
private $isCLI;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param AppFetcher $appFetcher
|
|
||||||
* @param IClientService $clientService
|
|
||||||
* @param ITempManager $tempManager
|
|
||||||
* @param ILogger $logger
|
|
||||||
* @param IConfig $config
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AppFetcher $appFetcher,
|
AppFetcher $appFetcher,
|
||||||
IClientService $clientService,
|
IClientService $clientService,
|
||||||
ITempManager $tempManager,
|
ITempManager $tempManager,
|
||||||
ILogger $logger,
|
LoggerInterface $logger,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
bool $isCLI
|
bool $isCLI
|
||||||
) {
|
) {
|
||||||
|
@ -201,9 +195,8 @@ class Installer {
|
||||||
try {
|
try {
|
||||||
$this->downloadApp($appId, $allowUnstable);
|
$this->downloadApp($appId, $allowUnstable);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->logException($e, [
|
$this->logger->error($e->getMessage(), [
|
||||||
'level' => ILogger::ERROR,
|
'exception' => $e,
|
||||||
'app' => 'core',
|
|
||||||
]);
|
]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
||||||
use OCP\Defaults;
|
use OCP\Defaults;
|
||||||
use OCP\IGroup;
|
use OCP\IGroup;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\Security\ISecureRandom;
|
use OCP\Security\ISecureRandom;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class Setup {
|
class Setup {
|
||||||
/** @var SystemConfig */
|
/** @var SystemConfig */
|
||||||
|
@ -72,28 +72,19 @@ class Setup {
|
||||||
protected $l10n;
|
protected $l10n;
|
||||||
/** @var Defaults */
|
/** @var Defaults */
|
||||||
protected $defaults;
|
protected $defaults;
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
protected $logger;
|
protected $logger;
|
||||||
/** @var ISecureRandom */
|
/** @var ISecureRandom */
|
||||||
protected $random;
|
protected $random;
|
||||||
/** @var Installer */
|
/** @var Installer */
|
||||||
protected $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(
|
public function __construct(
|
||||||
SystemConfig $config,
|
SystemConfig $config,
|
||||||
IniGetWrapper $iniWrapper,
|
IniGetWrapper $iniWrapper,
|
||||||
IL10N $l10n,
|
IL10N $l10n,
|
||||||
Defaults $defaults,
|
Defaults $defaults,
|
||||||
ILogger $logger,
|
LoggerInterface $logger,
|
||||||
ISecureRandom $random,
|
ISecureRandom $random,
|
||||||
Installer $installer
|
Installer $installer
|
||||||
) {
|
) {
|
||||||
|
@ -511,7 +502,7 @@ class Setup {
|
||||||
\OC::$server->get(IniGetWrapper::class),
|
\OC::$server->get(IniGetWrapper::class),
|
||||||
\OC::$server->getL10N('lib'),
|
\OC::$server->getL10N('lib'),
|
||||||
\OC::$server->query(Defaults::class),
|
\OC::$server->query(Defaults::class),
|
||||||
\OC::$server->getLogger(),
|
\OC::$server->get(LoggerInterface::class),
|
||||||
\OC::$server->getSecureRandom(),
|
\OC::$server->getSecureRandom(),
|
||||||
\OC::$server->query(Installer::class)
|
\OC::$server->query(Installer::class)
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,8 +34,8 @@ use OC\DB\ConnectionFactory;
|
||||||
use OC\DB\MigrationService;
|
use OC\DB\MigrationService;
|
||||||
use OC\SystemConfig;
|
use OC\SystemConfig;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\Security\ISecureRandom;
|
use OCP\Security\ISecureRandom;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
abstract class AbstractDatabase {
|
abstract class AbstractDatabase {
|
||||||
|
|
||||||
|
@ -55,12 +55,12 @@ abstract class AbstractDatabase {
|
||||||
protected $tablePrefix;
|
protected $tablePrefix;
|
||||||
/** @var SystemConfig */
|
/** @var SystemConfig */
|
||||||
protected $config;
|
protected $config;
|
||||||
/** @var ILogger */
|
/** @var LoggerInterface */
|
||||||
protected $logger;
|
protected $logger;
|
||||||
/** @var ISecureRandom */
|
/** @var ISecureRandom */
|
||||||
protected $random;
|
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->trans = $trans;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
|
@ -84,9 +84,8 @@ class MySQL extends AbstractDatabase {
|
||||||
$query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET $characterSet COLLATE ${characterSet}_bin;";
|
$query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET $characterSet COLLATE ${characterSet}_bin;";
|
||||||
$connection->executeUpdate($query);
|
$connection->executeUpdate($query);
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
$this->logger->logException($ex, [
|
$this->logger->error('Database creation failed.', [
|
||||||
'message' => 'Database creation failed.',
|
'exception' => $ex,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
'app' => 'mysql.setup',
|
'app' => 'mysql.setup',
|
||||||
]);
|
]);
|
||||||
return;
|
return;
|
||||||
|
@ -97,9 +96,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'";
|
$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);
|
$connection->executeUpdate($query);
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
$this->logger->logException($ex, [
|
$this->logger->debug('Could not automatically grant privileges, this can be ignored if database user already had privileges.', [
|
||||||
'message' => 'Could not automatically grant privileges, this can be ignored if database user already had privileges.',
|
'exception' => $ex,
|
||||||
'level' => ILogger::DEBUG,
|
|
||||||
'app' => 'mysql.setup',
|
'app' => 'mysql.setup',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -128,9 +126,8 @@ class MySQL extends AbstractDatabase {
|
||||||
$connection->executeUpdate($query);
|
$connection->executeUpdate($query);
|
||||||
}
|
}
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
$this->logger->logException($ex, [
|
$this->logger->error('Database user creation failed.',[
|
||||||
'message' => 'Database user creation failed.',
|
'exception' => $ex,
|
||||||
'level' => ILogger::ERROR,
|
|
||||||
'app' => 'mysql.setup',
|
'app' => 'mysql.setup',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
||||||
*/
|
*/
|
||||||
class Updater extends BasicEmitter {
|
class Updater extends BasicEmitter {
|
||||||
|
|
||||||
/** @var ILogger $log */
|
/** @var LoggerInterface */
|
||||||
private $log;
|
private $log;
|
||||||
|
|
||||||
/** @var IConfig */
|
/** @var IConfig */
|
||||||
|
@ -79,15 +79,9 @@ class Updater extends BasicEmitter {
|
||||||
4 => 'Fatal',
|
4 => 'Fatal',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IConfig $config
|
|
||||||
* @param Checker $checker
|
|
||||||
* @param ILogger $log
|
|
||||||
* @param Installer $installer
|
|
||||||
*/
|
|
||||||
public function __construct(IConfig $config,
|
public function __construct(IConfig $config,
|
||||||
Checker $checker,
|
Checker $checker,
|
||||||
ILogger $log = null,
|
?LoggerInterface $log,
|
||||||
Installer $installer) {
|
Installer $installer) {
|
||||||
$this->log = $log;
|
$this->log = $log;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -132,11 +126,15 @@ class Updater extends BasicEmitter {
|
||||||
try {
|
try {
|
||||||
$this->doUpgrade($currentVersion, $installedVersion);
|
$this->doUpgrade($currentVersion, $installedVersion);
|
||||||
} catch (HintException $exception) {
|
} 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()]);
|
$this->emit('\OC\Updater', 'failure', [$exception->getMessage() . ': ' .$exception->getHint()]);
|
||||||
$success = false;
|
$success = false;
|
||||||
} catch (\Exception $exception) {
|
} 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()]);
|
$this->emit('\OC\Updater', 'failure', [get_class($exception) . ': ' .$exception->getMessage()]);
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +270,10 @@ class Updater extends BasicEmitter {
|
||||||
$errors = Installer::installShippedApps(true);
|
$errors = Installer::installShippedApps(true);
|
||||||
foreach ($errors as $appId => $exception) {
|
foreach ($errors as $appId => $exception) {
|
||||||
/** @var \Exception $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()]);
|
$this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +425,9 @@ class Updater extends BasicEmitter {
|
||||||
$ocApp->enable($app);
|
$ocApp->enable($app);
|
||||||
}
|
}
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
$this->log->logException($ex, ['app' => 'core']);
|
$this->log->error($ex->getMessage(), [
|
||||||
|
'exception' => $ex,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue