diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-01-18 18:10:37 +0100 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-01-18 18:10:37 +0100 |
commit | f2d78424f2453974d40942c7c9cd5b295a70c644 (patch) | |
tree | cd8671f5413207fb7ce10231343d8da8b492ea8d /inc | |
parent | 9e75e34184b38791c75245d6061cdf25e362149f (diff) | |
download | nextcloud-server-f2d78424f2453974d40942c7c9cd5b295a70c644.tar.gz nextcloud-server-f2d78424f2453974d40942c7c9cd5b295a70c644.zip |
don't try to use *nix file premissions on windows hosts
Diffstat (limited to 'inc')
-rw-r--r-- | inc/lib_base.php | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/inc/lib_base.php b/inc/lib_base.php index b8c639b2446..c2ddd48bd6f 100644 --- a/inc/lib_base.php +++ b/inc/lib_base.php @@ -204,56 +204,60 @@ class OC_UTIL { * */ public static function checkServer(){ - global $SERVERROOT; - global $CONFIG_DATADIRECTORY_ROOT; - global $CONFIG_BACKUPDIRECTORY; - global $CONFIG_ENABLEBACKUP; - global $CONFIG_INSTALLED; - $error=''; - if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ + global $SERVERROOT; + global $CONFIG_DATADIRECTORY_ROOT; + global $CONFIG_BACKUPDIRECTORY; + global $CONFIG_ENABLEBACKUP; + global $CONFIG_INSTALLED; + $error=''; + if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ $error.='No database drivers (sqlite or mysql) installed.<br/>'; - } - global $CONFIG_DBTYPE; - global $CONFIG_DBNAME; - if($CONFIG_DBTYPE=='sqlite'){ - $file=$SERVERROOT.'/'.$CONFIG_DBNAME; - if(file_exists($file)){ - $prems=substr(decoct(fileperms($file)),-3); - if(substr($prems,2,1)!='0'){ - @chmod($file,0660); - clearstatcache(); + } + global $CONFIG_DBTYPE; + global $CONFIG_DBNAME; + echo PHP_OS; + if(!stristr(PHP_OS, 'WIN')){ + if($CONFIG_DBTYPE=='sqlite'){ + $file=$SERVERROOT.'/'.$CONFIG_DBNAME; + if(file_exists($file)){ $prems=substr(decoct(fileperms($file)),-3); if(substr($prems,2,1)!='0'){ - $error.='SQLite database file ('.$file.') is readable from the web<br/>'; + @chmod($file,0660); + clearstatcache(); + $prems=substr(decoct(fileperms($file)),-3); + if(substr($prems,2,1)!='0'){ + $error.='SQLite database file ('.$file.') is readable from the web<br/>'; + } } } } - } - $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); - if(substr($prems,-1)!='0'){ - chmodr($CONFIG_DATADIRECTORY_ROOT,0770); - clearstatcache(); $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); - if(substr($prems,2,1)!='0'){ - $error.='Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web<br/>'; - } - } - if($CONFIG_ENABLEBACKUP){ - $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); if(substr($prems,-1)!='0'){ - chmodr($CONFIG_BACKUPDIRECTORY,0770); + chmodr($CONFIG_DATADIRECTORY_ROOT,0770); clearstatcache(); - $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); if(substr($prems,2,1)!='0'){ - $error.='Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web<br/>'; + $error.='Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web<br/>'; } } + if($CONFIG_ENABLEBACKUP){ + $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + if(substr($prems,-1)!='0'){ + chmodr($CONFIG_BACKUPDIRECTORY,0770); + clearstatcache(); + $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + if(substr($prems,2,1)!='0'){ + $error.='Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web<br/>'; + } + } + } + }else{ + //TODO: premisions checks for windows hosts } if($error){ die($error); } - - } +} /** * show the header of the web GUI |