Handles canceled payment transactions.
[platal.git] / bin / cron / notifs.send.php
index 73b5a73..8a873aa 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/php5 -q
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -23,6 +23,7 @@
 require_once 'connect.db.inc.php';
 require_once 'plmailer.php';
 require_once 'notifs.inc.php';
+ini_set('memory_limit', '128M');
 
 $uids = XDB::query('SELECT  uid
                       FROM  watch
@@ -30,16 +31,17 @@ $uids = XDB::query('SELECT  uid
                   ORDER BY  uid');
 $iterator = User::iterOverUIDs($uids->fetchColumn());
 
-$mailer = new PlMailer('carnet/notif.mail.tpl');
 while($user = $iterator->next()) {
     $watch = new Watch($user);
     if ($watch->count() > 0) {
         $notifs = $watch->events();
+        $mailer = new PlMailer('carnet/notif.mail.tpl');
         $mailer->assign('sex', $user->isFemale());
         $mailer->assign('yourself', $user->display_name);
         $mailer->assign('week', date('W - Y'));
         $mailer->assign('notifs', $notifs);
         $mailer->sendTo($user);
+        unset($mailer);
         unset($notifs);
     }
     unset($watch);
@@ -52,5 +54,5 @@ XDB::execute("UPDATE  watch_profile
 XDB::execute('DELETE FROM  watch_profile
                     WHERE  ts < DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY)');
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>