diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-20 11:36:02 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-20 11:36:02 +0100 |
commit | a87cc90d1e7380a58bc4a60bd4cc1894ec41c33b (patch) | |
tree | c1bc3e439f7c407ed001d260a1bbb825a2c8c6f3 /lib | |
parent | cce303ff5ca830990e8565f81a4c12dd053adf03 (diff) | |
parent | 4a13a84cab8d775386fbc26534b009aa42ee79f9 (diff) | |
download | nextcloud-server-a87cc90d1e7380a58bc4a60bd4cc1894ec41c33b.tar.gz nextcloud-server-a87cc90d1e7380a58bc4a60bd4cc1894ec41c33b.zip |
Merge pull request #14993 from owncloud/stop-on-missing-deps
Stop executing, when 3rdparty is missing or apps directory is invalid
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/lib/base.php b/lib/base.php index 107ae059bb1..00117918c87 100644 --- a/lib/base.php +++ b/lib/base.php @@ -80,6 +80,10 @@ class OC { */ public static $server = null; + /** + * @throws \RuntimeException when the 3rdparty directory is missing or + * the app path list is empty or contains an invalid path + */ public static function initPaths() { // calculate the root directories OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4)); @@ -155,10 +159,9 @@ class OC { } } if (empty(OC::$THIRDPARTYROOT) || !file_exists(OC::$THIRDPARTYROOT)) { - echo('3rdparty directory not found! Please put the ownCloud 3rdparty' + throw new \RuntimeException('3rdparty directory not found! Please put the ownCloud 3rdparty' . ' folder in the ownCloud folder or the folder above.' . ' You can also configure the location in the config.php file.'); - return; } // search the apps folder @@ -182,12 +185,17 @@ class OC { } if (empty(OC::$APPSROOTS)) { - throw new Exception('apps directory not found! Please put the ownCloud apps folder in the ownCloud folder' + throw new \RuntimeException('apps directory not found! Please put the ownCloud apps folder in the ownCloud folder' . ' or the folder above. You can also configure the location in the config.php file.'); } $paths = array(); foreach (OC::$APPSROOTS as $path) { $paths[] = $path['path']; + if (!is_dir($path['path'])) { + throw new \RuntimeException(sprintf('App directory "%s" not found! Please put the ownCloud apps folder in the' + . ' ownCloud folder or the folder above. You can also configure the location in the' + . ' config.php file.', $path['path'])); + } } // set the right include path @@ -465,17 +473,20 @@ class OC { self::$CLI = (php_sapi_name() == 'cli'); - self::initPaths(); - - // setup 3rdparty autoloader - $vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php'; - if (file_exists($vendorAutoLoad)) { + try { + self::initPaths(); + // setup 3rdparty autoloader + $vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php'; + if (!file_exists($vendorAutoLoad)) { + throw new \RuntimeException('Composer autoloader not found, unable to continue. Check the folder "3rdparty".'); + } require_once $vendorAutoLoad; - } else { + + } catch (\RuntimeException $e) { OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); // we can't use the template error page here, because this needs the // DI container which isn't available yet - print('Composer autoloader not found, unable to continue. Check the folder "3rdparty".'); + print($e->getMessage()); exit(); } |