Commit 3523a649 authored by Simon Welsh's avatar Simon Welsh

More swears

git-svn-id: svn+ssh://lsgn/var/logbot-www@70 5f99df0c-6b0a-442a-b40a-040688e84a9d
parent e1b02ffd
...@@ -102,8 +102,22 @@ function get_stats() { ...@@ -102,8 +102,22 @@ function get_stats() {
function build_stats(Redis $r) { function build_stats(Redis $r) {
// SELECT COUNT(*) AS "Bitches", "Nick" FROM "Log" WHERE "Text" ILIKE '%cunt%' GROUP BY "Nick" ORDER BY "Bitches" DESC; // SELECT COUNT(*) AS "Bitches", "Nick" FROM "Log" WHERE "Text" ILIKE '%cunt%' GROUP BY "Nick" ORDER BY "Bitches" DESC;
$stats = []; $stats = [];
$swears = [
'Bitch',
'Cunt',
'Fuck',
'Shit',
'Joomla',
'WordPress',
'Dick',
'Slut',
'Crap',
'Synergy',
'Drupal',
'Bastard',
];
$query = 'SELECT COUNT(*) AS "Number", "Nick" FROM "Log" WHERE "Text" ILIKE \'%%%s%%\' GROUP BY "Nick" HAVING COUNT(*) >= 10 ORDER BY "Number" DESC;'; $query = 'SELECT COUNT(*) AS "Number", "Nick" FROM "Log" WHERE "Text" ILIKE \'%%%s%%\' GROUP BY "Nick" HAVING COUNT(*) >= 10 ORDER BY "Number" DESC;';
foreach(['Bitch', 'Cunt', 'Fuck', 'Shit', 'Joomla', 'WordPress', 'Dick', 'Slut', 'Crap'] as $name) { foreach($swears as $name) {
$res = DB::inst()->query(sprintf($query, $name)); $res = DB::inst()->query(sprintf($query, $name));
$stats[$name] = []; $stats[$name] = [];
while($row = pg_fetch_array($res)) { while($row = pg_fetch_array($res)) {
......
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