Alexander Nicolaysen Sørnes : distribution: Change 'queued' to 'state'

Chris Morgan cmorgan at winehq.org
Tue Dec 11 12:02:00 CST 2007


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

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Mon Dec 10 22:35:45 2007 +0100

distribution: Change 'queued' to 'state'

---

 include/distribution.php |   40 ++++++++++++++++++++--------------------
 tables/distributions.sql |    2 +-
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/include/distribution.php b/include/distribution.php
index ef2c5be..16fc41b 100644
--- a/include/distribution.php
+++ b/include/distribution.php
@@ -13,7 +13,7 @@ class distribution {
     var $sUrl;
     var $sSubmitTime;
     var $iSubmitterId;
-    var $sQueued;
+    var $sState;
     var $aTestingIds;
 
      // constructor, fetches the data.
@@ -41,7 +41,7 @@ class distribution {
             $this->sUrl = $oRow->url;
             $this->sSubmitTime = $oRow->submitTime;
             $this->iSubmitterId = $oRow->submitterId;
-            $this->sQueued = $oRow->queued;
+            $this->sState = $oRow->state;
         }
 
         /*
@@ -101,12 +101,12 @@ class distribution {
         }
 
         $hResult = query_parameters("INSERT INTO distributions (name, url, submitTime, ".
-                                    "submitterId, queued) ".
+                                    "submitterId, state) ".
                                     "VALUES ('?', '?', ?, '?', '?')",
                                     $this->sName, $this->sUrl,
                                     "NOW()",
                                     $_SESSION['current']->iUserId,
-                                    $this->mustBeQueued() ? "true" : "false");
+                                    $this->mustBeQueued() ? 'queued' : 'accepted');
         if($hResult)
         {
             $this->iDistributionId = query_appdb_insert_id();
@@ -149,7 +149,7 @@ class distribution {
            everyone to delete a queued, empty distribution, because it should be
            deleted along with the last testData associated with it */
         if(!($this->canEdit() || (!sizeof($this->aTestingIds) &&
-                $this->sQueued != "false")))
+                $this->sState != 'accepted')))
             return false;
 
         // if the distribution has test results only enable an admin to delete
@@ -184,13 +184,13 @@ class distribution {
             return FALSE;
 
         // If we are not in the queue, we can't move the Distribution out of the queue.
-        if(!$this->sQueued == 'true')
+        if($this->sState != 'queued')
             return false;
 
-        if(query_parameters("UPDATE distributions SET queued = '?' WHERE distributionId = '?'",
-                            "false", $this->iDistributionId))
+        if(query_parameters("UPDATE distributions SET state = '?' WHERE distributionId = '?'",
+                            'accepted', $this->iDistributionId))
         {
-            $this->sQueued = 'false';
+            $this->sState = 'accepted';
             // we send an e-mail to interested people
             $this->mailSubmitter("add");
             $this->SendNotificationMail();
@@ -211,7 +211,7 @@ class distribution {
         }
 
         // If we are not in the queue, we can't move the Distribution out of the queue.
-        if(!$this->sQueued == 'true')
+        if($this->sState != 'queued')
             return false;
 
         return $this->delete();
@@ -254,10 +254,10 @@ class distribution {
         if(query_parameters("UPDATE testResults SET queued = '?' WHERE testingId = '?'",
                             "true", $this->iTestingId))
         {
-            if(query_parameters("UPDATE distribution SET queued = '?' WHERE distributionId = '?'",
-                                "true", $this->iDistributionId))
+            if(query_parameters("UPDATE distribution SET state = '?' WHERE distributionId = '?'",
+                                'queued', $this->iDistributionId))
             {
-                $this->sQueued = 'true';
+                $this->sState = 'queued';
                 // we send an e-mail to interested people
                 $this->SendNotificationMail();
 
@@ -351,7 +351,7 @@ class distribution {
         switch($sAction)
         {
             case "add":
-                if($this->sQueued == "false")
+                if($this->sState == 'accepted')
                 {
                     $sSubject = "Distribution ".$this->sName." added by ".
                             $_SESSION['current']->sRealname;
@@ -458,8 +458,8 @@ class distribution {
             return FALSE;
 
         $hResult = query_parameters("SELECT count(distributionId) as num_dists FROM
-                                     distributions WHERE queued='?'",
-                                    $bQueued ? "true" : "false");
+                                     distributions WHERE state='?'",
+                                    $bQueued ? 'queued' : 'accepted');
 
         if($hResult)
         {
@@ -473,7 +473,7 @@ class distribution {
     function make_distribution_list($varname, $cvalue)
     {
         $sQuery = "SELECT name, distributionId FROM distributions
-                WHERE queued = 'false'
+                WHERE state = 'accepted'
                 ORDER BY name";
         $hResult = query_parameters($sQuery);
         if(!$hResult) return;
@@ -528,9 +528,9 @@ class distribution {
             $iRows = distribution::objectGetEntriesCount($bQueued, $bRejected);
 
         $sQuery = "SELECT * FROM distributions
-                       WHERE queued = '?' ORDER BY $sOrderBy $sOrder LIMIT ?,?";
+                       WHERE state = '?' ORDER BY $sOrderBy $sOrder LIMIT ?,?";
 
-        return query_parameters($sQuery, $bQueued ? "true" : "false",
+        return query_parameters($sQuery, $bQueued ? 'queued' : 'accepted',
                                 $iStart, $iRows);
     }
 
@@ -564,7 +564,7 @@ class distribution {
 
         /* Maintainers are allowed to process queued test results and therefore also
            queued distributions */
-        if(is_object($this) && $this->sQueued != "false" &&
+        if(is_object($this) && $this->sState != 'accepted' &&
            maintainer::isUserMaintainer($_SESSION['current']))
             return TRUE;
 
diff --git a/tables/distributions.sql b/tables/distributions.sql
index ab0ef31..d628eae 100644
--- a/tables/distributions.sql
+++ b/tables/distributions.sql
@@ -11,7 +11,7 @@ create table distributions (
         url                 varchar(255) default NULL,
         submitTime          datetime NOT NULL,
         submitterId         int(11) NOT NULL default '0',
-        queued              enum('true','false','rejected') NOT NULL default 'false',
+        state               enum('accepted','queued') NOT NULL default 'accepted',
         key(distributionId),
         index(name)
 );




More information about the wine-cvs mailing list