Code: Select all
$q = "SELECT ip FROM {$serendipity['dbPrefix']}spamblock_htaccess WHERE timestamp > " . (time() - 86400*2) . " GROUP BY ip ORDER BY timestamp DESC LIMIT " . 20*$blocklist_chunksize;
Code: Select all
"ERROR 1055 (42000): Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column..."
- using ANY_VALUE(ip) which is MySQL 5.7+ only (this is the "technically correct" solution but it will make the query fail on 5.6 and below)
- prefixing the query removing the ONLY_FULL_GROUP_BY SQL_MODE (ugly but compatible to 5.6 and 5.7+)
There's also some fencing on the foreach iterating over the query results missing, I'll add that to a patch once you have given me indication of whether depreciating MySQL 5.6 support would be acceptable. Does s9y have a "minimum MySQL version" statement somewhere as of now?