* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
if (!defined('__SECURITY')) {
die();
} elseif (!isExtensionActive('coupon')) {
- logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
+ logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension ext-coupon disabled.');
return;
}
// Search for all expired coupons that we can purge
-$result = SQL_QUERY('SELECT
+$result = sqlQuery('SELECT
`id`,
UNIX_TIMESTAMP(`coupon_created`) AS `coupon_created`,
UNIX_TIMESTAMP(`coupon_expired`) AS `coupon_expired`,
ORDER BY
`id` ASC', __FILE__, __LINE__);
-// Do we have entries?
-if (SQL_NUMROWS($result) > 0) {
+// Are there entries?
+if (sqlNumRows($result) > 0) {
// Init variables
$out = '';
$ids = array();
// Start purging all
- while ($content = SQL_FETCHARRAY($result)) {
+ while ($content = sqlFetchArray($result)) {
// Add id
- $ids[] = $content['id'];
+ array_push($ids, $content['id']);
// Translate some data
$content['coupon_created'] = generateDateTime($content['coupon_created'], '2');
} // END - while
// Purge all entries
- SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_coupon_data` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`coupon_expired`)) >= {?coupon_autopurge_time?}', __FILE__, __LINE__);
+ sqlQuery('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_coupon_data` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`coupon_expired`)) >= {?coupon_autopurge_time?}', __FILE__, __LINE__);
// Purge also user entries
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_coupons` WHERE `coupon_id` IN (%s) LIMIT %s",
+ sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_coupons` WHERE `coupon_id` IN (%s) LIMIT %s",
array(
implode(',', $ids),
count($ids)
} // END - if
// Free result
-SQL_FREERESULT($result);
+sqlFreeResult($result);
// [EOF]
?>