diff options
author | Tom N Harris <tnharris@whoopdedo.org> | 2008-02-26 02:19:40 +0100 |
---|---|---|
committer | Tom N Harris <tnharris@whoopdedo.org> | 2008-02-26 02:19:40 +0100 |
commit | 33a148e0f7688489ba9900abb450364586a68cdb (patch) | |
tree | 58d4a632e5c3242e79392e88f56511b895fadd54 /lib | |
parent | a05e297acbd41dc059369b143e2cadf281a581a1 (diff) | |
download | rpg-33a148e0f7688489ba9900abb450364586a68cdb.tar.gz rpg-33a148e0f7688489ba9900abb450364586a68cdb.tar.bz2 |
INDEXER_TASKS_RUN event for index-time hooks
The event INDEXER_TASKS_RUN is fired by lib/exe/indexer.php when a page is viewed. Plugins should only hook BEFORE the event if it is important for the task to be run as often as possible. Otherwise, hook AFTER the even to be run only when other tasks have completed.
Plugin authors must call stopPropagation() and preventDefault() if any work is done. If your plugin does nothing, then you must allow the event to continue. Not following these rules may cause DokuWiki to exceed the PHP execution time limit.
darcs-hash:20080226011940-6942e-09291b73bab84a2c4445b1d1c4de8b3bba743243.gz
Diffstat (limited to 'lib')
-rw-r--r-- | lib/exe/indexer.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 8f2205fe5..be5eed897 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -27,11 +27,21 @@ if(@ignore_user_abort() && !$conf['broken_iua']){ $defer = true; } +$ID = cleanID($_REQUEST['id']); + // Catch any possible output (e.g. errors) if(!$_REQUEST['debug']) ob_start(); // run one of the jobs -runIndexer() or metaUpdate() or runSitemapper() or runTrimRecentChanges(); +$tmp = array(); +$evt = new Doku_Event('INDEXER_TASKS_RUN', $tmp); +if ($evt->advise_before()) { + runIndexer() or + metaUpdate() or + runSitemapper() or + runTrimRecentChanges() or + $evt->advise_after(); +} if($defer) sendGIF(); if(!$_REQUEST['debug']) ob_end_clean(); @@ -120,6 +130,7 @@ function runTrimRecentChanges() { * @author Andreas Gohr <andi@splitbrain.org> */ function runIndexer(){ + global $ID; global $conf; print "runIndexer(): started".NL; @@ -135,7 +146,6 @@ function runIndexer(){ trigger_event('TEMPORARY_INDEX_UPGRADE_EVENT', $tmp); } - $ID = cleanID($_REQUEST['id']); if(!$ID) return false; // check if indexing needed @@ -188,9 +198,9 @@ function runIndexer(){ * gain their data when viewed for the first time. */ function metaUpdate(){ + global $ID; print "metaUpdate(): started".NL; - $ID = cleanID($_REQUEST['id']); if(!$ID) return false; $file = metaFN($ID, '.meta'); echo "meta file: $file".NL; |