diff --git a/bin/indexer.php b/bin/indexer.php index 6ee0a9e8d946244c6b798d4fb58de01511e76c5d..4bfd1682e50b748448fd6c84156908174210b325 100755 --- a/bin/indexer.php +++ b/bin/indexer.php @@ -86,16 +86,8 @@ function _index($id){ global $CLEAR; global $QUIET; - // if not cleared only update changed and new files - if($CLEAR){ - $idxtag = metaFN($id,'.indexed'); - if(@file_exists($idxtag)){ - @unlink($idxtag); - } - } - _quietecho("$id... "); - idx_addPage($id, !$QUIET); + idx_addPage($id, !$QUIET, $CLEAR); _quietecho("done.\n"); } diff --git a/inc/indexer.php b/inc/indexer.php index 03008cd7149f52cff2f4eed3ee96d5a9f0cb7dd3..107845e24d9396790b0f4ff313419ac93ddca83c 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -1166,13 +1166,14 @@ function & idx_get_stopwords() { * * @param string $page name of the page to index * @param boolean $verbose print status messages + * @param boolean $force force reindexing even when the index is up to date * @return boolean the function completed successfully * @author Tom N Harris <tnharris@whoopdedo.org> */ -function idx_addPage($page, $verbose=false) { +function idx_addPage($page, $verbose=false, $force=false) { // check if indexing needed $idxtag = metaFN($page,'.indexed'); - if(@file_exists($idxtag)){ + if(!$force && @file_exists($idxtag)){ if(trim(io_readFile($idxtag)) == idx_get_version()){ $last = @filemtime($idxtag); if($last > @filemtime(wikiFN($page))){