Module: appdb
Branch: master
Commit: 077ecab9f9044a593af0a70266149e5557442c33
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=077ecab9f9044a593af0a702…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com>
Date: Sun Jun 28 15:41:54 2009 +0200
Fix Potential Duplicates table when viewing a non-queued app
---
include/application_queue.php | 4 ++--
include/util.php | 19 ++++++++++++++-----
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/include/application_queue.php b/include/application_queue.php
index c3c51d1..5710cba 100644
--- a/include/application_queue.php
+++ b/include/application_queue.php
@@ -291,10 +291,10 @@ class application_queue
function displayDuplicates()
{
echo "<b>Like matches</b><br />\n";
- $this->displayDuplicateTable(searchForApplication($this->oApp->sName));
+ $this->displayDuplicateTable(searchForApplication($this->oApp->sName, $this->oApp->objectGetId()));
echo "<br />\n";
echo "<b>Partial matches</b><br />\n";
- $this->displayDuplicateTable(searchForApplicationPartial($this->oApp->sName));
+ $this->displayDuplicateTable(searchForApplicationPartial($this->oApp->sName, $this->oApp->objectGetId()));
}
function displayDuplicateTable($hResult)
diff --git a/include/util.php b/include/util.php
index 5d9cb8b..a8bce6c 100644
--- a/include/util.php
+++ b/include/util.php
@@ -443,8 +443,9 @@ function cleanupSearchWords($search_words)
/* A common error for users is to submit a new app entry for a new app version,
such as C&C Red Alert 2 Yuri's Revenge when we already have C&C Red Alert 2.
- Search for the first word in the search query */
-function searchForApplicationPartial($sSearchWords)
+ Search for the first word in the search query.
+ iExcludeAppId can be useful when showing a list of duplicate entries */
+function searchForApplicationPartial($sSearchWords, $iExcludeAppId = null)
{
/* This would yield too many results and stress MySQL */
if(strlen($sSearchWords) < 4)
@@ -474,14 +475,18 @@ function searchForApplicationPartial($sSearchWords)
}
}
+ $sExcludeApps = '';
+ if($iExcludeAppId && is_numeric($iExcludeAppId))
+ $sExcludeApps = " AND appId != '$iExcludeAppId' ";
+
$hResult = query_parameters("SELECT * FROM appFamily WHERE state = 'accepted' AND
- (appName LIKE '?%' OR appName LIKE '?')", $sSearchString.$sEnsureExactWord, $sSearchString);
+ (appName LIKE '?%' OR appName LIKE '?')$sExcludeApps", $sSearchString.$sEnsureExactWord, $sSearchString);
return $hResult;
}
/* search the database and return a hResult from the query_appdb() */
-function searchForApplication($search_words)
+function searchForApplication($search_words, $iExcludeAppId = null)
{
/* This would yield too many results and stress MySQL */
if(strlen($search_words) < 4)
@@ -505,6 +510,10 @@ function searchForApplication($search_words)
$search_words = str_replace(' ', '%', query_escape_string($search_words));
+ $sExcludeApps = '';
+ if($iExcludeAppId && is_numeric($iExcludeAppId))
+ $sExcludeApps = " AND appId != '$iExcludeAppId' ";
+
/* base query */
$sQuery = "SELECT *
FROM appFamily
@@ -513,7 +522,7 @@ function searchForApplication($search_words)
AND (appName LIKE '%?%'
OR keywords LIKE '%?%'";
- $sQuery.=" ) ORDER BY appName";
+ $sQuery.=" ) $sExcludeApps ORDER BY appName";
$hResult = query_parameters($sQuery, $search_words, $search_words);
return $hResult;
Module: appdb
Branch: master
Commit: 9f52eca642bb3a1814b92260575290844c5b056d
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=9f52eca642bb3a1814b92260…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com>
Date: Sun Jun 28 14:37:38 2009 +0200
Properly handle queued apps with more than one version
---
include/application_queue.php | 12 ++++++++++++
include/version.php | 3 +++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/application_queue.php b/include/application_queue.php
index c2b31e2..c3c51d1 100644
--- a/include/application_queue.php
+++ b/include/application_queue.php
@@ -99,6 +99,18 @@ class application_queue
$this->oApp->unQueue();
$this->oVersionQueue->unQueue();
+
+ /* Has anyone submitted new versions while the app was queued?
+ If so we need to change their state from pending to queued */
+ $aOtherVersions = $this->oApp->objectGetChildrenClassSpecific('version');
+ foreach($aOtherVersions as $oVersion)
+ {
+ if($oVersion->objectGetState() == 'pending')
+ {
+ $oVersion->objectSetState('queued');
+ $oVersion->update();
+ }
+ }
}
function reQueue()
diff --git a/include/version.php b/include/version.php
index 055a530..b1bceae 100644
--- a/include/version.php
+++ b/include/version.php
@@ -247,6 +247,9 @@ class version {
}
}
+ if($this->objectGetState() != $oVersion->objectGetState())
+ query_parameters("UPDATE appVersion SET state = '?' WHERE versionId = '?'", $this->objectGetState(), $this->objectGetId());
+
if($sWhatChanged and !$bSilent)
$this->SendNotificationMail("edit",$sWhatChanged);
return true;
Module: appdb
Branch: master
Commit: a3031b6e218d88765a47bed1bdb37e307f9132df
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=a3031b6e218d88765a47bed1…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com>
Date: Sun Jun 28 14:11:52 2009 +0200
objectManager: Don't attempt to show deleted entries
---
include/application.php | 3 ---
include/objectManager.php | 4 ++++
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/application.php b/include/application.php
index f342345..137580c 100644
--- a/include/application.php
+++ b/include/application.php
@@ -745,9 +745,6 @@ class Application {
{
$sError = 'You do not have permission to view this entry';
- if($this->objectGetState() == 'deleted')
- $sError = 'This entry has been deleted; it\'s contents may have been moved to another entry';
-
objectManager::error_exit($sError);
}
diff --git a/include/objectManager.php b/include/objectManager.php
index a695cda..dd6edfd 100644
--- a/include/objectManager.php
+++ b/include/objectManager.php
@@ -1303,6 +1303,10 @@ class ObjectManager
if(!$oObject->objectGetId())
$this->error_exit("Entry not found (class: {$this->sClass}, id: {$this->iId})");
+ /* Check if the entry has been deleted */
+ if($oObject->objectGetState() == 'deleted')
+ $this->error_exit("This entry has been deleted (class: {$this->sClass}, id: {$this->iId})<br />Its content may have been moved to another entry");
+
$aVars = $this->get_custom_vars($aClean, "view");
echo "<br />";