DokuWiki

It's better when it's simple

用户工具

站点工具


zh:cli

命令行工具

DokuWiki 自带一些用于 DokuWiki 服务器维护的 PHP 命令行(UNIX)脚本。所有脚本都在<yourWiki>/bin/目录

注意:为了能使用这些脚本,您需要事先在系统中安装 PHP CLI 解释器。

有两种方式可以运行脚本。可以将其转为可执行文件:

$> chmod +x ./bin/<script>.php
$> ./bin/<script>.php

也可以像下面这样运行(推荐):

$> /path/to/php bin/<script>.php

dwpage.php

注意:有些依赖于权限认证或者 DokuWiki 事件系统的插件会出现问题。

Usage: dwpage.php [opts] <action>
  
  Utility to help command line DokuWiki page editing, allow
  pages to be checked out for editing then committed after changes
  
  Normal operation would be;
  
  
  ACTIONS
      checkout: see $ dwpage.php --help=checkout
      commit: see $ dwpage.php --help=commit
      lock: see $ dwpage.php --help=lock
  
  OPTIONS
      -h, --help=<action>: get help
          e.g. $ ./dwpage.php -hcommit
          e.g. $ ./dwpage.php --help=commit

indexer.php

允许您更新搜索索引。

Usage: indexer.php <options>
  
  Updates the searchindex by indexing all new or changed pages
  when the -c option is given the index is cleared first.
  
  OPTIONS 
      -h, --help     show this help and exit
      -c, --clear    clear the index before updating
      -q, --quiet    don't produce any output

这需要具有相关用户和目录执行的权限。例如 Debian(lenny)下的用户 www-data 在目录 ~www-data 执行。所以如果您的维基在 /var/www/wiki 目录:

sudo -u www-data /var/www/wiki/bin/indexer.php

如果出现错误,首先检查您是否在 bin 目录使用的命令,而不是在 /lib/exe 目录。

当时用维基农场(farm)时,您可以定义 animal 变量启动脚本。注意这是在单行命令行。

animal=example ./bin/indexer.php

wantedpages.php

Usage: wantedpages.php [wiki:namespace]
  
  Outputs a list of wanted pages (pages which have
  internal links but do not yet exist).
  
  If the optional [wiki:namespace] is not provided,
  defaults to the root wiki namespace
  
  OPTIONS
      -h, --help get help

striplangs.php

允许您从安装程序内删除不想使用的语言。

Usage: striplangs.php [-h [-x]] [-e] [-k lang1[,lang2]..[,langN]]
  
  Removes all languages from the installation, except the ones
  after the -k option. English language is never removed!
  
  OPTIONS
      -h, --help     get this help
      -x, --examples get also usage examples
      -k, --keep     comma separated list of languages, -e is always implied
      -e, --english  keeps english, dummy to use without -k

gittool.php

通过 GIT 帮助维护 DokuWiki 和插件安装。

Usage: gittool.php <command> [parameters]

Manage git repositories for DokuWiki and its plugins and templates.

EXAMPLE

$> ./bin/gittool.php clone gallery template:ach
$> ./bin/gittool.php repos
$> ./bin/gittool.php origin -v

COMMANDS

help
    This help screen

clone <extensions>
    Tries to install a known plugin or template (prefix with template:) via
    git. Uses the DokuWiki.org plugin repository to find the proper git
    repository. Multiple extensions can be given as parameters

install <extensions>
    The same as clone, but when no git source repository can be found, the
    extension is installed via download

repos
    Lists all git repositories found in this DokuWiki installation

<any>
    Any unknown commands are assumed to be arguments to git and will be
    executed in all repositories found within this DokuWiki installation

plugin.php

此工具用于访问所有安装的插件。执行时不需要任何参数,执行结果就是得到所有安装插件的列表:

./bin/plugin.php

启动插件帮助学习更多用法

./bin/plugin.php <pluginname> -h
zh/cli.txt · 最后更改: 2021-05-17 10:39 由 hfl

除额外注明的地方外,本维基上的内容按下列许可协议发布: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki