Commit c4156009 authored by root's avatar root

Adding mailing stats

parent 7d60e34d
...@@ -643,6 +643,8 @@ CREATE TABLE IF NOT EXISTS `pingback_site` ( ...@@ -643,6 +643,8 @@ CREATE TABLE IF NOT EXISTS `pingback_site` (
`Contact` int(11) unsigned DEFAULT NULL, `Contact` int(11) unsigned DEFAULT NULL,
`Contribution` int(11) unsigned DEFAULT NULL, `Contribution` int(11) unsigned DEFAULT NULL,
`Participant` int(11) unsigned DEFAULT NULL, `Participant` int(11) unsigned DEFAULT NULL,
`Mailing` int(11) unsigned DEFAULT NULL,
`Delivered` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `hash` (`hash`), UNIQUE KEY `hash` (`hash`),
KEY `first_timestamp` (`first_timestamp`), KEY `first_timestamp` (`first_timestamp`),
...@@ -650,7 +652,7 @@ CREATE TABLE IF NOT EXISTS `pingback_site` ( ...@@ -650,7 +652,7 @@ CREATE TABLE IF NOT EXISTS `pingback_site` (
KEY `last_timestamp` (`last_timestamp`), KEY `last_timestamp` (`last_timestamp`),
KEY `is_active` (`is_active`), KEY `is_active` (`is_active`),
KEY `DB` (`DB`) KEY `DB` (`DB`)
) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_bin AUTO_INCREMENT=120191 ; ) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_bin;
-- -------------------------------------------------------- -- --------------------------------------------------------
......
...@@ -15,20 +15,22 @@ INSERT INTO pingback_site ...@@ -15,20 +15,22 @@ INSERT INTO pingback_site
(`hash`, `version`, `lang`, `uf`, `ufv`, `civi_country`, (`hash`, `version`, `lang`, `uf`, `ufv`, `civi_country`,
`geoip_isoCode`, `MySQL`, `PHP`, `geoip_isoCode`, `MySQL`, `PHP`,
`first_ping_id`, `first_timestamp`, `last_ping_id`, `last_timestamp`, `num_pings`, `first_ping_id`, `first_timestamp`, `last_ping_id`, `last_timestamp`, `num_pings`,
`Contact`, `Contribution`, `Participant`) `Contact`, `Contribution`, `Participant`, `Mailing`, `Delivered`)
SELECT SELECT
hash, version, lang, uf, ufv, c.name, hash, version, lang, uf, ufv, c.name,
geoip_isoCode, MySQL, PHP, geoip_isoCode, MySQL, PHP,
s.id, s.time, s.id, s.time, 1, s.id, s.time, s.id, s.time, 1,
e1.size AS Contact, e2.size AS Contribution, e3.size as Participant e1.size AS Contact, e2.size AS Contribution, e3.size as Participant, e4.size as Mailing, e5.size as Delivered
FROM " . DBPING . ".stats s FROM " . DBPING . ".stats s
LEFT JOIN civicrm_country c ON c.id = s.co LEFT JOIN civicrm_country c ON c.id = s.co
LEFT JOIN " . DBPING . ".entities e1 ON e1.stat_id = s.id AND e1.name = 'Contact' LEFT JOIN " . DBPING . ".entities e1 ON e1.stat_id = s.id AND e1.name = 'Contact'
LEFT JOIN " . DBPING . ".entities e2 ON e2.stat_id = s.id AND e2.name = 'Contribution' LEFT JOIN " . DBPING . ".entities e2 ON e2.stat_id = s.id AND e2.name = 'Contribution'
LEFT JOIN " . DBPING . ".entities e3 ON e3.stat_id = s.id AND e3.name = 'Participant' LEFT JOIN " . DBPING . ".entities e3 ON e3.stat_id = s.id AND e3.name = 'Participant'
LEFT JOIN " . DBPING . ".entities e4 ON e4.stat_id = s.id AND e4.name = 'Mailing'
LEFT JOIN " . DBPING . ".entities e5 ON e5.stat_id = s.id AND e5.name = 'Delivered'
WHERE s.id > $result[0] WHERE s.id > $result[0]
ORDER BY s.id ASC ORDER BY s.id ASC
LIMIT 30000 LIMIT 300000
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
version = s.version, lang = s.lang, uf = s.uf, ufv = s.ufv, civi_country = c.name, version = s.version, lang = s.lang, uf = s.uf, ufv = s.ufv, civi_country = c.name,
geoip_isoCode = s.geoip_isoCode, MySQL = s.MySQL, PHP = s.PHP, geoip_isoCode = s.geoip_isoCode, MySQL = s.MySQL, PHP = s.PHP,
......
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