public function executeListDeleteNeverActivated(sfWebRequest $request) { $nb = GcMailboxPeer::cleanup(60); if ($nb) { $this->getUser()->setFlash('notice', sprintf('%d buzones inactivos fueron eliminados.', $nb)); } else { $this->getUser()->setFlash('notice', 'No hay buzones expirados por eliminar.'); } $this->redirect('@gc_mailbox'); }
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)); }