From 1dd9371691ca89ce9b804d557258fe14a9655fc0 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Sat, 15 Jan 2005 00:51:12 +0000 Subject: [PATCH] closes FS#63 * create cron * update various tiny things git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-324 --- bin/cron/notifs.birthday.php | 35 +++++++++++++++++++++++++++++++++++ include/notifs.inc.php | 6 +++--- upgrade/0.9.4/60_watch.sql | 2 ++ upgrade/0.9.4/update.sh | 4 ++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100755 bin/cron/notifs.birthday.php diff --git a/bin/cron/notifs.birthday.php b/bin/cron/notifs.birthday.php new file mode 100755 index 0000000..7c99e50 --- /dev/null +++ b/bin/cron/notifs.birthday.php @@ -0,0 +1,35 @@ +#!/usr/bin/php4 -q +db->query("INSERT INTO watch_ops (uid, cid, known, date) + SELECT user_id, 4, '$date', $stamp + FROM auth_user_md5 + WHERE naissance LIKE '$like'"); + + +?> diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 4842ce2..08db2cb 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -65,7 +65,7 @@ function _select_notifs_base($table, $mail, $where) 'contact_sql' => '1' ), 'watch_promo' => Array('wfield' => 'promo', 'ufield' => 'promo', 'need_contact' => true, - 'freq_sql' => ' AND ( wc.type = "basic" OR wc.type="near" AND (w.promo <= u.promo+1 AND w.promo >= u.promo-1) )', + 'freq_sql' => ' AND ( wc.type = "basic" OR wc.type="near" AND (w.promo <= v.promo+1 AND w.promo >= v.promo-1) )', 'contact_sql' => 'NOT (c.contact IS NULL)' ), 'watch_nonins' => Array('wfield' => 'ni_id', 'ufield' => 'user_id', 'need_contact' => false, @@ -91,10 +91,10 @@ function _select_notifs_base($table, $mail, $where) $sql .= " FROM $table AS w INNER JOIN auth_user_md5 AS u ON(u.{$our['ufield']} = w.{$our['wfield']}) - INNER JOIN auth_user_quick AS q ON(q.user_id = w.uid)"; + INNER JOIN auth_user_quick AS q ON(q.user_id = w.uid) + INNER JOIN auth_user_md5 AS v ON(v.user_id = q.user_id)"; if ($mail) { $sql .=" - INNER JOIN auth_user_md5 AS v ON(v.user_id = q.user_id) INNER JOIN aliases AS b ON(b.id = q.user_id AND FIND_IN_SET('bestalias', b.flags))"; } if ($our['need_contact']) { diff --git a/upgrade/0.9.4/60_watch.sql b/upgrade/0.9.4/60_watch.sql index 44cb1f7..dddfd6c 100644 --- a/upgrade/0.9.4/60_watch.sql +++ b/upgrade/0.9.4/60_watch.sql @@ -2,3 +2,5 @@ alter table watch_cat add column type enum('basic', 'near', 'often') not null de update watch_cat set type='often' where frequent=1; alter table watch_cat drop column frequent; insert into watch_cat (id, short, mail, type) values(4, 'Anniversaires', 'Ces camarades ont feté leur anniversaire cette semaine', 'near'); + +replace into watch_sub (uid, cid) select user_id, 4 from auth_user_md5 where perms in ('admin', 'user') and deces=0; diff --git a/upgrade/0.9.4/update.sh b/upgrade/0.9.4/update.sh index 2970ad1..07e9d08 100755 --- a/upgrade/0.9.4/update.sh +++ b/upgrade/0.9.4/update.sh @@ -29,4 +29,8 @@ You now have to : (*) apt-get install php-banana (may not be on public servers) and add a rewrite rule on www.polytechnique.org (http and https) : ^/banana/([^/]*/.*)$ /usr/share/banana/\$1 + +(*) install the new cron : bin/cron/notifs.birthday.php + suggested : + 0 1 * * * ...../bin/cron/notifs.birthday.php " -- 2.1.4