rewrite utc timestamp requests
This commit is contained in:
@@ -11,6 +11,8 @@ class InsertSQLRewriter extends AbstractSQLRewriter
|
||||
// Those are used when we need to set the date to now() in gmt time
|
||||
$sql = str_replace("'0000-00-00 00:00:00'", 'now() AT TIME ZONE \'gmt\'', $sql);
|
||||
|
||||
$sql = str_replace("utc_timestamp()", "CURRENT_TIMESTAMP AT TIME ZONE 'UTC'", $sql);
|
||||
|
||||
// Multiple values group when calling INSERT INTO don't always work
|
||||
if(false !== strpos($sql, $wpdb->options) && false !== strpos($sql, '), (')) {
|
||||
$pattern = '/INSERT INTO.+VALUES/';
|
||||
|
||||
@@ -68,6 +68,8 @@ class SelectSQLRewriter extends AbstractSQLRewriter
|
||||
// HANDLE REGEXP
|
||||
$sql = preg_replace('/REGEXP/', '~', $sql);
|
||||
|
||||
$sql = str_replace("utc_timestamp()", "CURRENT_TIMESTAMP AT TIME ZONE 'UTC'", $sql);
|
||||
|
||||
// In order for users counting to work...
|
||||
$matches = array();
|
||||
if(preg_match_all('/COUNT[^C]+\),/', $sql, $matches)) {
|
||||
|
||||
Reference in New Issue
Block a user