From 9684e36c28805329ea390fb5de544661dbae547d Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Wed, 7 Sep 2005 23:06:43 +0200 Subject: [PATCH] try faster rename before falling back to copy in indexer darcs-hash:20050907210643-7ad00-a5cd36dc8b48ca445af87e9f066c7a54a98a3658.gz --- inc/indexer.php | 8 ++++++-- 1 file 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; } /** -- GitLab