status.php 1.8 KB

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