Esempio n. 1
0
 public function delete(PropelPDO $con = null)
 {
     $index = GcMailboxPeer::getLuceneIndex();
     if ($hit = $index->find('pk:' . $this->getId())) {
         $index->delete($hit->id);
     }
     return parent::delete($con);
 }
Esempio n. 2
0
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     //cleanup Lucene index
     $index = GcMailboxPeer::getLuceneIndex();
     $criteria = new Criteria();
     $criteria->add(GcMailboxPeer::EXPIRES_AT, time(), Criteria::LESS_THAN);
     $mailboxs = GcMailboxPeer::doSelect($criteria);
     foreach ($mailboxs as $gc_mailbox) {
         if ($hit = $index->find('pk:' . $gc_mailbox->getId())) {
             $hit->delete();
         }
     }
     $index->optimize();
     $this->logSection('lucene', 'Cleaned up and optimized the mailbox index');
     //Remove stale mailboxs
     $nb = GcMailboxPeer::cleanup($options['days']);
     $this->logSection('propel', sprintf('Removed %d stale mailboxs', $nb));
 }