addOptions(array( new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'frontend'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'prod'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'), )); $this->namespace = 'lucene'; $this->name = 'build'; $this->briefDescription = ''; $this->detailedDescription = ''; } /** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'])->getConnection(); $items = Doctrine::getTable('Item')->createQuery() // ->offset($options['offset']) // ->limit($options['limit']) ->execute(); foreach ($items as $item) { $item->updateLuceneIndex(); $this->logSection('Item', 'done: ' . $item->getName()); } $this->logSection('Items', 'finish'); $authors = Doctrine::getTable('Author')->createQuery() // ->offset($options['offset']) // ->limit($options['limit']) ->execute(); foreach ($authors as $author) { $author->updateLuceneIndex(); $this->logSection('Author', 'done: ' . $author->getName()); } $this->logSection('Authors', 'finish'); Common::chmodr(ItemTable::getLuceneIndexFile(), 0777); } }