Adapts plat/al crons to the new database.
[platal.git] / bin / cron / registrations.php
similarity index 87%
rename from bin/cron/rapports_inscription.php
rename to bin/cron/registrations.php
index 8800584..1caa440 100755 (executable)
@@ -1,16 +1,16 @@
 #!/usr/bin/php5 -q
 <?php
+
 require 'connect.db.inc.php';
-$message = '';
 
-// ---------------------------------------
+$message = '';
 
 $res = XDB::iterRow("SELECT  al.alias, pd.promo, e.email  //a.alias, u.promo, email
                        FROM  accounts AS a
                  INNER JOIN  account_profile AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms))
                  INNER JOIN  profile_display AS pd ON (ap.pid = pd.pid)
                   LEFT JOIN  aliases         AS al ON (a.uid =a.uid AND al.type = 'a_vie')
-                  LEFT JOIN  emails          AS e ON (a.uid = e.uid AND NOT FIND_IN_SET('filter', e.flags))
+                  LEFT JOIN  emails          AS e  ON (a.uid = e.uid AND NOT FIND_IN_SET('filter', e.flags))
                       WHERE  a.registration_date > {?}
                    GROUP BY  al.alias
                    ORDER BY  pd.promo",
@@ -22,8 +22,6 @@ if ($count = $res->total()) {
     }
 }
 
-// ---------------------------------------
-
 $res = XDB::iterRow("SELECT  a.hruid, r.email, r.date
                        FROM  register_pending AS r
                  INNER JOIN  accounts         AS a ON (a.uid = r.uid)
@@ -36,16 +34,12 @@ if ($count = $res->total()) {
     }
 }
 
-// ---------------------------------------
-
 $res = XDB::query('SELECT  COUNT(DISTINCT uid), COUNT(*)
                      FROM  register_marketing');
 list($a, $b) = $res->fetchOneRow();
 $message .= "\nINSCRIPTIONS SOLICITÉES :\n";
 $message .= "    $a utilisateurs\n    $b adresses email\n";
 
-// ---------------------------------------
-
 $message .= "\n\n";
 
 $mailer = new PlMailer();
@@ -54,5 +48,6 @@ $mailer->setFrom($globals->register->notif);
 $mailer->addTo($globals->register->notif);
 $mailer->setTxtBody($message);
 $mailer->send();
+
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>