New function fetchUserData() introduced to API, total rewrite (not all)
[mailer.git] / inc / autopurge / purge-mails.php
index 982795f103247d9d585c98bc8b7a2c208dcee5d9..a38879112429fd3d72d2ee550c98a59918637c56 100644 (file)
@@ -65,9 +65,7 @@ if (SQL_NUMROWS($result_mails) > 0) {
        // Okay, check for their sender's
        while ($content = SQL_FETCHARRAY($result_mails)) {
                // Check now...
-               $fount = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
-                       array(bigintval($content['sender'])), __FILE__, __LINE__));
-               if ($found == 0) {
+               if (!fetchUserData($content['sender'])) {
                        // Okay we found some mails!
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_pool` WHERE `sender`=%s",
                                array(bigintval($content['sender'])), __FILE__, __LINE__);
@@ -82,9 +80,9 @@ WHERE
        `data_type`='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - {?ap_dm_timeout?})
 ORDER BY
        `sender` ASC", __FILE__, __LINE__);
-               }
-       }
-}
+               } // END - if
+       } // END - while
+} // END - if
 
 // Free memory
 SQL_FREERESULT($result_mails);
@@ -104,9 +102,7 @@ if (SQL_NUMROWS($result_mails) > 0) {
        // Okay, check for their sender's
        while ($content = SQL_FETCHARRAY($result_mails)) {
                // Check now...
-               $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
-                       array(bigintval($content['sender'])), __FILE__, __LINE__));
-               if ($found == 0) {
+               if (!fetchUserData($content['sender'])) {
                        // Okay we found some mails!
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `sender`=%s",
                                array(bigintval($content['sender'])), __FILE__, __LINE__);
@@ -121,9 +117,9 @@ WHERE
        `timestamp_send` <= (UNIX_TIMESTAMP() - {?ap_dm_timeout?})
 ORDER BY
        `sender` ASC", __FILE__, __LINE__);
-               }
-       }
-}
+               } // END - if
+       } // END - while
+} // END - if
 
 // Free memory
 SQL_FREERESULT($result_mails);