X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Fhomonymes.php;h=c8c57c48e08a78c96281251ee85bba504eca791c;hb=ee71865181e96e7b0754ef9e7da4b3cb26f4c1d7;hp=9cfc622146403ff4bdf3e3c2447ab71335c46880;hpb=a7c29df3b9bf8f3c3b23fec0f1d2feb814cb61fe;p=platal.git diff --git a/bin/cron/homonymes.php b/bin/cron/homonymes.php index 9cfc622..c8c57c4 100755 --- a/bin/cron/homonymes.php +++ b/bin/cron/homonymes.php @@ -1,7 +1,7 @@ #!/usr/bin/php5 -q next()) { + $res = XDB::query( + "SELECT u.hruid + FROM homonymes AS h + INNER JOIN auth_user_md5 AS u USING (user_id) + WHERE homonyme_id = {?}", + $old['id']); + $hruids = $res->fetchColumn(); -$resRobot = XDB::iterator("SELECT id, alias, expire FROM aliases WHERE (expire = NOW() + $W_PERIOD OR expire <= NOW()) AND type = 'alias'"); - -if ($resRobot->total()) { - require_once('validations/homonymes.inc.php'); - while ($old = $resRobot->next()) { - $res = XDB::query("SELECT alias AS forlife FROM homonymes INNER JOIN aliases ON(user_id = id) WHERE homonyme_id = {?} AND type='a_vie'", $old['id']); - $forlifes = $res->fetchColumn(); - $req = new HomonymeReq($old['id'], $old['alias'], $forlifes, $old['expire'] > date("Y-m-d")); - $req->submit(); - } + $homonyme = User::getSilent($old['id']); + $req = new HomonymeReq($homonyme, $old['alias'], $hruids, $old['expire'] > date("Y-m-d")); + $req->submit(); } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: