status.php 1.7 KB

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