diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-08 00:19:23 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-08 00:19:23 +0200 |
commit | f099c9883e4f1073564cb2ffaa00472f3ed6d8ae (patch) | |
tree | 04d418920c044f7639b11dfa96920d149a2978f5 /lib/base.php | |
parent | 6c327f8331617652ef0b268d51edc6a23624e33c (diff) | |
download | nextcloud-server-f099c9883e4f1073564cb2ffaa00472f3ed6d8ae.tar.gz nextcloud-server-f099c9883e4f1073564cb2ffaa00472f3ed6d8ae.zip |
Adding check command to validate server environment - fixes #15429
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/lib/base.php b/lib/base.php index be397e52449..042419eff1d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -588,35 +588,36 @@ class OC { ini_set('session.cookie_secure', true); } - $errors = OC_Util::checkServer(\OC::$server->getConfig()); - if (count($errors) > 0) { - if (self::$CLI) { - // Convert l10n string into regular string for usage in database - $staticErrors = []; - foreach ($errors as $error) { - echo $error['error'] . "\n"; - echo $error['hint'] . "\n\n"; - $staticErrors[] = [ - 'error' => (string) $error['error'], - 'hint' => (string) $error['hint'], - ]; - } + if (!defined('OC_CONSOLE')) { + $errors = OC_Util::checkServer(\OC::$server->getConfig()); + if (count($errors) > 0) { + if (self::$CLI) { + // Convert l10n string into regular string for usage in database + $staticErrors = []; + foreach ($errors as $error) { + echo $error['error'] . "\n"; + echo $error['hint'] . "\n\n"; + $staticErrors[] = [ + 'error' => (string)$error['error'], + 'hint' => (string)$error['hint'], + ]; + } - try { - \OC::$server->getConfig()->setAppValue('core', 'cronErrors', json_encode($staticErrors)); - } catch(\Exception $e) { - echo('Writing to database failed'); + try { + \OC::$server->getConfig()->setAppValue('core', 'cronErrors', json_encode($staticErrors)); + } catch (\Exception $e) { + echo('Writing to database failed'); + } + exit(1); + } else { + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); + OC_Template::printGuestPage('', 'error', array('errors' => $errors)); + exit; } - exit(1); - } else { - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); - OC_Template::printGuestPage('', 'error', array('errors' => $errors)); - exit; - } - } elseif(self::$CLI && \OC::$server->getConfig()->getSystemValue('installed', false)) { + } elseif (self::$CLI && \OC::$server->getConfig()->getSystemValue('installed', false)) { \OC::$server->getConfig()->deleteAppValue('core', 'cronErrors'); + } } - //try to set the session lifetime $sessionLifeTime = self::getSessionLifeTime(); @ini_set('gc_maxlifetime', (string)$sessionLifeTime); |