forked from hans/Nominatim
Can't filter on rank_search before it has been assigned
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
if (isset($aCMDResult['parse-tiger']))
|
||||
{
|
||||
$bDidSomething = true;
|
||||
$bDidSomething = true;
|
||||
foreach(glob($aCMDResult['parse-tiger'].'/??_*', GLOB_ONLYDIR) as $sStateFolder)
|
||||
{
|
||||
preg_match('#([0-9]{2})_(.*)#',basename($sStateFolder), $aMatch);
|
||||
@@ -97,7 +97,7 @@
|
||||
mkdir($sTempDir);
|
||||
|
||||
|
||||
$bDidSomething = true;
|
||||
$bDidSomething = true;
|
||||
foreach(glob($aCMDResult['parse-tiger-2011'].'/tl_2011_?????_edges.zip', 0) as $sImportFile)
|
||||
{
|
||||
set_time_limit(30);
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
if (file_exists($sWikiArticlesFile))
|
||||
{
|
||||
echo "Importing wikipedia articles...";
|
||||
pgsqlRunRestoreData($sWikiArticlesFile);
|
||||
pgsqlRunDropAndRestore($sWikiArticlesFile);
|
||||
echo "...done\n";
|
||||
}
|
||||
else
|
||||
@@ -229,7 +229,7 @@
|
||||
if (file_exists($sWikiRedirectsFile))
|
||||
{
|
||||
echo "Importing wikipedia redirects...";
|
||||
pgsqlRunRestoreData($sWikiRedirectsFile);
|
||||
pgsqlRunDropAndRestore($sWikiRedirectsFile);
|
||||
echo "...done\n";
|
||||
}
|
||||
else
|
||||
@@ -558,3 +558,31 @@
|
||||
|
||||
proc_close($hProcess);
|
||||
}
|
||||
|
||||
function pgsqlRunDropAndRestore($sDumpFile)
|
||||
{
|
||||
// Convert database DSN to psql paramaters
|
||||
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
||||
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
||||
$sCMD = 'pg_restore -p '.$aDSNInfo['port'].' -d '.$aDSNInfo['database'].' -Fc --clean '.$sDumpFile;
|
||||
|
||||
$aDescriptors = array(
|
||||
0 => array('pipe', 'r'),
|
||||
1 => array('pipe', 'w'),
|
||||
2 => array('file', '/dev/null', 'a')
|
||||
);
|
||||
$ahPipes = null;
|
||||
$hProcess = proc_open($sCMD, $aDescriptors, $ahPipes);
|
||||
if (!is_resource($hProcess)) fail('unable to start pg_restore');
|
||||
|
||||
fclose($ahPipes[0]);
|
||||
|
||||
// TODO: error checking
|
||||
while(!feof($ahPipes[1]))
|
||||
{
|
||||
echo fread($ahPipes[1], 4096);
|
||||
}
|
||||
fclose($ahPipes[1]);
|
||||
|
||||
proc_close($hProcess);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user