Handles canceled payment transactions.
[platal.git] / bin / cron / emails.check.php
index 8bab8ab..426a2d6 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/php5 -q
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2011 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -129,5 +129,15 @@ if ($opt_verbose) {
     echo "\n";
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+/*
+ * Updates imap settings for users with no active redirection. Their emails
+ * must go to imap and bounce.
+ */
+XDB::execute("UPDATE  email_redirect_account AS r
+           LEFT JOIN  email_redirect_account AS a ON (r.uid = a.uid AND a.flags = 'active' AND a.type != 'imap')
+                 SET  r.action = 'imap_and_bounce'
+               WHERE  r.type = 'imap' AND a.redirect IS NULL");
+
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>