From afc5e13aeb41bba9cdd2e3698f92517ac78e451f Mon Sep 17 00:00:00 2001
From: Adrian Lang <lang@cosmocode.de>
Date: Thu, 10 Dec 2009 11:43:20 +0100
Subject: [PATCH] Grab version from darcs correctly and simpler

darcs-hash:20091210104320-e4919-3178a4f01fc1e1720ad86716552f4deaa52dc236.gz
---
 inc/infoutils.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/inc/infoutils.php b/inc/infoutils.php
index bf8554692..b43dd40be 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -74,10 +74,10 @@ function getVersionData(){
         fseek($fh,$seek);
         $chunk = fread($fh,2000);
         fclose($fh);
-        $inv = preg_grep('#\*\*\d{14}[\]$]#',explode("\n",$chunk));
-        $cur = array_pop($inv);
-        preg_match('#\*\*(\d{4})(\d{2})(\d{2})#',$cur,$matches);
-        $version['date'] = $matches[1].'-'.$matches[2].'-'.$matches[3];
+
+        preg_match_all('#\*\*(\d{4})(\d{2})(\d{2})\d{6}(?:\]|$)#m', $chunk, $matches,
+                       PREG_SET_ORDER);
+        $version['date'] = implode('-', array_slice(array_pop($matches), 1));
         $version['type'] = 'Darcs';
         return $version;
     }else{
-- 
GitLab