Changeset 1705


Ignore:
Timestamp:
Oct 7, 2010, 9:41:06 PM (10 years ago)
Author:
goya
Message:

Commit sans debug...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/lib/task/sendAlertTask.class.php

    r1704 r1705  
    2323    $solr = new SolrConnector();
    2424    $query = Doctrine::getTable('Alerte')->createQuery('a')->where('next_mail < NOW()')->andWhere('confirmed = 1');
    25         echo $query->getSqlQuery();
    2625    foreach($query->execute() as $alerte) {
    27       echo "Alerte\n";
    2826      $date = strtotime(preg_replace('/ /', 'T', $alerte->last_mail)."Z")-3600*2+1;
    2927      $query = $alerte->query." date:[".date('Y-m-d', $date).'T'.date('H:i:s', $date)."Z TO ".date('Y-m-d').'T'.date('H:i:s')."Z]";
     
    3129      $alerte->next_mail = date('Y-m-d H:i:s', time() + self::$period[$alerte->period]);
    3230      if (! $results['response']['numFound']) {
    33         echo "query « $query » returned no results\n";
    34 //      $alerte->save();
     31        $alerte->save();
    3532        continue;
    3633      }
    3734      echo "sending mail to : ".$alerte->email."\n";
    38       $message = $this->getMailer()->compose(array('no-reply@nosdeputes.fr' => "Regards Citoyens"),
    39 //                                           $alerte->email,
    40                                              "tangui@tangui.eu.org",
     35      $message = $this->getMailer()->compose(array('no-reply@nosdeputes.fr' => 'Regards Citoyens (ne pas répondre)'),
     36                                             $alerte->email,
    4137                                             '[NosDeputes.fr] Alerte - '.$alerte->titre);
    4238      echo $alerte->titre."\n";
     
    4541      try {
    4642        $this->getMailer()->send($message);
    47         echo $message;
    4843        $alerte->last_mail = preg_replace('/T/', ' ', preg_replace('/Z/', '', $results['response']['docs'][$results['response']['numFound'] -1]['date']));
    49 //      $alerte->save();
     44        $alerte->save();
    5045      }catch(Exception $e) {
    5146        echo "ERROR: mail could not be sent ($text)\n";
Note: See TracChangeset for help on using the changeset viewer.