[wp-hackers] Themes: Moving from 1.2.x to 1.5

Ryan Boren ryan at boren.nu
Tue Feb 1 01:16:02 GMT 2005


On Mon, 2005-01-31 at 09:32 -0500, Owen Winkler wrote:
> Ryan Boren wrote:
> > Upgrading templates from 1.2.x to 1.5 is automatically done during
> > upgrade if wp-content/themes is writable.  A theme named after the
> > weblog title is automatically created from the existing template files
> > and made the active theme.  We should mention somewhere that wp-
> > content/themes should be made writable before install/upgrade.  Perhaps
> > the install/upgrade itself should check for this and warn.
> 
> I'm too lazy to check- Does this happen if the theme already exists? 
> That would be unfortunate.

No.  The code is in make_site_theme() in upgrade-functions.php.  Here's
the logic.

Get the blogname setting.
Pass it through sanitize_title in order to get a suitable string for a
directory name.
Check to see if wp-content/themes/sanitized-blogname exists.  If it
exists, bail.  Otherwise...
Is wp-content/themes writable?  If not, bail.  Otherwise...
Make wp-content/themes/sanitized-blogname.
Proceed to setup the new site theme in the site theme dir.  (Insert
theme setup montage here.)
If the current theme is the Default theme, make the new site theme the
current theme.
If the current theme is anything other than Default, leave the theme
setting as is.
(This avoids bouncing the theme whenever upgrade.php is run.)

> > During a first time install of 1.5, a site theme is automatically
> > created if wp-content/themes is writable.  The site theme is a copy of
> > the default theme with a modified theme header.  It is named after the
> > blog title.  Users should be encouraged to avoid making modifications
> > directly to themes shipped with WP (Default and Classic).  They should
> > be copied to another theme directory and renamed.  This avoids the
> > overwrite-during-upgrade problems.
> 
> Are there notes in all of the theme files to this effect?  ("See codex 
> page X before you modify this file!") That would be a good idea.

Nope.  If we add it, we'll need to make sure we remove the notes from
the site theme when creating a site theme from the default theme.

Currently, the theme editor can be used to edit the Default and Classic
theme.  Perhaps the theme editor should disallow this and post a warning
that directs the user to create a site theme with which to work.

Ryan



More information about the hackers mailing list