diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-19 16:36:11 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-22 10:26:31 +0300 |
commit | 3aa77960ef78e397ae3e42d82aae32cac3114752 (patch) | |
tree | a0b11fd4e3c92a6bd0cbffa1efc0e2850011a1c9 /lib/private/updater.php | |
parent | d0030aad6cb108bbf4ca729d0e11f3438145aba9 (diff) |
Adding pre- and post-migration repair steps
Diffstat (limited to 'lib/private/updater.php')
-rw-r--r-- | lib/private/updater.php | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/lib/private/updater.php b/lib/private/updater.php index 627e01596bb..66f410b779f 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -40,6 +40,7 @@ use OC_Installer; use OCP\IConfig; use OC\Setup; use OCP\ILogger; +use Symfony\Component\EventDispatcher\GenericEvent; /** * Class that handles autoupdating of ownCloud @@ -361,6 +362,7 @@ class Updater extends BasicEmitter { * @throws NeedsUpdateException */ protected function doAppUpgrade() { + $this->emitRepairEvents(); $apps = \OC_App::getEnabledApps(); $priorityTypes = array('authentication', 'filesystem', 'logging'); $pseudoOtherType = 'other'; @@ -385,9 +387,9 @@ class Updater extends BasicEmitter { foreach ($stacks as $type => $stack) { foreach ($stack as $appId) { if (\OC_App::shouldUpgrade($appId)) { - $this->emit('\OC\Updater', 'appUpgradeStarted', array($appId, \OC_App::getAppVersion($appId))); + $this->emit('\OC\Updater', 'appUpgradeStarted', [$appId, \OC_App::getAppVersion($appId)]); \OC_App::updateApp($appId); - $this->emit('\OC\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId))); + $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]); } if($type !== $pseudoOtherType) { // load authentication, filesystem and logging apps after @@ -473,5 +475,33 @@ class Updater extends BasicEmitter { } } } + + /** + * Forward messages emitted by the repair routine + */ + private function emitRepairEvents() { + $dispatcher = \OC::$server->getEventDispatcher(); + $dispatcher->addListener('\OC\Repair::warning', function ($event) { + if ($event instanceof GenericEvent) { + $this->emit('\OC\Updater', 'repairWarning', $event->getArguments()); + } + }); + $dispatcher->addListener('\OC\Repair::error', function ($event) { + if ($event instanceof GenericEvent) { + $this->emit('\OC\Updater', 'repairError', $event->getArguments()); + } + }); + $dispatcher->addListener('\OC\Repair::info', function ($event) { + if ($event instanceof GenericEvent) { + $this->emit('\OC\Updater', 'repairInfo', $event->getArguments()); + } + }); + $dispatcher->addListener('\OC\Repair::step', function ($event) { + if ($event instanceof GenericEvent) { + $this->emit('\OC\Updater', 'repairStep', $event->getArguments()); + } + }); + } + } |