New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty mysql for alerts breaks regex rules #6614

Merged
merged 2 commits into from May 13, 2017
Jump to file or symbol
Failed to load files and symbols.
+1 −1
Diff settings

Always

Just for now

Next

Pretty mysql for alerts breaks regex rules

Fix for issue #6613
  • Loading branch information...
XioNoX committed May 9, 2017
commit 30bd3bd135048ba5d10a3b90bb39ee338e81e675
View
@@ -36,7 +36,7 @@ function GenSQL($rule)
return false;
}
//Pretty-print rule to dissect easier
$pretty = array('*' => '*', '(' => ' ( ', ')' => ' ) ', '/' => '/', '&&' => ' && ', '||' => ' || ', 'DATE_SUB ( NOW ( )' => 'DATE_SUB( NOW()');
$pretty = array('*' => '*', '(' => '(', ')' => ')', '/' => '/', '&&' => ' && ', '||' => ' || ', 'DATE_SUB ( NOW ( )' => 'DATE_SUB( NOW()');

This comment has been minimized.

@murrant

murrant May 9, 2017

Member

It looks like '&&' => ' && ' and '||' => ' || ' are the only two worthwhile mappings. Probably just remove the rest. It is interesting that this already contains two worthless replacements...

@murrant

murrant May 9, 2017

Member

It looks like '&&' => ' && ' and '||' => ' || ' are the only two worthwhile mappings. Probably just remove the rest. It is interesting that this already contains two worthless replacements...

This comment has been minimized.

@murrant

murrant May 9, 2017

Member

Or maybe the entire thing...

@murrant

murrant May 9, 2017

Member

Or maybe the entire thing...

$rule = str_replace(array_keys($pretty), $pretty, $rule);
$tmp = explode(" ", $rule);
$tables = array();
ProTip! Use n and p to navigate between commits in a pull request.