1
0

Status.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OC\Core\Command;
  26. use OC_Util;
  27. use OCP\Defaults;
  28. use OCP\IConfig;
  29. use OCP\Util;
  30. use Symfony\Component\Console\Input\InputInterface;
  31. use Symfony\Component\Console\Output\OutputInterface;
  32. class Status extends Base {
  33. /** @var IConfig */
  34. private $config;
  35. /** @var Defaults */
  36. private $themingDefaults;
  37. public function __construct(IConfig $config, Defaults $themingDefaults) {
  38. parent::__construct('status');
  39. $this->config = $config;
  40. $this->themingDefaults = $themingDefaults;
  41. }
  42. protected function configure() {
  43. parent::configure();
  44. $this
  45. ->setDescription('show some status information')
  46. ;
  47. }
  48. protected function execute(InputInterface $input, OutputInterface $output): int {
  49. $values = [
  50. 'installed' => $this->config->getSystemValueBool('installed', false),
  51. 'version' => implode('.', Util::getVersion()),
  52. 'versionstring' => OC_Util::getVersionString(),
  53. 'edition' => '',
  54. 'maintenance' => $this->config->getSystemValueBool('maintenance', false),
  55. 'needsDbUpgrade' => Util::needUpgrade(),
  56. 'productname' => $this->themingDefaults->getProductName(),
  57. 'extendedSupport' => Util::hasExtendedSupport()
  58. ];
  59. $this->writeArrayInOutputFormat($input, $output, $values);
  60. return 0;
  61. }
  62. }