Skip to content

Commit

Permalink
Fix(installer): rare case where sql_version is not defined (sbpp#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushaway committed Jun 3, 2024
1 parent cdfb4e2 commit 914312a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion web/configs/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.0",
"git": "1411",
"git": "1412",
"dev": true
}
45 changes: 23 additions & 22 deletions web/install/template/page.3.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
?>

<b><p>This page will list all of the requirements to run the SourceBans web interface, and compare them with your current values. This page will also list some recomendations. These aren't required to run SourceBans web interface, but they are highly recomended.</p></b>
<b><p>This page will list all of the requirements to run the SourceBans web interface, and compare them with your current values. This page will also list some recomendations. These aren't required to run SourceBans web interface, but they are highly recommended.</p></b>
<table style="width: 101%; margin: 0 0 -2px -2px;">
<tr>
<td colspan="3" class="listtable_top"><b>PHP Requirements</b></td>
Expand All @@ -25,7 +25,7 @@
<table width="98%" cellspacing="0" cellpadding="0" align="center" class="listtable" style="margin-top:3px;">
<tr>
<td width="33%" height="16" class="listtable_top">Setting</td>
<td width="22%" height="16" class="listtable_top">Recomended</td>
<td width="22%" height="16" class="listtable_top">Recommended</td>
<td width="22%" height="16" class="listtable_top">Required</td>
<td width="22%" height="16" class="listtable_top">Your Value</td>
</tr>
Expand Down Expand Up @@ -130,7 +130,7 @@
<table width="98%" cellspacing="0" cellpadding="0" align="center" class="listtable" style="margin-top:3px;">
<tr>
<td width="33%" height="16" class="listtable_top">Setting</td>
<td width="22%" height="16" class="listtable_top">Recomended</td>
<td width="22%" height="16" class="listtable_top">Recommended</td>
<td width="22%" height="16" class="listtable_top">Required</td>
<td width="22%" height="16" class="listtable_top">Your Value</td>
</tr>
Expand All @@ -139,28 +139,29 @@
<td width="22%" height="16" class="listtable_top">N/A</td>
<td width="22%" height="16" class="listtable_1"><b>Mysql 5.5 or MariaDB 10.0.5</b></td>
<?php
// Ensure $sql_version is defined
if (!isset($sql_version)) {
$sql_version = '0.0.0';
}

//our SQL is using FULLTEXT in inno DB.
//this is only supported from Mysql 5.5 onwards
//and >= MariaDB 10.0.5 ( https://mariadb.com/kb/en/full-text-index-overview/ )
if (strpos($sql_version, 'MARIADB') !== false){
//we have a mariadb.
//check for versions below 10.0.5
if(version_compare($sql_version, "10.0.5", "<")){
$class = "red";
$errors++;
}else{
$class = "green";
}
}else{
//other DB (presumably mysql)
//check for stuff lower then 5.5
if(version_compare($sql_version, "5.5", "<")) {
$class = "red";
$errors++;
}else{
$class = "green";
if (!empty($sql_version) && strpos($sql_version, 'MARIADB') !== false) {
if (version_compare($sql_version, '10.0.5') != -1) {
$class = "green";
} else {
$class = "red";
$errors++;
}
}
}
// other DB (presumably mysql) - check for stuff lower then 5.5
elseif (!empty($sql_version) && strpos($sql_version, '5.5') != -1 || strpos($sql_version, '10.0.5') != -1) {
$class = "green";
} else {
$class = "red";
$errors++;
}
?>
<td width="22%" height="16" class="<?php echo $class?>"><?php echo $sql_version;?></td>
</tr>
Expand All @@ -176,7 +177,7 @@
<table width="98%" cellspacing="0" cellpadding="0" align="center" class="listtable" style="margin-top:3px;">
<tr>
<td width="33%" height="16" class="listtable_top">Setting</td>
<td width="22%" height="16" class="listtable_top">Recomended</td>
<td width="22%" height="16" class="listtable_top">Recommended</td>
<td width="22%" height="16" class="listtable_top">Required</td>
<td width="22%" height="16" class="listtable_top">Your Value</td>
</tr>
Expand Down

0 comments on commit 914312a

Please sign in to comment.