diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-09-11 17:49:52 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-09-11 17:49:52 +0000 |
commit | 94e759a864291ee0e51dcd88b6de63ca541883ca (patch) | |
tree | 3916d2a707d9ffad0432386b3cb21258ede8f0eb | |
parent | 90c1623b4d27ae833a27cdb90f97f6b01b65e7bd (diff) | |
download | brdo-94e759a864291ee0e51dcd88b6de63ca541883ca.tar.gz brdo-94e759a864291ee0e51dcd88b6de63ca541883ca.tar.bz2 |
Adding upgrade path from old xtemplate settings to new theme system settings.
-rw-r--r-- | database/updates.inc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/database/updates.inc b/database/updates.inc index 25dd9eea8..8308c49b9 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -1707,6 +1707,45 @@ function update_104() { else { variable_set('theme_default', 'bluemarine'); } + + // Convert old xtemplate settings to new theme system + $settings = array(); + $convert = array('xtemplate_primary_links' => 'primary_links', + 'xtemplate_secondary_links' => 'secondary_links', + 'xtemplate_search_box' => 'toggle_search', + 'xtemplate_avatar_node' => 'toggle_node_user_picture', + 'xtemplate_avatar_comment' => 'toggle_comment_user_picture'); + foreach ($convert as $from => $to) { + if (($value = variable_get($from, NULL)) != NULL) { + $settings[$to] = $value; + variable_del($from); + } + } + + // Logo requires special treatment. Used to be an HTML tag, now it's a path to an image. + if (($logo = variable_get('xtemplate_logo', NULL)) != NULL) { + $match = array(); + // If logo was of the form <img src="..">, convert it. + if (preg_match('@src=(?:["\']?)(.+?)(?:["\']?(?:>| ?/>))@i', $logo, $match)) { + $settings['default_logo'] = 0; + $settings['logo_path'] = $match[1]; + } + variable_del('xtemplate_logo'); + } + + if (count($settings) > 0) { + variable_set('theme_settings', $settings); + } + + // These are not part of 'theme_settings' + $convert = array('xtemplate_avatar_default' => 'user_picture_default', + 'xtemplate_mission' => 'site_mission'); + foreach ($convert as $from => $to) { + if (($value = variable_get($from, NULL)) != NULL) { + variable_set($to, $value); + variable_del($from); + } + } } return $ret; } |