aboutsummaryrefslogtreecommitdiffstats
path: root/theme/admin/html/migration.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-06-24 21:09:24 +0200
committerThomas Lange <code@nerdmind.de>2021-06-24 21:09:24 +0200
commitd69d7e82b8bbb567668c935ace848c7dcf750b08 (patch)
treedfad6bc5ce73262e958c92a3c3875c619c28ffc8 /theme/admin/html/migration.php
parent55ae320e7cfd710f3ea0f295c880619217db2220 (diff)
downloadblog-d69d7e82b8bbb567668c935ace848c7dcf750b08.tar.gz
blog-d69d7e82b8bbb567668c935ace848c7dcf750b08.tar.xz
blog-d69d7e82b8bbb567668c935ace848c7dcf750b08.zip
Implement database schema Migrator
This commit implements the new database schema Migrator which keeps track of the on-disk schema and the schema used by the codebase. It tries to makes future database schema upgrades user-friendlier.
Diffstat (limited to 'theme/admin/html/migration.php')
-rw-r--r--theme/admin/html/migration.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/theme/admin/html/migration.php b/theme/admin/html/migration.php
new file mode 100644
index 0000000..14405c4
--- /dev/null
+++ b/theme/admin/html/migration.php
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html lang="<?=$BLOGMETA['LANG']?>">
+<head>
+ <meta charset="UTF-8" />
+ <meta name="referrer" content="origin-when-crossorigin" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="stylesheet" href="<?=Application::getTemplateURL('rsrc/css/main.css')?>" />
+ <title><?=$Language->text('maintenance_mode')?></title>
+</head>
+<body>
+<header id="main-header">
+ <div class="header-line background">
+ <div class="header-content">
+ <img id="header-logo" src="<?=Application::getTemplateURL('rsrc/icon-public-domain.svg')?>" alt="Administration" />
+ <div id="header-text"><?=escapeHTML($BLOGMETA['NAME'])?></div>
+ <div id="header-desc"><?=$Language->text('maintenance_mode')?></div>
+ </div>
+ </div>
+</header>
+<?php
+$migrations_list = $MIGRATION['LIST'];
+$database_schema = $MIGRATION['SCHEMA_VERSION']['DATABASE'];
+$codebase_schema = $MIGRATION['SCHEMA_VERSION']['CODEBASE'];
+?>
+<main id="main-content">
+ <h1><?=$Language->text('maintenance_mode')?></h1>
+ <?php if($migrated = $MIGRATION['SUCCESSFUL']): ?>
+ <p><?=$Language->text('migration_successful')?></p>
+ <ul>
+ <?php foreach($migrated as $migration): ?>
+ <li>Migration <code><?=$migration?></code></li>
+ <?php endforeach ?>
+ </ul>
+ <?php else: ?>
+ <p><?=$Language->text("migration_upgrade", [$database_schema, $codebase_schema])?></p>
+ <form action="" method="post">
+ <ul class="no-visual-list">
+ <?php foreach($migrations_list as $migration => $commands): ?>
+ <li>
+ <h2><strong>Migration <code><?=$migration?></code></strong></h2>
+ <p><?=$Language->text('migration_notice', [$migration-1, $migration])?></p>
+ <pre><?=$commands?></pre>
+ </li>
+ <?php endforeach ?>
+ </ul>
+ <input type="hidden" name="token" value="<?=Application::getSecurityToken()?>" ?>
+ <input type="submit" name="run" value="<?=$Language->text('migration_submit')?>" id="delete-button" />
+ </form>
+ <?php endif ?>
+</main>
+<footer id="main-footer">
+ <ul>
+ <li><i class="fa fa-github-square"></i><a href="https://github.com/Nerdmind/Blog/releases" target="_blank">Releases</a></li>
+ <li><i class="fa fa-book"></i><a href="https://github.com/Nerdmind/Blog/wiki" target="_blank">Documentation</a></li>
+ <li><i class="fa fa-bug"></i><a href="https://github.com/Nerdmind/Blog/issues">Bugreport</a></li>
+ </ul>
+</footer>
+</body>
+</html>