summaryrefslogtreecommitdiff
path: root/inc/indexer.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-09-07 23:06:43 +0200
committerAndreas Gohr <andi@splitbrain.org>2005-09-07 23:06:43 +0200
commit9684e36c28805329ea390fb5de544661dbae547d (patch)
tree13a744ceadd7bfc23b713f7baa55582bcbbebd93 /inc/indexer.php
parentd7c3763d432de58f39ae826bbcf80f5e8667171f (diff)
downloadrpg-9684e36c28805329ea390fb5de544661dbae547d.tar.gz
rpg-9684e36c28805329ea390fb5de544661dbae547d.tar.bz2
try faster rename before falling back to copy in indexer
darcs-hash:20050907210643-7ad00-a5cd36dc8b48ca445af87e9f066c7a54a98a3658.gz
Diffstat (limited to 'inc/indexer.php')
-rw-r--r--inc/indexer.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/inc/indexer.php b/inc/indexer.php
index e3af1fd4a..ce58f47a7 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -148,12 +148,16 @@ function idx_addPage($page){
// close the temp file and move it over to be the new one
fclose($tmp);
- if(copy($conf['cachedir'].'/index.tmp',
+ // try rename first (fast) fallback to copy (slow)
+ if(@rename($conf['cachedir'].'/index.tmp',
+ $conf['cachedir'].'/index.idx')){
+ return true;
+ }elseif(copy($conf['cachedir'].'/index.tmp',
$conf['cachedir'].'/index.idx')){
unlink($conf['cachedir'].'/index.tmp');
return true;
}
- else{return false;}
+ return false;
}
/**