CVS update: /cowiki/htdocs/setup/class/task/

[email protected] 16 May 2005 22:17:56 -0000
Newsgroups gmane.comp.php.cowiki.cvs
Message-ID <[email protected]>
User: dgorski 
Date: 2005/05/16 15:17:56

Modified:
   cowiki/htdocs/setup/class/task/class.TaskFilePermissionChecker.php

Log:
 Added canRead()

File Changes:

Directory: /cowiki/htdocs/setup/class/task/
===========================================

File [changed]: class.TaskFilePermissionChecker.php
Url: http://cowiki.tigris.org/source/browse/cowiki/htdocs/setup/class/task/class.TaskFilePermissionChecker.php?r1=1.2&r2=1.3
Delta lines:  +20 -6
--------------------
--- class.TaskFilePermissionChecker.php	29 Apr 2005 22:44:01 -0000	1.2
+++ class.TaskFilePermissionChecker.php	16 May 2005 22:17:54 -0000	1.3
@@ -2,7 +2,7 @@
 
 /**
  *
- * $Id: class.TaskFilePermissionChecker.php,v 1.2 2005/04/29 22:44:01 dgorski Exp $
+ * $Id: class.TaskFilePermissionChecker.php,v 1.3 2005/05/16 22:17:54 dgorski Exp $
  *
  * This file is part of coWiki. coWiki is free software under the terms of
  * the GNU General Public License (GPL). Read the LICENSE file. If you did
@@ -17,7 +17,7 @@
  * @author      Daniel T. Gorski, <[email protected]>
  * @copyright   (C) Daniel T. Gorski, {@link http://www.develnet.org}
  * @license     http://www.gnu.org/licenses/gpl.html
- * @version     $Revision: 1.2 $
+ * @version     $Revision: 1.3 $
  *
  */
 
@@ -137,21 +137,26 @@
             }
         }
 
+/* Can't check this, as this not available in an initial setup and _may_
+   be not available during an update. This check should be removed. Rethink.
+
         if (!$this->canReadWrite($sHtDocs . '/recent.rdf')) {
             $aArr[] = $sHtDocs . '/recent.rdf';
         }
-
+*/
         // ---
 
         if (!$this->canReadWrite($sIncludes)) {
             $aArr[] = $sIncludes;
         }
 
+        if ($this->State->isUpdateSetup()) {
         if (!$this->canReadWrite($sIncludes . '/core.conf')) {
             $aArr[] = $sIncludes . '/core.conf';
         }
+        }
 
-        if (!$this->canReadWrite($sIncludes . '/core.conf-dist')) {
+        if (!$this->canRead($sIncludes . '/core.conf-dist')) {
             $aArr[] = $sIncludes . '/core.conf-dist';
         }
 
@@ -163,6 +168,15 @@
     private function canReadWrite($sFile) {
         if (file_exists($sFile)) {
             return @is_readable($sFile) && @is_writable($sFile);
+        }
+        return false;
+    }
+
+    // --------------------------------------------------------------------
+
+    private function canRead($sFile) {
+        if (file_exists($sFile)) {
+            return @is_readable($sFile);
         }
         return false;
     }