The branch, master has been updated via 941c186d27b3bf6a708ce182399cea4ab6f17474 (commit) via c1f20fefd4c848f3b0e2ec952f60702b4237e341 (commit) from 7b054e9b7d677306ab93ea3812b5b5fc2ee6e2f2 (commit)
- Log ----------------------------------------------------------------- commit 941c186d27b3bf6a708ce182399cea4ab6f17474 Author: Piotr Przybylski piotrprz@gmail.com Date: Fri Aug 19 18:17:56 2011 +0200
Advisor: properly detect 64-bit builds of MySQL on Windows
commit c1f20fefd4c848f3b0e2ec952f60702b4237e341 Author: Piotr Przybylski piotrprz@gmail.com Date: Fri Aug 19 18:16:14 2011 +0200
Make Advisor evaluation code easier to understand
-----------------------------------------------------------------------
Summary of changes: libraries/Advisor.class.php | 21 +++++++++++++++++++-- libraries/advisory_rules.txt | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/libraries/Advisor.class.php b/libraries/Advisor.class.php index 6159286..b681155 100644 --- a/libraries/Advisor.class.php +++ b/libraries/Advisor.class.php @@ -174,6 +174,22 @@ class Advisor $this->runResult[$type][] = $rule; }
+ private function ruleExprEvaluate_var1($matches) + { + // '/fired\s*(\s*('|")(.*)\1\s*)/Uie' + return '1'; //isset($this->runResult['fired'] + } + + private function ruleExprEvaluate_var2($matches) + { + // '/\b(\w+)\b/e' + return isset($this->variables[$matches[1]]) + ? (is_numeric($this->variables[$matches[1]]) + ? $this->variables[$matches[1]] + : '"'.$this->variables[$matches[1]].'"') + : $matches[1]; + } + // Runs a code expression, replacing variable names with their respective values // ignoreUntil: if > 0, it doesn't replace any variables until that string position, but still evaluates the whole expr function ruleExprEvaluate($expr, $ignoreUntil = 0) @@ -182,13 +198,14 @@ class Advisor $exprIgnore = substr($expr,0,$ignoreUntil); $expr = substr($expr,$ignoreUntil); } - $expr = preg_replace('/fired\s*(\s*('|")(.*)\1\s*)/Uie','1',$expr); //isset($this->runResult['fired'] - $expr = preg_replace('/\b(\w+)\b/e','isset($this->variables['\1']) ? (!is_numeric($this->variables['\1']) ? '"'.$this->variables['\1'].'"' : $this->variables['\1']) : '\1'', $expr); + $expr = preg_replace_callback('/fired\s*(\s*('|")(.*)\1\s*)/Ui', array($this, 'ruleExprEvaluate_var1'), $expr); + $expr = preg_replace_callback('/\b(\w+)\b/', array($this, 'ruleExprEvaluate_var2'), $expr); if ($ignoreUntil > 0) { $expr = $exprIgnore . $expr; } $value = 0; $err = 0; + ob_start(); eval('$value = '.$expr.';'); $err = ob_get_contents(); diff --git a/libraries/advisory_rules.txt b/libraries/advisory_rules.txt index f13f838..b2aa21d 100644 --- a/libraries/advisory_rules.txt +++ b/libraries/advisory_rules.txt @@ -111,7 +111,7 @@ rule 'Distribution'
rule 'MySQL Architecture' system_memory - value > 3072*1024 && !preg_match('/64/',version_compile_machine) + value > 3072*1024 && !preg_match('/64/',version_compile_machine) && !preg_match('/64/',version_compile_os) MySQL is not compiled as a 64-bit package. Your memory capacity is above 3 GiB (assuming the Server is on localhost), so MySQL might not be able to access all of your memory. You might want to consider installing the 64-bit version of MySQL. Available memory on this host: %s | implode(' ',PMA_formatByteDown(value*1024, 2, 2))
hooks/post-receive