summaryrefslogtreecommitdiffstats
path: root/lib/util.php
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-08-07 15:56:26 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-08-07 15:56:26 -0400
commit1aa89b7cbb051875ffa577a6a89e9cf9bb6eafee (patch)
treeb4923b27fc550d37eeb609db02ef6d20a508ab30 /lib/util.php
parent5d521d7c7c8f8e796a3ddc81e1e4430238ba5451 (diff)
parent3e8ae8636cad91877c727c7b1ea77436816e7c3d (diff)
downloadnextcloud-server-1aa89b7cbb051875ffa577a6a89e9cf9bb6eafee.tar.gz
nextcloud-server-1aa89b7cbb051875ffa577a6a89e9cf9bb6eafee.zip
Merge branch 'master' into sharing
Conflicts: files/css/files.css lib/base.php
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/util.php b/lib/util.php
index 3e2e4fa34e4..10cd320977a 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -25,7 +25,13 @@ class OC_Util {
// Create root dir
if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){
- @mkdir($CONFIG_DATADIRECTORY_ROOT) or die("Can't create data directory ($CONFIG_DATADIRECTORY_ROOT), you can usually fix this by setting the owner of '$SERVERROOT' to the user that the web server uses (www-data for debian/ubuntu)");
+ $success=@mkdir($CONFIG_DATADIRECTORY_ROOT);
+ if(!$success) {
+ $tmpl = new OC_Template( '', 'error', 'guest' );
+ $tmpl->assign('errors',array(1=>array('error'=>"Can't create data directory ($CONFIG_DATADIRECTORY_ROOT)",'hint'=>"You can usually fix this by setting the owner of '$SERVERROOT' to the user that the web server uses (".exec('whoami').")")));
+ $tmpl->printPage();
+ exit;
+ }
}
// If we are not forced to load a specific user we load the one that is logged in
@@ -214,21 +220,21 @@ class OC_Util {
//check for correct file permissions
if(!stristr(PHP_OS, 'WIN')){
- $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
+ $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
if(substr($prems,-1)!='0'){
OC_Helper::chmodr($CONFIG_DATADIRECTORY_ROOT,0770);
clearstatcache();
- $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
+ $prems=substr(decoct(@fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
if(substr($prems,2,1)!='0'){
$errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web<br/>','hint'=>$permissionsHint);
}
}
if( OC_Config::getValue( "enablebackup", false )){
- $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3);
+ $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3);
if(substr($prems,-1)!='0'){
OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY,0770);
clearstatcache();
- $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3);
+ $prems=substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)),-3);
if(substr($prems,2,1)!='0'){
$errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web<br/>','hint'=>$permissionsHint);
}