Use object manager to process screenshot queue. Temporary fix for mysql overloading by
limiting screenshot processing to submitters.
This commit is contained in:
committed by
WineHQ
parent
ad2f0a0504
commit
e9060a68d5
@@ -8,6 +8,33 @@ require_once(BASE."include/util.php");
|
|||||||
|
|
||||||
class appData
|
class appData
|
||||||
{
|
{
|
||||||
|
var $iId;
|
||||||
|
var $iAppId;
|
||||||
|
var $iVersionId;
|
||||||
|
var $iSubmitterId;
|
||||||
|
var $sSubmitTime;
|
||||||
|
|
||||||
|
function appData($iId = null, $oRow = null)
|
||||||
|
{
|
||||||
|
if(!$iId)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!$oRow)
|
||||||
|
{
|
||||||
|
$hResult = query_parameters("SELECT * FROM appData WHERE $iId = '?'", $iId);
|
||||||
|
$oRow = mysql_fetch_object();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($oRow)
|
||||||
|
{
|
||||||
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
|
$this->iAppId = $oRow->appId;
|
||||||
|
$this->iVersionId = $oRow->versionId;
|
||||||
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
|
$this->iId = $iId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function listSubmittedBy($iUserId, $bQueued = true)
|
function listSubmittedBy($iUserId, $bQueued = true)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT appData.TYPE, appData.appId,
|
$hResult = query_parameters("SELECT appData.TYPE, appData.appId,
|
||||||
@@ -78,10 +105,10 @@ class appData
|
|||||||
if(($sQueued == "true" || $sQueued == "all") && !appData::canEdit($sType))
|
if(($sQueued == "true" || $sQueued == "all") && !appData::canEdit($sType))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if(($sQueued == "true" || $sQueued == "all") &&
|
/* if(($sQueued == "true" || $sQueued == "all") &&
|
||||||
!$_SESSION['current']->hasPriv("admin"))
|
!$_SESSION['current']->hasPriv("admin"))
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT COUNT(DISTINCT id) as count FROM appData, appMaintainers,
|
$sQuery = "SELECT COUNT(DISTINCT id) as count FROM appData, appMaintainers,
|
||||||
appVersion, appFamily
|
appVersion, appFamily
|
||||||
WHERE appMaintainers.userId = '?' AND
|
WHERE appMaintainers.userId = '?' AND
|
||||||
((((appMaintainers.appId = appFamily.appId) OR appMaintainers.appId =
|
((((appMaintainers.appId = appFamily.appId) OR appMaintainers.appId =
|
||||||
@@ -99,7 +126,7 @@ class appData
|
|||||||
|
|
||||||
if($sType)
|
if($sType)
|
||||||
{
|
{
|
||||||
$sQuery = " AND type = '?'";
|
$sQuery .= " AND type = '?'";
|
||||||
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
||||||
$sType);
|
$sType);
|
||||||
} else {
|
} else {
|
||||||
@@ -111,17 +138,31 @@ class appData
|
|||||||
appFamily, appVersion
|
appFamily, appVersion
|
||||||
WHERE ((appData.appId = appFamily.appId) OR (appData.versionId =
|
WHERE ((appData.appId = appFamily.appId) OR (appData.versionId =
|
||||||
appVersion.versionId)) AND appVersion.queued = 'false' AND
|
appVersion.versionId)) AND appVersion.queued = 'false' AND
|
||||||
appFamily.queued = 'false'";
|
appFamily.queued = 'false'";*/
|
||||||
|
|
||||||
|
$sQuery = "SELECT COUNT(*) as count FROM appData WHERE 1";
|
||||||
|
|
||||||
if($sQueued == "true" || $sQueued == "false")
|
if($sQueued == "true" || $sQueued == "false")
|
||||||
$sQuery .= " AND appData.queued = '$sQueued'";
|
$sQuery .= " AND appData.queued = '$sQueued'";
|
||||||
|
|
||||||
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
|
{
|
||||||
if($sType)
|
if($sType)
|
||||||
{
|
{
|
||||||
$sQuery .= " AND type = '?'";
|
$sQuery .= " AND type = '?'";
|
||||||
$hResult = query_parameters($sQuery,$sType);
|
$hResult = query_parameters($sQuery, $sType);
|
||||||
} else
|
} else
|
||||||
$hResult = query_parameters($sQuery);
|
$hResult = query_parameters($sQuery);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sQuery .= " AND submitterId = '?'";
|
||||||
|
if($sType)
|
||||||
|
{
|
||||||
|
$sQuery .= " AND type = '?'";
|
||||||
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
||||||
|
$sType);
|
||||||
|
} else
|
||||||
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
@@ -131,6 +172,68 @@ class appData
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return $oRow->count;
|
return $oRow->count;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectOutputHeader($sClass, $sType)
|
||||||
|
{
|
||||||
|
$aCells = array(
|
||||||
|
"Submission Date",
|
||||||
|
"Submitter",
|
||||||
|
"Application",
|
||||||
|
"Version");
|
||||||
|
|
||||||
|
if(appData::canEdit($sType))
|
||||||
|
$aCells[] = "Action";
|
||||||
|
|
||||||
|
echo html_tr($aCells, $sClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetEntries($bQueued, $sType)
|
||||||
|
{
|
||||||
|
if($bQueued && !appData::canEdit($sType))
|
||||||
|
return FALSE;
|
||||||
|
/*
|
||||||
|
if($bQueued && !$_SESSION['current']->hasPriv("admin"))
|
||||||
|
{
|
||||||
|
$sQuery = "SELECT DISTINCT appData.* FROM appData, appMaintainers,
|
||||||
|
appVersion, appFamily
|
||||||
|
WHERE appMaintainers.userId = '?' AND
|
||||||
|
((((appMaintainers.appId = appFamily.appId) OR appMaintainers.appId =
|
||||||
|
appVersion.appId) AND
|
||||||
|
appMaintainers.superMaintainer = '1' AND (appData.appId =
|
||||||
|
appMaintainers.appId OR (appData.versionId = appVersion.versionId
|
||||||
|
AND appVersion.appId = appMaintainers.appId))
|
||||||
|
) OR (appMaintainers.superMaintainer = '0' AND appMaintainers.versionId =
|
||||||
|
appVersion.versionId AND appMaintainers.versionId = appData.versionId))
|
||||||
|
AND appVersion.queued = 'false' AND
|
||||||
|
appFamily.queued = 'false' AND appData.queued = '?' AND
|
||||||
|
appData.type = '?'";
|
||||||
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
||||||
|
$bQueued ? "true" : "false", $sType);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sQuery = "SELECT DISTINCT appData.* FROM appData, appFamily, appVersion
|
||||||
|
WHERE ((appData.appId = appFamily.appId) OR (appData.versionId =
|
||||||
|
appVersion.versionId)) AND appVersion.queued = 'false' AND
|
||||||
|
appFamily.queued = 'false' AND appData.queued = '?' AND
|
||||||
|
appData.type = '?'"; */
|
||||||
|
|
||||||
|
$sQuery = "SELECT * FROM appData WHERE queued = '?' AND type = '?'";
|
||||||
|
|
||||||
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
|
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sQuery .= " AND submitterId = '?'";
|
||||||
|
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
|
||||||
|
$_SESSION['current']->iUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$hResult)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canEdit($sType = null)
|
function canEdit($sType = null)
|
||||||
@@ -148,6 +251,35 @@ class appData
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectOutputTableRow($oObject, $sClass)
|
||||||
|
{
|
||||||
|
$oVersion = new Version($this->iVersionId);
|
||||||
|
|
||||||
|
if(!$this->iAppId)
|
||||||
|
$this->iAppId = $oVersion->iAppId;
|
||||||
|
|
||||||
|
$oApp = new Application($this->iAppId);
|
||||||
|
$oUser = new User($this->iSubmitterId);
|
||||||
|
$aCells = array(
|
||||||
|
print_date(mysqldatetime_to_unixtimestamp($this->sSubmitTime)),
|
||||||
|
$oUser->sRealname,
|
||||||
|
$oApp->sName,
|
||||||
|
$this->iVersionId ? $oVersion->sName : "N/A");
|
||||||
|
|
||||||
|
if(appData::canEdit($oObject->sClass))
|
||||||
|
$aCells[] = "[ <a href=\"".BASE."admin/adminAppDataQueue.php?iId=".
|
||||||
|
"$this->iId\">Process</a> ]";
|
||||||
|
|
||||||
|
echo html_tr($aCells, $sClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectDisplayQueueProcessingHelp()
|
||||||
|
{
|
||||||
|
$sHelp = "<p>This is a list of application data submitted by users. ".
|
||||||
|
"Please inspect the data carefully before accepting or rejecting it.</p>";
|
||||||
|
echo $sHelp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -508,6 +508,41 @@ class Screenshot {
|
|||||||
}
|
}
|
||||||
return $shImg;
|
return $shImg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetEntries($bQueued)
|
||||||
|
{
|
||||||
|
return appData::objectGetEntries($bQueued, "screenshot");
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectOutputHeader($sClass)
|
||||||
|
{
|
||||||
|
return appData::objectOutputHeader($sClass, "screenshot");
|
||||||
|
}
|
||||||
|
|
||||||
|
function canEdit()
|
||||||
|
{
|
||||||
|
if($_SESSION['current']->hasPriv("admin") ||
|
||||||
|
maintainer::isUserMaintainer($_SESSION['current']))
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetInstanceFromRow($oRow)
|
||||||
|
{
|
||||||
|
return new appData($oRow->id, $oRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectOutputTableRow($oObject, $sClass)
|
||||||
|
{
|
||||||
|
$oAppData = new AppData();
|
||||||
|
$oAppData->objectOutputTableRow($oObject, $sClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectDisplayQueueProcessingHelp()
|
||||||
|
{
|
||||||
|
return appData::objectDisplayQueueProcessingHelp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -14,12 +14,18 @@ function global_admin_menu() {
|
|||||||
"false&sAction=add&sTitle=Add%20Vendor");
|
"false&sAction=add&sTitle=Add%20Vendor");
|
||||||
|
|
||||||
$g->addmisc(" ");
|
$g->addmisc(" ");
|
||||||
$g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount()."/".$_SESSION['current']->getQueuedVersionCount().")", BASE."admin/adminAppQueue.php");
|
$g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount()."/".
|
||||||
$g->add("View App Data Queue (".appData::objectGetEntriesCount("true").")",
|
$_SESSION['current']->getQueuedVersionCount().")",
|
||||||
BASE."admin/adminAppDataQueue.php");
|
BASE."admin/adminAppQueue.php");
|
||||||
|
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
||||||
|
"screenshot").")",
|
||||||
|
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
||||||
|
"Screenshot%20Queue");
|
||||||
$g->add("View Maintainer Queue (".Maintainer::getQueuedMaintainerCount().")",
|
$g->add("View Maintainer Queue (".Maintainer::getQueuedMaintainerCount().")",
|
||||||
BASE."objectManager.php?sClass=maintainer&bIsQueue=true&sTitle=Maintainer%20Queue");
|
BASE."objectManager.php?sClass=maintainer&bIsQueue=true&sTitle=".
|
||||||
$g->add("View Maintainer Entries (".Maintainer::getMaintainerCount().")", BASE."admin/adminMaintainers.php");
|
"Maintainer%20Queue");
|
||||||
|
$g->add("View Maintainer Entries (".Maintainer::getMaintainerCount().")",
|
||||||
|
BASE."admin/adminMaintainers.php");
|
||||||
$g->add("View Bug Links (".getNumberOfQueuedBugLinks()."/".getNumberOfBugLinks().")",
|
$g->add("View Bug Links (".getNumberOfQueuedBugLinks()."/".getNumberOfBugLinks().")",
|
||||||
BASE."admin/adminBugs.php");
|
BASE."admin/adminBugs.php");
|
||||||
$g->add("View Test Results Queue (".testData::getNumberOfQueuedTests().")",
|
$g->add("View Test Results Queue (".testData::getNumberOfQueuedTests().")",
|
||||||
|
|||||||
@@ -6,9 +6,13 @@
|
|||||||
function global_maintainer_admin_menu() {
|
function global_maintainer_admin_menu() {
|
||||||
|
|
||||||
$g = new htmlmenu("Maintainer Admin");
|
$g = new htmlmenu("Maintainer Admin");
|
||||||
|
|
||||||
$g->add("View App Queue (".$_SESSION['current']->getQueuedVersionCount().")", BASE."admin/adminAppQueue.php");
|
$g->add("View App Queue (".$_SESSION['current']->getQueuedVersionCount().")",
|
||||||
$g->add("View App Data Queue (".appData::objectGetEntriesCount("true").")", BASE."admin/adminAppDataQueue.php");
|
BASE."admin/adminAppQueue.php");
|
||||||
|
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
||||||
|
"screenshot").")",
|
||||||
|
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
||||||
|
"Screenshot%20Queue");
|
||||||
$g->done();
|
$g->done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user