summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2012-07-08 19:20:48 +0200
committerMichael Hamann <michael@content-space.de>2012-07-08 19:20:48 +0200
commit0990161c720c6b5202a59a91e3b7aa172374f277 (patch)
tree8e2e79c4c2b74eb64f54c2fe514afb3cbe19ea10 /inc
parent33df55c79019a8c7c777b8f58808a59f6dc19745 (diff)
downloadrpg-0990161c720c6b5202a59a91e3b7aa172374f277.tar.gz
rpg-0990161c720c6b5202a59a91e3b7aa172374f277.tar.bz2
Add cli support to farm implementation
Now the animal can be specified in the animal environment variable.
Diffstat (limited to 'inc')
-rw-r--r--inc/farm.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/inc/farm.php b/inc/farm.php
index 4cbffc99f..8434e3067 100644
--- a/inc/farm.php
+++ b/inc/farm.php
@@ -41,12 +41,15 @@ if(!defined('DOKU_FARM')) define('DOKU_FARM', false);
*/
function conf_path($farm) {
- // htaccess based
- if(isset($_REQUEST['animal'])) {
- if(!is_dir($farm.'/'.$_REQUEST['animal']))
+ // htaccess based or cli
+ // cli usage example: animal=your_animal bin/indexer.php
+ if(isset($_REQUEST['animal']) || ('cli' == php_sapi_name() && isset($_SERVER['animal']))) {
+ $mode = isset($_REQUEST['animal']) ? 'htaccess' : 'cli';
+ $animal = $mode == 'htaccess' ? $_REQUEST['animal'] : $_SERVER['animal'];
+ if(!is_dir($farm.'/'.$animal))
nice_die("Sorry! This Wiki doesn't exist!");
- if(!defined('DOKU_FARM')) define('DOKU_FARM', 'htaccess');
- return $farm.'/'.$_REQUEST['animal'].'/conf/';
+ if(!defined('DOKU_FARM')) define('DOKU_FARM', $mode);
+ return $farm.'/'.$animal.'/conf/';
}
// virtual host based