status.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 '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. 'version'=>implode('.', \OCP\Util::getVersion()),
  41. 'versionstring'=>OC_Util::getVersionString(),
  42. 'edition'=> '',
  43. 'productname'=>$defaults->getName());
  44. if (OC::$CLI) {
  45. print_r($values);
  46. } else {
  47. header('Access-Control-Allow-Origin: *');
  48. header('Content-Type: application/json');
  49. echo json_encode($values);
  50. }
  51. } catch (Exception $ex) {
  52. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  53. \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
  54. }