Dokuwiki notes and tricks
Latest update 2023-02-17.
My preferred template
My preferred DokuWiki template is Bootstrap3. This site is using theme Cosmo. I also like United theme a lot. Before switching to Bootstrap3 I used to use Typowiki template.
Automatic UI language selection based on URL
- Installed languages: en, fi
- The content is divided into two language branches so that all URL's start with en or fi
Add to conf/local.php:
@include(DOKU_CONF.'local.protected.php');
In conf/local.protected.php:
<?php $conf['lang'] = 'en'; $detected_lang = preg_replace('/^(..).*/i','$1',$_REQUEST['id']); if (strcmp($detected_lang, 'fi') == 0) { $conf['lang'] = 'fi'; } ?>
What this effectively does: Sets language to English. Then scans the requested path and if it begins with “fi”, sets language to Finnish.
Change password from Linux command line
- apt install whois
- mkpasswd -m md5crypt
- type in the new password
- copy the hash to conf/users.auth.php
Upgrading Dokuwiki
- Backup the server content
- Select the desired version, typically it is the recommended version and already selected
- Press “toggle all” to uncheck all other languages than English
- Don't tick anything else
- Press “Start Download” button
- A .tgz file is download
- Ship the file to the server
- Follow instructions on page https://www.dokuwiki.org/install:upgrade starting from step 4
- Untar the tar
- Become a root user
- Copy the files over the current installation
- Check permissions https://www.dokuwiki.org/install:permissions
- Delete unused files https://www.dokuwiki.org/install:unused_files
- Delete the default Dokuwiki content, pages/wiki
- Check that the site works ok
Removing visible page info
https://www.dokuwiki.org/config:showuseras
Edit file inc/template.php
Comment out code
$out .= '<bdi>'.$fn.'</bdi>'; $out .= ' · '; $out .= $lang['lastmod']; $out .= ' '; $out .= $date; if($INFO['editor']){ $out .= ' '.$lang['by'].' '; $out .= editorinfo($INFO['editor']); }else{ $out .= ' ('.$lang['external_edit'].')'; }
Remove discussion link on typowiki template
https://www.dokuwiki.org/template:typowiki
Edit file lib/tpl/typowiki/tpl_functions.php
In function _tpl_discussion comment out most of the code.