From fcf93a349f298e30c928160a8766ce1b45702965 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sat, 3 Mar 2007 20:28:36 +0100
Subject: [PATCH] improved writability check for sitemap FS#1093

darcs-hash:20070303192836-7ad00-fe821c42ba7541f58ab52b9d8d11b3241bc90b65.gz
---
 lib/exe/indexer.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index da79db0e0..04e46a6c8 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -246,7 +246,12 @@ function runSitemapper(){
     }
     print "runSitemapper(): using $sitemap".NL;
 
-    if(!is_writable(DOKU_INC.$sitemap)) return false;
+    if(@file_exists(DOKU_INC.$sitemap)){
+        if(!is_writable(DOKU_INC.$sitemap)) return false;
+    }else{
+        if(!is_writable(DOKU_INC)) return false;
+    }
+
     if(@filesize(DOKU_INC.$sitemap) && 
        @filemtime(DOKU_INC.$sitemap) > (time()-($conf['sitemap']*60*60*24))){
        print 'runSitemapper(): Sitemap up to date'.NL;
-- 
GitLab