change the detection of the webroot. it is simpler now and also works for app directories outside the owncloud folder. works for me and hopefully for everybody else too

This commit is contained in:
Frank Karlitschek 2012-02-28 18:21:23 +01:00
parent a829ce69c5
commit 0a9b0ee382
1 changed files with 20 additions and 18 deletions

View File

@ -159,7 +159,9 @@ class OC{
OC::$SUBURI=OC::$SUBURI.'index.php'; OC::$SUBURI=OC::$SUBURI.'index.php';
} }
} }
OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI)); // OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI));
// try a new way to detect the WEBROOT which is simpler and also works with the app directory outside the owncloud folder. let´s see if this works for everybody
OC::$WEBROOT=substr(OC::$SERVERROOT,strlen(OC::$DOCUMENTROOT));
if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){ if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){
@ -187,23 +189,23 @@ class OC{
exit; exit;
} }
// search the apps folder // search the apps folder
if(file_exists(OC::$SERVERROOT.'/apps')){ if(file_exists(OC::$SERVERROOT.'/apps')){
OC::$APPSROOT=OC::$SERVERROOT; OC::$APPSROOT=OC::$SERVERROOT;
OC::$APPSWEBROOT=OC::$WEBROOT; OC::$APPSWEBROOT=OC::$WEBROOT;
}elseif(file_exists(OC::$SERVERROOT.'/../apps')){ }elseif(file_exists(OC::$SERVERROOT.'/../apps')){
$url_tmp=explode('/',OC::$WEBROOT); $url_tmp=explode('/',OC::$WEBROOT);
$length=count($url_tmp); $length=count($url_tmp);
unset($url_tmp[$length-1]); unset($url_tmp[$length-1]);
OC::$APPSWEBROOT=implode('/',$url_tmp); OC::$APPSWEBROOT=implode('/',$url_tmp);
$root_tmp=explode('/',OC::$SERVERROOT); $root_tmp=explode('/',OC::$SERVERROOT);
$length=count($root_tmp); $length=count($root_tmp);
unset($root_tmp[$length-1]); unset($root_tmp[$length-1]);
OC::$APPSROOT=implode('/',$root_tmp); OC::$APPSROOT=implode('/',$root_tmp);
}else{ }else{
echo("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."); echo("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.");
exit; exit;
} }
// set the right include path // set the right include path
set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR.OC::$APPSROOT.PATH_SEPARATOR.OC::$APPSROOT.'/apps'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT); set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR.OC::$APPSROOT.PATH_SEPARATOR.OC::$APPSROOT.'/apps'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT);