protected $iInstances;
protected $sModulePath;
protected $aDSNInfo;
+ protected $bQuiet;
protected $bVerbose;
protected $sIgnoreErrors;
protected $bEnableDiffUpdates;
}
// setting member variables based on command line options stored in $aCMDResult
+ $this->bQuiet = $aCMDResult['quiet'];
$this->bVerbose = $aCMDResult['verbose'];
//setting default values which are not set by the update.php array
$oAlParser->createTable($this->oDB, 'address_levels');
}
+ public function createTableTriggers()
+ {
+ info('Create Tables');
+
+ $sTemplate = file_get_contents(CONST_BasePath.'/sql/table-triggers.sql');
+ $sTemplate = $this->replaceSqlPatterns($sTemplate);
+
+ $this->pgsqlRunScript($sTemplate, false);
+ }
+
public function createPartitionTables()
{
info('Create Partition Tables');
public function index($bIndexNoanalyse)
{
$sOutputFile = '';
- $sBaseCmd = CONST_InstallPath.'/nominatim/nominatim -i'
+ $sBaseCmd = CONST_BasePath.'/nominatim/nominatim.py'
.' -d '.escapeshellarg($this->aDSNInfo['database'])
.' -P '.escapeshellarg($this->aDSNInfo['port'])
.' -t '.escapeshellarg($this->iInstances.$sOutputFile);
+ if (!$this->bQuiet) {
+ $sBaseCmd .= ' -v';
+ }
+ if ($this->bVerbose) {
+ $sBaseCmd .= ' -v';
+ }
if (isset($this->aDSNInfo['hostspec'])) {
$sBaseCmd .= ' -H '.escapeshellarg($this->aDSNInfo['hostspec']);
}
{
info('Create Search indices');
+ $sSQL = 'SELECT relname FROM pg_class, pg_index ';
+ $sSQL .= 'WHERE pg_index.indisvalid = false AND pg_index.indexrelid = pg_class.oid';
+ $aInvalidIndices = $this->oDB->getCol($sSQL);
+
+ foreach ($aInvalidIndices as $sIndexName) {
+ info("Cleaning up invalid index $sIndexName");
+ $this->oDB->exec("DROP INDEX $sIndexName;");
+ }
+
$sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql');
if (!$this->dbReverseOnly()) {
$sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_search.src.sql');
private function createSqlFunctions()
{
$sBasePath = CONST_BasePath.'/sql/functions/';
- $sTemplate = file_get_contents(CONST_BasePath.'/sql/functions.sql');
+ $sTemplate = file_get_contents($sBasePath.'utils.sql');
$sTemplate .= file_get_contents($sBasePath.'normalization.sql');
+ $sTemplate .= file_get_contents($sBasePath.'importance.sql');
+ $sTemplate .= file_get_contents($sBasePath.'address_lookup.sql');
+ $sTemplate .= file_get_contents($sBasePath.'interpolation.sql');
+ if ($this->oDB->tableExists('place')) {
+ $sTemplate .= file_get_contents($sBasePath.'place_triggers.sql');
+ }
+ if ($this->oDB->tableExists('placex')) {
+ $sTemplate .= file_get_contents($sBasePath.'placex_triggers.sql');
+ }
+ if ($this->oDB->tableExists('location_postcode')) {
+ $sTemplate .= file_get_contents($sBasePath.'postcode_triggers.sql');
+ }
$sTemplate = str_replace('{modulepath}', $this->sModulePath, $sTemplate);
if ($this->bEnableDiffUpdates) {
$sTemplate = str_replace('RETURN NEW; -- %DIFFUPDATES%', '--', $sTemplate);