From c2a5b4983404685f2707ed7f31deae0088de12d7 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Fri, 12 Aug 2011 19:22:29 +0200 Subject: better error reporting during installation --- lib/config.php | 9 +++++++-- lib/crypt.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/config.php b/lib/config.php index 16e9ea441d5..dafb37edd33 100644 --- a/lib/config.php +++ b/lib/config.php @@ -177,8 +177,13 @@ class OC_Config{ $content .= ");\n?>\n"; // Write the file - file_put_contents( "$SERVERROOT/config/config.php", $content ); - + $result=@file_put_contents( "$SERVERROOT/config/config.php", $content ); + if(!$result) { + $tmpl = new OC_Template( '', 'error', 'guest' ); + $tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by setting the owner of 'config' to the user that the web server uses (".exec('whoami').")"))); + $tmpl->printPage(); + exit; + } return true; } } diff --git a/lib/crypt.php b/lib/crypt.php index 83e6ac4cde0..de1f6c73387 100755 --- a/lib/crypt.php +++ b/lib/crypt.php @@ -61,7 +61,7 @@ class OC_Crypt { // Write the file $username=OC_USER::getUser(); - file_put_contents(OC_Config::getValue( "datadirectory").'/'.$username.'/encryption.key', $enckey ); + @file_put_contents(OC_Config::getValue( "datadirectory").'/'.$username.'/encryption.key', $enckey ); } } -- cgit v1.2.3