diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-07-30 18:34:55 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-07-30 18:34:55 +0200 |
commit | 521934ee0d72831fc38b8a8179fd709ec341aea8 (patch) | |
tree | f3ab0ba43bb56762c2c80d0bb515b1d29fe8cb2d /lib | |
parent | 84ea393393c64b51bc162209f740b1146a1076d5 (diff) | |
parent | eb9bd200fac70cd49f650d18a7190be7969955bf (diff) | |
download | nextcloud-server-521934ee0d72831fc38b8a8179fd709ec341aea8.tar.gz nextcloud-server-521934ee0d72831fc38b8a8179fd709ec341aea8.zip |
Merge pull request #10029 from owncloud/fix-thirdparty
Fix silent crash if 3rdparty dir is not available
Diffstat (limited to 'lib')
-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 6751f897dfc..a6f6f6f71d7 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.'); + return; } + // search the apps folder $config_paths = OC_Config::getValue('apps_paths', array()); if (!empty($config_paths)) { |