protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'])->getConnection(); // need a scriptname otherwise it uses the symfony file if ($arguments['env'] != 'prod') { $_SERVER['SCRIPT_NAME'] = '/' . $arguments['application'] . '_' . $arguments['env'] . '.php'; } else { $_SERVER['SCRIPT_NAME'] = '/index.php'; } sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration($arguments['application'], $arguments['env'], true)); $searchIndex = new zsSearchIndex($arguments['index']); //optimize to increase speed $searchIndex->optimize(); //loop thru all models specified in this index and update all entries foreach ($searchIndex->getModels() as $model => $config) { $this->logSection('update', 'model: ' . $model); foreach (Doctrine::getTable($model)->findAll() as $object) { $searchIndex->updateIndex($object); echo '.'; } echo "\n"; } //re-optimize index $searchIndex->optimize(); }
protected function execute($arguments = array(), $options = array()) { // initialize the database connection //$databaseManager = new sfDatabaseManager($this->configuration); //$connection = $databaseManager->getDatabase($options['connection'])->getConnection(); sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true)); $searchIndex = new zsSearchIndex($arguments['index']); //optimize to increase speed $searchIndex->optimize(); }