]> git.mxchange.org Git - mailer.git/blobdiff - inc/purge/purge-general.php
Rewrote a lot parts to extract 'payments' table (+ handling) into own extension:
[mailer.git] / inc / purge / purge-general.php
index 3694ae702759ce609755bcecf9a5ed6fb3a1f333..9fdacc38096419ab11e3f25efa544156cb61e0f0 100644 (file)
@@ -53,20 +53,16 @@ if (getAutoPurge() > 0) {
 
        // Then check for outdated mail order. We don't delete them just the confirmation links will be deleted.
        $result = SQL_QUERY('SELECT
-       `s`.`id`,
-       `s`.`userid`,
-       `s`.`pool_id`,
-       `t`.`price`
+       `id`,
+       `userid`,
+       `pool_id`,
+       `payment_id`
 FROM
-       `{?_MYSQL_PREFIX?}_user_stats` AS `s`
-LEFT JOIN
-       `{?_MYSQL_PREFIX?}_payments` AS `t`
-ON
-       `s`.`payment_id`=`t`.`id`
+       `{?_MYSQL_PREFIX?}_user_stats`
 WHERE
-       (UNIX_TIMESTAMP() - `s`.`timestamp_ordered`) >= {?auto_purge?}
+       (UNIX_TIMESTAMP() - `timestamp_ordered`) >= {?auto_purge?}
 ORDER BY
-       `s`.`userid` ASC', __FILE__, __LINE__);
+       `userid` ASC', __FILE__, __LINE__);
        if (!SQL_HASZERONUMS($result)) {
                // Start deleting procedure
                $userid = NULL;
@@ -87,7 +83,7 @@ ORDER BY
 
                                // Add points
                                $userid = $content['userid'];
-                               $points += $content['price'];
+                               $points += getPaymentPrice($content['payment_id']);
                                $admin_points += $content['price'];
 
                                // Remove confirmation links from queue