diff options
author | Thomas Lange <code@nerdmind.de> | 2021-06-24 21:09:24 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-06-24 21:09:24 +0200 |
commit | d69d7e82b8bbb567668c935ace848c7dcf750b08 (patch) | |
tree | dfad6bc5ce73262e958c92a3c3875c619c28ffc8 /theme/admin/html | |
parent | 55ae320e7cfd710f3ea0f295c880619217db2220 (diff) | |
download | blog-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')
-rw-r--r-- | theme/admin/html/main.php | 2 | ||||
-rw-r--r-- | theme/admin/html/migration.php | 59 |
2 files changed, 60 insertions, 1 deletions
diff --git a/theme/admin/html/main.php b/theme/admin/html/main.php index a7772ed..db637da 100644 --- a/theme/admin/html/main.php +++ b/theme/admin/html/main.php @@ -10,7 +10,7 @@ </head> <body> <header id="main-header"> - <div class="header-line"> + <div class="header-line background"> <div class="header-content"> <a href="<?=Application::getURL()?>"> <img id="header-logo" src="<?=Application::getTemplateURL('rsrc/icon-public-domain.svg')?>" alt="Administration" /> 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> |