diff --git a/src/Command/CheckSystemCommand.php b/src/Command/CheckSystemCommand.php index 1cf89d6e..0eb3afc7 100644 --- a/src/Command/CheckSystemCommand.php +++ b/src/Command/CheckSystemCommand.php @@ -44,8 +44,8 @@ protected function execute(InputInterface $input, OutputInterface $output){ /** @var \Owncloud\Updater\Utils\AppManager $occRunner */ $appManager = $this->container['utils.appmanager']; $registry->set( - 'shippedApps', - $appManager->getShippedApps() + 'notShippedApps', + $appManager->getNotShippedApps() ); $occRunner = $this->container['utils.occrunner']; diff --git a/src/Command/EnableNotShippedAppsCommand.php b/src/Command/EnableNotShippedAppsCommand.php index 4e05adc3..fca61b0c 100644 --- a/src/Command/EnableNotShippedAppsCommand.php +++ b/src/Command/EnableNotShippedAppsCommand.php @@ -36,11 +36,31 @@ protected function configure(){ } protected function execute(InputInterface $input, OutputInterface $output){ + /** @var \Owncloud\Updater\Utils\Locator $locator */ + $locator = $this->container['utils.locator']; + /** @var \Owncloud\Updater\Utils\Checkpoint $checkpoint */ + $checkpoint = $this->container['utils.checkpoint']; + /** @var \Owncloud\Updater\Utils\FilesystemHelper $fsHelper */ + $fsHelper = $this->container['utils.filesystemhelper']; + $registry = $this->container['utils.registry']; + + $notShippedApps = $registry->get('notShippedApps'); + $notShippedApps = is_array($notShippedApps) ? $notShippedApps : []; + + $lastCheckpointId = $checkpoint->getLastCheckpointId(); + $lastCheckpointPath = $checkpoint->getCheckpointPath($lastCheckpointId); + if ($lastCheckpointId){ + $oldSourcesDir = $locator->getOwnCloudRootPath(); + foreach ($notShippedApps as $notShippedApp) { + $fsHelper->copyr($lastCheckpointPath . '/apps/' . $notShippedApp, $oldSourcesDir . '/apps/' . $notShippedApp, false); + } + } + + /** @var \Owncloud\Updater\Utils\AppManager $appManager */ $appManager = $registry->get('appManager'); if (!is_null($appManager)){ $appManager->reenableNotShippedApps($output); } } - } diff --git a/src/Utils/AppManager.php b/src/Utils/AppManager.php index 421f0b04..5168f5e9 100644 --- a/src/Utils/AppManager.php +++ b/src/Utils/AppManager.php @@ -100,6 +100,12 @@ public function getAllApps(){ return $allApps; } + public function getNotShippedApps(){ + $shippedApps = $this->occRunner->runJson('app:list --shipped false'); + $allApps = array_merge(array_keys($shippedApps['enabled']), array_keys($shippedApps['disabled'])); + return $allApps; + } + public function getShippedApps(){ $shippedApps = $this->occRunner->runJson('app:list --shipped true'); $allApps = array_merge(array_keys($shippedApps['enabled']), array_keys($shippedApps['disabled']));