moin2doku/doku.php

66 lines
1.6 KiB
PHP
Raw Normal View History

#!/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.
#
# Author: Elan Ruusamäe <glen@pld-linux.org>
2012-09-22 18:23:47 +02:00
# Version: 1.0
#
# You should probably adjust path to DOKU_INC.
if ('cli' != php_sapi_name()) die();
//add to following define of 'DOKU_INC' to your "doku.local.php" file and adjust the path:
//define('DOKU_INC', '/home/caddy/wikifarm/dokuwiki/dokuwiki/');
//define('DOKU_INC', "d:/website/wwwroot/dokuwiki/" );
require_once './doku.local.php';
require_once DOKU_INC.'inc/init.php';
require_once DOKU_INC.'inc/common.php';
require_once DOKU_INC.'inc/cli.php';
2012-09-18 22:57:31 +02:00
# disable gzip regardless of config, then we don't have to compress when converting
$conf['compression'] = 0; //compress old revisions: (0: off) ('gz': gnuzip) ('bz2': bzip)
2012-09-19 22:01:24 +02:00
# override start page, as there's currently configured temporary frontpage
$conf['start'] = 'start'; //name of start page
function strip_dir($dir, $fn) {
2012-09-22 18:14:38 +02:00
global $conf;
return end(explode($dir.'/', $fn, 2));
2012-09-16 18:04:41 +02:00
}
$action = $argv[1];
$argPage = $argv[2];
//filext = $argv[3];
switch ($action) {
case 'cleanID':
echo cleanID($argPage);
break;
2012-09-16 18:04:41 +02:00
case 'wikiFN':
2012-09-18 22:57:49 +02:00
if ($argc > 3 && $argv[3]) {
echo strip_dir($conf['olddir'], wikiFN($argPage, $argv[3]));
2012-09-18 22:57:31 +02:00
} else {
echo strip_dir($conf['datadir'], wikiFN($argPage));
2012-09-18 22:57:31 +02:00
}
break;
case 'mediaFN':
echo strip_dir($conf['mediadir'], mediaFN($argPage));
break;
2012-09-18 02:04:03 +02:00
case 'metaFN':
echo strip_dir($conf['metadir'], metaFN($argPage, $argv[3]));
2012-09-18 02:04:03 +02:00
break;
case 'getNS':
echo getNS($argPage);
break;
case 'getId':
echo getId();
break;
default:
die("Unknown knob: {$action}");
}