protected $bEnableDiffUpdates;
protected $bEnableDebugStatements;
protected $bNoPartitions;
+ protected $bDrop;
protected $oDB = null;
public function __construct(array $aCMDResult)
} else {
$this->bEnableDiffUpdates = false;
}
+
+ $this->bDrop = $aCMDResult['drop'];
}
public function createDB()
if (!$this->sIgnoreErrors && !$this->oDB->getRow('select * from place limit 1')) {
fail('No Data');
}
+
+ if ($this->bDrop) {
+ $this->dropTable('planet_osm_nodes');
+ $this->removeFlatnodeFile();
+ }
}
public function createFunctions()
{
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->bDrop) {
+ $sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_updates.src.sql');
+ }
if (!$this->dbReverseOnly()) {
$sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_search.src.sql');
}
$this->dropTable($sDrop);
}
+ $this->removeFlatnodeFile();
+ }
+
+ private function removeFlatnodeFile()
+ {
if (!is_null(CONST_Osm2pgsql_Flatnode_File) && CONST_Osm2pgsql_Flatnode_File) {
if (file_exists(CONST_Osm2pgsql_Flatnode_File)) {
if ($this->bVerbose) echo 'Deleting '.CONST_Osm2pgsql_Flatnode_File."\n";