1<?php 2 3use dokuwiki\Extension\ActionPlugin; 4use dokuwiki\Extension\EventHandler; 5use dokuwiki\Extension\Event; 6 7class action_plugin_approve_move extends ActionPlugin { 8 9 /** 10 * @inheritDoc 11 */ 12 public function register(EventHandler $controller) { 13 $controller->register_hook('PLUGIN_MOVE_PAGE_RENAME', 'AFTER', $this, 'handle_move', true); 14 } 15 16 /** 17 * Renames all occurrences of a page ID in the database. 18 * 19 * @param Event $event event object by reference 20 * @param bool $ispage is this a page move operation? 21 * @return void 22 */ 23 public function handle_move(Event $event, $ispage) { 24 /** @var \helper_plugin_approve_db $db_helper */ 25 $db = $this->loadHelper('approve_db'); 26 27 $old = $event->data['src_id']; 28 $new = $event->data['dst_id']; 29 30 // move revision history 31 $db->moveRevisionHistory($old, $new); 32 } 33 34} 35