Commit 7f45af48 authored by catch's avatar catch

Issue #1829170 by LinL, socketwench, vijaycs85, mtift, LittleCoding, andypost,...

Issue #1829170 by LinL, socketwench, vijaycs85, mtift, LittleCoding, andypost, dawehner, ianmthomasuk: Convert the Maintenance Theme variable to settings.
parent 21713807
......@@ -34,7 +34,7 @@ function _drupal_maintenance_theme() {
// Install and update pages are treated differently to prevent theming overrides.
if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
$custom_theme = (isset($conf['maintenance_theme']) ? $conf['maintenance_theme'] : 'seven');
$custom_theme = settings()->get('maintenance_theme', 'seven');
}
else {
// The bootstrap was not complete. So we are operating in a crippled
......@@ -44,23 +44,23 @@ function _drupal_maintenance_theme() {
require_once __DIR__ . '/database.inc';
}
// We use the default theme as the maintenance theme. If a default theme
// isn't specified in the database or in settings.php, we use Bartik.
// @todo Should use the actual default theme configured, but that depends on
// configuration being available while possibly not having a working
// database connection (yet). And only if that fails, should fall back to
// Stark otherwise. Since there is no low-level access to configuration
// currently, we only consult settings.php and fall back to Bartik
// otherwise, as it looks generic enough and way more user-friendly.
$custom_theme = variable_get('maintenance_theme');
if (!$custom_theme) {
$config = \Drupal::config('system.theme');
// A broken install might not return an object.
if (is_object($config)) {
// Use the maintenance theme if specified, otherwise attempt to use the
// default site theme.
try {
$custom_theme = settings()->get('maintenance_theme', '');
if (!$custom_theme) {
$config = \Drupal::config('system.theme');
$custom_theme = $config->get('default');
}
}
if (!$custom_theme) {
catch (\Exception $e) {
// Whatever went wrong (often a database connection problem), we are
// about to fall back to a sensible theme so there is no need for special
// handling.
}
if (!$custom_theme) {
// We have been unable to identify the configured theme, so fall back to
// a safe default. Bartik is reasonably user friendly and fairly generic.
$custom_theme = 'bartik';
}
}
......
......@@ -472,6 +472,17 @@
*/
# $settings['session_write_interval'] = 180;
/**
* A custom theme for the offline page:
*
* This applies when the site is explicitly set to maintenance mode through the
* administration page or when the database is inactive due to an error.
* The template file should also be copied into the theme. It is located inside
* 'core/modules/system/maintenance-page.tpl.php'.
* Note: This setting does not apply to installation and update pages.
*/
# $settings['maintenance_theme'] = 'bartik';
/**
* Base URL (optional).
*
......@@ -573,16 +584,6 @@
# $conf['system.theme']['default'] = 'stark';
# $conf['anonymous'] = 'Visitor';
/**
* A custom theme can be set for the offline page. This applies when the site
* is explicitly set to maintenance mode through the administration page or when
* the database is inactive due to an error. It can be set through the
* 'maintenance_theme' key. The template file should also be copied into the
* theme. It is located inside 'core/modules/system/maintenance-page.tpl.php'.
* Note: This setting does not apply to installation and update pages.
*/
# $conf['maintenance_theme'] = 'bartik';
/**
* CSS/JS aggregated file gzip compression:
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment