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
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)) {