4 require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
\r
5 require_once(CONST_BasePath.'/lib/init-cmd.php');
\r
6 include_once(CONST_InstallPath.'/utils/setupClass.php');
\r
7 // ->indirect via init-cmd.php -> /lib/cmd.php for runWithEnv, getCmdOpt
\r
8 // ->indirect via init-cmd.php -> /lib/init.php -> db.php for &getDB()
\r
10 include_once(CONST_BasePath.'/lib/setup_functions.php');
\r
11 include_once(CONST_BasePath.'/lib/setup_functions.php');
\r
12 ini_set('memory_limit', '800M');
\r
15 $aCMDOptions = createSetupArgvArray();
\r
17 // $aCMDOptions passed to getCmdOpt by reference
\r
18 getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
\r
21 $bDidSomething = false;
\r
23 //*******************************************************
\r
24 // Making some sanity check:
\r
25 // Check if osm-file is set and points to a valid file
\r
26 if ($aCMDResult['import-data'] || $aCMDResult['all']) {
\r
27 // to remain in /lib/setup_functions.php function
\r
28 checkInFile($aCMDResult['osm-file']);
\r
29 echo $aCMDResult['osm-file'];
\r
32 // osmosis init is no longer supported
\r
33 if ($aCMDResult['osmosis-init']) {
\r
34 $bDidSomething = true;
\r
35 echo "Command 'osmosis-init' no longer available, please use utils/update.php --init-updates.\n";
\r
38 // ******************************************************
\r
39 // instantiate Setup class
\r
40 $cSetup = new SetupFunctions ($aCMDResult);
\r
41 if ($aCMDResult['create-db'] || $aCMDResult['all']) {
\r
42 $bDidSomething = true;
\r
43 $cSetup -> createDB();
\r
46 // *******************************************************
\r
47 // go through complete process if 'all' is selected or start selected functions
\r
48 if ($aCMDResult['setup-db'] || $aCMDResult['all']) {
\r
49 $bDidSomething = true;
\r
50 $cSetup -> setupDB();
\r
53 // Try accessing the C module, so we know early if something is wrong
\r
54 if (!checkModulePresence()) {
\r
55 fail('error loading nominatim.so module');
\r
58 if ($aCMDResult['import-data'] || $aCMDResult['all']) {
\r
59 $bDidSomething = true;
\r
60 $cSetup -> importData($aCMDResult['osm-file']);
\r
63 if ($aCMDResult['create-functions'] || $aCMDResult['all']) {
\r
64 $bDidSomething = true;
\r
65 $cSetup -> createFunctions();
\r
68 if ($aCMDResult['create-tables'] || $aCMDResult['all']) {
\r
69 $bDidSomething = true;
\r
70 $cSetup -> createTables();
\r
73 if ($aCMDResult['create-partition-tables'] || $aCMDResult['all']) {
\r
74 $bDidSomething = true;
\r
75 $cSetup -> createPartitionTables();
\r
78 if ($aCMDResult['create-partition-functions'] || $aCMDResult['all']) {
\r
79 $bDidSomething = true;
\r
80 $cSetup -> createPartitionFunctions();
\r
83 if ($aCMDResult['import-wikipedia-articles'] || $aCMDResult['all']) {
\r
84 $bDidSomething = true;
\r
85 $cSetup -> importWikipediaArticles();
\r
88 if ($aCMDResult['load-data'] || $aCMDResult['all']) {
\r
89 $bDidSomething = true;
\r
90 $cSetup -> loadData($aCMDResult['disable-token-precalc']);
\r
93 if ($aCMDResult['import-tiger-data']) {
\r
94 $bDidSomething = true;
\r
95 $cSetup -> importTigerData();
\r
98 if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all']) {
\r
99 $bDidSomething = true;
\r
100 $cSetup -> calculatePostcodes($aCMDResult['all']);
\r
103 if ($aCMDResult['index'] || $aCMDResult['all']) {
\r
104 $bDidSomething = true;
\r
105 $cSetup -> index($aCMDResult['index-noanalyse']);
\r
108 if ($aCMDResult['create-search-indices'] || $aCMDResult['all']) {
\r
109 $bDidSomething = true;
\r
110 $cSetup -> createSearchIndices();
\r
113 if ($aCMDResult['create-country-names'] || $aCMDResult['all']) {
\r
114 $bDidSomething = true;
\r
115 $cSetup -> createCountryNames($aCMDResult);
\r
118 if ($aCMDResult['drop']) {
\r
119 $bDidSomething = true;
\r
120 $cSetup -> drop($aCMDResult);
\r
123 // ******************************************************
\r
124 // If we did something, repeat the warnings
\r
125 if (!$bDidSomething) {
\r
126 showUsage($aCMDOptions, true);
\r
128 echo "Summary of warnings:\n\n";
\r
131 info('Setup finished.');
\r