Increase memory_limit in notifs.send.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 19 Jun 2010 09:26:30 +0000 (11:26 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 19 Jun 2010 09:26:30 +0000 (11:26 +0200)
Also do a bit of rewrite in order to limit instantiation of
$user->profile() for informations that are present in the user object.

Use PlMailer::sendTo() that set automatically the Recipient and the format
of the mail (update core to use version that uses PlMailer::setTo).

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
bin/cron/notifs.send.php
core

index 939b558..73b5a73 100755 (executable)
@@ -32,16 +32,17 @@ $iterator = User::iterOverUIDs($uids->fetchColumn());
 
 $mailer = new PlMailer('carnet/notif.mail.tpl');
 while($user = $iterator->next()) {
-    if (Watch::getCount($user) > 0) {
-        $notifs = Watch::getEvents($user, time() - (7 * 86400));
-        $mailer->assign('sex', $user->profile()->isFemale());
-        $mailer->assign('yourself', $user->profile()->yourself);
+    $watch = new Watch($user);
+    if ($watch->count() > 0) {
+        $notifs = $watch->events();
+        $mailer->assign('sex', $user->isFemale());
+        $mailer->assign('yourself', $user->display_name);
         $mailer->assign('week', date('W - Y'));
         $mailer->assign('notifs', $notifs);
-        $mailer->addTo('"' . $user->full_name . '" <' . $user->bestalias . '>');
-        $mailer->send($user->email_format == 'html');
+        $mailer->sendTo($user);
         unset($notifs);
     }
+    unset($watch);
     unset($user);
 }
 
diff --git a/core b/core
index bbeb39f..7418556 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit bbeb39f78c0e4a7fbcc745c5c905de52d71f8b38
+Subproject commit 7418556c91a5d8e81e23d9a335fbc3a5623a4079