status.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. require_once __DIR__ . '/lib/versioncheck.php';
  30. try {
  31. require_once __DIR__ . '/lib/base.php';
  32. $systemConfig = \OC::$server->getSystemConfig();
  33. $installed = (bool) $systemConfig->getValue('installed', false);
  34. $maintenance = (bool) $systemConfig->getValue('maintenance', false);
  35. # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
  36. # for description and defaults
  37. $defaults = new \OCP\Defaults();
  38. $values=array(
  39. 'installed'=>$installed,
  40. 'maintenance' => $maintenance,
  41. 'needsDbUpgrade' => \OCP\Util::needUpgrade(),
  42. 'version'=>implode('.', \OCP\Util::getVersion()),
  43. 'versionstring'=>OC_Util::getVersionString(),
  44. 'edition'=> '',
  45. 'productname'=>$defaults->getName());
  46. if (OC::$CLI) {
  47. print_r($values);
  48. } else {
  49. header('Access-Control-Allow-Origin: *');
  50. header('Content-Type: application/json');
  51. echo json_encode($values);
  52. }
  53. } catch (Exception $ex) {
  54. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  55. \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
  56. }