Guard against network failures in getDatabaseDate()

When updating use the date from the diff file instead
as we are guaranteed to get this if the file has been
successfully loaded.
This commit is contained in:
Sarah Hoffmann
2017-06-09 21:49:31 +02:00
parent 7448d3f171
commit 4e6c75040e
4 changed files with 57 additions and 5 deletions

View File

@@ -407,9 +407,13 @@ if ($aCMDResult['load-data'] || $aCMDResult['all']) {
$sDatabaseDate = getDatabaseDate($oDB);
pg_query($oDB->connection, 'TRUNCATE import_status');
$sSQL = "INSERT INTO import_status (lastimportdate) VALUES('".$sDatabaseDate."')";
pg_query($oDB->connection, $sSQL);
echo "Latest data imported from $sDatabaseDate.\n";
if ($sDatabaseDate === false) {
echo "WARNING: could not determine database date.\n";
} else {
$sSQL = "INSERT INTO import_status (lastimportdate) VALUES('".$sDatabaseDate."')";
pg_query($oDB->connection, $sSQL);
echo "Latest data imported from $sDatabaseDate.\n";
}
}
if ($aCMDResult['import-tiger-data']) {