diff --git a/libraries/advisor.class.php b/libraries/Advisor.class.php similarity index 94% rename from libraries/advisor.class.php rename to libraries/Advisor.class.php index a45c76c012..ca9fb6f61f 100644 --- a/libraries/advisor.class.php +++ b/libraries/Advisor.class.php @@ -140,11 +140,18 @@ class Advisor $rule['name'] = $this->translate($rule['name']); $rule['issue'] = $this->translate($rule['issue']); + // Replaces {server_variable} with 'server_variable' linking to server_variables.php $rule['recommendation'] = preg_replace( '/\{([a-z_0-9]+)\}/Ui', - '\1', + '\1', $this->translate($rule['recommendation'])); + // Replaces external Links with PMA_linkURL() generated links + $rule['recommendation'] = preg_replace( + '#href=("|\')(https?://[^\1]+)\1#ie', + '\'href="\' . PMA_linkURL("\2") . \'"\'', + $rule['recommendation'] + ); break; } diff --git a/libraries/advisory_rules.txt b/libraries/advisory_rules.txt index dd1843665d..f13f838890 100644 --- a/libraries/advisory_rules.txt +++ b/libraries/advisory_rules.txt @@ -1,6 +1,6 @@ # phpMyAdmin Advisory rules file # Use only UNIX style newlines -# This file is being parsed by advisor.class.php, which should handle syntax errors correctly. +# This file is being parsed by Advisor.class.php, which should handle syntax errors correctly. # However, PHP Warnings and the like are being consumed by the phpMyAdmin error handler, so those won't show up # E.g.: Justification line is empty because you used an unescape percent sign, sprintf() returns an empty string and no warning/error is shown # @@ -422,7 +422,7 @@ rule 'InnoDB buffer pool size' [system_memory > 0] value < 60 Your InnoDB buffer pool is fairly small. The InnoDB buffer pool has a profound impact on performance for InnoDB tables. Assign all your remaining memory to this buffer. For database servers that use solely InnoDB as storage engine and have no other services (e.g. a web server) running, you may set this as high as 80% of your available memory. If that is not the case, you need to carefully assess the memory consumption of your other services and non-InnoDB-Tables and set this variable accordingly. If it is set too high, your system will start swapping, which decreases performance significantly. See also this article - You are currently using %s% of your memory for the InnoDB buffer pool. This rule fires if you are assigning less than 60%, however this might be perfectly adequate for your system if you don't have much InnoDB tables or other services running on the same machine. + You are currently using %s% of your memory for the InnoDB buffer pool. This rule fires if you are assigning less than 60%, however this might be perfectly adequate for your system if you don't have much InnoDB tables or other services running on the same machine. | value # # other diff --git a/scripts/advisor2php b/scripts/advisor2php index 7bc85677db..c34f2870d1 100644 --- a/scripts/advisor2php +++ b/scripts/advisor2php @@ -5,10 +5,10 @@ * by gettext for generating po(t) files. */ -if (!file_exists('./libraries/advisor.class.php')) { +if (!file_exists('./libraries/Advisor.class.php')) { chdir('..'); } -include './libraries/advisor.class.php'; +include './libraries/Advisor.class.php'; $rules = Advisor::parseRulesFile(); diff --git a/server_status.php b/server_status.php index e7d104b5dc..1add0b6932 100644 --- a/server_status.php +++ b/server_status.php @@ -357,7 +357,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { } if(isset($_REQUEST['advisor'])) { - include('libraries/advisor.class.php'); + include('libraries/Advisor.class.php'); $advisor = new Advisor(); exit(json_encode($advisor->run())); } diff --git a/test/classes/Advisor_test.php b/test/classes/Advisor_test.php index 9bcba01c7b..ac43516eb1 100644 --- a/test/classes/Advisor_test.php +++ b/test/classes/Advisor_test.php @@ -9,7 +9,7 @@ /* * Include to test. */ -require_once 'libraries/advisor.class.php'; +require_once 'libraries/Advisor.class.php'; class Advisor_test extends PHPUnit_Framework_TestCase { @@ -29,5 +29,12 @@ class Advisor_test extends PHPUnit_Framework_TestCase array('%s% foo', '%s%% foo'), ); } + + public function testParse() + { + $advisor = new Advisor(); + $parseResult = $this->parseRulesFile(); + $this->assertEquals($parseResult['errors'], array()); + } } ?>