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

Alexandru Băluț alexandru.balut at gmail.com
Mon Jun 21 16:18:26 CDT 2010


The second argument when calling the constructor should be a "row",
not a boolean value.
-------------- next part --------------
From 48f812eb3817a09e009e2228312b92e6028890a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20B=C4=83lu=C8=9B?= <alexandru.balut at gmail.com>
Date: Mon, 21 Jun 2010 22:59:01 +0200
Subject: Fixed a bug in Url.create(): after creating a table row, the object is not updated properly
To: wine-patches <alexandru.balut at gmail.com>
Reply-To: wine-devel <wine-devel at winehq.org>

---
 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();
-- 
1.7.0.4


More information about the wine-patches mailing list