diff options
author | andi <andi@splitbrain.org> | 2005-06-26 12:09:13 +0200 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-06-26 12:09:13 +0200 |
commit | 98407a7ab8cdc6e868009187f47cc7768449a3c9 (patch) | |
tree | 81ff92e45a1ec0db93dadbbf24fbab1f17cea434 /inc/init.php | |
parent | d477fdcf1c8e21ef479942fe1d14acb7991d8a4a (diff) | |
download | rpg-98407a7ab8cdc6e868009187f47cc7768449a3c9.tar.gz rpg-98407a7ab8cdc6e868009187f47cc7768449a3c9.tar.bz2 |
directory cleanup
This cleans up the directory structure as discussed on the mailning
list. Users should delete their previous _cache directories to
recover diskspace.
darcs-hash:20050626100913-9977f-83c0fdc32047db2090fc52a843ffae50cbf12248.gz
Diffstat (limited to 'inc/init.php')
-rw-r--r-- | inc/init.php | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/inc/init.php b/inc/init.php index ba24d7ced..370e308b7 100644 --- a/inc/init.php +++ b/inc/init.php @@ -66,18 +66,8 @@ // remember original umask $conf['oldumask'] = umask(); - // make absolute mediaweb - if(!preg_match('#^(https?://|/)#i',$conf['mediaweb'])){ - $conf['mediaweb'] = getBaseURL().$conf['mediaweb']; - } - // make real paths and check them - $conf['datadir'] = init_path($conf['datadir']); - if(!$conf['datadir']) die('Wrong datadir! Check config!'); - $conf['olddir'] = init_path($conf['olddir']); - if(!$conf['olddir']) die('Wrong olddir! Check config!'); - $conf['mediadir'] = init_path($conf['mediadir']); - if(!$conf['mediadir']) die('Wrong mediadir! Check config!'); + init_paths(); // automatic upgrade to script versions of certain files scriptify(DOKU_INC.'conf/users.auth'); @@ -85,15 +75,37 @@ /** + * Checks paths from config file + */ +function init_paths(){ + global $conf; + + $paths = array('datadir' => 'pages', + 'olddir' => 'attic', + 'mediadir' => 'media', + 'metadir' => 'meta', + 'cachedir' => 'cache', + 'lockdir' => 'locks', + 'changelog' => 'changes.log'); + + foreach($paths as $c => $p){ + + if(!$conf[$c]) $conf[$c] = $conf['savedir'].'/'.$p; + $conf[$c] = init_path($conf[$c]); + if(!$conf[$c]) die("$c does not exist or isn't writable. Check config!"); + } +} + +/** * returns absolute path * - * This tries the given past first, then checks in DOKU_INC + * This tries the given path first, then checks in DOKU_INC */ function init_path($path){ $p = realpath($path); - if(is_dir($p)) return $p; + if(@file_exists($p)) return $p; $p = realpath(DOKU_INC.$path); - if(is_dir($p)) return $p; + if(@file_exists($p)) return $p; return ''; } |