Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
update: database files
Browse files Browse the repository at this point in the history
fix: installer updating removed table
fix: installer remove checks for settings depecrated by MariaDB 10.3
  • Loading branch information
darkalchemy committed Oct 28, 2018
1 parent 3921060 commit bf102bc
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 38 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
28 Oct, 2018
update: database files
fix: installer updating removed table
fix: installer remove checks for settings depecrated by MariaDB 10.3
update: README
update: global blocks

Expand Down
4 changes: 2 additions & 2 deletions database/trivia.php.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion database/tvmaze.php.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2018-10-26 15:42:29
-- Dump completed on 2018-10-28 7:14:15
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"devDependencies": {
"autoprefixer": "^9.3.1",
"browserslist": "^4.3.3",
"browserslist": "^4.3.4",
"bulma": "^0.7.2",
"clean-css": "^4.2.1",
"clean-css-cli": "^4.2.1",
Expand Down
6 changes: 3 additions & 3 deletions public/install/extra/data.php.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/install/extra/schema.php.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2633,4 +2633,4 @@ CREATE TABLE `wiki` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2018-10-26 15:42:29
-- Dump completed on 2018-10-28 7:14:15
38 changes: 21 additions & 17 deletions public/install/functions/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ function db_test()
<div class="readable">Schema can be created</div>
<div class="readable">Data can be imported</div>
<div style="text-align:center;">
<input type="hidden" name="do" value="db_insert" />
<input type="hidden" name="xbt" value="' . $_GET['xbt'] . '" />
<input type="hidden" name="do" value="db_insert">
<input type="hidden" name="xbt" value="' . $_GET['xbt'] . '">
</div>
</fieldset>
<div style="text-align:center;">
<input type="submit" value="Import database" />
<input type="submit" value="Import database">
</div>
</form>';
} else {
$out .= '
<div class="notreadable">There was an error while selecting the database<br>' . $mysqli_test->error . '</div>
</fieldset>
<div style="text-align:center;">
<input type="button" value="Reload" onclick="window.location.reload()" />
<input type="button" value="Reload" onclick="window.location.reload()">
</div>';
}
} else {
$out .= '
<div class="notreadable">There was an error while connection to the database<br>' . $mysqli_test->connect_error . '</div>
</fieldset>
<div class="info" style="text-align:center;">
<input type="button" value="Reload" onclick="window.location.reload()" />
<input type="button" value="Reload" onclick="window.location.reload()">
</div>';
}
$out .= '
Expand All @@ -72,18 +72,23 @@ function db_insert()

$timestamp = strtotime('today midnight');
$fail = '';
$query = 'SHOW VARIABLES LIKE "innodb_large_prefix"';
$query = 'SELECT VERSION() AS ver';
$sql = sprintf("/usr/bin/mysql -h %s -u%s -p'%s' %s -e '%s'", $_ENV['DB_HOST'], $_ENV['DB_USERNAME'], $_ENV['DB_PASSWORD'], $_ENV['DB_DATABASE'], $query);
$retval = shell_exec($sql);
if (!preg_match('/innodb_large_prefix\s+ON/', $retval)) {
$fail .= "<div class='notreadable'>Please add/update my.cnf 'innodb_large_prefix = 1' and restart mysql.</div>";
}
if (!preg_match('/10\.3\.\d+\-MariaDB/i', $retval)) {
$query = 'SHOW VARIABLES LIKE "innodb_large_prefix"';
$sql = sprintf("/usr/bin/mysql -h %s -u%s -p'%s' %s -e '%s'", $_ENV['DB_HOST'], $_ENV['DB_USERNAME'], $_ENV['DB_PASSWORD'], $_ENV['DB_DATABASE'], $query);
$retval = shell_exec($sql);
if (!preg_match('/innodb_large_prefix\s+ON/', $retval)) {
$fail .= "<div class='notreadable'>Please add/update my.cnf 'innodb_large_prefix = 1' and restart mysql.</div>";
}

$query = 'SHOW VARIABLES LIKE "innodb_file_format"';
$sql = sprintf("/usr/bin/mysql -h %s -u%s -p'%s' %s -e '%s'", $_ENV['DB_HOST'], $_ENV['DB_USERNAME'], $_ENV['DB_PASSWORD'], $_ENV['DB_DATABASE'], $query);
$retval = shell_exec($sql);
if (!preg_match('/innodb_file_format\s+Barracuda/', $retval)) {
$fail .= "<div class='notreadable'>Please add/update my.cnf 'innodb_file_format = Barracuda' and restart mysql.</div>";
$query = 'SHOW VARIABLES LIKE "innodb_file_format"';
$sql = sprintf("/usr/bin/mysql -h %s -u%s -p'%s' %s -e '%s'", $_ENV['DB_HOST'], $_ENV['DB_USERNAME'], $_ENV['DB_PASSWORD'], $_ENV['DB_DATABASE'], $query);
$retval = shell_exec($sql);
if (!preg_match('/innodb_file_format\s+Barracuda/', $retval)) {
$fail .= "<div class='notreadable'>Please add/update my.cnf 'innodb_file_format = Barracuda' and restart mysql.</div>";
}
}

$query = 'SHOW VARIABLES LIKE "innodb_file_per_table"';
Expand All @@ -104,7 +109,6 @@ function db_insert()
'schema' => "source {$public}install/extra/schema.php.sql",
'data' => "source {$public}install/extra/data.php.sql",
'timestamps' => "UPDATE cleanup SET clean_time = $timestamp",
'stats' => 'INSERT INTO stats (regusers) VALUES (1)',
];

if (empty($fail)) {
Expand All @@ -116,7 +120,7 @@ function db_insert()
ignore_user_abort(true);
exec($sql, $output, $retval);
if ($retval != 0) {
$fail .= "<div class='notreadable'>There was an error while creating the database $name</div>";
$fail .= "<div class='notreadable'>There was an error while creating the database $name,<br>at step: {$name}</div>";
}
}
}
Expand All @@ -125,7 +129,7 @@ function db_insert()
$out .= '<div class="readable">Database was imported</div>
</fieldset>
<div style="text-align:center;">
<input type="button" value="Finish" onclick="onClick(6)" />
<input type="button" value="Finish" onclick="onClick(6)">
</div>';
} else {
$out .= "
Expand Down
2 changes: 1 addition & 1 deletion public/install/functions/permissioncheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function permissioncheck()
$root . 'cache/' => 0,
$root . 'torrents/' => 0,
$root . 'uploads/' => 0,
$root . 'include/backup/' => 0,
$root . 'backups/' => 0,
$root . 'sqlerr_logs/' => 0,
$root . 'chat/css/' => 0,
$root . 'chat/js/' => 0,
Expand Down
4 changes: 2 additions & 2 deletions public/install/functions/writeconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function createblock($fo, $foo)
$explain = !empty($bo['explain']) ? "<div class='info'>{$bo['explain']}</div>" : '';
$out .= "
<td class='input_input'>
<input type='{$type}' name='{$bo['input']}' size='30' placeholder='{$bo['placeholder']}' title='{$bo['info']}' />$explain
<input type='{$type}' name='{$bo['input']}' size='30' placeholder='{$bo['placeholder']}' title='{$bo['info']}' required>$explain
</td>
</tr>";
}
Expand Down Expand Up @@ -239,7 +239,7 @@ function saveconfig()
$out .= '
</fieldset>
<div style="text-align:center;">
<input type="button" value="Next step" onclick="onClick(5)" />
<input type="button" value="Next step" onclick="onClick(5)">
</div>';
} else {
$out .= '
Expand Down

0 comments on commit bf102bc

Please sign in to comment.