From cd1ffd912b092179c2cb5a6507e1894477f3c907 Mon Sep 17 00:00:00 2001
From: Robin <Robin Appelman icewind1991@gmail.com>
Date: Sun, 23 May 2010 00:18:37 +0200
Subject: [PATCH] only check for a writeable config.php when attempting to
 change the config

---
 inc/lib_base.php            | 4 +---
 inc/templates/adminform.php | 3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/inc/lib_base.php b/inc/lib_base.php
index 3a8ad7163f..14b9aa10af 100755
--- a/inc/lib_base.php
+++ b/inc/lib_base.php
@@ -151,10 +151,8 @@ class OC_UTIL {
     global $CONFIG_DATADIRECTORY_ROOT;
     global $CONFIG_BACKUPDIRECTORY;
     global $CONFIG_ENABLEBACKUP;
+    global $CONFIG_INSTALLED;
     $error='';
-    $f=@fopen($SERVERROOT.'/config/config.php','w+');
-    if(!$f) $error.='Error: Config file (config/config.php) is not writable for the webserver.<br/>';
-    @fclose($f);
     if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){
 		$error.='No database drivers (sqlite or mysql) installed.<br/>';
     }
diff --git a/inc/templates/adminform.php b/inc/templates/adminform.php
index 5ef5fa68cb..ef45bd9ee2 100755
--- a/inc/templates/adminform.php
+++ b/inc/templates/adminform.php
@@ -4,6 +4,9 @@ global $CONFIG_ENABLEBACKUP;
 global $CONFIG_DATADIRECTORY_ROOT;
 global $CONFIG_BACKUPDIRECTORY;
 global $CONFIG_ERROR;
+$f=@fopen($SERVERROOT.'/config/config.php','r+');
+if(!$f) die('Error: Config file (config/config.php) is not writable for the webserver.<br/>');
+@fclose($f);
 if(!isset($fillDB)) $fillDB=true;
 if(!isset($CONFIG_DBHOST)) $CONFIG_DBHOST='localhost';
 if(!isset($CONFIG_DBUSER)) $CONFIG_DBUSER='owncloud';
-- 
GitLab