Fix silent crash if 3rdparty dir is not available

This commit is contained in:
Victor Dubiniuk 2014-07-29 22:07:12 +03:00 committed by Morris Jobke
parent 06d118d06c
commit 31e7fdb9bf
1 changed files with 16 additions and 11 deletions

View File

@ -132,20 +132,25 @@ class OC {
} }
// search the 3rdparty folder // search the 3rdparty folder
if (OC_Config::getValue('3rdpartyroot', '') <> '' and OC_Config::getValue('3rdpartyurl', '') <> '') { OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', null);
OC::$THIRDPARTYROOT = OC_Config::getValue('3rdpartyroot', ''); OC::$THIRDPARTYWEBROOT = OC_Config::getValue('3rdpartyurl', null);
OC::$THIRDPARTYWEBROOT = OC_Config::getValue('3rdpartyurl', '');
} elseif (file_exists(OC::$SERVERROOT . '/3rdparty')) { if (is_null(OC::$THIRDPARTYROOT) && is_null(OC::$THIRDPARTYWEBROOT)) {
if (file_exists(OC::$SERVERROOT . '/3rdparty')) {
OC::$THIRDPARTYROOT = OC::$SERVERROOT; OC::$THIRDPARTYROOT = OC::$SERVERROOT;
OC::$THIRDPARTYWEBROOT = OC::$WEBROOT; OC::$THIRDPARTYWEBROOT = OC::$WEBROOT;
} elseif (file_exists(OC::$SERVERROOT . '/../3rdparty')) { } elseif (file_exists(OC::$SERVERROOT . '/../3rdparty')) {
OC::$THIRDPARTYWEBROOT = rtrim(dirname(OC::$WEBROOT), '/'); OC::$THIRDPARTYWEBROOT = rtrim(dirname(OC::$WEBROOT), '/');
OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/'); OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/');
} else { }
throw new Exception('3rdparty directory not found! Please put the ownCloud 3rdparty' }
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.' . ' folder in the ownCloud folder or the folder above.'
. ' You can also configure the location in the config.php file.'); . ' You can also configure the location in the config.php file.');
exit();
} }
// search the apps folder // search the apps folder
$config_paths = OC_Config::getValue('apps_paths', array()); $config_paths = OC_Config::getValue('apps_paths', array());
if (!empty($config_paths)) { if (!empty($config_paths)) {