Dokuwiki Startup Guide
install and setup 2021
- install dokuwiki web app
- initial setup
- disable register: login wiki with your Admin > Configuration Manager: find “Register”, check the box for “Disable Dokuwiki actions”
- delete all default page: in sitemap, go each default page and empty the page content to delete
- set wiki site wide permission: admin page > Access Control List Management
* @ALL Read (change from default upload to Read to prevent spam) * @user Create (allow other reg user to create page) * userA Delete (allow some power user to delete page) categoryNameSpace:* @ALL None (to limit public access on some sub folder content) categoryNameSpace:* @user Upload (free reg user to access sub folder content)
Customize
hide sitemap index from non-login user
- check on Configuration Manager > sneaky_index
start page customize
- admin panel > Configuration manager: Basic panel, starting point: change from “start” to “Welcome” as example, then create the page
- (outdated way) /wiki/conf/dokuwiki.php
$conf['start'] = 'Welcome'; //name of start page
change wiki page width
- method 0 - Toggle Page Width with Javascript, CSS and Side Tool customize on “/lib/tpl/dokuwiki/main.php”
- step 1: edit main.php head part to add css and javascript function (jquery no need)
<style> .fullpageOn{ max-width: 100% !important; } </style> <script> // standard javascript here function toggleFullPage() { var myPageClasses = document.getElementById("dokuwiki__site").classList; if (myPageClasses.contains("fullpageOn")) { myPageClasses.remove("fullpageOn"); } else { myPageClasses.add("fullpageOn"); } } </script>
- method 1 with css:
/* find css file in default template folder with class dokuwiki__site #dokuwiki__site { max-width: 100% !important; }
- method 2 with style.ini in default template folder (ref)
__site_width__ = "100%" ; @ini_site_width #defaut __site_width__ = "75em" ; @ini_site_width
change “doku.php” in URL (you need repeat steps if you update dokuwiki)
- (updated 2021)
- copy the file “wiki/doku.php” into “wiki/newName.php” (such as “page.php”; but can not be “index.php”, as it is reserved for default)
- edit wiki/index.php, replace all “doku.php” with “newName.php”
- create wiki/inc/preload.php
<?php if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','newName.php');
- for link in some page that still link to doku.php, you may need to edit that page and update the page cache
change wiki URL format
- edit wiki/conf/local.php part
$conf['userewrite'] = 2;
- 0 : dokuwiki/doku.php?id=wiki:syntax (default)
- 1 : dokuwiki/wiki:syntax (server side control)
- 2 : http://example.com/dokuwiki/doku.php/wiki:syntax (doku side control)
change 2013 or later DokuWiki homepage logo (further if you want to change the favicon)
- method 1: use media manager, under wiki namespace, upload new logo to replace old one (:wiki:logo.png). (ref)
- method 2: go dokuwiki\lib\tpl\dokuwiki\images, swap out the image with your same correct size one
- apple-touch-icon.png
- favicon.ico
- logo.png
DokuWiki Favicon
- generate favicon from logo: http://www.favicon-generator.org/
- loading priority sequence
- $DokuWiki/data/media/favicon.ico
- $DokuWiki/lib/tpl/dokuwiki/images/favicon.ico
- $DokuWiki root/favicon.ico
- web root/favicon.ico
change 2013 or later DokuWiki theme, top “Media Manager” link for non-user (repeat after each update)
- need to edit lib/tpl/dokuwiki/tpl_header.php file
- then in the display “Media Manager” link part, add a user login condition check
tpl_action('recent', 1, 'li'); if(!empty($INFO['userinfo']['name'])){ tpl_action('media', 1, 'li'); tpl_action('index', 1, 'li'); } // note: $INFO['client'] will give ip or username // ref: $INFO variable in dokuwiki: https://www.dokuwiki.org/devel:environment
- for new wiki check this
# change tpl_toolsevent('sitetools', array( tpl_action('recent', true, 'li', true), tpl_action('media', true, 'li', true), tpl_action('index', true, 'li', true) )); # into if(!empty($INFO['userinfo']['name'])){ tpl_toolsevent('sitetools', array( tpl_action('recent', true, 'li', true), tpl_action('media', true, 'li', true), tpl_action('index', true, 'li', true) )); } else{ tpl_toolsevent('sitetools', array( tpl_action('recent', true, 'li', true) )); }
DokuWiki plugins
- Clear and Merge history: remove small change history
- Doku TeX it: a TeX and PDF output plugin for DokuWiki page
- CronoJob: script schedule job for Dokuwiki
- Move: a plugin helping on moving page and media while maintaining the links
- hidden plugin: like create spoiler in page syntax
- Video Share Plugin: embed video site videdo (youtube, vimeo)
- HTML5 video plugin: embed local or url video
- EditTable Plugin: easy to edit table
- other option: DTable: gui to edit table
- video:
- addition config
-
- good for file type support config, and user css config
-
DokuWiki Templates Install
- go Admin > Extension Manager: Search and Install tab, search the theme you want to install.
- then, go to admin > Configuration Manager, Basic: Template to choose the installed template
Dokuwiki operation life-cycle maintain guide
compare to other wiki
install and setup
- download dokuwiki at: http://www.dokuwiki.org/dokuwiki
- extract the file structure to your Website Wiki folder
- start your web server, and browser to the “install.php” in wiki folder; (for me, no permission problem by guide)
- Then, create users,
- login wiki with your Admin account, click “Admin” button at the right bottom corner;
- then, click “User Manager”, create other user for writing and admining in Group of “user” or “admin”
- Then, authorize user rights
- click “admin” button at the bottom after login as admin
- click “Access Control List Management” to define page or namespace (directory) level control
- Create page
- create page by a internal link: [[techwiki:macfix|Mac Fix tech page]]
- create page by entering a new URL: http://mysite/wiki/doku.php?id=techwiki:macfix
- delete page
- delete page by empty the content of that page
- insert media like image and video
- use the toolbar in page editing panel
maintain
- clean up trash in dokuwiki
- cleanup.sh
#!/bin/bash cleanup() { # $1 ... full path to data directory of wiki # $2 ... number of days after which old files are to be removed # purge files older than $2 days from the attic (old revisions) find "$1"/attic/ -type f -mtime +$2 -print0 | xargs -0r rm -f # remove stale lock files (files which are 1-2 days old) find "$1"/locks/ -name '*.lock' -type f -mtime +1 -print0 | xargs -0r rm -f # remove empty directories find "$1"/{attic,cache,index,locks,media,meta,pages,tmp}/ \ -mindepth 1 -type d -empty -print0 | xargs -0r rmdir # remove files older than $2 days from the cache find "$1"/cache/?/ -type f -mtime +$2 -print0 | xargs -0r rm -f }
# cleanup DokuWiki installations (path to datadir, number of days) # some examples: cleanup /home/user1/htdocs/doku/data 256 cleanup /home/user2/htdocs/mywiki/data 180 cleanup /var/www/superwiki/data 180
backup
- for normal personal or author-free article type wiki, then you just need to backup these 2 folder
- /wiki/data/media - this is for images used in wiki
- /wiki/data/pages - this is for all the pages
- for large user base free type wiki, then you may like to backup
- /wiki/data/media
- /wiki/data/pages
- /wiki/data/meta - version and activity tracking;
- (wiki can re-generate new version tracks if you don't want to keep old ones)
- /wiki/data/attic - old things of each edit;
- (suggest to delete it, or don't backup it if you never undo old changes)
- for community based tracking type wiki
- in addition, backup the users and group configuration file and rights configuration
- /wiki/conf - wiki configuration and user database
- not sure what to do
- /wiki - backup whole wiki to a zip file
- best to tar the wiki folder with permission info as well
# back inside wiki folder cd /path/to/folder/to/copy tar cvpzf put_your_name_here.tar.gz . # restore inside wiki folder cd /path/to/destination/folder tar xpvzf put_your_name_here.tar.gz
move to new server
- zip the wiki, download, update to new server, extract
- for server with strict ModSecurity, you need server side whitelist setup to get embeded code part working, and avoid 406 error (ref: https://www.dokuwiki.org/faq:mod_security)
- run fix date php script to fix external edit and date issue (ref: https://www.dokuwiki.org/tips:fixmtime)
- Run it from within DokuWiki installation directory.
<?php /** * Fix modification times based on timestamps. Run from within DokuWiki installation directory. * @Author: dreamlusion <http://dreamlusion.eucoding.com> * last modified: 2008-09-05 4:15:00 */ function WalkDirectory($parentDirectory) { global $_weeds; foreach(array_diff(scandir($parentDirectory), $_weeds) as $directory) { $path = $parentDirectory . '/'. $directory; if(is_dir($path)) { WalkDirectory($path); } else { // Calculate changes file path. $path_parts = pathinfo($path); // Remove pages path. global $_pagesPath; $relativePath = substr($path_parts['dirname'], strlen($_pagesPath), strlen($path_parts['dirname'])); // Add <filename>.changes $filename = $path_parts['filename']; // Requires PHP 5.2.0 (http://gr2.php.net/manual/en/function.pathinfo.php) $relativePath .= '/' . $filename . '.' . 'changes'; global $_metaPath; $changelog = $_metaPath . '/' . $relativePath; if (is_file($changelog)) { $handle = @fopen($changelog, "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); preg_match('/(?<timestamp>\d+)/', $buffer, $matches); if ($matches['timestamp'] != '') $timestamp = $matches['timestamp']; } fclose($handle); } // At this point we have our timestamp. echo 'Updating ' . $path . '<br />'; echo ' Timestamp in changelog: ' . $timestamp . '<br />'; echo ' Old modification time: ' . filemtime($path) . '<br />'; if (touch($path, $timestamp)) { // In my host, although the timestamp had changed successfully (checked manually), running filemtime($path) at this point // did not return the correct timestamp, so use I use $timestamp instead of filemtime($path) to avoid confusing the user. echo ' New modification time: ' . $timestamp . '<br />'; } else { echo ' Could not change modification time for page ' . $filename; } } else { echo 'Changelog not found: ' . $changelog . '<br />'; } } } } $_weeds = array('.', '..'); $_pagesPath = getcwd() . '/data/pages'; $_metaPath = getcwd() . '/data/meta'; WalkDirectory($_pagesPath); ?>
Update and Install Plugin
- the easiest way to update DokuWiki to latest version is to use “Upgrade” plugin
- go to Admin page > plugin manager
- check the “Upgrade” plugin from this page, and right click on download to copy the download link url: https://www.dokuwiki.org/plugin:upgrade
- paste the url on plugin manager's url text field, and click Download
- once finished, in Admin page, there will be a upgrade plugin link, and click it to go through the auto-download-dokuwiki-upgrade system
- these 2 image shows how to install plugin using plugin manager in admin panel
Google Analytics Plugin
Google Side
- go: analytics.google.com
- login google
- create track account
- choose info sharing or not
- choose web to monitor
- enter site name and info
- get the tracking id
dokuwiki side:
- dokuwiki admin page > extension: install https://www.dokuwiki.org/plugin:googletagmanager
- dokuwiki admin page: google analytics plugin link
- add its referred code into head section of: wiki/lib/tpl/your_current_doku_template_folder/main.php
- note: some of template already have google analytics feature built-in, you may like to check config page to see
- then, back to dokuwiki admin config page: plugin: google analytics, put tracking id there
Problem and Solution
Dokuwiki Upload Image Failed
- Problem description:
- when I use XAMPP to setup my local server, and put the dokuwiki in the htdocs folder, I can write wiki page, but upload image just saying “fail”
- Problem analysis:
- It can be caused by several things, maybe your folder permission is set wrong, but most likely a fresh copy of dokuwiki folder should have everything set default correctly;
- It can be caused by your server upload setting, like allow upload in PHP setting, but default XAMPP should have everything setup correctly already
- Solution:
- for my case, I just grab a fresh latest copy of XAMPP from https://sourceforge.net/projects/xampp/files/, the 7z portable version, so I can extract the XAMPP out and put where I want exactly myself
- then I run the setup_xampp.bat from the XAMPP folder to tell it where the location it sits
- then I just run xampp_control.exe with admin to start the server and mysql properly
- put fresh latest copy of dokuwiki in the XAMPP htdocs folder, and browser it from browser, like your machine name and /, following the dokuwiki folder name.
- it should all be all right, test by upload a image using dokuwiki image icon
Wiki Folder Permission and Security
- Problem description
- when move to new server, it sometimes can have file and folder permission lost problem, cause whole wiki has security issues
- ref doc:
- Solution
- when migrating, make sure wiki compressed with file permission info
cd /path/to/folder/to/copy tar cvpzf put_your_name_here.tar.gz . cd /path/to/destination/folder tar xpvzf put_your_name_here.tar.gz
- after migration, check and fix permission
- if visit page error, then fix with chmod: fix file permission with chmod
# check existing htdoc file the_same_user:the_same_group info ls -l # then for wiki folder, fix own and permission # ref: https://www.dokuwiki.org/install:permissions cd wiki/ chmod -R 775 data/ sudo chown -R the_same_user:the_same_group data/ cd data/ chmod 2775 {attic,cache,index,locks,media,meta,pages,tmp} chown the_same_user:the_same_group {attic,cache,index,locks,media,meta,pages,tmp}
- if inside Admin page, the Extension Manager says “Extension directory is not writable”, and each plugin doesn't show (uninstall/re-install/update) buttons, it means the ./lib/plugins folder permission need to check owner/group
// if you just need to change and match the group name, then this way // cd to the plugins's parent folder and do sudo chown -R :the_group_name_that_works ./plugins/* // if you need user name change as well sudo chown -R the_user_name_that_works:the_group_name_that_works ./plugins/* // and check now permission with ls -l // you can check all user name by cat /etc/passwd
- check wiki security by visit a page txt file like ,
http://your_site.com/wiki/data/pages/subFolder/pageName.txt
- if accessible, then fix with apache htaccess in httpd.conf (its location vary based on what linux creator you use):
- put data, conf, bin, inc folder in deny mode, example as for data
<Directory /web_root_path/wiki/data> order allow,deny deny from allow satisfy all </Directory>
- also prevent file access
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)"> Require all denied </Files>
dokuwiki config can't be saved problem
- it is under wiki/conf/local.php, so check the file permission in terminal.
- change local.php file permisison,
chmod 775 local.php chmod 775 local.php.bak
- ref article:
old dokuwiki php 7.4 above error
- Problem: .\inc\init.php line 564 array error:
- solution: “if($path{0} == '/'){” change to if($path[0] == '/'){
- since new array will use [] instead {}
- Problem: other plugin error like “A PCRE internal error occured. This might be caused by a faulty plugin.”
- solution: backup page and media folder under data, and move to new fresh copy of dokuwiki. (like in backup guide)
Basic Syntax
more syntax at http://www.dokuwiki.org/syntax
edit bar at http://www.dokuwiki.org/toolbar
page creation at http://www.dokuwiki.org/page
comparison of wiki http://www.wikimatrix.org/compare/DokuWiki+PmWiki+WikkaWiki
Text Format and Color
no way but plugin
Photo and Image
name then size
{{wiki:dokuwiki-128.png?20x50}}
Links
- Use [[dir_name_space:pageName|Link_Text]] to create internal link;
- Just type link as http://google.com to create normal link;
- Use [[http://google.com|Google]] to create title link like Google
- Use [[this>./subCustomFolder/myfile.mp4|Video]] to link a relative path from wiki root
List
"2 spaces followed by * or -" at line start will create unordered or ordered list;
“2 extra spaces” in front will indent it to sub-level.
New Line & Escape container
There are 4 ways to create a line break, or a blank line.
- type “2 Enter key” to create 1 blank line
- type “\\” to create <br> like link break
- type "%% content %%" to create line-keep-as-you-type block
- type "<nowiki> content </nowiki>" to create line-keep-as-you-type block
Separator Line
- four “-” and more makes a Separator line, like below
Code Format
type "<code language> content </code>" to create code like block
Plain code text here
type "<file language fileName.txt> content </file>" to create downloadable code
- fileName.txt
Plain code text here
Supported:
4cs, abap, actionscript-french, actionscript, actionscript3, ada, apache, applescript, asm, asp, autoconf, autohotkey, autoit, avisynth, awk, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, ecmascript, eiffel, email, erlang, fo, fortran, freebasic, fsharp, gambas, genero, genie, gdb, glsl, gml, gnuplot, groovy, gettext, gwbasic, haskell, hicest, hq9plus, html, icon, idl, ini, inno, intercal, io, j, java5, java, javascript, jquery, kixtart, klonec, klonecpp, latex, lisp, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, modula2, modula3, mmix, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, ocaml-brief, ocaml, oobas, oracle8, oracle11, oxygene, oz, pascal, pcre, perl, perl6, per, pf, php-brief, php, pike, pic16, pixelbender, plsql, postgresql, povray, powerbuilder, powershell, progress, prolog, properties, providex, purebasic, python, q, qbasic, rails, rebol, reg, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, vala, vbnet, vb, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, winbatch, whois, xbasic, xml, xorg_conf, xpp, z80
special page
- :sidebar for sidebar content
Dokuwiki user group setup and security control
Method:
- use dokuwiki admin page control
- use text config of dokuwiki: official guide
DokuWiki Theme and Customize
- cool theme:
Bootstrap3 template for Dokuwiki
- author page guide page:
- step for setup
- install bootstrap3 template: https://www.dokuwiki.org/template:bootstrap3
- install related plugin:
- Bootstrap Wrapper Plugin: https://www.dokuwiki.org/plugin:bootswrapper
- icons plugin: https://www.dokuwiki.org/plugin:icons
- custom Bootstrap3
- admin > Configuration Setting, go bottom bootstrap3 part
- bootstrap them, choose Bootswatch.com theme
- select a theme : superhero
- check show theme switcher (next, check hide them in switch list, recommend hide all except lumen,slate,superhero,yeti,darkly)
- Navbar part:
- display tools in navbar: when logged in
- enable disable indivdual menu in navbar: check user
- Layout part:
- uncheck full width
- table style: check all except condensed
- uncheck display doku link on footer
- TOC part
- uncheck collapse for 2 option
- Page part:
- check AnchorJs
- and uncheck collapse 2nd section level on mobile
- navbar page for navbar:
- code
* [[:start|Home]] * DokuWiki * [[:wiki:welcome]] * [[:wiki:syntax]] * [[:wiki:welcome]] * [[:playground:playground]] ~~NOCACHE~~