5
* Provides a way for the application to reindex data records after import or install/data-load
9
* LICENSE: This source file is subject to LGPLv2.1 license
10
* that is available through the world-wide-web at the following URI:
11
* http://www.gnu.org/licenses/lgpl-2.1.html
13
* @author Charles Wisniewski, CUNY SPS
15
* Copyright of the Sahana Software Foundation, sahanafoundation.org
21
private static $indexModels;
23
function __construct($indexModels)
25
self::$indexModels = $indexModels;
29
* @param array $models the model(s) to be reindexed
30
* @param boolean $reset by default is 0, meaning the entire index is rewritten.
31
* @return results of the reindexing command, keyed by the model name
33
public function indexAll($models = null, $reset=0)
35
chdir(sfConfig::get('sf_root_dir')); // Trick plugin into thinking you are in a project directory
36
$dispatcher = sfContext::getInstance()->getEventDispatcher();
37
$task = new luceneReindexTask($dispatcher, new sfFormatter()); //this->dispatcher
39
foreach (self::$indexModels as $indexModel) {
40
$returnArray[$indexModel] = $task->run(array('model' => $indexModel), array('reset' => $reset, 'env' => 'all', 'connection' => 'doctrine', 'application' => 'frontend'));