Updater.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. * @copyright Copyright (c) 2016, Lukas Reschke <lukas@statuscode.ch>
  6. *
  7. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  8. * @author Bjoern Schiessle <bjoern@schiessle.org>
  9. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  10. * @author Frank Karlitschek <frank@karlitschek.de>
  11. * @author Georg Ehrke <oc.list@georgehrke.com>
  12. * @author J0WI <J0WI@users.noreply.github.com>
  13. * @author Joas Schilling <coding@schilljs.com>
  14. * @author Julius Härtl <jus@bitgrid.net>
  15. * @author Lukas Reschke <lukas@statuscode.ch>
  16. * @author Morris Jobke <hey@morrisjobke.de>
  17. * @author Robin Appelman <robin@icewind.nl>
  18. * @author Roeland Jago Douma <roeland@famdouma.nl>
  19. * @author Steffen Lindner <mail@steffen-lindner.de>
  20. * @author Thomas Müller <thomas.mueller@tmit.eu>
  21. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  22. * @author Vincent Petry <vincent@nextcloud.com>
  23. *
  24. * @license AGPL-3.0
  25. *
  26. * This code is free software: you can redistribute it and/or modify
  27. * it under the terms of the GNU Affero General Public License, version 3,
  28. * as published by the Free Software Foundation.
  29. *
  30. * This program is distributed in the hope that it will be useful,
  31. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  32. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  33. * GNU Affero General Public License for more details.
  34. *
  35. * You should have received a copy of the GNU Affero General Public License, version 3,
  36. * along with this program. If not, see <http://www.gnu.org/licenses/>
  37. *
  38. */
  39. namespace OC;
  40. use OC\App\AppManager;
  41. use OC\DB\Connection;
  42. use OC\DB\MigrationService;
  43. use OC\DB\MigratorExecuteSqlEvent;
  44. use OC\Hooks\BasicEmitter;
  45. use OC\IntegrityCheck\Checker;
  46. use OC\Repair\Events\RepairAdvanceEvent;
  47. use OC\Repair\Events\RepairErrorEvent;
  48. use OC\Repair\Events\RepairFinishEvent;
  49. use OC\Repair\Events\RepairInfoEvent;
  50. use OC\Repair\Events\RepairStartEvent;
  51. use OC\Repair\Events\RepairStepEvent;
  52. use OC\Repair\Events\RepairWarningEvent;
  53. use OC_App;
  54. use OCP\App\IAppManager;
  55. use OCP\EventDispatcher\Event;
  56. use OCP\EventDispatcher\IEventDispatcher;
  57. use OCP\HintException;
  58. use OCP\IConfig;
  59. use OCP\ILogger;
  60. use OCP\Util;
  61. use Psr\Log\LoggerInterface;
  62. /**
  63. * Class that handles autoupdating of ownCloud
  64. *
  65. * Hooks provided in scope \OC\Updater
  66. * - maintenanceStart()
  67. * - maintenanceEnd()
  68. * - dbUpgrade()
  69. * - failure(string $message)
  70. */
  71. class Updater extends BasicEmitter {
  72. /** @var LoggerInterface */
  73. private $log;
  74. /** @var IConfig */
  75. private $config;
  76. /** @var Checker */
  77. private $checker;
  78. /** @var Installer */
  79. private $installer;
  80. private $logLevelNames = [
  81. 0 => 'Debug',
  82. 1 => 'Info',
  83. 2 => 'Warning',
  84. 3 => 'Error',
  85. 4 => 'Fatal',
  86. ];
  87. public function __construct(IConfig $config,
  88. Checker $checker,
  89. ?LoggerInterface $log,
  90. Installer $installer) {
  91. $this->log = $log;
  92. $this->config = $config;
  93. $this->checker = $checker;
  94. $this->installer = $installer;
  95. }
  96. /**
  97. * runs the update actions in maintenance mode, does not upgrade the source files
  98. * except the main .htaccess file
  99. *
  100. * @return bool true if the operation succeeded, false otherwise
  101. */
  102. public function upgrade(): bool {
  103. $this->logAllEvents();
  104. $logLevel = $this->config->getSystemValue('loglevel', ILogger::WARN);
  105. $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
  106. $this->config->setSystemValue('loglevel', ILogger::DEBUG);
  107. $wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance');
  108. if (!$wasMaintenanceModeEnabled) {
  109. $this->config->setSystemValue('maintenance', true);
  110. $this->emit('\OC\Updater', 'maintenanceEnabled');
  111. }
  112. // Clear CAN_INSTALL file if not on git
  113. if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) {
  114. if (!unlink(\OC::$configDir . '/CAN_INSTALL')) {
  115. $this->log->error('Could not cleanup CAN_INSTALL from your config folder. Please remove this file manually.');
  116. }
  117. }
  118. $installedVersion = $this->config->getSystemValueString('version', '0.0.0');
  119. $currentVersion = implode('.', \OCP\Util::getVersion());
  120. $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, ['app' => 'core']);
  121. $success = true;
  122. try {
  123. $this->doUpgrade($currentVersion, $installedVersion);
  124. } catch (HintException $exception) {
  125. $this->log->error($exception->getMessage(), [
  126. 'exception' => $exception,
  127. ]);
  128. $this->emit('\OC\Updater', 'failure', [$exception->getMessage() . ': ' .$exception->getHint()]);
  129. $success = false;
  130. } catch (\Exception $exception) {
  131. $this->log->error($exception->getMessage(), [
  132. 'exception' => $exception,
  133. ]);
  134. $this->emit('\OC\Updater', 'failure', [get_class($exception) . ': ' .$exception->getMessage()]);
  135. $success = false;
  136. }
  137. $this->emit('\OC\Updater', 'updateEnd', [$success]);
  138. if (!$wasMaintenanceModeEnabled && $success) {
  139. $this->config->setSystemValue('maintenance', false);
  140. $this->emit('\OC\Updater', 'maintenanceDisabled');
  141. } else {
  142. $this->emit('\OC\Updater', 'maintenanceActive');
  143. }
  144. $this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
  145. $this->config->setSystemValue('loglevel', $logLevel);
  146. $this->config->setSystemValue('installed', true);
  147. return $success;
  148. }
  149. /**
  150. * Return version from which this version is allowed to upgrade from
  151. *
  152. * @return array allowed previous versions per vendor
  153. */
  154. private function getAllowedPreviousVersions(): array {
  155. // this should really be a JSON file
  156. require \OC::$SERVERROOT . '/version.php';
  157. /** @var array $OC_VersionCanBeUpgradedFrom */
  158. return $OC_VersionCanBeUpgradedFrom;
  159. }
  160. /**
  161. * Return vendor from which this version was published
  162. *
  163. * @return string Get the vendor
  164. */
  165. private function getVendor(): string {
  166. // this should really be a JSON file
  167. require \OC::$SERVERROOT . '/version.php';
  168. /** @var string $vendor */
  169. return (string) $vendor;
  170. }
  171. /**
  172. * Whether an upgrade to a specified version is possible
  173. * @param string $oldVersion
  174. * @param string $newVersion
  175. * @param array $allowedPreviousVersions
  176. * @return bool
  177. */
  178. public function isUpgradePossible(string $oldVersion, string $newVersion, array $allowedPreviousVersions): bool {
  179. $version = explode('.', $oldVersion);
  180. $majorMinor = $version[0] . '.' . $version[1];
  181. $currentVendor = $this->config->getAppValue('core', 'vendor', '');
  182. // Vendor was not set correctly on install, so we have to white-list known versions
  183. if ($currentVendor === '' && (
  184. isset($allowedPreviousVersions['owncloud'][$oldVersion]) ||
  185. isset($allowedPreviousVersions['owncloud'][$majorMinor])
  186. )) {
  187. $currentVendor = 'owncloud';
  188. $this->config->setAppValue('core', 'vendor', $currentVendor);
  189. }
  190. if ($currentVendor === 'nextcloud') {
  191. return isset($allowedPreviousVersions[$currentVendor][$majorMinor])
  192. && (version_compare($oldVersion, $newVersion, '<=') ||
  193. $this->config->getSystemValueBool('debug', false));
  194. }
  195. // Check if the instance can be migrated
  196. return isset($allowedPreviousVersions[$currentVendor][$majorMinor]) ||
  197. isset($allowedPreviousVersions[$currentVendor][$oldVersion]);
  198. }
  199. /**
  200. * runs the update actions in maintenance mode, does not upgrade the source files
  201. * except the main .htaccess file
  202. *
  203. * @param string $currentVersion current version to upgrade to
  204. * @param string $installedVersion previous version from which to upgrade from
  205. *
  206. * @throws \Exception
  207. */
  208. private function doUpgrade(string $currentVersion, string $installedVersion): void {
  209. // Stop update if the update is over several major versions
  210. $allowedPreviousVersions = $this->getAllowedPreviousVersions();
  211. if (!$this->isUpgradePossible($installedVersion, $currentVersion, $allowedPreviousVersions)) {
  212. throw new \Exception('Updates between multiple major versions and downgrades are unsupported.');
  213. }
  214. // Update .htaccess files
  215. try {
  216. Setup::updateHtaccess();
  217. Setup::protectDataDirectory();
  218. } catch (\Exception $e) {
  219. throw new \Exception($e->getMessage());
  220. }
  221. // create empty file in data dir, so we can later find
  222. // out that this is indeed an ownCloud data directory
  223. // (in case it didn't exist before)
  224. file_put_contents($this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
  225. // pre-upgrade repairs
  226. $repair = \OCP\Server::get(Repair::class);
  227. $repair->setRepairSteps(Repair::getBeforeUpgradeRepairSteps());
  228. $repair->run();
  229. $this->doCoreUpgrade();
  230. try {
  231. // TODO: replace with the new repair step mechanism https://github.com/owncloud/core/pull/24378
  232. Setup::installBackgroundJobs();
  233. } catch (\Exception $e) {
  234. throw new \Exception($e->getMessage());
  235. }
  236. // update all shipped apps
  237. $this->checkAppsRequirements();
  238. $this->doAppUpgrade();
  239. // Update the appfetchers version so it downloads the correct list from the appstore
  240. \OC::$server->getAppFetcher()->setVersion($currentVersion);
  241. /** @var AppManager $appManager */
  242. $appManager = \OC::$server->getAppManager();
  243. // upgrade appstore apps
  244. $this->upgradeAppStoreApps($appManager->getInstalledApps());
  245. $autoDisabledApps = $appManager->getAutoDisabledApps();
  246. if (!empty($autoDisabledApps)) {
  247. $this->upgradeAppStoreApps(array_keys($autoDisabledApps), $autoDisabledApps);
  248. }
  249. // install new shipped apps on upgrade
  250. $errors = Installer::installShippedApps(true);
  251. foreach ($errors as $appId => $exception) {
  252. /** @var \Exception $exception */
  253. $this->log->error($exception->getMessage(), [
  254. 'exception' => $exception,
  255. 'app' => $appId,
  256. ]);
  257. $this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]);
  258. }
  259. // post-upgrade repairs
  260. $repair = \OCP\Server::get(Repair::class);
  261. $repair->setRepairSteps(Repair::getRepairSteps());
  262. $repair->run();
  263. //Invalidate update feed
  264. $this->config->setAppValue('core', 'lastupdatedat', '0');
  265. // Check for code integrity if not disabled
  266. if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
  267. $this->emit('\OC\Updater', 'startCheckCodeIntegrity');
  268. $this->checker->runInstanceVerification();
  269. $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity');
  270. }
  271. // only set the final version if everything went well
  272. $this->config->setSystemValue('version', implode('.', Util::getVersion()));
  273. $this->config->setAppValue('core', 'vendor', $this->getVendor());
  274. }
  275. protected function doCoreUpgrade(): void {
  276. $this->emit('\OC\Updater', 'dbUpgradeBefore');
  277. // execute core migrations
  278. $ms = new MigrationService('core', \OC::$server->get(Connection::class));
  279. $ms->migrate();
  280. $this->emit('\OC\Updater', 'dbUpgrade');
  281. }
  282. /**
  283. * upgrades all apps within a major ownCloud upgrade. Also loads "priority"
  284. * (types authentication, filesystem, logging, in that order) afterwards.
  285. *
  286. * @throws NeedsUpdateException
  287. */
  288. protected function doAppUpgrade(): void {
  289. $apps = \OC_App::getEnabledApps();
  290. $priorityTypes = ['authentication', 'extended_authentication', 'filesystem', 'logging'];
  291. $pseudoOtherType = 'other';
  292. $stacks = [$pseudoOtherType => []];
  293. foreach ($apps as $appId) {
  294. $priorityType = false;
  295. foreach ($priorityTypes as $type) {
  296. if (!isset($stacks[$type])) {
  297. $stacks[$type] = [];
  298. }
  299. if (\OC_App::isType($appId, [$type])) {
  300. $stacks[$type][] = $appId;
  301. $priorityType = true;
  302. break;
  303. }
  304. }
  305. if (!$priorityType) {
  306. $stacks[$pseudoOtherType][] = $appId;
  307. }
  308. }
  309. foreach (array_merge($priorityTypes, [$pseudoOtherType]) as $type) {
  310. $stack = $stacks[$type];
  311. foreach ($stack as $appId) {
  312. if (\OC_App::shouldUpgrade($appId)) {
  313. $this->emit('\OC\Updater', 'appUpgradeStarted', [$appId, \OCP\Server::get(IAppManager::class)->getAppVersion($appId)]);
  314. \OC_App::updateApp($appId);
  315. $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OCP\Server::get(IAppManager::class)->getAppVersion($appId)]);
  316. }
  317. if ($type !== $pseudoOtherType) {
  318. // load authentication, filesystem and logging apps after
  319. // upgrading them. Other apps my need to rely on modifying
  320. // user and/or filesystem aspects.
  321. \OC_App::loadApp($appId);
  322. }
  323. }
  324. }
  325. }
  326. /**
  327. * check if the current enabled apps are compatible with the current
  328. * ownCloud version. disable them if not.
  329. * This is important if you upgrade ownCloud and have non ported 3rd
  330. * party apps installed.
  331. *
  332. * @throws \Exception
  333. */
  334. private function checkAppsRequirements(): void {
  335. $isCoreUpgrade = $this->isCodeUpgrade();
  336. $apps = OC_App::getEnabledApps();
  337. $version = implode('.', Util::getVersion());
  338. $appManager = \OC::$server->getAppManager();
  339. foreach ($apps as $app) {
  340. // check if the app is compatible with this version of Nextcloud
  341. $info = $appManager->getAppInfo($app);
  342. if ($info === null || !OC_App::isAppCompatible($version, $info)) {
  343. if ($appManager->isShipped($app)) {
  344. throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
  345. }
  346. $appManager->disableApp($app, true);
  347. $this->emit('\OC\Updater', 'incompatibleAppDisabled', [$app]);
  348. }
  349. }
  350. }
  351. /**
  352. * @return bool
  353. */
  354. private function isCodeUpgrade(): bool {
  355. $installedVersion = $this->config->getSystemValueString('version', '0.0.0');
  356. $currentVersion = implode('.', Util::getVersion());
  357. if (version_compare($currentVersion, $installedVersion, '>')) {
  358. return true;
  359. }
  360. return false;
  361. }
  362. /**
  363. * @param array $apps
  364. * @param array $previousEnableStates
  365. * @throws \Exception
  366. */
  367. private function upgradeAppStoreApps(array $apps, array $previousEnableStates = []): void {
  368. foreach ($apps as $app) {
  369. try {
  370. $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
  371. if ($this->installer->isUpdateAvailable($app)) {
  372. $this->emit('\OC\Updater', 'upgradeAppStoreApp', [$app]);
  373. $this->installer->updateAppstoreApp($app);
  374. }
  375. $this->emit('\OC\Updater', 'checkAppStoreApp', [$app]);
  376. if (!empty($previousEnableStates)) {
  377. $ocApp = new \OC_App();
  378. if (!empty($previousEnableStates[$app]) && is_array($previousEnableStates[$app])) {
  379. $ocApp->enable($app, $previousEnableStates[$app]);
  380. } else {
  381. $ocApp->enable($app);
  382. }
  383. }
  384. } catch (\Exception $ex) {
  385. $this->log->error($ex->getMessage(), [
  386. 'exception' => $ex,
  387. ]);
  388. }
  389. }
  390. }
  391. private function logAllEvents(): void {
  392. $log = $this->log;
  393. /** @var IEventDispatcher $dispatcher */
  394. $dispatcher = \OC::$server->get(IEventDispatcher::class);
  395. $dispatcher->addListener(
  396. MigratorExecuteSqlEvent::class,
  397. function (MigratorExecuteSqlEvent $event) use ($log): void {
  398. $log->info(get_class($event).': ' . $event->getSql() . ' (' . $event->getCurrentStep() . ' of ' . $event->getMaxStep() . ')', ['app' => 'updater']);
  399. }
  400. );
  401. $repairListener = function (Event $event) use ($log): void {
  402. if ($event instanceof RepairStartEvent) {
  403. $log->info(get_class($event).': Starting ... ' . $event->getMaxStep() . ' (' . $event->getCurrentStepName() . ')', ['app' => 'updater']);
  404. } elseif ($event instanceof RepairAdvanceEvent) {
  405. $desc = $event->getDescription();
  406. if (empty($desc)) {
  407. $desc = '';
  408. }
  409. $log->info(get_class($event).': ' . $desc . ' (' . $event->getIncrement() . ')', ['app' => 'updater']);
  410. } elseif ($event instanceof RepairFinishEvent) {
  411. $log->info(get_class($event), ['app' => 'updater']);
  412. } elseif ($event instanceof RepairStepEvent) {
  413. $log->info(get_class($event).': Repair step: ' . $event->getStepName(), ['app' => 'updater']);
  414. } elseif ($event instanceof RepairInfoEvent) {
  415. $log->info(get_class($event).': Repair info: ' . $event->getMessage(), ['app' => 'updater']);
  416. } elseif ($event instanceof RepairWarningEvent) {
  417. $log->warning(get_class($event).': Repair warning: ' . $event->getMessage(), ['app' => 'updater']);
  418. } elseif ($event instanceof RepairErrorEvent) {
  419. $log->error(get_class($event).': Repair error: ' . $event->getMessage(), ['app' => 'updater']);
  420. }
  421. };
  422. $dispatcher->addListener(RepairStartEvent::class, $repairListener);
  423. $dispatcher->addListener(RepairAdvanceEvent::class, $repairListener);
  424. $dispatcher->addListener(RepairFinishEvent::class, $repairListener);
  425. $dispatcher->addListener(RepairStepEvent::class, $repairListener);
  426. $dispatcher->addListener(RepairInfoEvent::class, $repairListener);
  427. $dispatcher->addListener(RepairWarningEvent::class, $repairListener);
  428. $dispatcher->addListener(RepairErrorEvent::class, $repairListener);
  429. $this->listen('\OC\Updater', 'maintenanceEnabled', function () use ($log) {
  430. $log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']);
  431. });
  432. $this->listen('\OC\Updater', 'maintenanceDisabled', function () use ($log) {
  433. $log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']);
  434. });
  435. $this->listen('\OC\Updater', 'maintenanceActive', function () use ($log) {
  436. $log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']);
  437. });
  438. $this->listen('\OC\Updater', 'updateEnd', function ($success) use ($log) {
  439. if ($success) {
  440. $log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']);
  441. } else {
  442. $log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']);
  443. }
  444. });
  445. $this->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($log) {
  446. $log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']);
  447. });
  448. $this->listen('\OC\Updater', 'dbUpgrade', function () use ($log) {
  449. $log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']);
  450. });
  451. $this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use ($log) {
  452. $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']);
  453. });
  454. $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($log) {
  455. $log->debug('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']);
  456. });
  457. $this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($log) {
  458. $log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']);
  459. });
  460. $this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($log) {
  461. $log->debug('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']);
  462. });
  463. $this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) {
  464. $log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <' . $app . '> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']);
  465. });
  466. $this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) {
  467. $log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']);
  468. });
  469. $this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) {
  470. $log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']);
  471. });
  472. $this->listen('\OC\Updater', 'failure', function ($message) use ($log) {
  473. $log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']);
  474. });
  475. $this->listen('\OC\Updater', 'setDebugLogLevel', function () use ($log) {
  476. $log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']);
  477. });
  478. $this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($log) {
  479. $log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']);
  480. });
  481. $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($log) {
  482. $log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']);
  483. });
  484. $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($log) {
  485. $log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']);
  486. });
  487. }
  488. }