Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

--- develop ---

* issue#270: Use strict MariaDB version detection in the install advisor
* issue: Making changes to support Cacti 1.3
* issue: Don't use MyISAM for non-analytical tables
* issue: The install advisor for Syslog was broken in current Cacti releases
Expand Down
8 changes: 4 additions & 4 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,10 +960,11 @@ function syslog_install_advisor($syslog_exists) {
$type = __('Install', 'syslog');
}

$database = db_fetch_row('SHOW GLOBAL VARIABLES LIKE "version"');
syslog_connect();
$database = syslog_db_fetch_row('SHOW GLOBAL VARIABLES LIKE "version"');

/* remove Aria as a storage enging if this is mysql */
if (stripos($database['Value'], 'mariadb') == false) {
/* remove Aria as a storage engine if this is mysql */
if (stripos($database['Value'], 'mariadb') === false) {
unset($fields_syslog_update['engine']['array']['aria']);
} else {
$fields_syslog_update['engine']['value'] = 'aria';
Expand Down Expand Up @@ -1626,4 +1627,3 @@ function syslog_utilities_list() {
</tr>
<?php
}

23 changes: 23 additions & 0 deletions tests/regression/issue270_mariadb_detection_strict_test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

$setup = file_get_contents(dirname(__DIR__, 2) . '/setup.php');

if ($setup === false) {
fwrite(STDERR, "Failed to load setup.php\n");
exit(1);
}

$legacyPattern = '/stripos\s*\(\s*\$database\s*\[\s*[\'"]{1}Value[\'"]{1}\s*\]\s*,\s*[\'"]{1}mariadb[\'"]{1}\s*\)\s*==\s*false/';
$fixedPattern = '/stripos\s*\(\s*\$database\s*\[\s*[\'"]{1}Value[\'"]{1}\s*\]\s*,\s*[\'"]{1}mariadb[\'"]{1}\s*\)\s*===\s*false/';

if (preg_match($legacyPattern, $setup)) {
fwrite(STDERR, "Legacy loose MariaDB stripos comparison is still present.\n");
exit(1);
}

if (!preg_match($fixedPattern, $setup)) {
fwrite(STDERR, "Strict MariaDB stripos comparison is missing.\n");
exit(1);
}

echo "issue270_mariadb_detection_strict_test passed\n";