nicer error report and streamlined setup

This commit is contained in:
Frank Karlitschek 2011-08-06 23:19:00 +02:00
parent d9ccbe96dd
commit b513a60540
2 changed files with 22 additions and 6 deletions

View File

@ -125,7 +125,17 @@ if( OC_Config::getValue( "forcessl", false )){
}
}
$error=(count(OC_Util::checkServer())>0);
$errors=OC_Util::checkServer();
$error=(count($errors)>0);
if($error) {
$tmpl = new OC_Template( '', 'error', 'guest' );
$tmpl->assign('errors',$errors);
$tmpl->printPage();
exit;
}
// User and Groups
if( !OC_Config::getValue( "installed", false )){

View File

@ -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 (www-data for debian/ubuntu)")));
$tmpl->printPage();
exit;
}
}
// If we are not forced to load a specific user we load the one that is logged in
@ -210,21 +216,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);
}