summaryrefslogtreecommitdiff
path: root/inc/infoutils.php
diff options
context:
space:
mode:
authorAnika Henke <anika@selfthinker.org>2009-11-15 13:42:44 +0100
committerAnika Henke <anika@selfthinker.org>2009-11-15 13:42:44 +0100
commit25c07f932486a6a46d6a29a5e7602556b4cfc6a4 (patch)
treebe68b832428bc0163e03092a7556c911fec86576 /inc/infoutils.php
parent4646b5843386d140d6c6796a19081a59e02c0b17 (diff)
downloadrpg-25c07f932486a6a46d6a29a5e7602556b4cfc6a4.tar.gz
rpg-25c07f932486a6a46d6a29a5e7602556b4cfc6a4.tar.bz2
added getVersionData() additionally to getVersion() to get version date and type independently
darcs-hash:20091115124244-f7d6d-fa481e7c3ebf5ae5ab1203e8774ab81e122e14a0.gz
Diffstat (limited to 'inc/infoutils.php')
-rw-r--r--inc/infoutils.php31
1 files changed, 25 insertions, 6 deletions
diff --git a/inc/infoutils.php b/inc/infoutils.php
index 0be050ce5..bf8554692 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -44,22 +44,27 @@ function checkUpdateMessages(){
/**
- * Return DokuWikis version
+ * Return DokuWiki's version (split up in date and type)
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function getVersion(){
+function getVersionData(){
+ $version = array();
//import version string
if(@file_exists(DOKU_INC.'VERSION')){
//official release
- return 'Release '.trim(io_readfile(DOKU_INC.'VERSION'));
+ $version['date'] = trim(io_readfile(DOKU_INC.'VERSION'));
+ $version['type'] = 'Release';
+ return $version;
}elseif(is_dir(DOKU_INC.'_darcs')){
if(is_file(DOKU_INC.'_darcs/inventory')){
$inventory = DOKU_INC.'_darcs/inventory';
}elseif(is_file(DOKU_INC.'_darcs/hashed_inventory')){
$inventory = DOKU_INC.'_darcs/hashed_inventory';
}else{
- return 'Darcs unknown';
+ $version['date'] = 'unknown';
+ $version['type'] = 'Darcs';
+ return $version;
}
//darcs checkout - read last 2000 bytes of inventory
@@ -72,13 +77,27 @@ function getVersion(){
$inv = preg_grep('#\*\*\d{14}[\]$]#',explode("\n",$chunk));
$cur = array_pop($inv);
preg_match('#\*\*(\d{4})(\d{2})(\d{2})#',$cur,$matches);
- return 'Darcs '.$matches[1].'-'.$matches[2].'-'.$matches[3];
+ $version['date'] = $matches[1].'-'.$matches[2].'-'.$matches[3];
+ $version['type'] = 'Darcs';
+ return $version;
}else{
- return 'snapshot?';
+ $version['date'] = 'unknown';
+ $version['type'] = 'snapshot?';
+ return $version;
}
}
/**
+ * Return DokuWiki's version (as a string)
+ *
+ * @author Anika Henke <anika@selfthinker.org>
+ */
+function getVersion(){
+ $version = getVersionData();
+ return $version['type'].' '.$version['date'];
+}
+
+/**
* Run a few sanity checks
*
* @author Andreas Gohr <andi@splitbrain.org>