Remove debug printing from cleanup script now that the bug in user.php has been fixed
This commit is contained in:
@@ -23,7 +23,6 @@ notifyAdminsOfCleanupStart();
|
|||||||
|
|
||||||
/* users inactive for 6 months that haven't been warned already */
|
/* users inactive for 6 months that haven't been warned already */
|
||||||
$hUsersToWarn = unwarnedAndInactiveSince(6);
|
$hUsersToWarn = unwarnedAndInactiveSince(6);
|
||||||
notifyAdminsOfProgress("Got through unwarnedAndInactiveSince");
|
|
||||||
if($hUsersToWarn)
|
if($hUsersToWarn)
|
||||||
{
|
{
|
||||||
while($oRow = mysql_fetch_object($hUsersToWarn))
|
while($oRow = mysql_fetch_object($hUsersToWarn))
|
||||||
@@ -31,18 +30,11 @@ if($hUsersToWarn)
|
|||||||
$usersWarned++;
|
$usersWarned++;
|
||||||
$oUser = new User($oRow->userid);
|
$oUser = new User($oRow->userid);
|
||||||
$oUser->warnForInactivity();
|
$oUser->warnForInactivity();
|
||||||
|
|
||||||
/* every 25 users send a progress email */
|
|
||||||
if(($usersWarned % 25) == 0)
|
|
||||||
emailProgress(0, $usersWarned);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyAdminsOfProgress("in the middle between warning and deleting");
|
|
||||||
|
|
||||||
/* warned >= 1 month ago */
|
/* warned >= 1 month ago */
|
||||||
$hUsersToDelete = warnedSince(1);
|
$hUsersToDelete = warnedSince(1);
|
||||||
notifyAdminsOfProgress("Got through warnedSince");
|
|
||||||
if($hUsersToDelete)
|
if($hUsersToDelete)
|
||||||
{
|
{
|
||||||
while($oRow = mysql_fetch_object($hUsersToDelete))
|
while($oRow = mysql_fetch_object($hUsersToDelete))
|
||||||
@@ -62,12 +54,6 @@ if($hUsersToDelete)
|
|||||||
|
|
||||||
$usersWithData++;
|
$usersWithData++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* every 25 users send a progress email */
|
|
||||||
if(($usersDeleted % 25) == 0)
|
|
||||||
emailProgress(1, $usersDeleted);
|
|
||||||
if(($usersWithData % 25) == 0)
|
|
||||||
emailProgress(2, $usersWithData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,10 +64,7 @@ notifyAdminsOfCleanupExecution($usersWarned, $usersDeleted, $usersWithData);
|
|||||||
function unwarnedAndInactiveSince($iMonths)
|
function unwarnedAndInactiveSince($iMonths)
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT userid FROM user_list WHERE DATE_SUB(CURDATE(),INTERVAL $iMonths MONTH) >= stamp AND inactivity_warned='false'";
|
$sQuery = "SELECT userid FROM user_list WHERE DATE_SUB(CURDATE(),INTERVAL $iMonths MONTH) >= stamp AND inactivity_warned='false'";
|
||||||
notifyAdminsOfProgress("in unwarnedAndInactiveSince ".$sQuery);
|
|
||||||
$hResult = query_appdb($sQuery);
|
$hResult = query_appdb($sQuery);
|
||||||
notifyAdminsOfProgress("in unwarnedAndInactiveSince after $hResult");
|
|
||||||
notifyAdminsOfProgress("retrieved ".mysql_num_rows($hResult)." rows");
|
|
||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,36 +117,4 @@ function notifyAdminsOfCleanupExecution($usersWarned, $usersDeleted, $usersWithD
|
|||||||
$sEmail = get_notify_email_address_list(null, null); /* get list admins */
|
$sEmail = get_notify_email_address_list(null, null); /* get list admins */
|
||||||
if($sEmail)
|
if($sEmail)
|
||||||
mail_appdb($sEmail, $sSubject, $sMsg);
|
mail_appdb($sEmail, $sSubject, $sMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* email all admins that the appdb cleanup script is executing */
|
|
||||||
/* so we admins have some visibility into the background cleanup */
|
|
||||||
/* events of the appdb */
|
|
||||||
function notifyAdminsOfProgress($sMsg="")
|
|
||||||
{
|
|
||||||
$sSubject = "Cleanup script progress\r\n";
|
|
||||||
$sMsg .= "Appdb cleanup cron script is processing warnings and processing deletions.\r\n";
|
|
||||||
$sEmail = "cmorgan@alum.wpi.edu";
|
|
||||||
if($sEmail)
|
|
||||||
mail_appdb($sEmail, $sSubject, $sMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* email all admins that the appdb cleanup script is executing */
|
|
||||||
/* so we admins have some visibility into the background cleanup */
|
|
||||||
/* events of the appdb */
|
|
||||||
function emailProgress($value, $processedNumber)
|
|
||||||
{
|
|
||||||
$sSubject = "Cleanup script is processing\r\n";
|
|
||||||
if($value == 0)
|
|
||||||
$sMsg = "warning processed: ".$processedNumber;
|
|
||||||
else if($value == 1)
|
|
||||||
$sMsg = "deleting processed: ".$processedNumber;
|
|
||||||
else if($value == 2)
|
|
||||||
$sMsg = "deleting with data: ".$processedNumber;
|
|
||||||
|
|
||||||
$sEmail = "cmorgan@alum.wpi.edu";
|
|
||||||
if($sEmail)
|
|
||||||
mail_appdb($sEmail, $sSubject, $sMsg);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user