Make sure $hUsersToWarn and $hUsersToDelete are valid before calling mysql_fetch_object() on them

This commit is contained in:
Chris Morgan
2005-10-09 17:32:59 +00:00
committed by WineHQ
parent d4740cf030
commit 1de5d7923f

View File

@@ -24,8 +24,10 @@ notifyAdminsOfCleanupStart();
/* users inactive for 6 months that haven't been warned already */
$hUsersToWarn = unwarnedAndInactiveSince(6);
notifyAdminsOfProgress("Got through unwarnedAndInactiveSince");
while($oRow = mysql_fetch_object($hUsersToWarn))
if($hUsersToWarn)
{
while($oRow = mysql_fetch_object($hUsersToWarn))
{
$usersWarned++;
$oUser = new User($oRow->userid);
$oUser->warnForInactivity();
@@ -33,15 +35,18 @@ while($oRow = mysql_fetch_object($hUsersToWarn))
/* every 25 users send a progress email */
if(($usersWarned % 25) == 0)
emailProgress(0, $usersWarned);
}
}
notifyAdminsOfProgress();
notifyAdminsOfProgress("in the middle between warning and deleting");
/* warned >= 1 month ago */
$hUsersToDelete = warnedSince(1);
notifyAdminsOfProgress("Got through warnedSince");
while($oRow = mysql_fetch_object($hUsersToDelete))
if($hUsersToDelete)
{
while($oRow = mysql_fetch_object($hUsersToDelete))
{
$oUser = new User($oRow->userid);
if(!$oUser->hasDataAssociated())
{
@@ -63,6 +68,7 @@ while($oRow = mysql_fetch_object($hUsersToDelete))
emailProgress(1, $usersDeleted);
if(($usersWithData % 25) == 0)
emailProgress(2, $usersWithData);
}
}
notifyAdminsOfCleanupExecution($usersWarned, $usersDeleted, $usersWithData);