Skip to content

Commit

Permalink
Merge pull request #13 from startersclan/enhancement/admin-add-db-upd…
Browse files Browse the repository at this point in the history
…ater-tool-in-admin-panel-to-upgrade-db

Enhancement (admin): Add DB Updater tool in Admin Panel to upgrade DB
  • Loading branch information
leojonathanoh committed Oct 30, 2023
2 parents ada8231 + d9139c4 commit f024078
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
19 changes: 19 additions & 0 deletions web/pages/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,24 @@ function message($icon, $msg)
<tr valign="top">
<td><?php

$updateDbHtml = "<div>
Current Version: <span style=\"color: #C40000;font-weight:bold\">{$g_options['version']}</span><br />
Current DB version: <span style=\"color: #C40000;font-weight:bold\">{$g_options['dbversion']}</span><br />";
if (file_exists('./updater') && $mode != 'updater') {
if (file_exists("./updater/" . ($g_options['dbversion'] + 1) . ".php")) {
$updateDbHtml .= "
<div class=\"block\">
<div class=\"warning\">
<span class=\"fHeading\"><img src=\"" . IMAGE_PATH . "/warning.gif\" alt=\"Warning\"> Warning:</span> Your database needs an upgrade. To perform a Database Update, please go to the Updater page.
<div style=\"text-align: center;\"><strong><a class=\"fMediumLarge\" href=\"{$g_options['scripturl']}?mode=updater&task=tools_updater\"><span>HLX:CE Database Updater</span></a></strong></div>
</span>
</div>";
} else {
$updateDbHtml .= "Great. Your database is the latest version.";
}
}
$updateDbHtml .= "</div>";

// General Settings
$admintasks['options'] = new AdminTask('HLstatsX:CE Settings', 80);
$admintasks['adminusers'] = new AdminTask('Admin Users', 100);
Expand All @@ -1036,6 +1054,7 @@ function message($icon, $msg)
$admintasks['ribbons'] = new AdminTask('Ribbons (triggered by Awards)', 80, 'game');

// Tools
$admintasks['tools_updater'] = new AdminTask('DB Updater', 100, 'tool', $updateDbHtml);
$admintasks['tools_perlcontrol'] = new AdminTask('HLstatsX: CE Daemon Control', 80, 'tool', 'Reload or stop your HLX: CE Daemons');
$admintasks['tools_editdetails'] = new AdminTask('Edit Player or Clan Details', 80, 'tool', 'Edit a player or clan\'s profile information.');
$admintasks['tools_adminevents'] = new AdminTask('Admin-Event History', 80, 'tool', 'View event history of logged Rcon commands and Admin Mod messages.');
Expand Down
7 changes: 5 additions & 2 deletions web/pages/updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,8 @@
}
}

echo "<br /><br /><img src=\"".IMAGE_PATH."/warning.gif\" alt=\"Warning\"> <span class=\"warning-header\">You <strong>must delete</strong> the \"updater\" folder from your web site before your site will be operational.</span>\n</div>\n";
?>
// In docker, the updater folder will always be present, to allow
// DB upgrades to be done using this updater. Hence, this code is
// commented out to allow things to work correctly after the DB upgrade in docker.
// echo "<br /><br /><img src=\"".IMAGE_PATH."/warning.gif\" alt=\"Warning\"> <span class=\"warning-header\">You <strong>must delete</strong> the \"updater\" folder from your web site before your site will be operational.</span>\n</div>\n";
?>

0 comments on commit f024078

Please sign in to comment.