From 5ecaa68e834e823f3d2ab9ea2c3613c1ebc19bf6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 30 May 2010 14:51:23 +0200 Subject: [PATCH] Adapts plat/al crons to the new database. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- bin/cron/banana.feedgen.php | 2 +- bin/cron/checkdb.php | 319 ++++++++++++--------- bin/cron/clean.php | 54 ++-- bin/cron/cron_ml_moderate.php | 13 +- bin/cron/cron_validations.php | 38 +-- bin/cron/emails.check.php | 4 +- bin/cron/{homonymes.php => homonyms.php} | 0 bin/cron/notifs.birthday.php | 2 +- bin/cron/notifs.send.php | 6 +- bin/cron/phones.check.php | 6 +- ...{rapports_inscription.php => registrations.php} | 13 +- 11 files changed, 256 insertions(+), 201 deletions(-) rename bin/cron/{homonymes.php => homonyms.php} (100%) rename bin/cron/{rapports_inscription.php => registrations.php} (87%) diff --git a/bin/cron/banana.feedgen.php b/bin/cron/banana.feedgen.php index b4dae8b..379c1bc 100755 --- a/bin/cron/banana.feedgen.php +++ b/bin/cron/banana.feedgen.php @@ -9,7 +9,7 @@ ********************************************************************************/ require_once 'connect.db.inc.php'; -require_once dirname(__FILE__).'/../../include/banana/forum.inc.php'; +require_once dirname(__FILE__) . '/../../include/banana/forum.inc.php'; ini_set('memory_limit', '128M'); Banana::$mbox_helper = $globals->banana->mbox_helper; diff --git a/bin/cron/checkdb.php b/bin/cron/checkdb.php index c222052..689fe78 100755 --- a/bin/cron/checkdb.php +++ b/bin/cron/checkdb.php @@ -19,113 +19,167 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -/* - * verifie qu'il n'y a pas d'incoherences dans les tables de jointures - * -*/ +/* Checks inconsistances in tables ans joins. */ -require('./connect.db.inc.php'); -require("Console/Getopt.php"); +require './connect.db.inc.php'; +require 'Console/Getopt.php'; -function check($sql, $commentaire='') +function check($sql, $comment = '') { $it = XDB::iterRow($sql); - if ($err = XDB::error()) echo $err; + if ($err = XDB::error()) { + echo $err; + } if ($it->total() > 0) { - echo "Erreur pour la verification : $commentaire\n$sql\n\n"; + echo "Erreur pour la verification : $comment\n$sql\n\n"; echo "|"; while($col = $it->nextField()) { - echo "\t".$col->name."\t|"; + echo "\t" . $col->name . "\t|"; } echo "\n"; while ($arr = $it->next()) { echo "|"; - foreach ($arr as $val) echo "\t$val\t|"; + foreach ($arr as $val) { + echo "\t$val\t|"; + } echo "\n"; } echo "\n"; } } -function info($sql,$commentaire='') { +function info($sql, $comment = '') { global $opt_verbose; - if ($opt_verbose) - check($sql,$commentaire); + if ($opt_verbose) { + check($sql, $comment); + } } -/* on parse les options */ -$opts = Console_GetOpt::getopt($argv, "v"); -$opt_verbose=false; +/* Parses options. */ +$opts = Console_GetOpt::getopt($argv, 'v'); +$opt_verbose = false; -if ( PEAR::isError($opts) ) { +if (PEAR::isError($opts)) { echo $opts->getMessage(); } else { $opts = $opts[0]; - foreach ( $opts as $opt) { + foreach ($opts as $opt) { switch ($opt[0]) { - case "v": - $opt_verbose=true; + case 'v': + $opt_verbose = true; break; } } } -/* Validite des flags de transmission */ -check("SELECT u.user_id, nom, prenom, promo, - emails_alias_pub, profile_freetext_pub, profile_medal_enum_pub - FROM auth_user_md5 AS u - INNER JOIN auth_user_quick AS q USING(user_id) - WHERE (emails_alias_pub != 'private' AND emails_alias_pub != 'public') - OR (profile_freetext_pub != 'private' AND profile_freetext_pub != 'public') - OR (profile_medal_enum_pub != 'private' AND profile_medal_enum_pub != 'public')", - "Utilisateur n'ayant pas de flag de publicite pour leurs donnees de profil"); -check("SELECT pid - FROM profile_addresses - WHERE pub != 'private' AND pub !='ax' AND pub != 'public'", - "Utiliseur n'ayant pas de flag de publicité pour une adresse."); -check("select pid from profile_phones where pub != 'private' and pub != 'ax' and pub != 'public'", "Utiliseur n'ayant pas de flag de publicite pour un numero de téléphone"); -check("select pid from profile_networking where pub != 'private' and pub != 'public'", "Utiliseur n'ayant pas de flag de publicité pour une adresse de networking"); - -/* validite des hruid */ -check("SELECT user_id, nom, prenom, promo FROM auth_user_md5 WHERE hruid IS NULL OR hruid = ''", +/* hrid correctness */ +check("SELECT uid, full_name + FROM accounts + WHERE hruid IS NULL OR hruid = ''", "Utilisateur n'ayant pas de hruid."); - -/* validite de aliases */ -check("SELECT a.* - FROM aliases AS a - LEFT JOIN auth_user_md5 AS u ON u.user_id=a.uid - WHERE (a.type='alias' OR a.type='a_vie') AND u.prenom is null"); - -/* validite de profile_education */ -check("select a.* from profile_education as a left join auth_user_md5 as u on u.user_id=a.pid where u.prenom is null"); -check("select a.* from profile_education as a left join profile_education_enum as ad on ad.id=a.eduid where ad.name is null"); - -/* validite de binet_users */ -check("select b.* from profile_binets as b left join auth_user_md5 as u on u.user_id=b.user_id where u.prenom is null"); -check("select b.* from profile_binets as b left join profile_binet_enum as bd on bd.id=b.binet_id where bd.text is null"); - -/* validite de contacts */ -check("select c.* from contacts as c left join auth_user_md5 as u on u.user_id=c.uid where u.prenom is null"); -check("select c.* from contacts as c left join auth_user_md5 as u on u.user_id=c.contact where u.prenom is null"); - -/* validite de emails */ -check("select e.* from emails as e left join auth_user_md5 as u on u.user_id=e.uid where e.uid and u.prenom is null"); - -/* validite de forums */ -check("select f.* from #forums#.abos as f left join #x4dat#.auth_user_md5 as u on u.user_id=f.uid where u.prenom is null"); -check("select f.* from #forums#.abos as f left join #forums#.list as fd on fd.fid=f.fid where fd.nom is null"); -check("select f.* from #forums#.respofaqs as f left join #forums#.list as fd on fd.fid=f.fid where fd.nom is null"); -check("select f.* from #forums#.respofaqs as f left join #x4dat#.auth_user_md5 as u on u.user_id=f.uid where u.prenom is null"); - -/* validite de groupesx_ins */ -check("select g.* from groupesx_ins as g left join auth_user_md5 as u on u.user_id=g.guid where u.prenom is null"); -check("select g.* from groupesx_ins as g left join groupesx_def as gd on g.gid=g.gid where gd.text is null"); - -/* validite de photo */ -check("select p.* from photo as p left join auth_user_md5 as u on u.user_id=p.uid where u.prenom is null"); - -/* validite des formats téléphoniques */ +check("SELECT p.pid, pd.public_name, pd.promo + FROM profiles AS p + LEFT JOIN profile_display AS pd ON (p.pid = pd.pid) + WHERE p.hrpid IS NULL OR p.hrpid = ''", + "Profil n'ayant pas de hrpid."); + +/* No alumni is allowed to have empty names. */ +check("SELECT p.pid, p.hrpid + FROM profiles AS p + INNER JOIN profile_name AS pn ON (p.pid = pn.pid) + WHERE name = ''", + "Liste des personnes qui ont un de leur nom de recherche vide."); + +/* Checks rewriting on deleted aliases. */ +check("SELECT a.alias, e.email, e.rewrite AS broken + FROM aliases AS a + INNER JOIN emails AS e ON (a.uid = e.uid AND rewrite != '') + LEFT JOIN aliases AS b ON (b.uid = a.uid AND rewrite LIKE CONCAT(b.alias, '@%') AND b.type != 'homonyme') + WHERE a.type = 'a_vie' AND b.type IS NULL", + "Personnes qui ont des rewrite sur un alias perdu."); + +/* Publicity flags correctness */ +check("SELECT p.pid, p.hrpid, p.freetext_pub, p.medals_pub, p.alias_pub, + pa.pub, pc.corps_pub, pj.pub, pj.email_pub, pn.pub, pp.pub, ph.pub + FROM profiles AS p + LEFT JOIN profile_addresses AS pa ON (p.pid = pa.pid) + LEFT JOIN profile_corps AS pc ON (p.pid = pc.pid) + LEFT JOIN profile_job AS pj ON (p.pid = pj.pid) + LEFT JOIN profile_networking AS pn ON (p.pid = pn.pid) + LEFT JOIN profile_phones AS pp ON (p.pid = pp.pid) + LEFT JOIN profile_photos AS ph ON (p.pid = ph.pid) + WHERE (p.freetext_pub != 'public' AND p.freetext_pub != 'private') + OR (p.medals_pub != 'public' AND p.medals_pub != 'private') + OR (p.alias_pub != 'public' AND p.alias_pub != 'private') + OR (pa.pub != 'public' AND pa.pub != 'ax' AND pa.pub != 'private') + OR (pc.corps_pub != 'public' AND pc.corps_pub != 'ax' AND pc.corps_pub != 'private') + OR (pj.pub != 'public' AND pj.pub != 'ax' AND pj.pub != 'private') + OR (pj.email_pub != 'public' AND pj.email_pub != 'ax' AND pj.email_pub != 'private') + OR (pn.pub != 'public' AND pn.pub != 'private') + OR (pp.pub != 'public' AND pp.pub != 'ax' AND pp.pub != 'private') + OR (ph.pub != 'public' AND ph.pub != 'private')", + 'Profil ayant des flags de publicité manquant.'); + +/* Checks profile_*_enum all have a name to describe them. */ +check("SELECT * + FROM profile_binet_enum + WHERE text IS NULL OR text = ''"); +check("SELECT * + FROM profile_corps_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_corps_rank_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_education_degree_enum + WHERE degree IS NULL OR degree = ''"); +check("SELECT * + FROM profile_education_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_education_field_enum + WHERE field IS NULL OR field = ''"); +check("SELECT * + FROM profile_job_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_job_sector_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_job_subsector_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_job_subsubsector_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_langskill_enum + WHERE langue_fr IS NULL OR langue_fr = ''"); +check("SELECT * + FROM profile_medal_enum + WHERE text IS NULL OR text = ''"); +check("SELECT * + FROM profile_name_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_networking_enum + WHERE name IS NULL OR name = ''"); +check("SELECT * + FROM profile_section_enum + WHERE text IS NULL OR text = ''"); +check("SELECT * + FROM profile_skill_enum + WHERE text_fr IS NULL OR text_fr = ''"); + +/* Checks some other tables all have a name to describe them. */ +check("SELECT id, nom, diminutif + FROM groups + WHERE nom IS NULL OR nom = ''"); +check("SELECT fid, name + FROM forums + WHERE name IS NULL OR name = ''"); + +/* Checks phone formating. */ check("SELECT DISTINCT g.phonePrefix FROM geoloc_countries AS g WHERE EXISTS (SELECT h.phonePrefix @@ -135,80 +189,63 @@ check("SELECT DISTINCT g.phonePrefix FROM geoloc_countries AS i WHERE i.phonePrefix = g.phonePrefix LIMIT 1))", - "Préfixes téléphoniques qui ont des formats de numéros de téléphones différents selon les pays"); + "Préfixes téléphoniques qui ont des formats de numéros de téléphones différents selon les pays."); -/* validite des champ pays */ -check("SELECT a.pid, a.countryId - FROM profile_addresses AS a +/* Checks correctness of countries in the profiles. */ +check("SELECT pa.pid, pa.countryId + FROM profile_addresses AS pa LEFT JOIN geoloc_countries AS gc ON (a.countryId = gc.iso_3166_1_a2) WHERE gc.countryFR IS NULL OR gc.countryFR = ''", - "donne la liste des pays dans les profils qui n'ont pas d'entree correspondante dans geoloc_countries"); + "Donne la liste des pays dans les profils qui n'ont pas d'entrée correspondante dans geoloc_countries."); -/* donne la liste des emails douteux que les administrateurs n'ont pas encore traité */ +/* Lists unsound emails that remain unprocessed by the administrators. */ check("SELECT a1.alias, a2.alias, e1.email, e2.flags - FROM emails AS e1 - INNER JOIN emails AS e2 ON(e1.email = e2.email AND e1.uid!=e2.uid AND - (e1.uid 1", "à chaque personne de l'annuaire de l'AX (identification_ax) doit correspondre AU PLUS UNE personne de notre annuaire (auth_user_md5) -> si ce n'est pas le cas il faut regarder en manuel ce qui ne va pas !"); - -/* no alumni is allowed to have empty names */ -check("SELECT s.uid, d.public_name - FROM profile_name AS s - INNER JOIN profile_display AS d ON (d.pid = s.uid) - WHERE name = ''", "liste des personnes qui ont un de leur nom de recherche vide"); - -/* verifie qu'il n'y a pas d'utilisateurs ayant un compte Google Apps désactivé et une redirection encore active vers Google Apps */ -check("SELECT a.alias, g.g_status, u.mail_storage - FROM auth_user_md5 AS u - INNER JOIN aliases AS a ON (a.uid = u.user_id AND a.type = 'a_vie') - INNER JOIN gapps_accounts AS g ON (g.l_userid = u.user_id) - WHERE FIND_IN_SET('googleapps', u.mail_storage) > 0 AND g.g_status != 'active'", - "utilisateurs ayant une redirection vers Google Apps alors que leur compte GApps n'est pas actif"); + "Donne la liste des homonymes qui ont un alias égal à leur loginbis depuis plus d'un mois, il est temps de supprimer leur alias."); + +/* Correctness of ax_id in profiles table. */ +check("SELECT pid, hrpid, ax_id, COUNT(ax_id) AS c + FROM profiles + WHERE ax_id != '0' + GROUP BY ax_id + HAVING c > 1", + "À chaque personne de l'annuaire de l'AX doit correspondre AU PLUS UNE personne de notre annuaire -> si ce n'est pas le cas il faut regarder en manuel ce qui ne va pas !"); + +/* Checks there is no user with a disactivated Google Apps account and an active redirection towards Google Apps. */ +check("SELECT a.alias, g.g_status, eo.storage + FROM email_options AS eo + INNER JOIN aliases AS a ON (a.uid = eo.uid AND a.type = 'a_vie') + INNER JOIN gapps_accounts AS g ON (g.l_userid = eo.uid) + WHERE FIND_IN_SET('googleapps', eo.storage) > 0 AND g.g_status != 'active'", + "Utilisateurs ayant une redirection vers Google Apps alors que leur compte GApps n'est pas actif."); + +/* TODO: add check on foreign keys for every table! */ // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?> diff --git a/bin/cron/clean.php b/bin/cron/clean.php index 6a1fef8..6135696 100755 --- a/bin/cron/clean.php +++ b/bin/cron/clean.php @@ -20,33 +20,53 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require('./connect.db.inc.php'); +require './connect.db.inc.php'; function query ($sql) { XDB::execute($sql); if (XDB::errno() != 0) { - echo "error in \"$sql\" :\n", XDB::error(), "\n"; + echo "error in \"$sql\":\n", XDB::error(), "\n"; } } -// la table des notifs est nettoyée -$eight_days_ago = date("YmdHis", time() - 8*24*60*60); -query("DELETE FROM watch_ops WHERE known<$eight_days_ago"); +query('DELETE FROM register_pending + WHERE TO_DAYS(NOW()) - TO_DAYS(date) >= 365'); +query('DELETE FROM register_pending + WHERE hash = \'INSCRIT\''); -query("DELETE FROM register_pending WHERE TO_DAYS(NOW()) - TO_DAYS(date) >= 365"); -query("DELETE FROM register_pending WHERE hash = 'INSCRIT'"); - -// quelques tables sont triées pour que la lecture triée soit plus facile -query("ALTER TABLE profile_education_enum ORDER BY name"); -query("ALTER TABLE profile_binet_enum ORDER BY text"); -query("ALTER TABLE groupesx_def ORDER BY text"); -query("ALTER TABLE profile_job_sector_enum ORDER BY name"); -query("ALTER TABLE profile_job_subsector_enum ORDER BY name"); -query("ALTER TABLE profile_job_subsubsector_enum ORDER BY name"); -query("ALTER TABLE profile_section_enum ORDER BY text"); +// Sorts a few tables to optimize sorted read acces. +query('ALTER TABLE profile_binet_enum + ORDER BY text'); +query('ALTER TABLE profile_corps_enum + ORDER BY name'); +query('ALTER TABLE profile_corps_rank_enum + ORDER BY name'); +query('ALTER TABLE profile_education_degree_enum + ORDER BY name'); +query('ALTER TABLE profile_education_field_enum + ORDER BY field'); +query('ALTER TABLE profile_job_enum + ORDER BY name'); +query('ALTER TABLE profile_job_sector_enum + ORDER BY name'); +query('ALTER TABLE profile_job_subsector_enum + ORDER BY name'); +query('ALTER TABLE profile_job_subsubsector_enum + ORDER BY name'); +query('ALTER TABLE profile_langskill_enum + ORDER BY langue_fr'); +query('ALTER TABLE profile_medal_enum + ORDER BY text'); +query('ALTER TABLE profile_networking_enum + ORDER BY name'); +query('ALTER TABLE profile_section_enum + ORDER BY text'); +query('ALTER TABLE profile_skill_enum + ORDER BY text_fr'); // Prunes older autocomplete queries. -query("DELETE FROM search_autocomplete WHERE generated < DATE_SUB(NOW(), INTERVAL 1 DAY)"); +query('DELETE FROM search_autocomplete + WHERE generated < DATE_SUB(NOW(), INTERVAL 1 DAY)'); // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?> diff --git a/bin/cron/cron_ml_moderate.php b/bin/cron/cron_ml_moderate.php index 268cdd3..13cf6d2 100755 --- a/bin/cron/cron_ml_moderate.php +++ b/bin/cron/cron_ml_moderate.php @@ -29,17 +29,17 @@ $handler = time(); while ($sent_mails < $globals->lists->max_mail_per_min && time() - $handler < 60) { // take a lock on a mail - XDB::execute("UPDATE email_list_moderate + XDB::execute('UPDATE email_list_moderate SET handler = {?} WHERE handler IS NULL ORDER BY ts - LIMIT 1", $handler); + LIMIT 1', $handler); if (XDB::affectedRows() == 0) { break; } $query = XDB::query('SELECT a.fullname, a.uid, a.password, ml.ml, ml.domain, ml.mid, ml.action, ml.message - FROM accounts AS a + FROM accounts AS a INNER JOIN email_list_moderate AS ml ON (a.uid = ml.uid) WHERE ml.handler = {?}', $handler); list($fullname, $uid, $password, $list, $domain, $mid, $action, $reason) = $query->fetchOneRow(); @@ -48,7 +48,7 @@ while ($sent_mails < $globals->lists->max_mail_per_min $client = new MMList($uid, $password, $domain); // send the mail - $mail = $client->get_pending_mail($list, $mid); + $mail = $client->get_pending_mail($list, $mid); list($det,$mem,$own) = $client->get_members($list); $count = 0; switch ($action) { @@ -70,7 +70,7 @@ while ($sent_mails < $globals->lists->max_mail_per_min $action = 3; /** 3 = DISCARD **/ $subject = "Message supprimé"; $append = "a été supprimé par $fullname.\n\n" - . "Rappel: il ne faut utiliser cette opération " + . "Rappel : il ne faut utiliser cette opération " . "que dans le cas de spams ou de virus !\n"; $type = 'spam'; $count += count($own); @@ -115,7 +115,8 @@ while ($sent_mails < $globals->lists->max_mail_per_min } // release the lock - XDB::execute("DELETE FROM email_list_moderate WHERE handler = {?}", + XDB::execute('DELETE FROM email_list_moderate + WHERE handler = {?}', $handler); sleep(60 * $count / $globals->lists->max_mail_per_min); } diff --git a/bin/cron/cron_validations.php b/bin/cron/cron_validations.php index 6c67503..0b73a49 100755 --- a/bin/cron/cron_validations.php +++ b/bin/cron/cron_validations.php @@ -19,15 +19,16 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -/* vim: set sw=4 ts=4 sts=4 tw=100: - * vérifie qu'il n'y a pas de validations en cours, et maile si c'est le cas -*/ -$M_PERIOD = "INTERVAL 3 HOUR"; // période d'envoi des mails de 3h -$R_PERIOD = "INTERVAL 6 HOUR"; // période de réponse moyenne de 6h +/** Check if there is some pending validations, + * and if so sends notification email. + */ -require('connect.db.inc.php'); -require('plmailer.php'); +$M_PERIOD = "INTERVAL 3 HOUR"; // 3 hour lap (old validations) +$R_PERIOD = "INTERVAL 6 HOUR"; // 6 hour lap (very old validations) + +require 'connect.db.inc.php'; +require 'plmailer.php'; $res = XDB::query("SELECT count(r.stamp), UNIX_TIMESTAMP(MIN(r.stamp)), sum(r.stamp < NOW() - $M_PERIOD), sum(r.stamp < NOW() - $R_PERIOD) @@ -35,7 +36,7 @@ $res = XDB::query("SELECT count(r.stamp), UNIX_TIMESTAMP(MIN(r.stamp)), list($nb, $age, $nbold, $nbveryold) = $res->fetchOneRow(); $age = (time() - intval($age)) / 86400; -$head = ""; +$head = ''; if ($age > 15) { $head = "[Autodestruction du serveur] "; } elseif ($age > 7) { @@ -55,30 +56,31 @@ if (empty($nb)) { exit; } -$plural = $nb == 1 ? "" : "s"; +$plural = $nb == 1 ? '' : 's'; $mymail = new PlMailer(); $mymail->setFrom('validation@' . $globals->mail->domain); -$mymail->addTo("validation@" . $globals->mail->domain); +$mymail->addTo('validation@' . $globals->mail->domain); $mymail->setSubject($head . "Il y a $nb validation$plural non effectuée$plural"); $message = "Il y a $nb validation$plural à effectuer\n" - .(empty($nbold)?"":"dont $nbold depuis le dernier mail !!!\n") - .(empty($nbveryold)?"":"et dont *$nbveryold* ".($nbveryold == 1 ? "est" : "sont")." en retard de plus de 6h !!!") - ."\n" - ."https://www.polytechnique.org/admin/validate\n\n" - ."Par catégorie :\n"; -$res = XDB::iterRow("SELECT type, count(*) + . (empty($nbold) ? '' : "dont $nbold depuis le dernier mail !!!\n") + . (empty($nbveryold) ? '' : "et dont *$nbveryold* " . ($nbveryold == 1 ? 'est' : 'sont') . ' en retard de plus de 6h !!!') + . "\n" + . "https://www.polytechnique.org/admin/validate\n\n" + . "Par catégorie :\n"; +$res = XDB::iterRow('SELECT type, count(*) FROM requests GROUP BY type - ORDER BY type"); + ORDER BY type'); while (list($type, $nb) = $res->next()) { $message .= "- $type : $nb\n"; } -$message = wordwrap($message,78); +$message = wordwrap($message, 78); $mymail->setTxtBody($message); $mymail->send(); + // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?> diff --git a/bin/cron/emails.check.php b/bin/cron/emails.check.php index 433e718..e38dfb8 100755 --- a/bin/cron/emails.check.php +++ b/bin/cron/emails.check.php @@ -24,8 +24,8 @@ */ $panne_level = 3; -require('./connect.db.inc.php'); -require("Console/Getopt.php"); +require './connect.db.inc.php'; +require 'Console/Getopt.php'; /* * Parse the command-line options. diff --git a/bin/cron/homonymes.php b/bin/cron/homonyms.php similarity index 100% rename from bin/cron/homonymes.php rename to bin/cron/homonyms.php diff --git a/bin/cron/notifs.birthday.php b/bin/cron/notifs.birthday.php index f783d78..62da064 100755 --- a/bin/cron/notifs.birthday.php +++ b/bin/cron/notifs.birthday.php @@ -20,7 +20,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require('./connect.db.inc.php'); +require './connect.db.inc.php'; $it = 0; do { diff --git a/bin/cron/notifs.send.php b/bin/cron/notifs.send.php index c17a516..a9958e4 100755 --- a/bin/cron/notifs.send.php +++ b/bin/cron/notifs.send.php @@ -20,9 +20,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once('connect.db.inc.php'); -require_once('plmailer.php'); -require_once('notifs.inc.php'); +require_once 'connect.db.inc.php'; +require_once 'plmailer.php'; +require_once 'notifs.inc.php'; $all = new AllNotifs(); diff --git a/bin/cron/phones.check.php b/bin/cron/phones.check.php index b661e5e..ffea56d 100755 --- a/bin/cron/phones.check.php +++ b/bin/cron/phones.check.php @@ -1,10 +1,10 @@ #!/usr/bin/php5 debug = 0; //do not store backtraces +$globals->debug = 0; // do not store backtraces function do_update_by_block($values) diff --git a/bin/cron/rapports_inscription.php b/bin/cron/registrations.php similarity index 87% rename from bin/cron/rapports_inscription.php rename to bin/cron/registrations.php index 8800584..1caa440 100755 --- a/bin/cron/rapports_inscription.php +++ b/bin/cron/registrations.php @@ -1,16 +1,16 @@ #!/usr/bin/php5 -q {?} 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: ?> -- 2.1.4