summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php40
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php
index 8f169a5732f..a95c9d2b21a 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -54,6 +54,14 @@ class OC{
* the folder that stores the data for the root filesystem (e.g. /srv/http/owncloud/data)
*/
public static $CONFIG_DATADIRECTORY_ROOT = '';
+ /**
+ * The installation path of the 3rdparty folder on the server (e.g. /srv/http/owncloud/3rdparty)
+ */
+ public static $THIRDPARTYROOT = '';
+ /**
+ * the root path of the 3rdparty folder for http requests (e.g. owncloud/3rdparty)
+ */
+ public static $THIRDPARTYWEBROOT = '';
/**
* SPL autoload
@@ -138,12 +146,35 @@ class OC{
}
OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI));
+
if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){
OC::$WEBROOT='/'.OC::$WEBROOT;
}
+ // 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')){
+ $url_tmp=explode('/',OC::$WEBROOT);
+ $length=count($url_tmp);
+ unset($url_tmp[$length-1]);
+ OC::$THIRDPARTYWEBROOT=implode('/',$url_tmp);
+ $root_tmp=explode('/',OC::$SERVERROOT);
+ $length=count($root_tmp);
+ unset($root_tmp[$length-1]);
+ OC::$THIRDPARTYROOT=implode('/',$root_tmp);
+ }else{
+ 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;
+ }
+
+
// set the right include path
- set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$SERVERROOT.'/3rdparty'.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.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT);
// Redirect to installer if not installed
if (!OC_Config::getValue('installed', false) && OC::$SUBURI != '/index.php') {
@@ -171,6 +202,13 @@ class OC{
echo 'Error while upgrading the database';
die();
}
+ if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")) {
+ $tmpl = new OC_Template( '', 'error', 'guest' );
+ $tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
+ $tmpl->printPage();
+ exit;
+ }
+
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
}