Alexander Nicolaysen Sørnes : Merge some code to get list of Wine versions

Alexander Nicolaysen Sørnes asornes at winehq.org
Mon Jun 15 08:19:19 CDT 2009


Module: appdb
Branch: master
Commit: 70729a700c63a41da2ae3520a68dbe136b2fdb2b
URL:    http://source.winehq.org/git/appdb.git/?a=commit;h=70729a700c63a41da2ae3520a68dbe136b2fdb2b

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Mon Jun 15 15:18:39 2009 +0200

Merge some code to get list of Wine versions

---

 include/util.php |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/include/util.php b/include/util.php
index acdac5a..5d9cb8b 100644
--- a/include/util.php
+++ b/include/util.php
@@ -165,8 +165,10 @@ function get_xml_tag ($file, $mode = null)
 /* bugzilla functions */
 
 // Returns an array containg the Wine versions stored in our Bugzilla DB
-function get_bugzilla_versions()
+// If bReturnIds is true, version ids are returned instead of names
+function get_bugzilla_versions($bReturnIds = false)
 {
+    $sFetchColumn = $bReturnIds ? 'id' : 'value';
     $aVersions = array();
     $sTable = BUGZILLA_DB.".versions";
 
@@ -180,7 +182,7 @@ function get_bugzilla_versions()
     foreach($aBranches as $sBranch)
     {
         $sWhere = "WHERE product_id =".BUGZILLA_PRODUCT_ID." AND value LIKE '$sBranch%'";
-        $sQuery = "SELECT value FROM $sTable $sWhere ORDER BY id desc limit 6";
+        $sQuery = "SELECT $sFetchColumn FROM $sTable $sWhere ORDER BY id desc limit 6";
         $hResult = query_bugzilladb($sQuery);
         if($hResult)
         {
@@ -198,18 +200,7 @@ function get_bugzilla_versions()
 // Returns an array containing the IDs of the Wine versions stored in Bugzilla
 function get_bugzilla_version_ids()
 {
-    $aIds = array();
-    $hResult = query_bugzilladb("SELECT id FROM ".BUGZILLA_DB.".versions WHERE
-                                 product_id = '".BUGZILLA_PRODUCT_ID."'
-                                 ORDER BY id DESC LIMIT 6");
-
-    if(!$hResult)
-        return $aIds;
-
-    while(list($sId) = mysql_fetch_row($hResult))
-        $aIds[] = $sId;
-
-    return $aIds;
+    return get_bugzilla_versions(true);
 }
 
 // $sVarname - name of the selection array that this function will output




More information about the wine-cvs mailing list