- // Archive for debug?
- unlink($sImportFile);
-
- $sBatchEnd = getosmosistimestamp($sOsmosisConfigDirectory);
-
- // Index file
- $fCMDStartTime = time();
- $iFileID = $oDB->getOne('select nextval(\'file\')');
- if (PEAR::isError($iFileID))
- {
- echo $oDB->getMessage()."\n";
- exit;
- }
- $sFileDir = CONST_BasePath.'/export/diff/';
- $sFileDir .= str_pad(floor($iFileID/1000000), 3, '0', STR_PAD_LEFT);
- $sFileDir .= '/'.str_pad(floor($iFileID/1000) % 1000, 3, '0', STR_PAD_LEFT);
-
- if (!is_dir($sFileDir)) mkdir($sFileDir, 0777, true);
- $sThisIndexCmd = $sCMDIndex;
- $sThisIndexCmd .= $sFileDir;
- $sThisIndexCmd .= '/'.str_pad($iFileID % 1000, 3, '0', STR_PAD_LEFT);
- $sThisIndexCmd .= ".npi.out";
- echo "$sThisIndexCmd\n";
+ $iFileSize = filesize($sImportFile);
+ $sBatchEnd = getosmosistimestamp($sOsmosisConfigDirectory);
+
+ // Import the file
+ $fCMDStartTime = time();
+ echo $sCMDImport."\n";
+ exec($sCMDImport, $sJunk, $iErrorLevel);
+ if ($iErrorLevel)
+ {
+ echo "Error: $iErrorLevel\n";
+ exit($iErrorLevel);
+ }
+ $sSQL = "INSERT INTO import_osmosis_log values ('$sBatchEnd',$iFileSize,'".date('Y-m-d H:i:s',$fCMDStartTime)."','".date('Y-m-d H:i:s')."','osm2pgsql')";
+ var_Dump($sSQL);
+ $oDB->query($sSQL);
+ echo date('Y-m-d H:i:s')." Completed osm2pgsql step for $sBatchEnd in ".round((time()-$fCMDStartTime)/60,2)." minutes\n";