diff --git a/action.php b/action.php index dcb4200..a889cfc 100644 --- a/action.php +++ b/action.php @@ -107,7 +107,9 @@ function handle_cache(Doku_Event $event, $param) { * @param array $param Optional parameters (unused) */ public function handle_index_version(Doku_Event $event, $param) { - $event->data['plugin_pagemove'] = 0.1; + // From indexer version 6 on the media references are indexed by DokuWiki itself + if ($event->data['dokuwiki'] < 6) + $event->data['plugin_pagemove'] = 0.2; } /** @@ -117,6 +119,8 @@ public function handle_index_version(Doku_Event $event, $param) { * @param array $param Optional parameters (unused) */ public function index_media_use(Doku_Event $event, $param) { + // From indexer version 6 on the media references are indexed by DokuWiki itself + if (INDEXER_VERSION >= 6) return; $id = $event->data['page']; $media_references = array(); $instructions = p_cached_instructions(wikiFn($id), false, $id); @@ -124,7 +128,7 @@ public function index_media_use(Doku_Event $event, $param) { $this->get_media_references_from_instructions($instructions, $media_references, $id); } $media_references = array_unique($media_references); - $event->data['metadata']['pagemove_media'] = $media_references; + $event->data['metadata']['relation_media'] = $media_references; } /** diff --git a/helper.php b/helper.php index 5ddda97..13d96ee 100644 --- a/helper.php +++ b/helper.php @@ -517,7 +517,7 @@ public function move_media(&$opts, $checkonly = false) { * End of init (checks) */ - $affected_pages = idx_get_indexer()->lookupKey('pagemove_media', $opts['id']); + $affected_pages = idx_get_indexer()->lookupKey('relation_media', $opts['id']); $data = array('opts' => &$opts, 'affected_pages' => &$affected_pages); // give plugins the option to add their own meta files to the list of files that need to be moved @@ -531,7 +531,7 @@ public function move_media(&$opts, $checkonly = false) { } else { $Indexer = new helper_plugin_pagemove_indexer(); // copy of the new code } - if (($idx_msg = $Indexer->renameMetaValue('pagemove_media', $opts['id'], $opts['new_id'])) !== true) { + if (($idx_msg = $Indexer->renameMetaValue('relation_media', $opts['id'], $opts['new_id'])) !== true) { msg('Error while updating the search index '.$idx_msg, -1); return false; }