status.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. $values=array(
  35. 'installed'=>$installed,
  36. 'maintenance' => $maintenance,
  37. 'version'=>implode('.', \OCP\Util::getVersion()),
  38. 'versionstring'=>OC_Util::getVersionString(),
  39. 'edition'=> $installed ? OC_Util::getEditionString() : '');
  40. if (OC::$CLI) {
  41. print_r($values);
  42. } else {
  43. header('Access-Control-Allow-Origin: *');
  44. header('Content-Type: application/json');
  45. echo json_encode($values);
  46. }
  47. } catch (Exception $ex) {
  48. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  49. \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
  50. }