4 require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
5 require_once(CONST_BasePath.'/lib/init-cmd.php');
6 include_once(CONST_BasePath.'/lib/setup_functions.php');
7 ini_set('memory_limit', '800M');
9 # (long-opt, short-opt, min-occurs, max-occurs, num-arguments, num-arguments, type, help)
11 $aCMDOptions = createSetupArgvArray();
13 getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
15 $bDidSomething = false;
17 // Check if osm-file is set and points to a valid file if --all or --import-data is given
18 checkInFile($aCMDResult);
20 // get info how many processors and huch much cache mem we can use
21 $prepSreturn = prepSystem($aCMDResult);
22 $iCacheMemory = $prepSreturn[0];
23 $iInstances = $prepSreturn[1];
25 // prepares DB for import or update, returns Data Source Name
26 $aDSNInfo = prepDB($aCMDResult);
28 if ($aCMDResult['import-data'] || $aCMDResult['all']) {
29 $bDidSomething = true;
30 importData($aCMDResult, $iCacheMemory, $aDSNInfo);
33 if ($aCMDResult['create-functions'] || $aCMDResult['all']) {
34 $bDidSomething = true;
35 createFunctions($aCMDResult);
38 if ($aCMDResult['create-tables'] || $aCMDResult['all']) {
39 $bDidSomething = true;
40 createTables($aCMDResult);
43 if ($aCMDResult['create-partition-tables'] || $aCMDResult['all']) {
44 $bDidSomething = true;
45 createPartitionTables($aCMDResult);
48 if ($aCMDResult['create-partition-functions'] || $aCMDResult['all']) {
49 $bDidSomething = true;
50 createPartitionFunctions($aCMDResult);
53 if ($aCMDResult['import-wikipedia-articles'] || $aCMDResult['all']) {
54 $bDidSomething = true;
55 importWikipediaArticles();
59 if ($aCMDResult['load-data'] || $aCMDResult['all']) {
60 $bDidSomething = true;
61 loadData($aCMDResult, $iInstances);
64 if ($aCMDResult['import-tiger-data']) {
65 $bDidSomething = true;
66 importTigerData($aCMDResult, $iInstances);
69 if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all']) {
70 $bDidSomething = true;
71 calculatePostcodes($aCMDResult);
74 if ($aCMDResult['osmosis-init']) {
75 $bDidSomething = true;
76 echo "Command 'osmosis-init' no longer available, please use utils/update.php --init-updates.\n";
79 if ($aCMDResult['index'] || $aCMDResult['all']) {
80 $bDidSomething = true;
81 index($aCMDResult, $aDSNInfo, $iInstances);
84 if ($aCMDResult['create-search-indices'] || $aCMDResult['all']) {
85 $bDidSomething = true;
86 createSearchIndices($aCMDResult);
89 if ($aCMDResult['create-country-names'] || $aCMDResult['all']) {
90 $bDidSomething = true;
91 createCountryNames($aCMDResult);
94 if ($aCMDResult['drop']) {
95 $bDidSomething = true;
99 didSomething($bDidSomething);