mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-09 19:44:07 +00:00
replace double-quoting with single quotes where applicable
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
#!/usr/bin/php -Cq
|
||||
<?php
|
||||
|
||||
$hFile = @fopen("wikidatawiki-20130623-pages-articles.xml", "r");
|
||||
$hFile = @fopen('wikidatawiki-20130623-pages-articles.xml', 'r');
|
||||
|
||||
$hFileEntity = fopen("entity.csv", "w");
|
||||
$hFileEntityLabel = fopen("entity_label.csv", "w");
|
||||
$hFileEntityDescription = fopen("entity_description.csv", "w");
|
||||
$hFileEntityAlias = fopen("entity_alias.csv", "w");
|
||||
$hFileEntityLink = fopen("entity_link.csv", "w");
|
||||
$hFileEntityProperty = fopen("entity_property.csv", "w");
|
||||
$hFileEntity = fopen('entity.csv', 'w');
|
||||
$hFileEntityLabel = fopen('entity_label.csv', 'w');
|
||||
$hFileEntityDescription = fopen('entity_description.csv', 'w');
|
||||
$hFileEntityAlias = fopen('entity_alias.csv', 'w');
|
||||
$hFileEntityLink = fopen('entity_link.csv', 'w');
|
||||
$hFileEntityProperty = fopen('entity_property.csv', 'w');
|
||||
|
||||
$iCount = 0;
|
||||
|
||||
@@ -50,7 +50,7 @@ if ($hFile) {
|
||||
$sText = html_entity_decode(substr($sLine, 33, -8), ENT_COMPAT, 'UTF-8');
|
||||
$aArticle = json_decode($sText, true);
|
||||
|
||||
if (array_diff(array_keys($aArticle), array("label", "description", "aliases", "links", "entity", "claims", "datatype")) != array()) {
|
||||
if (array_diff(array_keys($aArticle), array('label', 'description', 'aliases', 'links', 'entity', 'claims', 'datatype')) != array()) {
|
||||
// DEBUG
|
||||
var_dump($sTitle);
|
||||
var_dump(array_keys($aArticle));
|
||||
@@ -67,7 +67,7 @@ if ($hFile) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo ".";
|
||||
echo '.';
|
||||
|
||||
fputcsv($hFileEntity, array($iID, $sTitle, $iPID, $iQID, @$aArticle['datatype']));
|
||||
|
||||
@@ -123,7 +123,7 @@ if ($hFile) {
|
||||
$iPID,
|
||||
null,
|
||||
null,
|
||||
"SRID=4326;POINT(".((float) $aClaim['m'][3]['longitude'])." ".((float)$aClaim['m'][3]['latitude']).")", null
|
||||
'SRID=4326;POINT('.((float) $aClaim['m'][3]['longitude']).' '.((float)$aClaim['m'][3]['latitude']).')', null
|
||||
)
|
||||
);
|
||||
/* echo "insert into entity_property values (nextval('seq_entity_property'),";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
for ($iTimestamp = mktime(0, 0, 0, 5, 1, 2013); $iTimestamp < mktime(0, 0, 0, 6, 15, 2013); $iTimestamp += 24*60*60) {
|
||||
$sYear = date("Y", $iTimestamp);
|
||||
$sMonth = date("Y-m", $iTimestamp);
|
||||
$sDay = date("Ymd", $iTimestamp);
|
||||
$sYear = date('Y', $iTimestamp);
|
||||
$sMonth = date('Y-m', $iTimestamp);
|
||||
$sDay = date('Ymd', $iTimestamp);
|
||||
|
||||
for ($iHour = 0; $iHour < 24; $iHour++) {
|
||||
$sFilename = sprintf("pagecounts-".$sDay."-%02d0000", $iHour);
|
||||
$sFilename = sprintf('pagecounts-'.$sDay.'-%02d0000', $iHour);
|
||||
echo $sFilename."\n";
|
||||
if (!file_exists($sFilename.'.gz')) {
|
||||
exec('wget http://dumps.wikimedia.org/other/pagecounts-raw/'.$sYear.'/'.$sMonth.'/'.$sFilename.'.gz');
|
||||
@@ -14,9 +14,9 @@ for ($iTimestamp = mktime(0, 0, 0, 5, 1, 2013); $iTimestamp < mktime(0, 0, 0, 6,
|
||||
|
||||
exec('gzip -dc '.$sFilename.'.gz'.' | grep -e "^[a-z]\{2\} [^ :]\+ [0-9]\+" > hour.txt');
|
||||
|
||||
$hPrevTotals = @fopen("totals.txt", "r");
|
||||
$hDayTotals = @fopen("hour.txt", "r");
|
||||
$hNewTotals = @fopen("newtotals.txt", "w");
|
||||
$hPrevTotals = @fopen('totals.txt', 'r');
|
||||
$hDayTotals = @fopen('hour.txt', 'r');
|
||||
$hNewTotals = @fopen('newtotals.txt', 'w');
|
||||
|
||||
$sPrevKey = $sDayKey = true;
|
||||
$sPrevLine = true;
|
||||
@@ -64,8 +64,8 @@ for ($iTimestamp = mktime(0, 0, 0, 5, 1, 2013); $iTimestamp < mktime(0, 0, 0, 6,
|
||||
@fclose($hDayTotals);
|
||||
@fclose($hNewTotals);
|
||||
|
||||
@unlink("totals.txt");
|
||||
rename("newtotals.txt", "totals.txt");
|
||||
@unlink('totals.txt');
|
||||
rename('newtotals.txt', 'totals.txt');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user