From 308f419bfa12824338ce98b6adcbc58bfef15581 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 05 Mar 2008 09:14:40 -0500
Subject: [PATCH] Remove test for sockets + check if temp and log dirs are writeable

---
 installer/check.php    |    4 ++--
 installer/test.php     |   29 ++++++++++++++++++++++++++++-
 installer/welcome.html |    1 -
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/installer/check.php b/installer/check.php
index 8352364..b795fa9 100644
--- a/installer/check.php
+++ b/installer/check.php
@@ -1,7 +1,7 @@
 <form action="index.php" method="get">
 <?php
 
-$required_php_exts = array('PCRE' => 'pcre', 'Session' => 'session', 'Sockets' => 'sockets');
+$required_php_exts = array('PCRE' => 'pcre', 'Session' => 'session');
 
 $optional_php_exts = array('FileInfo' => 'fileinfo', 'Libiconv' => 'iconv',
     'Multibyte' => 'mbstring', 'OpenSSL' => 'openssl', 'Mcrypt' => 'mcrypt', 'GD' => 'gd');
@@ -65,7 +65,7 @@
 
 ?>
 
-<p class="hint">These extensions are <em>optional</em> but recommended to get the best performance:</p>
+<p class="hint">The next couple of extensions are <em>optional</em> but recommended to get the best performance:</p>
 <?php
 
 foreach ($optional_php_exts AS $name => $ext) {
diff --git a/installer/test.php b/installer/test.php
index 7e99039..9b7435d 100644
--- a/installer/test.php
+++ b/installer/test.php
@@ -31,11 +31,38 @@
 
 ?>
 
+<h3>Check if directories are writable</h3>
+<p>RoundCube may need to write/save files into these directories</p>
+<?php
+
+if ($RCI->configured) {
+    $pass = false;
+    foreach (array($RCI->config['temp_dir'],$RCI->config['log_dir']) as $dir) {
+        $dirpath = $dir{0} == '/' ? $dir : $docroot . '/' . $dir;
+        if (is_writable(realpath($dirpath))) {
+            $RCI->pass($dir);
+            $pass = true;
+        }
+        else {
+            $RCI->fail($dir, 'not writeable for the webserver');
+        }
+        echo '<br />';
+    }
+    
+    if (!$pass)
+        echo '<p class="hint">Use <tt>chmod</tt> or <tt>chown</tt> to grant write privileges to the webserver</p>';
+}
+else {
+    $RCI->fail('Config', 'Could not read config files');
+}
+
+?>
+
 <h3>Check configured database settings</h3>
 <?php
 
 $db_working = false;
-if (!empty($RCI->config)) {
+if ($RCI->configured) {
     if (!empty($RCI->config['db_backend']) && !empty($RCI->config['db_dsnw'])) {
 
         echo 'Backend: ';
diff --git a/installer/welcome.html b/installer/welcome.html
index a0c88e5..200f680 100644
--- a/installer/welcome.html
+++ b/installer/welcome.html
@@ -10,7 +10,6 @@
     <ul>
       <li>PCRE (perl compatible regular expression)</li>
       <li>Session support</li>
-      <li>Sockets enabled</li>
       <li>Libiconv (recommended)</li>
       <li>OpenSSL (recommended)</li>
       <li>FileInfo (optional)</li>

--
Gitblit v1.9.1