From 83a7902180a9375447b010051e6209eb093455b8 Mon Sep 17 00:00:00 2001 From: Steen Larsen Date: Fri, 28 Sep 2012 10:57:48 +0200 Subject: [PATCH 1/2] Adding cleanup of transactions --- ding_dibs/ding_dibs.module | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ding_dibs/ding_dibs.module b/ding_dibs/ding_dibs.module index 9c7417c4c..a0cf91340 100644 --- a/ding_dibs/ding_dibs.module +++ b/ding_dibs/ding_dibs.module @@ -123,3 +123,14 @@ function ding_dibs_payment_prepare($amount, $params, $callback) { dibs_payment_prepare($params); } + +/** + * Implementation of hook_cron(). + * Cleanup old transactions from the database + */ +function ding_dibs_cron() { + $res = db_query('DELETE FROM {dibs_transactions} WHERE DATEDIFF(sysdate(), payment_time) > 60 LIMIT 250'); + if(!$res){ + watchdog('ding_dibs', t('There where an error in deleting DIBS payment transactions @res.', array('@res' => check_plain($res)))); + } +} \ No newline at end of file From 2dadb4ca41a02ecb260368a1f744b6bb1b29a60e Mon Sep 17 00:00:00 2001 From: Steen Larsen Date: Mon, 1 Oct 2012 14:59:45 +0200 Subject: [PATCH 2/2] adding comment and remove irrelevant parm in logmessage --- ding_dibs/ding_dibs.module | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ding_dibs/ding_dibs.module b/ding_dibs/ding_dibs.module index a0cf91340..66f5c174b 100644 --- a/ding_dibs/ding_dibs.module +++ b/ding_dibs/ding_dibs.module @@ -126,11 +126,11 @@ function ding_dibs_payment_prepare($amount, $params, $callback) { /** * Implementation of hook_cron(). - * Cleanup old transactions from the database + * For security reasons we remove old transactions from the database */ function ding_dibs_cron() { $res = db_query('DELETE FROM {dibs_transactions} WHERE DATEDIFF(sysdate(), payment_time) > 60 LIMIT 250'); if(!$res){ - watchdog('ding_dibs', t('There where an error in deleting DIBS payment transactions @res.', array('@res' => check_plain($res)))); + watchdog('ding_dibs', t('There was an error in deleting DIBS payment transactions')); } -} \ No newline at end of file +}