summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorTom N Harris <tnharris@whoopdedo.org>2010-12-29 03:50:05 -0500
committerTom N Harris <tnharris@whoopdedo.org>2010-12-29 03:50:05 -0500
commit9b41be2446ea725a496f34b28ac4db84bece57c9 (patch)
treebb002063560d6132c6cda8d85cd1d1d089084f27 /lib/exe
parent00803e562833be06ab5a869541581314b9b84d58 (diff)
downloadrpg-9b41be2446ea725a496f34b28ac4db84bece57c9.tar.gz
rpg-9b41be2446ea725a496f34b28ac4db84bece57c9.tar.bz2
Indexer v3 Rewrite part two, update uses of indexer
Diffstat (limited to 'lib/exe')
-rw-r--r--lib/exe/indexer.php35
-rw-r--r--lib/exe/xmlrpc.php27
2 files changed, 4 insertions, 58 deletions
diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index 55d860296..a5a7d6b2a 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -134,41 +134,8 @@ function runIndexer(){
if(!$ID) return false;
- // check if indexing needed
- $idxtag = metaFN($ID,'.indexed');
- if(@file_exists($idxtag)){
- if(trim(io_readFile($idxtag)) == idx_get_version()){
- $last = @filemtime($idxtag);
- if($last > @filemtime(wikiFN($ID))){
- print "runIndexer(): index for $ID up to date".NL;
- return false;
- }
- }
- }
-
- // try to aquire a lock
- $lock = $conf['lockdir'].'/_indexer.lock';
- while(!@mkdir($lock,$conf['dmode'])){
- usleep(50);
- if(time()-@filemtime($lock) > 60*5){
- // looks like a stale lock - remove it
- @rmdir($lock);
- print "runIndexer(): stale lock removed".NL;
- }else{
- print "runIndexer(): indexer locked".NL;
- return false;
- }
- }
- if($conf['dperm']) chmod($lock, $conf['dperm']);
-
// do the work
- idx_addPage($ID);
-
- // we're finished - save and free lock
- io_saveFile(metaFN($ID,'.indexed'), idx_get_version());
- @rmdir($lock);
- print "runIndexer(): finished".NL;
- return true;
+ return idx_addPage($ID, true);
}
/**
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index 410d4f6ba..84068f96e 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -355,9 +355,8 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
*/
function listPages(){
$list = array();
- $pages = array_filter(array_filter(idx_getIndex('page', ''),
- 'isVisiblePage'),
- 'page_exists');
+ $pages = idx_get_indexer()->getPages();
+ $pages = array_filter(array_filter($pages,'isVisiblePage'),'page_exists');
foreach(array_keys($pages) as $idx) {
$perm = auth_quickaclcheck($pages[$idx]);
@@ -552,27 +551,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
unlock($id);
// run the indexer if page wasn't indexed yet
- if(!@file_exists(metaFN($id, '.indexed'))) {
- // try to aquire a lock
- $lock = $conf['lockdir'].'/_indexer.lock';
- while(!@mkdir($lock,$conf['dmode'])){
- usleep(50);
- if(time()-@filemtime($lock) > 60*5){
- // looks like a stale lock - remove it
- @rmdir($lock);
- }else{
- return false;
- }
- }
- if($conf['dperm']) chmod($lock, $conf['dperm']);
-
- // do the work
- idx_addPage($id);
-
- // we're finished - save and free lock
- io_saveFile(metaFN($id,'.indexed'), idx_get_version());
- @rmdir($lock);
- }
+ idx_addPage($id);
return 0;
}