Skip to content

Commit

Permalink
Reenable notShipped apps
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed May 3, 2016
1 parent b0589e0 commit f48bfd1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Command/CheckSystemCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];

Expand Down
22 changes: 21 additions & 1 deletion src/Command/EnableNotShippedAppsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

}
6 changes: 6 additions & 0 deletions src/Utils/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
Expand Down

0 comments on commit f48bfd1

Please sign in to comment.