]> source.dussan.org Git - nextcloud-server.git/commitdiff
nicer error report and streamlined setup
authorFrank Karlitschek <karlitschek@kde.org>
Sat, 6 Aug 2011 21:19:00 +0000 (23:19 +0200)
committerFrank Karlitschek <karlitschek@kde.org>
Sat, 6 Aug 2011 21:19:00 +0000 (23:19 +0200)
lib/base.php
lib/util.php

index e9451c45b6162cc22f714b350e4dc2f891485137..520c12d4df11ad04a5110155ff41b32288772aaa 100644 (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 )){
index d9c749521ea4dcfcc27f344c144ea97f6b2f03aa..e07400fc1fdc4fa650c6c1caaffd41f9e7f97037 100644 (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);
                                        }