summaryrefslogtreecommitdiff
path: root/inc/indexer.php
diff options
context:
space:
mode:
authorTom N Harris <tnharris@whoopdedo.org>2011-02-22 02:53:20 -0500
committerTom N Harris <tnharris@whoopdedo.org>2011-02-22 02:53:20 -0500
commitd0d6fe1be56ef474d844b3556af7ba2a5961d798 (patch)
tree42a1f0105c05c7f5629a7e3561ae51a43c645fb0 /inc/indexer.php
parent0604da3403f907227d3dfe13e6e58d2e78d0c855 (diff)
downloadrpg-d0d6fe1be56ef474d844b3556af7ba2a5961d798.tar.gz
rpg-d0d6fe1be56ef474d844b3556af7ba2a5961d798.tar.bz2
Indexer version tag should include plugin names
Diffstat (limited to 'inc/indexer.php')
-rw-r--r--inc/indexer.php32
1 files changed, 23 insertions, 9 deletions
diff --git a/inc/indexer.php b/inc/indexer.php
index 1809b1c8f..bcda2a9b9 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -50,19 +50,33 @@ define('IDX_ASIAN', '(?:'.IDX_ASIAN1.'|'.IDX_ASIAN2.'|'.IDX_ASIAN3.')');
* Version of the indexer taking into consideration the external tokenizer.
* The indexer is only compatible with data written by the same version.
*
+ * Triggers INDEXER_VERSION_GET
+ * Plugins that modify what gets indexed should hook this event and
+ * add their version info to the event data like so:
+ * $data[$plugin_name] = $plugin_version;
+ *
* @author Tom N Harris <tnharris@whoopdedo.org>
* @author Michael Hamann <michael@content-space.de>
*/
function idx_get_version(){
- global $conf;
- if($conf['external_tokenizer'])
- $version = INDEXER_VERSION . '+' . trim($conf['tokenizer_cmd']);
- else
- $version = INDEXER_VERSION;
-
- $data = array($version);
- trigger_event('INDEXER_VERSION_GET', $data, null, false);
- return implode('+', $data);
+ static $indexer_version = null;
+ if ($indexer_version == null) {
+ global $conf;
+ if($conf['external_tokenizer'])
+ $version = INDEXER_VERSION . '+' . trim($conf['tokenizer_cmd']);
+ else
+ $version = INDEXER_VERSION;
+
+ // DokuWiki version is included for the convenience of plugins
+ $data = array('dokuwiki'=>$version);
+ trigger_event('INDEXER_VERSION_GET', $data, null, false);
+ unset($data['dokuwiki']); // this needs to be first
+ ksort($data);
+ foreach ($data as $plugin=>$vers)
+ $version .= '+'.$plugin.'='.$vers;
+ $indexer_version = $version;
+ }
+ return $indexer_version;
}
/**