Alexander Nicolaysen Sørnes : Allow adding downloadurl to queued versions

Chris Morgan cmorgan at winehq.org
Fri Oct 3 07:37:10 CDT 2008


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

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Fri Oct  3 13:20:45 2008 +0200

Allow adding downloadurl to queued versions

---

 include/downloadurl.php   |    5 +++++
 include/version_queue.php |   11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/include/downloadurl.php b/include/downloadurl.php
index acdfdf4..d4903da 100644
--- a/include/downloadurl.php
+++ b/include/downloadurl.php
@@ -63,6 +63,11 @@ class downloadurl
         return $sReturn;
     }
 
+    public function objectSetParent($iId, $sClass = 'version')
+    {
+        $this->iVersionId = $iId;
+    }
+
     function objectGetChildren($bIncludeDeleted = false)
     {
         /* We have none */
diff --git a/include/version_queue.php b/include/version_queue.php
index 553cb8e..db3dd01 100644
--- a/include/version_queue.php
+++ b/include/version_queue.php
@@ -33,6 +33,9 @@ class version_queue
 
         $this->oTestDataQueue = new testData_queue($iTestingId);
         $this->oDownloadUrl = new downloadurl($iDownloadUrlId);
+
+        if(!$this->oDownloadUrl->objectGetId() && $iVersionId)
+            $this->oDownloadUrl->objectSetParent($iVersionId);
     }
 
     function create()
@@ -69,7 +72,13 @@ class version_queue
     function update()
     {
         $this->oVersion->update();
-        $this->oDownloadUrl->update();
+
+        /* A downloadurl is optional and can thus be added later */
+        if($this->oDownloadUrl->objectGetId())
+            $this->oDownloadUrl->update();
+        else
+            $this->oDownloadUrl->create();
+
         $this->oTestDataQueue->update();
     }
 




More information about the wine-cvs mailing list