Message info
 
To:wp-svn@lists.automattic.com From:m@wordpress.org Subject:[wp-svn] [21080] trunk: Introduce wp_clean_themes_cache() for upgrades and testing. Date:Thu, 14 Jun 2012 14:24:25 +0000 (UTC)
 

Revision
21080
Author
nacin
Date
2012-06-14 14:24:25 +0000 (Thu, 14 Jun 2012)

Log Message

Introduce wp_clean_themes_cache() for upgrades and testing. fixes #20954.

Modified Paths

Diff

Modified: trunk/wp-admin/includes/class-wp-upgrader.php (21079 => 21080)


--- trunk/wp-admin/includes/class-wp-upgrader.php	2012-06-14 13:35:52 UTC (rev 21079)
+++ trunk/wp-admin/includes/class-wp-upgrader.php	2012-06-14 14:24:25 UTC (rev 21080)
@@ -763,10 +763,7 @@
 			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 @@
 			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 @@
 		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;
 	}

Modified: trunk/wp-includes/theme.php (21079 => 21080)


--- trunk/wp-includes/theme.php	2012-06-14 13:35:52 UTC (rev 21079)
+++ trunk/wp-includes/theme.php	2012-06-14 14:24:25 UTC (rev 21080)
@@ -107,6 +107,18 @@
 }
 
 /**
+ * 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