diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/ActivityManager.php (renamed from lib/private/activitymanager.php) | 0 | ||||
-rw-r--r-- | lib/private/AllConfig.php (renamed from lib/private/allconfig.php) | 0 | ||||
-rw-r--r-- | lib/private/App/DependencyAnalyzer.php | 6 | ||||
-rw-r--r-- | lib/private/App/InfoParser.php | 6 | ||||
-rw-r--r-- | lib/private/App/Platform.php | 7 | ||||
-rw-r--r-- | lib/private/AppConfig.php (renamed from lib/private/appconfig.php) | 0 | ||||
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 3 | ||||
-rw-r--r-- | lib/private/AppHelper.php (renamed from lib/private/apphelper.php) | 0 | ||||
-rw-r--r-- | lib/private/Avatar.php (renamed from lib/private/avatar.php) | 0 | ||||
-rw-r--r-- | lib/private/AvatarManager.php (renamed from lib/private/avatarmanager.php) | 0 | ||||
-rw-r--r-- | lib/private/CapabilitiesManager.php (renamed from lib/private/capabilitiesmanager.php) | 0 | ||||
-rw-r--r-- | lib/private/Config.php (renamed from lib/private/config.php) | 0 | ||||
-rw-r--r-- | lib/private/ContactsManager.php (renamed from lib/private/contactsmanager.php) | 0 | ||||
-rw-r--r-- | lib/private/DatabaseException.php (renamed from lib/private/databaseexception.php) | 0 | ||||
-rw-r--r-- | lib/private/DatabaseSetupException.php (renamed from lib/private/databasesetupexception.php) | 0 | ||||
-rw-r--r-- | lib/private/DateTimeFormatter.php (renamed from lib/private/datetimeformatter.php) | 0 | ||||
-rw-r--r-- | lib/private/DateTimeZone.php (renamed from lib/private/datetimezone.php) | 0 | ||||
-rw-r--r-- | lib/private/Files/Filesystem.php | 7 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Availability.php | 4 | ||||
-rw-r--r-- | lib/private/ForbiddenException.php (renamed from lib/private/forbiddenexception.php) | 0 | ||||
-rw-r--r-- | lib/private/HTTPHelper.php (renamed from lib/private/httphelper.php) | 0 | ||||
-rw-r--r-- | lib/private/HintException.php (renamed from lib/private/hintexception.php) | 0 | ||||
-rw-r--r-- | lib/private/Http/Client/Client.php (renamed from lib/private/http/client/client.php) | 0 | ||||
-rw-r--r-- | lib/private/Http/Client/ClientService.php (renamed from lib/private/http/client/clientservice.php) | 0 | ||||
-rw-r--r-- | lib/private/Http/Client/Response.php (renamed from lib/private/http/client/response.php) | 0 | ||||
-rw-r--r-- | lib/private/LargeFileHelper.php (renamed from lib/private/largefilehelper.php) | 0 | ||||
-rw-r--r-- | lib/private/Lock/AbstractLockingProvider.php | 4 | ||||
-rw-r--r-- | lib/private/Lock/MemcacheLockingProvider.php | 9 | ||||
-rw-r--r-- | lib/private/Log.php (renamed from lib/private/log.php) | 0 | ||||
-rw-r--r-- | lib/private/Migration/BackgroundRepair.php | 116 | ||||
-rw-r--r-- | lib/private/NaturalSort.php (renamed from lib/private/naturalsort.php) | 0 | ||||
-rw-r--r-- | lib/private/NavigationManager.php (renamed from lib/private/navigationmanager.php) | 0 | ||||
-rw-r--r-- | lib/private/NeedsUpdateException.php (renamed from lib/private/needsupdateexception.php) | 0 | ||||
-rw-r--r-- | lib/private/NotSquareException.php (renamed from lib/private/notsquareexception.php) | 0 | ||||
-rw-r--r-- | lib/private/OCSClient.php (renamed from lib/private/ocsclient.php) | 0 | ||||
-rw-r--r-- | lib/private/Preview.php (renamed from lib/private/preview.php) | 0 | ||||
-rw-r--r-- | lib/private/PreviewManager.php (renamed from lib/private/previewmanager.php) | 0 | ||||
-rw-r--r-- | lib/private/Repair.php (renamed from lib/private/repair.php) | 20 | ||||
-rw-r--r-- | lib/private/Repair/DropOldTables.php | 5 | ||||
-rw-r--r-- | lib/private/RepairException.php (renamed from lib/private/repairexception.php) | 0 | ||||
-rw-r--r-- | lib/private/Search.php (renamed from lib/private/search.php) | 0 | ||||
-rw-r--r-- | lib/private/ServerContainer.php (renamed from lib/private/servercontainer.php) | 0 | ||||
-rw-r--r-- | lib/private/ServerNotAvailableException.php (renamed from lib/private/servernotavailableexception.php) | 0 | ||||
-rw-r--r-- | lib/private/ServiceUnavailableException.php (renamed from lib/private/serviceunavailableexception.php) | 0 | ||||
-rw-r--r-- | lib/private/Setup.php (renamed from lib/private/setup.php) | 0 | ||||
-rw-r--r-- | lib/private/Streamer.php (renamed from lib/private/streamer.php) | 0 | ||||
-rw-r--r-- | lib/private/SubAdmin.php (renamed from lib/private/subadmin.php) | 0 | ||||
-rw-r--r-- | lib/private/SystemConfig.php (renamed from lib/private/systemconfig.php) | 0 | ||||
-rw-r--r-- | lib/private/TagManager.php (renamed from lib/private/tagmanager.php) | 0 | ||||
-rw-r--r-- | lib/private/Tags.php (renamed from lib/private/tags.php) | 0 | ||||
-rw-r--r-- | lib/private/TempManager.php (renamed from lib/private/tempmanager.php) | 0 | ||||
-rw-r--r-- | lib/private/TemplateLayout.php (renamed from lib/private/templatelayout.php) | 0 | ||||
-rw-r--r-- | lib/private/URLGenerator.php (renamed from lib/private/urlgenerator.php) | 0 | ||||
-rw-r--r-- | lib/private/Updater.php (renamed from lib/private/updater.php) | 29 | ||||
-rw-r--r-- | lib/private/app.php | 14 | ||||
-rw-r--r-- | lib/public/migration/ioutput.php | 3 |
56 files changed, 195 insertions, 38 deletions
diff --git a/lib/private/activitymanager.php b/lib/private/ActivityManager.php index e522dca9e3b..e522dca9e3b 100644 --- a/lib/private/activitymanager.php +++ b/lib/private/ActivityManager.php diff --git a/lib/private/allconfig.php b/lib/private/AllConfig.php index b4888fde022..b4888fde022 100644 --- a/lib/private/allconfig.php +++ b/lib/private/AllConfig.php diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index 6519e15bd8b..1e3a81c6351 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -145,6 +145,12 @@ class DependencyAnalyzer { $missing[] = (string)$this->l->t('PHP with a version lower than %s is required.', $maxVersion); } } + if (isset($dependencies['php']['@attributes']['min-int-size'])) { + $intSize = $dependencies['php']['@attributes']['min-int-size']; + if ($intSize > $this->platform->getIntSize()*8) { + $missing[] = (string)$this->l->t('%sbit or higher PHP required.', $intSize); + } + } return $missing; } diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php index e763364e148..b7540c04248 100644 --- a/lib/private/App/InfoParser.php +++ b/lib/private/App/InfoParser.php @@ -80,6 +80,9 @@ class InfoParser { if (!array_key_exists('post-migration', $array['repair-steps'])) { $array['repair-steps']['post-migration'] = []; } + if (!array_key_exists('live-migration', $array['repair-steps'])) { + $array['repair-steps']['live-migration'] = []; + } if (array_key_exists('documentation', $array) && is_array($array['documentation'])) { foreach ($array['documentation'] as $key => $url) { @@ -110,6 +113,9 @@ class InfoParser { if (isset($array['repair-steps']['post-migration']['step']) && is_array($array['repair-steps']['post-migration']['step'])) { $array['repair-steps']['post-migration'] = $array['repair-steps']['post-migration']['step']; } + if (isset($array['repair-steps']['live-migration']['step']) && is_array($array['repair-steps']['live-migration']['step'])) { + $array['repair-steps']['live-migration'] = $array['repair-steps']['live-migration']['step']; + } return $array; } diff --git a/lib/private/App/Platform.php b/lib/private/App/Platform.php index 1d4c3767121..b1cb7c5aeb0 100644 --- a/lib/private/App/Platform.php +++ b/lib/private/App/Platform.php @@ -49,6 +49,13 @@ class Platform { } /** + * @return int + */ + public function getIntSize() { + return PHP_INT_SIZE; + } + + /** * @return string */ public function getOcVersion() { diff --git a/lib/private/appconfig.php b/lib/private/AppConfig.php index 14c48299a8a..14c48299a8a 100644 --- a/lib/private/appconfig.php +++ b/lib/private/AppConfig.php diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 7cd8cedcfdd..fb6f1415fe9 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -271,6 +271,9 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @return bool */ public function __isset($name) { + if (in_array($name, $this->allowedKeys, true)) { + return true; + } return isset($this->items['parameters'][$name]); } diff --git a/lib/private/apphelper.php b/lib/private/AppHelper.php index c19ed2f5b67..c19ed2f5b67 100644 --- a/lib/private/apphelper.php +++ b/lib/private/AppHelper.php diff --git a/lib/private/avatar.php b/lib/private/Avatar.php index 3f8038360a4..3f8038360a4 100644 --- a/lib/private/avatar.php +++ b/lib/private/Avatar.php diff --git a/lib/private/avatarmanager.php b/lib/private/AvatarManager.php index 62f4faf436c..62f4faf436c 100644 --- a/lib/private/avatarmanager.php +++ b/lib/private/AvatarManager.php diff --git a/lib/private/capabilitiesmanager.php b/lib/private/CapabilitiesManager.php index 8b89692faa9..8b89692faa9 100644 --- a/lib/private/capabilitiesmanager.php +++ b/lib/private/CapabilitiesManager.php diff --git a/lib/private/config.php b/lib/private/Config.php index 9bb5c299463..9bb5c299463 100644 --- a/lib/private/config.php +++ b/lib/private/Config.php diff --git a/lib/private/contactsmanager.php b/lib/private/ContactsManager.php index a2640d36945..a2640d36945 100644 --- a/lib/private/contactsmanager.php +++ b/lib/private/ContactsManager.php diff --git a/lib/private/databaseexception.php b/lib/private/DatabaseException.php index 4d50fe82b0f..4d50fe82b0f 100644 --- a/lib/private/databaseexception.php +++ b/lib/private/DatabaseException.php diff --git a/lib/private/databasesetupexception.php b/lib/private/DatabaseSetupException.php index 30bd00de2d6..30bd00de2d6 100644 --- a/lib/private/databasesetupexception.php +++ b/lib/private/DatabaseSetupException.php diff --git a/lib/private/datetimeformatter.php b/lib/private/DateTimeFormatter.php index 5639ab1cace..5639ab1cace 100644 --- a/lib/private/datetimeformatter.php +++ b/lib/private/DateTimeFormatter.php diff --git a/lib/private/datetimezone.php b/lib/private/DateTimeZone.php index 5359cd6b391..5359cd6b391 100644 --- a/lib/private/datetimezone.php +++ b/lib/private/DateTimeZone.php diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index d33f9476f22..61319a8cbaa 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -58,6 +58,7 @@ namespace OC\Files; +use OC\Cache\CappedMemoryCache; use OC\Files\Config\MountProviderCollection; use OC\Files\Mount\MountPoint; use OC\Files\Storage\StorageFactory; @@ -81,7 +82,7 @@ class Filesystem { static private $usersSetup = array(); - static private $normalizedPathCache = array(); + static private $normalizedPathCache = null; static private $listeningForProviders = false; @@ -812,6 +813,10 @@ class Filesystem { * @return string */ public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false) { + if (is_null(self::$normalizedPathCache)) { + self::$normalizedPathCache = new CappedMemoryCache(); + } + /** * FIXME: This is a workaround for existing classes and files which call * this function with another type than a valid string. This diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php index 0ed31ba854a..8d6fc4b3369 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -40,9 +40,13 @@ class Availability extends Wrapper { } /** + * Only called if availability === false + * * @return bool */ private function updateAvailability() { + // reset availability to false so that multiple requests don't recheck concurrently + $this->setAvailability(false); try { $result = $this->test(); } catch (\Exception $e) { diff --git a/lib/private/forbiddenexception.php b/lib/private/ForbiddenException.php index 48be35ba316..48be35ba316 100644 --- a/lib/private/forbiddenexception.php +++ b/lib/private/ForbiddenException.php diff --git a/lib/private/httphelper.php b/lib/private/HTTPHelper.php index f33d4a51745..f33d4a51745 100644 --- a/lib/private/httphelper.php +++ b/lib/private/HTTPHelper.php diff --git a/lib/private/hintexception.php b/lib/private/HintException.php index aeddea481cc..aeddea481cc 100644 --- a/lib/private/hintexception.php +++ b/lib/private/HintException.php diff --git a/lib/private/http/client/client.php b/lib/private/Http/Client/Client.php index bd9e82ddae7..bd9e82ddae7 100644 --- a/lib/private/http/client/client.php +++ b/lib/private/Http/Client/Client.php diff --git a/lib/private/http/client/clientservice.php b/lib/private/Http/Client/ClientService.php index 7e280dbf3ca..7e280dbf3ca 100644 --- a/lib/private/http/client/clientservice.php +++ b/lib/private/Http/Client/ClientService.php diff --git a/lib/private/http/client/response.php b/lib/private/Http/Client/Response.php index 7a879eab111..7a879eab111 100644 --- a/lib/private/http/client/response.php +++ b/lib/private/Http/Client/Response.php diff --git a/lib/private/largefilehelper.php b/lib/private/LargeFileHelper.php index f5252ee01e7..f5252ee01e7 100644 --- a/lib/private/largefilehelper.php +++ b/lib/private/LargeFileHelper.php diff --git a/lib/private/Lock/AbstractLockingProvider.php b/lib/private/Lock/AbstractLockingProvider.php index f96358778c1..1886fbea082 100644 --- a/lib/private/Lock/AbstractLockingProvider.php +++ b/lib/private/Lock/AbstractLockingProvider.php @@ -116,4 +116,8 @@ abstract class AbstractLockingProvider implements ILockingProvider { $this->releaseLock($path, self::LOCK_EXCLUSIVE); } } + + protected function getOwnSharedLockCount($path) { + return isset($this->acquiredLocks['shared'][$path]) ? $this->acquiredLocks['shared'][$path] : 0; + } } diff --git a/lib/private/Lock/MemcacheLockingProvider.php b/lib/private/Lock/MemcacheLockingProvider.php index 536b29e2c28..56e581b2192 100644 --- a/lib/private/Lock/MemcacheLockingProvider.php +++ b/lib/private/Lock/MemcacheLockingProvider.php @@ -88,9 +88,14 @@ class MemcacheLockingProvider extends AbstractLockingProvider { */ public function releaseLock($path, $type) { if ($type === self::LOCK_SHARED) { - if (isset($this->acquiredLocks['shared'][$path]) and $this->acquiredLocks['shared'][$path] > 0) { + if ($this->getOwnSharedLockCount($path) === 1) { + $removed = $this->memcache->cad($path, 1); // if we're the only one having a shared lock we can remove it in one go + if (!$removed) { //someone else also has a shared lock, decrease only + $this->memcache->dec($path); + } + } else { + // if we own more than one lock ourselves just decrease $this->memcache->dec($path); - $this->memcache->cad($path, 0); } } else if ($type === self::LOCK_EXCLUSIVE) { $this->memcache->cad($path, 'exclusive'); diff --git a/lib/private/log.php b/lib/private/Log.php index bbdad9cf166..bbdad9cf166 100644 --- a/lib/private/log.php +++ b/lib/private/Log.php diff --git a/lib/private/Migration/BackgroundRepair.php b/lib/private/Migration/BackgroundRepair.php new file mode 100644 index 00000000000..d85c8550d5d --- /dev/null +++ b/lib/private/Migration/BackgroundRepair.php @@ -0,0 +1,116 @@ +<?php +/** + * @author Thomas Müller <thomas.mueller@tmit.eu> + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ +namespace OC\Migration; + +use OC\BackgroundJob\JobList; +use OC\BackgroundJob\TimedJob; +use OC\NeedsUpdateException; +use OC\Repair; +use OC_App; +use OCP\BackgroundJob\IJobList; +use OCP\ILogger; +use Symfony\Component\EventDispatcher\EventDispatcher; + +/** + * Class BackgroundRepair + * + * @package OC\Migration + */ +class BackgroundRepair extends TimedJob { + + /** @var IJobList */ + private $jobList; + + /** @var ILogger */ + private $logger; + + /** @var EventDispatcher */ + private $dispatcher; + + public function setDispatcher(EventDispatcher $dispatcher) { + $this->dispatcher = $dispatcher; + } + /** + * run the job, then remove it from the job list + * + * @param JobList $jobList + * @param ILogger $logger + */ + public function execute($jobList, ILogger $logger = null) { + // add an interval of 15 mins + $this->setInterval(15*60); + + $this->jobList = $jobList; + $this->logger = $logger; + parent::execute($jobList, $logger); + } + + /** + * @param array $argument + * @throws \Exception + * @throws \OC\NeedsUpdateException + */ + protected function run($argument) { + if (!isset($argument['app']) || !isset($argument['step'])) { + // remove the job - we can never execute it + $this->jobList->remove($this, $this->argument); + return; + } + $app = $argument['app']; + + try { + $this->loadApp($app); + } catch (NeedsUpdateException $ex) { + // as long as the app is not yet done with it's offline migration + // we better not start with the live migration + return; + } + + $step = $argument['step']; + $repair = new Repair([], $this->dispatcher); + try { + $repair->addStep($step); + } catch (\Exception $ex) { + $this->logger->logException($ex,[ + 'app' => 'migration' + ]); + + // remove the job - we can never execute it + $this->jobList->remove($this, $this->argument); + return; + } + + // execute the repair step + $repair->run(); + + // remove the job once executed successfully + $this->jobList->remove($this, $this->argument); + } + + /** + * @codeCoverageIgnore + * @param $app + * @throws NeedsUpdateException + */ + protected function loadApp($app) { + OC_App::loadApp($app); + } +} diff --git a/lib/private/naturalsort.php b/lib/private/NaturalSort.php index f44e8032d36..f44e8032d36 100644 --- a/lib/private/naturalsort.php +++ b/lib/private/NaturalSort.php diff --git a/lib/private/navigationmanager.php b/lib/private/NavigationManager.php index 6dbb9c925e0..6dbb9c925e0 100644 --- a/lib/private/navigationmanager.php +++ b/lib/private/NavigationManager.php diff --git a/lib/private/needsupdateexception.php b/lib/private/NeedsUpdateException.php index 90c642780d8..90c642780d8 100644 --- a/lib/private/needsupdateexception.php +++ b/lib/private/NeedsUpdateException.php diff --git a/lib/private/notsquareexception.php b/lib/private/NotSquareException.php index e3494463850..e3494463850 100644 --- a/lib/private/notsquareexception.php +++ b/lib/private/NotSquareException.php diff --git a/lib/private/ocsclient.php b/lib/private/OCSClient.php index a783a1f8425..a783a1f8425 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/OCSClient.php diff --git a/lib/private/preview.php b/lib/private/Preview.php index 4fca56dd984..4fca56dd984 100644 --- a/lib/private/preview.php +++ b/lib/private/Preview.php diff --git a/lib/private/previewmanager.php b/lib/private/PreviewManager.php index f3c7a4de0d0..f3c7a4de0d0 100644 --- a/lib/private/previewmanager.php +++ b/lib/private/PreviewManager.php diff --git a/lib/private/repair.php b/lib/private/Repair.php index 586e4e42b13..590b0bee721 100644 --- a/lib/private/repair.php +++ b/lib/private/Repair.php @@ -28,7 +28,6 @@ namespace OC; -use OC\Hooks\BasicEmitter; use OC\Hooks\Emitter; use OC\Repair\AssetCache; use OC\Repair\CleanTags; @@ -51,11 +50,13 @@ use OCP\Migration\IRepairStep; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\GenericEvent; -class Repair extends BasicEmitter implements IOutput{ +class Repair implements IOutput{ /* @var IRepairStep[] */ private $repairSteps; /** @var EventDispatcher */ private $dispatcher; + /** @var string */ + private $currentStep; /** * Creates a new repair step runner @@ -79,7 +80,8 @@ class Repair extends BasicEmitter implements IOutput{ } // run each repair step foreach ($this->repairSteps as $step) { - $this->emit('\OC\Repair', 'step', array($step->getName())); + $this->currentStep = $step->getName(); + $this->emit('\OC\Repair', 'step', [$this->currentStep]); if ($step instanceof Emitter) { $step->listen('\OC\Repair', 'warning', function ($description) use ($self) { @@ -178,10 +180,11 @@ class Repair extends BasicEmitter implements IOutput{ } /** - * {@inheritDoc} + * @param string $scope + * @param string $method + * @param array $arguments */ public function emit($scope, $method, array $arguments = []) { - parent::emit($scope, $method, $arguments); if (!is_null($this->dispatcher)) { $this->dispatcher->dispatch("$scope::$method", new GenericEvent("$scope::$method", $arguments)); @@ -206,15 +209,16 @@ class Repair extends BasicEmitter implements IOutput{ */ public function startProgress($max = 0) { // for now just emit as we did in the past - $this->emit('\OC\Repair', 'startProgress', [$max]); + $this->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]); } /** * @param int $step + * @param string $description */ - public function advance($step = 1) { + public function advance($step = 1, $description = '') { // for now just emit as we did in the past - $this->emit('\OC\Repair', 'advance', [$step]); + $this->emit('\OC\Repair', 'advance', [$step, $description]); } /** diff --git a/lib/private/Repair/DropOldTables.php b/lib/private/Repair/DropOldTables.php index 15d5b9a3577..b9963b50775 100644 --- a/lib/private/Repair/DropOldTables.php +++ b/lib/private/Repair/DropOldTables.php @@ -55,12 +55,15 @@ class DropOldTables implements IRepairStep { * @throws \Exception in case of failure */ public function run(IOutput $output) { + $tables = $this->oldDatabaseTables(); + $output->startProgress(count($tables)); foreach ($this->oldDatabaseTables() as $tableName) { if ($this->connection->tableExists($tableName)){ - $output->info(sprintf('Table %s has been deleted', $tableName)); $this->connection->dropTable($tableName); } + $output->advance(1, "Drop old database table: $tableName"); } + $output->finishProgress(); } /** diff --git a/lib/private/repairexception.php b/lib/private/RepairException.php index e244f2bb820..e244f2bb820 100644 --- a/lib/private/repairexception.php +++ b/lib/private/RepairException.php diff --git a/lib/private/search.php b/lib/private/Search.php index 7d1e2734195..7d1e2734195 100644 --- a/lib/private/search.php +++ b/lib/private/Search.php diff --git a/lib/private/servercontainer.php b/lib/private/ServerContainer.php index d297c9fd39c..d297c9fd39c 100644 --- a/lib/private/servercontainer.php +++ b/lib/private/ServerContainer.php diff --git a/lib/private/servernotavailableexception.php b/lib/private/ServerNotAvailableException.php index f4b5f4f8cf3..f4b5f4f8cf3 100644 --- a/lib/private/servernotavailableexception.php +++ b/lib/private/ServerNotAvailableException.php diff --git a/lib/private/serviceunavailableexception.php b/lib/private/ServiceUnavailableException.php index fb4920b3607..fb4920b3607 100644 --- a/lib/private/serviceunavailableexception.php +++ b/lib/private/ServiceUnavailableException.php diff --git a/lib/private/setup.php b/lib/private/Setup.php index 196ae8a8bce..196ae8a8bce 100644 --- a/lib/private/setup.php +++ b/lib/private/Setup.php diff --git a/lib/private/streamer.php b/lib/private/Streamer.php index 23c191b68da..23c191b68da 100644 --- a/lib/private/streamer.php +++ b/lib/private/Streamer.php diff --git a/lib/private/subadmin.php b/lib/private/SubAdmin.php index 34dd40c22ff..34dd40c22ff 100644 --- a/lib/private/subadmin.php +++ b/lib/private/SubAdmin.php diff --git a/lib/private/systemconfig.php b/lib/private/SystemConfig.php index 449a2dc50b2..449a2dc50b2 100644 --- a/lib/private/systemconfig.php +++ b/lib/private/SystemConfig.php diff --git a/lib/private/tagmanager.php b/lib/private/TagManager.php index a9e1cdfe076..a9e1cdfe076 100644 --- a/lib/private/tagmanager.php +++ b/lib/private/TagManager.php diff --git a/lib/private/tags.php b/lib/private/Tags.php index cf39a9a9759..cf39a9a9759 100644 --- a/lib/private/tags.php +++ b/lib/private/Tags.php diff --git a/lib/private/tempmanager.php b/lib/private/TempManager.php index dd97a36cd7f..dd97a36cd7f 100644 --- a/lib/private/tempmanager.php +++ b/lib/private/TempManager.php diff --git a/lib/private/templatelayout.php b/lib/private/TemplateLayout.php index 88077b418a7..88077b418a7 100644 --- a/lib/private/templatelayout.php +++ b/lib/private/TemplateLayout.php diff --git a/lib/private/urlgenerator.php b/lib/private/URLGenerator.php index 327c0c32dfe..327c0c32dfe 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/URLGenerator.php diff --git a/lib/private/updater.php b/lib/private/Updater.php index 66f410b779f..093ebebbbe4 100644 --- a/lib/private/updater.php +++ b/lib/private/Updater.php @@ -132,6 +132,8 @@ class Updater extends BasicEmitter { * @return bool true if the operation succeeded, false otherwise */ public function upgrade() { + $this->emitRepairEvents(); + $logLevel = $this->config->getSystemValue('loglevel', \OCP\Util::WARN); $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); $this->config->setSystemValue('loglevel', \OCP\Util::DEBUG); @@ -196,26 +198,6 @@ class Updater extends BasicEmitter { } /** - * Forward messages emitted by the repair routine - * - * @param Repair $repair repair routine - */ - private function emitRepairMessages(Repair $repair) { - $repair->listen('\OC\Repair', 'warning', function ($description) { - $this->emit('\OC\Updater', 'repairWarning', array($description)); - }); - $repair->listen('\OC\Repair', 'error', function ($description) { - $this->emit('\OC\Updater', 'repairError', array($description)); - }); - $repair->listen('\OC\Repair', 'info', function ($description) { - $this->emit('\OC\Updater', 'repairInfo', array($description)); - }); - $repair->listen('\OC\Repair', 'step', function ($description) { - $this->emit('\OC\Updater', 'repairStep', array($description)); - }); - } - - /** * runs the update actions in maintenance mode, does not upgrade the source files * except the main .htaccess file * @@ -245,8 +227,7 @@ class Updater extends BasicEmitter { file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); // pre-upgrade repairs - $repair = new Repair(Repair::getBeforeUpgradeRepairSteps()); - $this->emitRepairMessages($repair); + $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher()); $repair->run(); // simulate DB upgrade @@ -278,8 +259,7 @@ class Updater extends BasicEmitter { } // post-upgrade repairs - $repair = new Repair(Repair::getRepairSteps()); - $this->emitRepairMessages($repair); + $repair = new Repair(Repair::getRepairSteps(), \OC::$server->getEventDispatcher()); $repair->run(); //Invalidate update feed @@ -362,7 +342,6 @@ class Updater extends BasicEmitter { * @throws NeedsUpdateException */ protected function doAppUpgrade() { - $this->emitRepairEvents(); $apps = \OC_App::getEnabledApps(); $priorityTypes = array('authentication', 'filesystem', 'logging'); $pseudoOtherType = 'other'; diff --git a/lib/private/app.php b/lib/private/app.php index 7bcbef32531..246bf97ee91 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -1153,6 +1153,7 @@ class OC_App { OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml'); } self::executeRepairSteps($appId, $appData['repair-steps']['post-migration']); + self::setupLiveMigrations($appId, $appData['repair-steps']['live-migration']); unset(self::$appVersion[$appId]); // run upgrade code if (file_exists($appPath . '/appinfo/update.php')) { @@ -1211,6 +1212,19 @@ class OC_App { /** * @param string $appId + * @param string[] $steps + */ + private static function setupLiveMigrations($appId, array $steps) { + $queue = \OC::$server->getJobList(); + foreach ($steps as $step) { + $queue->add('OC\Migration\BackgroundRepair', [ + 'app' => $appId, + 'step' => $step]); + } + } + + /** + * @param string $appId * @return \OC\Files\View|false */ public static function getStorage($appId) { diff --git a/lib/public/migration/ioutput.php b/lib/public/migration/ioutput.php index c52f13b31dc..d3b43028495 100644 --- a/lib/public/migration/ioutput.php +++ b/lib/public/migration/ioutput.php @@ -48,9 +48,10 @@ interface IOutput { /** * @param int $step + * @param string $description * @since 9.1.0 */ - public function advance($step = 1); + public function advance($step = 1, $description = ''); /** * @param int $max |