Changeset 1438 for cpc/trunk/project/lib/task/sendAlertTask.class.php
- Timestamp:
- Sep 26, 2010, 8:15:35 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/lib/task/sendAlertTask.class.php
r1327 r1438 8 8 $this->name = 'Alert'; 9 9 $this->briefDescription = 'send alerts'; 10 $this->addOption('env', null, sfCommandOption::PARAMETER_OPTIONAL, 'Changes the environment this task is run in', ' test');10 $this->addOption('env', null, sfCommandOption::PARAMETER_OPTIONAL, 'Changes the environment this task is run in', 'prod'); 11 11 $this->addOption('app', null, sfCommandOption::PARAMETER_OPTIONAL, 'Changes the environment this task is run in', 'frontend'); 12 12 } … … 17 17 $manager = new sfDatabaseManager($this->configuration); 18 18 $context = sfContext::createInstance($this->configuration); 19 $this->configuration->loadHelpers( 'Partial');19 $this->configuration->loadHelpers(array('Partial', 'Url')); 20 20 21 21 $solr = new SolrConnector(); 22 22 $query = Doctrine::getTable('Alerte')->createQuery('a')->where('next_mail < NOW()'); 23 23 foreach($query->execute() as $alerte) { 24 $date = strtotime(preg_replace('/ /', 'T', $alerte->last_mail)."Z") +1-3600;25 $query = $alerte->query." date:[".date('Y-m-d', $date).'T'.date('H:i:s', $date)."Z TO NOW]";24 $date = strtotime(preg_replace('/ /', 'T', $alerte->last_mail)."Z")-3600*2; 25 $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]"; 26 26 $results = $solr->search($query, array('sort' => 'date desc', 'hl' => 'yes', 'hl.fragsize'=>500)); 27 27 echo "$query\n";
Note: See TracChangeset
for help on using the changeset viewer.