Permalink
Browse files

Introduce wp_clean_themes_cache() for upgrades and testing. fixes #20…

…954.

git-svn-id: http://core.svn.wordpress.org/trunk@21080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent c095235 commit 0032b682c094be5ef865ecc14ff6b64e2fab441a nacin committed Jun 14, 2012
Showing with 15 additions and 12 deletions.
  1. +3 −12 wp-admin/includes/class-wp-upgrader.php
  2. +12 −0 wp-includes/theme.php
@@ -763,10 +763,7 @@ function install($package) {
return $this->result;
// Force refresh of theme update information
- delete_site_transient('update_themes');
- search_theme_directories( true );
- foreach ( wp_get_themes() as $theme )
- $theme->cache_delete();
+ wp_clean_themes_cache();
return true;
}
@@ -812,10 +809,7 @@ function upgrade($theme) {
return $this->result;
// Force refresh of theme update information
- delete_site_transient('update_themes');
- search_theme_directories( true );
- foreach ( wp_get_themes() as $theme )
- $theme->cache_delete();
+ wp_clean_themes_cache();
return true;
}
@@ -902,10 +896,7 @@ function bulk_upgrade($themes) {
remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
// Force refresh of theme update information
- delete_site_transient('update_themes');
- search_theme_directories( true );
- foreach ( wp_get_themes() as $theme )
- $theme->cache_delete();
+ wp_clean_themes_cache();
return $results;
}
View
@@ -107,6 +107,18 @@ function wp_get_theme( $stylesheet = null, $theme_root = null ) {
}
/**
+ * Clears the cache held by get_theme_roots() and WP_Theme.
+ *
+ * @since 3.5.0
+ */
+function wp_clean_themes_cache() {
+ delete_site_transient('update_themes');
+ search_theme_directories( true );
+ foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme )
+ $theme->cache_delete();
+}
+
+/**
* Whether a child theme is in use.
*
* @since 3.0.0

0 comments on commit 0032b68

Please sign in to comment.