diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2014-07-29 22:07:12 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-07-30 14:03:31 +0200 |
commit | 31e7fdb9bff367b4e5ca7d6ca12787e536b0bc74 (patch) | |
tree | 9f2a23d031c8ccf1bb6f7fdc99a5eef2c4ec4a8d /lib/base.php | |
parent | 06d118d06c0def5a33aab64c6a2c20f79944b378 (diff) | |
download | nextcloud-server-31e7fdb9bff367b4e5ca7d6ca12787e536b0bc74.tar.gz nextcloud-server-31e7fdb9bff367b4e5ca7d6ca12787e536b0bc74.zip |
Fix silent crash if 3rdparty dir is not available
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/base.php b/lib/base.php index afa498e502e..56b2bec7f6c 100644 --- a/lib/base.php +++ b/lib/base.php @@ -132,20 +132,25 @@ class OC { } // search the 3rdparty folder - if (OC_Config::getValue('3rdpartyroot', '') <> '' and OC_Config::getValue('3rdpartyurl', '') <> '') { - OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', ''); - OC::$THIRDPARTYWEBROOT = OC_Config::getValue('3rdpartyurl', ''); - } elseif (file_exists(OC::$SERVERROOT . '/3rdparty')) { - OC::$THIRDPARTYROOT = OC::$SERVERROOT; - OC::$THIRDPARTYWEBROOT = OC::$WEBROOT; - } elseif (file_exists(OC::$SERVERROOT . '/../3rdparty')) { - OC::$THIRDPARTYWEBROOT = rtrim(dirname(OC::$WEBROOT), '/'); - OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/'); - } else { - throw new Exception('3rdparty directory not found! Please put the ownCloud 3rdparty' + OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', null); + OC::$THIRDPARTYWEBROOT = OC_Config::getValue('3rdpartyurl', null); + + if (is_null(OC::$THIRDPARTYROOT) && is_null(OC::$THIRDPARTYWEBROOT)) { + if (file_exists(OC::$SERVERROOT . '/3rdparty')) { + OC::$THIRDPARTYROOT = OC::$SERVERROOT; + OC::$THIRDPARTYWEBROOT = OC::$WEBROOT; + } elseif (file_exists(OC::$SERVERROOT . '/../3rdparty')) { + OC::$THIRDPARTYWEBROOT = rtrim(dirname(OC::$WEBROOT), '/'); + OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/'); + } + } + if (is_null(OC::$THIRDPARTYROOT) || !file_exists(OC::$THIRDPARTYROOT)) { + echo('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.'); + exit(); } + // search the apps folder $config_paths = OC_Config::getValue('apps_paths', array()); if (!empty($config_paths)) { |