status.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Andreas Fischer <bantu@owncloud.com>
  6. * @author Christopher Schäpers <kondou@ts.unde.re>
  7. * @author Frank Karlitschek <frank@karlitschek.de>
  8. * @author Joas Schilling <coding@schilljs.com>
  9. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  10. * @author Lukas Reschke <lukas@statuscode.ch>
  11. * @author Masaki Kawabata Neto <masaki.kawabata@gmail.com>
  12. * @author Morris Jobke <hey@morrisjobke.de>
  13. *
  14. * @license AGPL-3.0
  15. *
  16. * This code is free software: you can redistribute it and/or modify
  17. * it under the terms of the GNU Affero General Public License, version 3,
  18. * as published by the Free Software Foundation.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU Affero General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU Affero General Public License, version 3,
  26. * along with this program. If not, see <http://www.gnu.org/licenses/>
  27. *
  28. */
  29. try {
  30. require_once __DIR__ . '/lib/base.php';
  31. $systemConfig = \OC::$server->getSystemConfig();
  32. $installed = (bool) $systemConfig->getValue('installed', false);
  33. $maintenance = (bool) $systemConfig->getValue('maintenance', false);
  34. # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
  35. # for description and defaults
  36. $defaults = new \OCP\Defaults();
  37. $values=array(
  38. 'installed'=>$installed,
  39. 'maintenance' => $maintenance,
  40. 'needsDbUpgrade' => \OCP\Util::needUpgrade(),
  41. 'version'=>implode('.', \OCP\Util::getVersion()),
  42. 'versionstring'=>OC_Util::getVersionString(),
  43. 'edition'=> '',
  44. 'productname'=>$defaults->getName());
  45. if (OC::$CLI) {
  46. print_r($values);
  47. } else {
  48. header('Access-Control-Allow-Origin: *');
  49. header('Content-Type: application/json');
  50. echo json_encode($values);
  51. }
  52. } catch (Exception $ex) {
  53. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  54. \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
  55. }