Move deletion of maintainer logic into the user class. If the cleanup script wants to delete a user and can't, if they are a maintainer we should remove their maintainer status even if we don't delete their account. Send email at the start of the cleanup script to aid in debug

This commit is contained in:
Chris Morgan
2005-09-30 01:37:57 +00:00
committed by WineHQ
parent b067e62789
commit a66ae25f38
3 changed files with 56 additions and 12 deletions

View File

@@ -315,6 +315,35 @@ class User {
return $statusMessage;
}
/* remove maintainership */
/* if $iAppId and $iVersionId are null, delete all maintainership for this user */
function deleteMaintainer($iAppId = null, $iVersionId = null)
{
/* remove supermaintainer */
if($iAppId && ($iVersionId == null))
{
$superMaintainer = 1;
$sQuery = "DELETE FROM appMaintainers WHERE userId = ".$this->iUserId.
" AND appId = ".$iAppId." AND superMaintainer = ".$superMaintainer.";";
} else if($iAppId && $iVersionId) /* remove a normal maintainer */
{
$superMaintainer = 0;
$sQuery = "DELETE FROM appMaintainers WHERE userId = ".$this->iUserId.
" AND appId = ".$iAppId." AND versionId = ".$iVersionId." AND superMaintainer = ".$superMaintainer.";";
} else if(($iAppId == null) && ($iVersionId == null)) /* remove all maintainership by this user */
{
$sQuery = "DELETE FROM appMaintainers WHERE userId = ".$this->iUserId.";";
}
if($sQuery)
{
if($result = query_appdb($sQuery))
return true;
}
return false;
}
/* get the number of queued applications */
function getQueuedAppCount()
{