Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tech:others:dokuwiki_cli [2014/11/15 09:13] (current)
Line 1: Line 1:
 +====== Command line tools for Dokuwiki ======
 +
 +[[http://​www.dokuwiki.org/​cli|Dokuwiki Command Line Interface]]\\
 +
 +Three CLI tools are:
 +  * dwpage.php
 +  * indexer.php
 +  * wantedpages.php
 +
 +===== Indexer =====
 +To run this do the following:
 +<code bash>
 +cd /​var/​www/​sub/​wiki
 +/​usr/​bin/​php bin/​indexer.php -c
 +chown -R www-data:​www-data *
 +</​code>​
 +
 +Explanation:​\\
 +  * Move to the dokuwiki root directory
 +  * Run command (make sure your php is where the script says it is)
 +  * The command does a clean and recreate index - which is the way I prefer
 +  * Make sure the permissions on the new index files are good by changing them to the apache user
 +
 +Here is a full script
 +<code bash>
 +#!/bin/bash
 +cd /​var/​www/​sub/​wiki
 +/​usr/​bin/​php bin/​indexer.php -c
 +chown -R www-data:​www-data *
 +exit
 +</​code>​
 +
 +===== Wanted Pages =====
 +To run this do the following:
 +<code bash>
 +cd /​var/​www/​sub/​wiki
 +/​usr/​bin/​php bin/​wantedpages.php | grep -v "​some:​namespaces"​ | grep -v "​wiki:​nonexisting"​ | grep -v "​wiki:​pagename"​
 +</​code>​
 +
 +Explanation:​\\
 +  * Move to the dokuwiki root directory
 +  * Run the command but ignore some outputs that I know are broken links and don't care to fix
 +  * If you get no output you are good to go
 +  * Otherwise to find the source file that is having the issue for each line of output run this command
 +    * grep -R "​somenamespace:​someothernamespace:​somepage"​ data/​pages/​*
 +    * This will give you the source page having the broken link
 +
 +Here is a full script that can be saved and run any time:
 +<code bash>
 +#!/bin/bash
 +NOW=$(date +"​%Y-%m-%d-%H-%M-%S"​)
 +wpages=/​tmp/​blinks_${NOW}.txt
 +cd /​var/​www/​sub/​wiki
 +/​usr/​bin/​php bin/​wantedpages.php | grep -v "​some:​namespaces"​ | grep -v "​wiki:​nonexisting"​ | grep -v "​wiki:​pagename"​ > $wpages
 +grep -R -f $wpages data/​pages/​* | grep -v "​\.svn"​
 +rm $wpages
 +</​code>​
 +
 +Explanation:​\\
 +  * I have a grep -v "​\.svn"​ because I have my wiki under subversion!
 +  * Also this lists both the broken link and the page at which it occurs
  

QR Code
QR Code tech:others:dokuwiki_cli (generated for current page)