2011-02-10 09:29:51 +01:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
# -*- coding: utf-8 -*-
|
2012-09-18 09:56:04 +02:00
|
|
|
# Setup VIM: ex: noet ts=2 sw=2 :
|
2011-02-10 10:00:19 +01:00
|
|
|
#
|
|
|
|
# PHP side Bridge of accessing DokuWiki functions from Python.
|
|
|
|
# See README for details.
|
|
|
|
#
|
2011-02-10 09:29:51 +01:00
|
|
|
# Author: Elan Ruusamäe <glen@pld-linux.org>
|
|
|
|
#
|
|
|
|
# You should probably adjust path to DOKU_INC.
|
|
|
|
|
|
|
|
if ('cli' != php_sapi_name()) die();
|
|
|
|
|
|
|
|
define('DOKU_INC', '/usr/share/dokuwiki/');
|
|
|
|
require_once DOKU_INC.'inc/init.php';
|
|
|
|
require_once DOKU_INC.'inc/common.php';
|
|
|
|
require_once DOKU_INC.'inc/cliopts.php';
|
|
|
|
|
2012-09-17 23:56:40 +02:00
|
|
|
function strip_dir($dir, $fn) {
|
2012-09-16 18:04:41 +02:00
|
|
|
global $conf;
|
2012-09-17 23:56:40 +02:00
|
|
|
return end(explode($dir.'/', $fn, 2));
|
2012-09-16 18:04:41 +02:00
|
|
|
}
|
|
|
|
|
2011-02-10 09:29:51 +01:00
|
|
|
switch ($argv[1]) {
|
|
|
|
case 'cleanID':
|
|
|
|
echo cleanID($argv[2]);
|
|
|
|
break;
|
2012-09-16 18:04:41 +02:00
|
|
|
case 'wikiFN':
|
2012-09-17 23:56:40 +02:00
|
|
|
echo strip_dir($conf['datadir'], wikiFN($argv[2]));
|
2011-02-10 09:29:51 +01:00
|
|
|
break;
|
2012-09-17 23:56:40 +02:00
|
|
|
case 'mediaFN':
|
|
|
|
echo strip_dir($conf['mediadir'], mediaFN($argv[2]));
|
2011-02-10 09:29:51 +01:00
|
|
|
break;
|
2012-09-18 02:04:03 +02:00
|
|
|
case 'metaFN':
|
|
|
|
echo strip_dir($conf['metadir'], metaFN($argv[2], $argv[3]));
|
|
|
|
break;
|
2011-02-10 09:29:51 +01:00
|
|
|
case 'getNS':
|
|
|
|
echo getNS($argv[2]);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
die("Unknown knob: {$argv[1]}");
|
|
|
|
}
|