Make sure $hUsersToWarn and $hUsersToDelete are valid before calling mysql_fetch_object() on them
This commit is contained in:
@@ -24,8 +24,10 @@ 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");
|
notifyAdminsOfProgress("Got through unwarnedAndInactiveSince");
|
||||||
while($oRow = mysql_fetch_object($hUsersToWarn))
|
if($hUsersToWarn)
|
||||||
{
|
{
|
||||||
|
while($oRow = mysql_fetch_object($hUsersToWarn))
|
||||||
|
{
|
||||||
$usersWarned++;
|
$usersWarned++;
|
||||||
$oUser = new User($oRow->userid);
|
$oUser = new User($oRow->userid);
|
||||||
$oUser->warnForInactivity();
|
$oUser->warnForInactivity();
|
||||||
@@ -33,15 +35,18 @@ while($oRow = mysql_fetch_object($hUsersToWarn))
|
|||||||
/* every 25 users send a progress email */
|
/* every 25 users send a progress email */
|
||||||
if(($usersWarned % 25) == 0)
|
if(($usersWarned % 25) == 0)
|
||||||
emailProgress(0, $usersWarned);
|
emailProgress(0, $usersWarned);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyAdminsOfProgress();
|
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");
|
notifyAdminsOfProgress("Got through warnedSince");
|
||||||
while($oRow = mysql_fetch_object($hUsersToDelete))
|
if($hUsersToDelete)
|
||||||
{
|
{
|
||||||
|
while($oRow = mysql_fetch_object($hUsersToDelete))
|
||||||
|
{
|
||||||
$oUser = new User($oRow->userid);
|
$oUser = new User($oRow->userid);
|
||||||
if(!$oUser->hasDataAssociated())
|
if(!$oUser->hasDataAssociated())
|
||||||
{
|
{
|
||||||
@@ -63,6 +68,7 @@ while($oRow = mysql_fetch_object($hUsersToDelete))
|
|||||||
emailProgress(1, $usersDeleted);
|
emailProgress(1, $usersDeleted);
|
||||||
if(($usersWithData % 25) == 0)
|
if(($usersWithData % 25) == 0)
|
||||||
emailProgress(2, $usersWithData);
|
emailProgress(2, $usersWithData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyAdminsOfCleanupExecution($usersWarned, $usersDeleted, $usersWithData);
|
notifyAdminsOfCleanupExecution($usersWarned, $usersDeleted, $usersWithData);
|
||||||
|
|||||||
Reference in New Issue
Block a user