Clear theme cache after editing. Reduce default cache persistence to 1800. (Could go lower.) see #20331.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-03-30 14:39:05 +00:00
parent 9305155baf
commit 70aa7f9607
3 changed files with 7 additions and 4 deletions

View File

@ -94,6 +94,7 @@ case 'update':
fwrite( $f, $newcontent );
fclose( $f );
$location .= '&updated=true';
$theme->cache_delete();
}
}
wp_redirect( $location );

View File

@ -154,7 +154,7 @@ final class WP_Theme implements ArrayAccess {
* @access private
* @var bool
*/
private static $cache_expiration = 7200;
private static $cache_expiration = 1800;
/**
* Constructor for WP_Theme.
@ -503,6 +503,9 @@ final class WP_Theme implements ArrayAccess {
public function cache_delete() {
foreach ( array( 'theme', 'screenshot', 'screenshot_count', 'files', 'headers', 'page_templates' ) as $key )
wp_cache_delete( $key . '-' . $this->cache_hash, 'themes' );
$this->template = $this->textdomain_loaded = $this->theme_root_uri = $this->parent = $this->errors = $this->headers_sanitized = $this->name_translated = null;
$this->headers = array();
$this->__construct( $this->stylesheet, $this->theme_root );
}
/**

View File

@ -351,10 +351,9 @@ function search_theme_directories( $force = false ) {
return $found_themes;
}
if ( ! is_int( $cache_expiration ) )
$cache_expiration = 7200;
$cache_expiration = 1800; // half hour
} else {
// Two hours is the default.
$cache_expiration = 7200;
$cache_expiration = 1800; // half hour
}
/* Loop the registered theme directories and extract all themes */