Alex Băluț : Fixed a bug in Url.create(): after creating a table row, the object is not updated properly

Alexander Nicolaysen Sørnes asornes at winehq.org
Mon Jun 21 17:02:38 CDT 2010


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

Author: Alex Băluț <alexandru.balut at gmail.com>
Date:   Mon Jun 21 22:59:01 2010 +0200

Fixed a bug in Url.create(): after creating a table row, the object is not updated properly

---

 include/url.php |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/url.php b/include/url.php
index 0419168..15d33ef 100644
--- a/include/url.php
+++ b/include/url.php
@@ -5,7 +5,10 @@
 require_once(BASE."include/util.php");
 
 /**
- * Url class for handling urls
+ * Class for handling URLs (aka Links) of applications and
+ * of application versions.
+ * 
+ * Uses the appData table to store the URLs in rows with type='url'.
  */
 class Url {
     var $iUrlId;
@@ -33,6 +36,8 @@ class Url {
                        WHERE type = 'url'
                        AND id = '?'";
             $hResult = query_parameters($sQuery, $iUrlId);
+            if(!$hResult)
+                return;
             $oRow = query_fetch_object($hResult);
         }
 
@@ -53,12 +58,14 @@ class Url {
 
     /**
      * Creates a new url.
+     * Writes the url into the appData table, then updates the object.
+     * 
+     * @param bSilent Whether to send a notification email.
+     * @return true if everything went fine.
      */
     function create($sDescription = null, $sUrl = null, $iVersionId = null,
                     $iAppId = null, $bSilent = false)
     {
-        global $aClean;
-
         // Security, if we are not an administrator or a maintainer, the url must be queued.
         if(($iAppId && !url::canEdit(NULL, $iAppId)) ||
         ($iVersionId && !url::canEdit($iVersionId)))
@@ -78,7 +85,7 @@ class Url {
         }
 
         $this->iUrlId = query_appdb_insert_id();
-        $this->url($this->iUrlId,$this->bQueued);
+        $this->Url($this->iUrlId);
 
         if(!$bSilent)
             $this->SendNotificationMail();




More information about the wine-cvs mailing list