summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrank Karlitschek <karlitschek@kde.org>2011-08-06 23:19:00 +0200
committerFrank Karlitschek <karlitschek@kde.org>2011-08-06 23:19:00 +0200
commitb513a6054036455605d96f1d1827e156b2127ce3 (patch)
tree0fcc89bdfa9288ca2e71cbc9feff0bce09cde69d /lib
parentd9ccbe96dda717712d67274c777a0e614743784f (diff)
downloadnextcloud-server-b513a6054036455605d96f1d1827e156b2127ce3.tar.gz
nextcloud-server-b513a6054036455605d96f1d1827e156b2127ce3.zip
nicer error report and streamlined setup
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php12
-rw-r--r--lib/util.php16
2 files changed, 22 insertions, 6 deletions
diff --git a/lib/base.php b/lib/base.php
index e9451c45b61..520c12d4df1 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -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 )){
diff --git a/lib/util.php b/lib/util.php
index d9c749521ea..e07400fc1fd 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 (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);
}