|
|
@@ -29,6 +29,7 @@ use OCP\Defaults; |
|
|
|
use OCP\IConfig; |
|
|
|
use OCP\Util; |
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
|
|
|
class Status extends Base { |
|
|
@@ -47,17 +48,33 @@ class Status extends Base { |
|
|
|
|
|
|
|
$this |
|
|
|
->setDescription('show some status information') |
|
|
|
; |
|
|
|
->addOption( |
|
|
|
'exit-code', |
|
|
|
'e', |
|
|
|
InputOption::VALUE_NONE, |
|
|
|
'exit with 0 if running in normal mode, 1 when in maintenance mode, 2 when `./occ upgrade` is needed. Does not write any output to STDOUT.' |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int { |
|
|
|
$maintenanceMode = $this->config->getSystemValueBool('maintenance', false); |
|
|
|
$needUpgrade = Util::needUpgrade(); |
|
|
|
if ($input->getOption('exit-code')) { |
|
|
|
if ($maintenanceMode === true) { |
|
|
|
return 1; |
|
|
|
} elseif ($needUpgrade == true) { |
|
|
|
return 2; |
|
|
|
} else { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
$values = [ |
|
|
|
'installed' => $this->config->getSystemValueBool('installed', false), |
|
|
|
'version' => implode('.', Util::getVersion()), |
|
|
|
'versionstring' => OC_Util::getVersionString(), |
|
|
|
'edition' => '', |
|
|
|
'maintenance' => $this->config->getSystemValueBool('maintenance', false), |
|
|
|
'needsDbUpgrade' => Util::needUpgrade(), |
|
|
|
'maintenance' => $maintenanceMode, |
|
|
|
'needsDbUpgrade' => $needUpgrade, |
|
|
|
'productname' => $this->themingDefaults->getProductName(), |
|
|
|
'extendedSupport' => Util::hasExtendedSupport() |
|
|
|
]; |