[wp-trac] [WordPress Trac] #22515: Child theme installation not installing parent (regression)
WordPress Trac
noreply at wordpress.org
Wed Nov 21 11:37:04 UTC 2012
#22515: Child theme installation not installing parent (regression)
-----------------------------+--------------------
Reporter: Otto42 | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: 3.4.3
Component: Upgrade/Install | Version:
Severity: major | Resolution:
Keywords: has-patch |
-----------------------------+--------------------
Comment (by nacin):
If you look at how Theme_Upgrader works, it specifically checks if the
theme is already installed by checking for `$theme->parent()->errors()`.
That's the key. The parent theme is ''potentially'' valid, it just doesn't
exist.
This is different from being a completely invalid parent, such as being a
child of yet another theme, or suggesting that its own child is the parent
(circular reference). In those cases, we do set parent to null (line 265),
because the theme itself is broken and its parent is never going to be
valid.
[attachment:22515.diff] happens to work in this case, but the block is
getting moved up above code it depends on (see $theme_root_template, for
example). [attachment:22515.2.diff] makes sure we set $this->parent in
this one case. Fixes everything for me.
Additionally, the ! parent()->errors() check in Theme_Upgrader should
actually become a parent()->exists() check. That's because the parent()
WP_Theme object will properly get theme_not_found as the WP_Error code. If
there happens to be an error in the theme, we still don't want to try
installing it because it *does* exist. (A future enhancement could be to
try to upgrade/replace a parent theme before installing a child theme of
it, especially if it is broken. This will not happen implicitly now
because clear_destination => false.)
The only remaining issue is that a broken theme can still technically be
activated. That's no fun, though. [attachment:22515.2.diff] additionally
guards against that one issue.
Only the single-line WP_Theme change is necessary for the 3.4 branch to
get things working again. The rest is poka yoke.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22515#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list