Trying to set my custom theme for install and update pages on drupal version 6.20 I had to do some changes. I write the code, hoping they may come in handy.
I have create a replacement function for variable_get, variable_set, and variable_del. (this function made access to db but is not initialized) and then i have substitute al call with the replaced function
zen_variable_get, Zen_variable_set, and zen_variable_del in all zen-internals files.
template.php
/**
* Replace variable_get
*/
function zen_variable_get($name, $default) {
return variable_get($name, $default);
}
/**
* Replace variable_set
*/
function zen_variable_set($name, $value) {
global $conf;
if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
$conf[$name] = $value;
return;
}
variable_set($name, $value);
}
/**
* Replace variable_del
*/
function zen_variable_del($name) {
global $conf;
if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
$conf[$name] = $value;
cache_clear_all('variables', 'cache');
unset($conf[$name]);
return;
}
variable_del($name);
}
Then i have generate my custom maintenance-page.tpl.php and i have modify drupal core in file includes/theme.maintenance.inc
in function _drupal_maintenance_theme() at line 37
function _drupal_maintenance_theme() {
global $theme, $theme_key;
....
// Install and update pages are treated differently to prevent theming overrides.
if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
//$theme = 'minnelli';
$theme = 'zen'; //my custom theme
}
...
in function theme_install_page () at line 116
function theme_install_page($content) {
....
global $theme_path;
//$theme_path = 'themes/garland';
//return theme_render_template('themes/garland/maintenance-page.tpl.php', $variables);
$theme_path = 'sites/all/themes/zen'; //@WORKAROUND update theme replacement
return theme_render_template($theme_path . '/templates/maintenance-page.tpl.php', $variables);
}
and the same to function theme_update_page () at line 170
function theme_update_page($content) {
....
global $theme_path;
//$theme_path = 'themes/garland';
//return theme_render_template('themes/garland/maintenance-page.tpl.php', $variables);
$theme_path = 'sites/all/themes/zen'; //@WORKAROUND update theme replacement
return theme_render_template($theme_path . '/templates/maintenance-page.tpl.php', $variables);
}
Sorry for my pour english.. =)
Comments
Comment #1
johnalbinComment #2
johnalbinFYI #705264: Allow Zen (and subthemes) to be used without a database has just been committed.
If you can supply your changes in patch form, it will make it easier to review
Comment #3
johnalbinNo response