1<?php 2 3/** 4 * DokuWiki Plugin acknowledge (SQLite Action Component) 5 * 6 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 7 * @author Andreas Gohr, Anna Dabrowska <dokuwiki@cosmocode.de> 8 */ 9 10use dokuwiki\Extension\ActionPlugin; 11use dokuwiki\Extension\EventHandler; 12use dokuwiki\Extension\Event; 13 14class action_plugin_acknowledge_sqlite extends ActionPlugin 15{ 16 /** @inheritDoc */ 17 public function register(EventHandler $controller) 18 { 19 $controller->register_hook('PLUGIN_SQLITE_DATABASE_UPGRADE', 'AFTER', $this, 'handleUpgrade'); 20 } 21 22 /** 23 * Handle Migration events 24 * 25 * @param Event $event 26 * @param $param 27 * @return void 28 */ 29 public function handleUpgrade(Event $event, $param) 30 { 31 if ($event->data['sqlite']->getAdapter()->getDbname() !== 'acknowledgement') { 32 return; 33 } 34 $to = $event->data['to']; 35 if ($to !== 3) return; // only handle upgrade to version 3 36 37 /** @var helper_plugin_acknowledge $helper */ 38 $helper = plugin_load('helper', 'acknowledge'); 39 $helper->updatePageIndex(); 40 } 41} 42