Quickstart: run a migration, a transaction and a read
The shortest way from “the plugin is installed” to “a migration has run, a row has been written inside a transaction and read back” — without a line of your own code. The plugin ships a demonstration page that does exactly that against a throwaway database. Two steps, about five minutes.
Prerequisites
wkstorageandwkcoreare installed and enabled.wkcoreis required here, not optional: storage publishes itself through its registry.- PHP 8.2 or later with the SQLite PDO driver.
- The wiki's save directory is writable.
- You may edit
conf/local.php.
Step 1: unlock the demonstration
The page is locked behind DokuWiki's allowdebug setting, because it writes and truncates on every call. Without the setting it reports only wkstorage demo requires $conf['allowdebug'] = 1.
Set in conf/local.php:
$conf['allowdebug'] = 1;
Take the line out again after the check. The demonstration works exclusively against the throwaway database
demo and touches no domain data — but the setting unlocks diagnostic output across the whole wiki.
Step 2: call the demonstration
Open /doku.php?do=wkstorage_diag.
Check the result
The page demonstrates four things and shows the outcome of each:
| Section | What you should see |
|---|---|
| Migrations | dryRun_pending names the versions still outstanding — the dry run changes nothing. applied_now names the applied ones, backup the backup taken while doing it. second_run is empty: a second run has nothing left to do and takes no second backup. |
| Prepared statements + transaction | A table with two rows, Alpha and Beta. Beta was written inside a transaction; that it is there proves the transaction committed. |
| Path | The resolved file path under data/dwdo. That is the storage convention which keeps the installation copy-paste portable. |
| Error | A deliberately faulty query against a table that does not exist, with the resulting StorageException message. It names the SQLSTATE and neither the SQL nor a path — an error message you can hand to a caller. |
That is the plugin's complete public surface, seen working once.
Next step
- wkcore — fetch the
storage.sqliteservice from your own code instead of constructingStorageyourself. - wkdostorage — the DevOps suite's domain storage on top of it.
- wkstorage (German) — the package page:
Storage,Db,Migrator, and whatStorageExceptionsays and does not say.
en/wiki/dwe/wkstorage/quickstart.txt · Last modified: by 0.0.0.0