Remove OC::$CONFIG_DATADIRECTORY, not used

This commit is contained in:
Bart Visscher 2012-06-19 22:50:28 +02:00
parent d8b32c2f0e
commit f54ef5a464
3 changed files with 18 additions and 33 deletions

View file

@ -42,10 +42,6 @@ class OC{
* the owncloud root path for http requests (e.g. owncloud/)
*/
public static $WEBROOT = '';
/**
* the folder that stores that data files for the filesystem of the user (e.g. /srv/http/owncloud/data/myusername/files)
*/
public static $CONFIG_DATADIRECTORY = '';
/**
* The installation path of the 3rdparty folder on the server (e.g. /srv/http/owncloud/3rdparty)
*/
@ -349,19 +345,11 @@ class OC{
exit;
}
// TODO: we should get rid of this one, too
// WARNING: to make everything even more confusing,
// DATADIRECTORY is a var that changes and DATADIRECTORY_ROOT
// stays the same, but is set by "datadirectory".
// Any questions?
OC::$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
// User and Groups
if( !OC_Config::getValue( "installed", false )){
$_SESSION['user_id'] = '';
}
OC_User::useBackend( OC_Config::getValue( "userbackend", "database" ));
OC_Group::useBackend(new OC_Group_Database());

View file

@ -30,12 +30,9 @@ class OC_Files {
/**
* get the content of a directory
* @param dir $directory
* @param dir $directory path under datadirectory
*/
public static function getDirectoryContent($directory, $mimetype_filter = ''){
if(strpos($directory,OC::$CONFIG_DATADIRECTORY)===0){
$directory=substr($directory,strlen(OC::$CONFIG_DATADIRECTORY));
}
$files=OC_FileCache::getFolderContent($directory, false, $mimetype_filter);
foreach($files as &$file){
$file['directory']=$directory;

View file

@ -24,16 +24,16 @@ class OC_Util {
$user = OC_User::getUser();
}
$CONFIG_DATADIRECTORY_ROOT = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
//first set up the local "root" storage
if(!self::$rootMounted){
OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$CONFIG_DATADIRECTORY_ROOT),'/');
OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$CONFIG_DATADIRECTORY),'/');
self::$rootMounted=true;
}
if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem
OC::$CONFIG_DATADIRECTORY = $CONFIG_DATADIRECTORY_ROOT."/$user/$root";
if( !is_dir( OC::$CONFIG_DATADIRECTORY )){
mkdir( OC::$CONFIG_DATADIRECTORY, 0755, true );
$userdirectory = $CONFIG_DATADIRECTORY."/$user/$root";
if( !is_dir( $userdirectory )){
mkdir( $userdirectory, 0755, true );
}
//jail the user into his "home" directory
@ -42,8 +42,8 @@ class OC_Util {
OC_FileProxy::register($quotaProxy);
self::$fsSetup=true;
// Load personal mount config
if (is_file($CONFIG_DATADIRECTORY_ROOT.'/'.$user.'/mount.php')) {
$mountConfig = include($CONFIG_DATADIRECTORY_ROOT.'/'.$user.'/mount.php');
if (is_file($CONFIG_DATADIRECTORY.'/'.$user.'/mount.php')) {
$mountConfig = include($CONFIG_DATADIRECTORY.'/'.$user.'/mount.php');
if (isset($mountConfig['user'][$user])) {
foreach ($mountConfig['user'][$user] as $mountPoint => $options) {
OC_Filesystem::mount($options['class'], $options['options'], $mountPoint);
@ -202,17 +202,17 @@ class OC_Util {
$errors[]=array('error'=>"Can't write into apps directory 'apps'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
}
$CONFIG_DATADIRECTORY_ROOT = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
//check for correct file permissions
if(!stristr(PHP_OS, 'WIN')){
$permissionsModHint="Please change the permissions to 0770 so that the directory cannot be listed by other users.";
$prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
$prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)),-3);
if(substr($prems,-1)!='0'){
OC_Helper::chmodr($CONFIG_DATADIRECTORY_ROOT,0770);
OC_Helper::chmodr($CONFIG_DATADIRECTORY,0770);
clearstatcache();
$prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
$prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY)),-3);
if(substr($prems,2,1)!='0'){
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable for other users<br/>','hint'=>$permissionsModHint);
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') is readable for other users<br/>','hint'=>$permissionsModHint);
}
}
if( OC_Config::getValue( "enablebackup", false )){
@ -231,13 +231,13 @@ class OC_Util {
//TODO: permissions checks for windows hosts
}
// Create root dir.
if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){
$success=@mkdir($CONFIG_DATADIRECTORY_ROOT);
if(!is_dir($CONFIG_DATADIRECTORY)){
$success=@mkdir($CONFIG_DATADIRECTORY);
if(!$success) {
$errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY_ROOT.")",'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
$errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY.")",'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
}
} else if(!is_writable($CONFIG_DATADIRECTORY_ROOT)){
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') not writable by ownCloud<br/>','hint'=>$permissionsHint);
} else if(!is_writable($CONFIG_DATADIRECTORY)){
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY.') not writable by ownCloud<br/>','hint'=>$permissionsHint);
}
// check if all required php modules are present