status.php 1.8 KB

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