diff --git a/appdbStats.php b/appdbStats.php
index abc0afa..26e1849 100644
--- a/appdbStats.php
+++ b/appdbStats.php
@@ -42,6 +42,12 @@ echo "
Inactive users (not logged in since six months): | \n";
echo " ".(get_number_of_users()-get_active_users_within_days(183))." | \n";
echo "\n\n";
+/* Display the users who were warned and pending deletion */
+echo "\n";
+echo " | Inactive users pending deletion: | \n";
+echo " ".get_inactive_users_pending_deletion()." | \n";
+echo "
\n\n";
+
/* Display the number of comments */
echo "\n";
echo " | Comments: | \n";
diff --git a/cron/cleanup.php b/cron/cleanup.php
index 35fceb7..b744fec 100644
--- a/cron/cleanup.php
+++ b/cron/cleanup.php
@@ -124,11 +124,7 @@ function notifyAdminsOfCleanupStart()
/* events of the appdb */
function notifyAdminsOfCleanupExecution($usersWarned, $usersUnwarnedWithData, $usersDeleted, $usersWithData)
{
- /* retrieve the number of users that have been warned and are pending deletion */
- $sQuery = "select count(*) as count from user_list where inactivity_warned = 'true'";
- $hResult = query_appdb($sQuery);
- $oRow = mysql_fetch_object($hResult);
- $warnedUsers = $oRow->count;
+ $warnedUsers = get_inactive_users_pending_deletion();
$sSubject = "Cleanup script summary\r\n";
$sMsg = "Appdb cleanup cron script executed.\r\n";
diff --git a/include/user.php b/include/user.php
index 103e39c..1c481b8 100644
--- a/include/user.php
+++ b/include/user.php
@@ -882,6 +882,19 @@ function get_active_users_within_days($days)
}
+/**
+ * Get the count of users who have been warned for inactivity and are
+ * pending deletion after the X month grace period
+ */
+function get_inactive_users_pending_deletion()
+{
+ /* retrieve the number of users that have been warned and are pending deletion */
+ $sQuery = "select count(*) as count from user_list where inactivity_warned = 'true'";
+ $hResult = query_appdb($sQuery);
+ $oRow = mysql_fetch_object($hResult);
+ return $oRow->count;
+}
+
/**
* Check if a user exists.
* returns the userid if the user exists