Skip to content
Snippets Groups Projects
Commit 33a148e0 authored by Tom N Harris's avatar Tom N Harris
Browse files

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
parent a05e297a
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment