From f31d5b73c07fa4e2b21cfe3b28bdec1e76f7897f Mon Sep 17 00:00:00 2001 From: andi Date: Mon, 24 Jan 2005 21:03:09 +0100 Subject: new versionstring method darcs-hash:20050124200309-9977f-fda536f83c08a38d56f77a09bd99abdd1745e2fb.gz --- inc/common.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index dc50028b8..a76b247dd 100644 --- a/inc/common.php +++ b/inc/common.php @@ -889,8 +889,7 @@ function setCorrectLocale(){ * @author Aidan Lister * @version 1.0.0 */ -function filesize_h($size, $dec = 1) -{ +function filesize_h($size, $dec = 1){ $sizes = array('B', 'KB', 'MB', 'GB'); $count = count($sizes); $i = 0; @@ -903,6 +902,28 @@ function filesize_h($size, $dec = 1) return round($size, $dec) . ' ' . $sizes[$i]; } +/** + * Run a few sanity checks + * + * @author Andreas Gohr + */ +function getVersion(){ + //import version string + if(@file_exists('VERSION')){ + //official release + return 'Release '.io_readfile('VERSION'); + }elseif(is_dir('_darcs')){ + //darcs checkout + $inv = file('_darcs/inventory'); + $inv = preg_grep('#andi@splitbrain\.org\*\*\d{14}#',$inv); + $cur = array_pop($inv); + preg_match('#\*\*(\d{4})(\d{2})(\d{2})#',$cur,$matches); + return 'Darcs '.$matches[1].'-'.$matches[2].'-'.$matches[3]; + }else{ + return 'snapshot?'; + } +} + /** * Run a few sanity checks * @@ -912,6 +933,8 @@ function check(){ global $conf; global $INFO; + msg('DokuWiki version: '.getVersion(),1); + if(version_compare(phpversion(),'4.3.0','<')){ msg('Your PHP version is too old ('.phpversion().' vs. 4.3.+ recommended)',-1); }elseif(version_compare(phpversion(),'4.3.10','<')){ -- cgit v1.2.3