X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/e1be3d9f48b51a927c26d1ac0035b50b82423916..7f0a0ce5e573db724310abe2153cb9224e219ece:/wikidata/pull_wikipedia_logs.php diff --git a/wikidata/pull_wikipedia_logs.php b/wikidata/pull_wikipedia_logs.php index a7f6a9a3..3e172069 100644 --- a/wikidata/pull_wikipedia_logs.php +++ b/wikidata/pull_wikipedia_logs.php @@ -1,12 +1,12 @@ 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,14 +64,16 @@ 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'); } } // Notes: /* - gzip -dc $FILE.gz | grep -e "^en [^ :]\+ [0-9]\+" | sed "s#\(^[a-z]\{2\}\) \([^ :]\+\) \([0-9]\+\) [0-9]\+#update wikipedia_article set hit_count = coalesce(hit_count,0) + \3 where language = '\1' and title = catch_decode_url_part('\2');#g" | /opt/mapquest/stdbase-dev$ + gzip -dc $FILE.gz | grep -e "^en [^ :]\+ [0-9]\+" | + sed "s#\(^[a-z]\{2\}\) \([^ :]\+\) \([0-9]\+\) [0-9]\+#update wikipedia_article set hit_count = coalesce(hit_count,0) + \3 where language = '\1' + and title = catch_decode_url_part('\2');#g" | /opt/mapquest/stdbase-dev$ cat totals.txt | sed "s#\(^[a-z]\{2\}\) \([^ ]\+\) \([0-9]\+\)\$#update entity_link set hits = s,0) + \3 where target = '\1wiki' and value = catch_decode_url_part('\2');#g" cat totals.txt | sed "s#\(^[a-z]\{2\}\) \([^ ]\+\) \([0-9]\+\)\$#update entity_link set hits = coalesce(hits,0) + \3 where target = '\1wiki' and value = catch_decode_url_part('\2');#g" */