3
class luceneOptimizeTask extends sfBaseTask
5
protected function configure()
8
$this->addOptions(array(
9
new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true),
10
new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
11
new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'default'),
12
// add your own options here
15
$this->namespace = 'lucene';
16
$this->name = 'optimize';
17
$this->briefDescription = 'Optimize a lucene index';
18
$this->detailedDescription = <<<EOF
19
The [lucene:optimize|INFO] optimizes the lucene index
21
symfony lucene:optimize
23
[php symfony lucene:optimize|INFO]
27
protected function execute($arguments = array(), $options = array())
29
sfContext::createInstance($this->configuration);
30
$timer = new sfTimer('timer');
31
$this->log('Optimizing ' . LuceneHandler::getLuceneIndexFile() );
32
$index = LuceneHandler::getLuceneIndex();
34
$this->log('Optimizing took '. round($timer->getElapsedTime(),2) . ' seconds');