register_hook('PLUGIN_SQLITE_DATABASE_UPGRADE', 'AFTER', $this, 'handle_migrations'); } /** * Call our custom migrations when defined * * @param Doku_Event $event * @param $param */ public function handle_migrations(Doku_Event $event, $param) { if ($event->data['sqlite']->getAdapter()->getDbname() !== 'telleveryone') { return; } $to = $event->data['to']; if (is_callable([$this, "migration$to"])) { $event->result = call_user_func([$this, "migration$to"], $event->data); } } protected function migration1($data) { global $conf; /** @var helper_plugin_sqlite $sqlite */ $sqlite = $data['sqlite']; $token = bin2hex(openssl_random_pseudo_bytes(16)); $sqlite->storeEntry('config', [ 'key' => 'token', 'value' => $token ]); } }