From ad79cb7c93a655f864c633433e743b03685b5719 Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Sun, 6 Mar 2011 14:48:58 +0100
Subject: [PATCH] Adjust bin/indexer.php for the new indexer

Now the indexer is directly called instead of duplicating a large part
of the indexer code.
---
 bin/indexer.php | 32 +++-----------------------------
 1 file changed, 3 insertions(+), 29 deletions(-)

diff --git a/bin/indexer.php b/bin/indexer.php
index 85e990bbe..6ee0a9e8d 100755
--- a/bin/indexer.php
+++ b/bin/indexer.php
@@ -87,41 +87,15 @@ function _index($id){
     global $QUIET;
 
     // if not cleared only update changed and new files
-    if(!$CLEAR){
+    if($CLEAR){
         $idxtag = metaFN($id,'.indexed');
         if(@file_exists($idxtag)){
-            if(io_readFile($idxtag) == idx_get_version()){
-                $last = @filemtime($idxtag);
-                if($last > @filemtime(wikiFN($id))) return;
-            }
+            @unlink($idxtag);
         }
     }
 
     _quietecho("$id... ");
-    $body = '';
-    $data = array($id, $body);
-    $evt = new Doku_Event('INDEXER_PAGE_ADD', $data);
-    if ($evt->advise_before()) $data[1] = $data[1] . " " . rawWiki($id);
-    $evt->advise_after();
-    unset($evt);
-    list($id,$body) = $data;
-    $said = false;
-    while(true) {
-        $result = $INDEXER->addPageWords($id, $body);
-        if ($result == "locked") {
-            if($said){
-                _quietecho(".");
-            }else{
-                _quietecho("Waiting for lockfile (max. 5 min)");
-                $said = true;
-            }
-            sleep(15);
-        } else {
-            break;
-        }
-    }
-    if ($result)
-        io_saveFile(metaFN($id,'.indexed'), idx_get_version());
+    idx_addPage($id, !$QUIET);
     _quietecho("done.\n");
 }
 
-- 
GitLab