4 require_once('../lib/init-cmd.php');
5 ini_set('memory_limit', '800M');
8 "Create and setup nominatim search system",
9 array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
10 array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
11 array('verbose', 'v', 0, 1, 0, 0, 'bool', 'Verbose output'),
13 array('create-partitions', '', 0, 1, 0, 0, 'bool', 'Create required partition tables and triggers'),
15 getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
17 if ($aCMDResult['create-partitions'])
19 $sSQL = 'select distinct country_code from country_name order by country_code';
20 $aPartitions = $oDB->getCol($sSQL);
21 $aPartitions[] = 'none';
23 $sTemplate = file_get_contents(CONST_BasePath.'/sql/partitions.src.sql');
24 preg_match_all('#^-- start(.*?)^-- end#ms', $sTemplate, $aMatches, PREG_SET_ORDER);
25 foreach($aMatches as $aMatch)
28 foreach($aPartitions as $sPartitionName)
30 $sResult .= str_replace('-partition-', $sPartitionName, $aMatch[1]);
32 $sTemplate = str_replace($aMatch[0], $sResult, $sTemplate);
37 showUsage($aCMDOptions, true);