Commit 3d86aa5a authored by cividesk's avatar cividesk

Added geoip_country, added privacy limits

parent ab28491d
......@@ -16,7 +16,7 @@ $queries[] = array(
WHERE is_active = 1
GROUP BY short_version
ORDER BY num_sites DESC
LIMIT 10 -- we do not need more for the graph
LIMIT 10 -- privacy: we do not need more for the graph
",
);
$queries[] = array(
......@@ -28,6 +28,7 @@ $queries[] = array(
WHERE is_active = 1
GROUP BY language
ORDER BY num_sites DESC
HAVING num_sites > 10 -- privacy: do not report marginal languages
",
);
$queries[] = array(
......@@ -38,7 +39,18 @@ $queries[] = array(
WHERE is_active = 1
GROUP BY uf
ORDER BY num_sites DESC
LIMIT 4 -- this hides the Standalone and Drupal8 data
LIMIT 4 -- privacy: this hides the Standalone and Drupal8 data
",
);
$queries[] = array(
'file' => 'active-sites-server-country.json',
'query' => "
SELECT geoip_country AS country, COUNT(*) AS num_sites
FROM pingback_site s
WHERE is_active = 1
GROUP BY country
ORDER BY num_sites DESC
HAVING num_sites > 10 -- privacy: do not report marginal countries
",
);
$queries[] = array(
......@@ -60,6 +72,6 @@ $queries[] = array(
'query' => "
SELECT * FROM pingback_extension
ORDER BY num_sites DESC
LIMIT 25 -- this hides the non-public extensions
LIMIT 50 -- privacy: only report on top (ie. public) extensions
",
);
\ No newline at end of file
......@@ -12,11 +12,13 @@ echo "Starting from stat_id: $result[0]" . PHP_EOL;
// Feed raw pings into the summary database
$query = "
INSERT INTO pingback_site
(`hash`, `version`, `lang`, `uf`, `ufv`, `MySQL`, `PHP`,
(`hash`, `version`, `lang`, `uf`, `ufv`,
`geoip_country`, `MySQL`, `PHP`,
`first_ping_id`, `first_timestamp`, `last_ping_id`, `last_timestamp`, `num_pings`,
`Contact`, `Contribution`, `Participant`)
SELECT
hash, version, lang, uf, ufv, MySQL, PHP,
hash, version, lang, uf, ufv,
geoip_country, MySQL, PHP,
id, `time`, id, `time`, 1,
e1.size AS Contact, e2.size AS Contribution, e3.size as Participant
FROM " . DBPING . ".stats s
......@@ -27,7 +29,8 @@ INSERT INTO pingback_site
ORDER BY `id` ASC
LIMIT 30000
ON DUPLICATE KEY UPDATE
version = s.version, lang = s.lang, uf = s.uf, ufv = s.ufv, MySQL = s.MySQL, PHP = s.PHP,
version = s.version, lang = s.lang, uf = s.uf, ufv = s.ufv,
geoip_country = s.geoip_country, MySQL = s.MySQL, PHP = s.PHP,
last_ping_id = s.id, last_timestamp = s.time, num_pings = num_pings + 1,
Contact = e1.size, Contribution = e2.size, Participant = e3.size
";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment