Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding cleanup of dibs transactions #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ding_dibs/ding_dibs.module
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The referenced ticket provides a more elaborate reasoning behind why this cleanup is necessary. I would like to have this documented in the code comments as well.

If this is a general problem consider submitting this as a patch for the DIBS module instead of implementing it here.

*/
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))));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I see it $res should either be FALSE or NULL here which makes it irrelevant in the log message.

Also there is a spelling error :).

}
}