Commit c47dc9c3 authored by root's avatar root Committed by lechuck
Browse files

Import wp-super-cache 0.9.9.8

parent ca0b5a52
2011-01-06 17:37 donncha
* wp-cache.php: Print the text, not __() it, and check if rewrite
rules in .htaccess are present before emailing user about it.
2011-01-06 13:21 donncha
* Changelog.txt: Updated changelog
2011-01-06 13:13 donncha
* readme.txt: Updated docs
2011-01-06 12:12 donncha
* readme.txt: Minor changes to docs
2011-01-06 10:03 donncha
* readme.txt, wp-cache.php: Tagged version 0.9.9.8
2011-01-05 15:02 donncha
* Changelog.txt, readme.txt: Updated changelogs
2011-01-05 14:54 donncha
* wp-super-cache.pot: Updated pot file
2011-01-05 14:51 donncha
* ossdl-cdn.php, wp-cache.php: Fixed link to CDN Sync support
forum.
2011-01-05 13:37 donncha
* wp-super-cache.pot: Updated pot file.
2011-01-05 13:32 donncha
* ossdl-cdn.php, wp-cache.php: Link to the CDN Sync tool from the
Easy settings page too
2011-01-05 13:15 donncha
* ossdl-cdn.php: Link to CDN Sync Tool on CDN page.
2011-01-05 11:50 donncha
* Changelog.txt: Updated changelog
2011-01-05 11:46 donncha
* wp-cache-phase1.php, wp-cache.php: Remove log by email
functionality. It cases problems for users when they get too much
email
2011-01-05 11:45 donncha
* wp-cache-phase2.php: Warn user by debug log if cache expiry is
zero and therefore no garbage collection
2011-01-04 15:22 donncha
* languages/wp-super-cache-zh_TW.mo,
languages/wp-super-cache-zh_TW.po: Updated Traditional Chinese
translation
2011-01-04 12:49 donncha
* wp-cache.php: Added an extra space to make selecting chmod
command easier.
2011-01-04 12:48 donncha
* wp-cache.php: Flush the rewrite rules after uninstalling. Props
@nacin, http://ocaoimh.ie/uninstall-supercache/
2011-01-04 12:42 donncha
* wp-cache.php: Make uninstall warnings clearer and easier to read,
hopefully
2010-12-22 16:22 donncha
* wp-cache.php: Cast $lines as array to avoid warnings arising from
empty config files.
2010-12-22 12:00 donncha
* wp-cache.php: Remove .htaccess rules if they match the ones in
the plugin, else email the blog admin that there's a problem.
2010-12-21 14:26 donncha
* readme.txt: Updated docs to reflect changes to caching modes and
uninstall instructions
2010-12-21 12:52 donncha
* wp-cache.php: Let's tidy up and add some space
2010-12-21 12:44 donncha
* wp-cache.php: * Added code to remove plugin files when plugin
deactivated.
* Show cache contents even when caching is disabled.
* Minor fixes
2010-12-21 12:17 donncha
* wp-cache.php: Fixed easy page "Update Status" button, it was
triggering the cache tester
2010-12-20 15:26 donncha
* wp-cache.php: Put cache tester and delete buttons on the "Easy"
setup page.
2010-12-20 14:43 donncha
* wp-cache-phase1.php: Allow functions in classes to be used in
cacheactions. Props exz,
http://wordpress.org/support/topic/plugin-wp-super-cache-use-function-in-a-class-with-add_cacheaction?replies=1
2010-12-17 18:32 donncha
* wp-cache.php: Show Settings->Super Cache page to super admins to
preserve old links
2010-12-17 16:47 donncha
* wp-cache-phase2.php, wp-cache.php: Added option to enable front
page cache checks and enable by default.
2010-12-17 16:04 donncha
* wp-cache-phase1.php: Print compression comment on cached dynamic
pages
2010-12-17 14:13 donncha
* wp-cache-phase2.php: Gzip the dynamic cached page before we serve
the first user to visit a page.
2010-12-17 14:10 donncha
* wp-cache-phase1.php: Use the plugin $cache_compression settings
to determine if gzipped dynamic cached files should be served or
not.
2010-12-17 13:04 donncha
* wp-cache-phase1.php: Sometimes "zlib.output_compression" is set
to "off" rather than 0, check for "on" to make sure we don't
disable compression accidentally.
2010-12-15 12:42 donncha
* wp-cache-phase1.php: CHeck if PHP is using zlib compression
already before compressing dynamic pages
2010-12-15 12:37 donncha
* wp-cache-phase1.php: Use "ob_gzhandler" to compress dynamic pages
on the fly if supported, see
http://wordpress.org/support/topic/plugin-wp-super-cache-suggestion-mod_rewrite-mode-with-legacy-fallback?replies=8#post-1837856
2010-12-15 12:27 donncha
* wp-cache.php: Updated patch to support 1and1 webhosting, see
http://wordpress.org/support/topic/plugin-wp-super-cache-how-to-get-mod_rewrite-working-on-1and1-shared-hosting?replies=6#post-1837843
2010-12-15 07:20 donncha
* wp-cache-phase2.php: oops, left some debug code in!
2010-12-14 14:56 donncha
* wp-cache.php: Regenerate the cache stats when the cache is
deleted
2010-12-14 14:34 donncha
* wp-cache.php: Minor typo fixed.
2010-12-14 13:38 donncha
* wp-cache-phase1.php, wp-cache-phase2.php: First pass at using
supercache files to store "dynamic pages". See
http://wordpress.org/support/topic/plugin-wp-super-cache-suggestion-mod_rewrite-mode-with-legacy-fallback?replies=5
2010-12-14 10:48 donncha
* wp-cache.php: Hopefully fix problems with 1and1 hosting as they
use /kunden/ in their path, see
http://wordpress.org/support/topic/plugin-wp-super-cache-how-to-get-mod_rewrite-working-on-1and1-shared-hosting,
props reviewmylife
2010-12-13 18:52 donncha
* wp-cache.php: For the purposes of our checks, home is / or
wherever the blog lives, not in the paged content.
2010-12-13 18:38 donncha
* wp-cache.php: Call the correct function on template_redirect to
set the is_home cache.
2010-12-13 17:30 donncha
* languages/wp-super-cache-de_DE.mo,
languages/wp-super-cache-de_DE.po: Updated German translation,
props Mathias,
http://wordpress.org/support/topic/plugin-wp-super-cache-can-i-help-to-improve-language-file?replies=11#post-1829165
2010-12-13 15:54 donncha
* wp-cache-phase2.php, wp-cache.php: Cache is_home and
is_front_page in $wp_cache_is_home because they may not work on
PHP shutdown. See
http://wordpress.org/support/topic/plugin-wp-super-cache-not-writing-another-page-to-front-page-cache?replies=8
2010-12-09 13:34 donncha
* wp-super-cache.pot: Updated pot file for translation
2010-12-09 13:31 donncha
* languages/wp-super-cache-de_DE.mo,
languages/wp-super-cache-de_DE.po: Updated German translation,
props Mathias (http://trade-service.biz/)
2010-12-09 12:28 donncha
* ossdl-cdn.php: Added multiple CNAME support to CDN functionality
(props David Ward) and add translation strings
2010-12-07 16:00 donncha
* plugins/badbehaviour.php: Fixed admin form on Bad Behavior plugin
2010-11-30 12:08 donncha
* ossdl-cdn.php, wp-cache-config-sample.php: Allow CDN support to
be switched off, see
http://wordpress.org/support/topic/plugin-wp-super-cache-wp_supercache-problem-with-sharedaddy-shareandfollow?replies=6
2010-11-29 15:55 donncha
* wp-cache.php: Add Supercache menu item on network admin menu,
WordPress 3.1
2010-11-29 11:24 donncha
* wp-cache.php: Silently fail when the config file is missing and
we try to update it. Only happens when the settings page is first
loaded.
http://wordpress.org/support/topic/plugin-wp-super-cache-warning-invalid-argument-supplied-for-foreach?replies=3
2010-11-26 12:25 donncha
* wp-cache-phase2.php: There's no need to write meta files when
we're not caching for logged in users!
2010-11-26 11:31 donncha
* advanced-cache.php, wp-cache.php: Define the constant
"ADVANCEDCACHEPROBLEM" if wp-cache-phase1.php can't be loaded and
report it on the dashboard. See
http://thehoneymonster.com/2010/10/wp-super-cache-oopsiedoodle/
2010-11-26 10:03 donncha
* wp-cache.php: Fixed translation domain on string, props Priv,
http://wordpress.org/support/topic/plugin-wp-super-cache-can-i-help-to-improve-language-file?replies=6
2010-11-24 09:55 donncha
* wp-cache.php: Preload pages as well as posts, see
http://wordpress.org/support/topic/plugin-wp-super-cache-pages-are-not-cached-in-preload-mode?replies=2
2010-11-23 20:37 donncha
* languages/wp-super-cache-it_IT.mo,
languages/wp-super-cache-it_IT.po: Updated Italian translation,
props Gianni
2010-11-23 13:48 donncha
* readme.txt, wp-cache.php: Bump version to 0.9.9.7
2010-11-23 13:45 donncha
* Changelog.txt: Updated changelog
2010-11-23 13:38 donncha
* wp-cache-phase1.php: Check if there are any actions before
......
......@@ -15,6 +15,12 @@ if ( get_option( 'ossdl_off_exclude' ) == false )
$ossdl_off_exclude = trim(get_option('ossdl_off_exclude'));
$arr_of_excludes = array_map('trim', explode(',', $ossdl_off_exclude));
if ( get_option( 'ossdl_cname' ) == false )
add_option('ossdl_cname', '');
$ossdl_cname = trim(get_option('ossdl_cname'));
$arr_of_cnames = array_map('trim', explode(',', $ossdl_cname));
if ($arr_of_cnames[0] == '') $arr_of_cnames = array();
/**
* Determines whether to exclude a match.
*
......@@ -37,13 +43,20 @@ function scossdl_off_exclude_match($match, $excludes) {
* Called by #scossdl_off_filter.
*/
function scossdl_off_rewriter($match) {
global $ossdl_off_blog_url, $ossdl_off_cdn_url, $arr_of_excludes;
static $offset = -1;
global $ossdl_off_blog_url, $ossdl_off_cdn_url, $arr_of_excludes, $arr_of_cnames;
if ( false == in_array( $ossdl_off_cdn_url, $arr_of_cnames ) )
$arr_of_cnames[] = $ossdl_off_cdn_url;
if (scossdl_off_exclude_match($match[0], $arr_of_excludes)) {
return $match[0];
} else {
$include_dirs = scossdl_off_additional_directories();
if ( preg_match( '/' . $include_dirs . '/', $match[0] ) ) {
return str_replace($ossdl_off_blog_url, $ossdl_off_cdn_url, $match[0]);
$offset++;
$offset %= count($arr_of_cnames);
return str_replace($ossdl_off_blog_url, $arr_of_cnames[$offset], $match[0]);
} else {
return $match[0];
}
......@@ -101,6 +114,7 @@ function scossdl_off_options() {
update_option('ossdl_off_cdn_url', $_POST['ossdl_off_cdn_url']);
update_option('ossdl_off_include_dirs', $_POST['ossdl_off_include_dirs'] == '' ? 'wp-content,wp-includes' : $_POST['ossdl_off_include_dirs']);
update_option('ossdl_off_exclude', $_POST['ossdl_off_exclude']);
update_option('ossdl_cname', $_POST['ossdl_cname']);
if ( isset( $_POST[ 'ossdlcdn' ] ) ) {
$ossdlcdn = 1;
} else {
......@@ -108,12 +122,16 @@ function scossdl_off_options() {
}
wp_cache_replace_line('^ *\$ossdlcdn', "\$ossdlcdn = $ossdlcdn;", $wp_cache_config_file);
}
$example_cdn_uri = str_replace('http://', 'http://cdn.', str_replace('www.', '', get_option('siteurl')));
$example_cdn_uri = str_replace( 'http://', 'http://cdn.', str_replace( 'www.', '', get_option( 'siteurl' ) ) );
$example_cnames = str_replace( 'http://cdn.', 'http://cdn1.', $example_cdn_uri );
$example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn2.', $example_cdn_uri );
$example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn3.', $example_cdn_uri );
$example_cdn_uri = get_option('ossdl_off_cdn_url') == get_option('siteurl') ? $example_cdn_uri : get_option('ossdl_off_cdn_url');
$example_cdn_uri .= '/wp-includes/js/prototype.js';
?>
<p><?php _e( 'Your website probably uses lots of static files. Image, Javascript and CSS files are usually static files that could just as easily be served from another site or CDN. Therefore this plugin replaces any links in the <code>wp-content</code> and <code>wp-includes</code> directories (except for PHP files) on your site with the URL you provide below. That way you can either copy all the static content to a dedicated host or mirror the files to a CDN by <a href="http://knowledgelayer.softlayer.com/questions/365/How+does+Origin+Pull+work%3F" target="_blank">origin pull</a>.', 'wp-super-cache' ); ?></p>
<p><?php printf( __( 'The <a href="%1$s">CDN Sync Tool</a> plugin will help upload files to Amazon S3/Cloudfront if you would rather not depend on origin pull. See the <a href="%2$s">plugin support forum</a> if you have any queries about this plugin.', 'wp-super-cache' ), 'http://wordpress.org/extend/plugins/cdn-sync-tool/', 'http://wordpress.org/tags/cdn-sync-tool?forum_id=10' ); ?></p>
<p><?php printf( __( '<strong style="color: red">WARNING:</strong> Test some static urls e.g., %s to ensure your CDN service is fully working before saving changes.', 'wp-super-cache' ), '<code>' . $example_cdn_uri . '</code>' ); ?></p>
<p><?php _e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?></p>
<p><form method="post" action="">
......@@ -126,24 +144,31 @@ function scossdl_off_options() {
<th scope="row"><label for="ossdlcdn"><?php _e( 'Enable CDN Support', 'wp-super-cache' ); ?></label></th>
</tr>
<tr valign="top">
<th scope="row"><label for="ossdl_off_cdn_url"><?php _e( 'off-site URL', 'wp-super-cache' ); ?></label></th>
<th scope="row"><label for="ossdl_off_cdn_url"><?php _e( 'Off-site URL', 'wp-super-cache' ); ?></label></th>
<td>
<input type="text" name="ossdl_off_cdn_url" value="<?php echo(get_option('ossdl_off_cdn_url')); ?>" size="64" class="regular-text code" /><br />
<span class="description"><?php printf( __( 'The new URL to be used in place of %1$s for rewriting. No trailing <code>/</code> please.<br />Example: <code>%2$s</code>.', 'wp-super-cache' ), get_option( 'siteurl' ), $example_cdn_uri ); ?></span>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="ossdl_off_include_dirs"><?php _e( 'Include directories', 'wp-super-cache' ); ?></label></th>
<td>
<input type="text" name="ossdl_off_cdn_url" value="<?php echo(get_option('ossdl_off_cdn_url')); ?>" size="64" class="regular-text code" />
<span class="description">The new URL to be used in place of <?php echo(get_option('siteurl')); ?> for rewriting. No trailing <code>/</code> please. E.g. <code><?php echo($example_cdn_uri); ?></code>.</span>
<input type="text" name="ossdl_off_include_dirs" value="<?php echo esc_attr( get_option( 'ossdl_off_include_dirs' ) ); ?>" size="64" class="regular-text code" /><br />
<span class="description"><?php _e( 'Directories to include in static file matching. Use a comma as the delimiter. Default is <code>wp-content, wp-includes</code>, which will be enforced if this field is left empty.', 'wp-super-cache' ); ?></span>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="ossdl_off_include_dirs">include dirs</label></th>
<th scope="row"><label for="ossdl_off_exclude"><?php _e( 'Exclude if substring', 'wp-super-cache' ); ?></label></th>
<td>
<input type="text" name="ossdl_off_include_dirs" value="<?php echo(get_option('ossdl_off_include_dirs')); ?>" size="64" class="regular-text code" />
<span class="description">Directories to include in static file matching. Use a comma as the delimiter. Default is <code>wp-content, wp-includes</code>, which will be enforced if this field is left empty.</span>
<input type="text" name="ossdl_off_exclude" value="<?php echo esc_attr( get_option( 'ossdl_off_exclude' ) ); ?>" size="64" class="regular-text code" /><br />
<span class="description"><?php _e( 'Excludes something from being rewritten if one of the above strings is found in the match. Use a comma as the delimiter like this, <code>.php, .flv, .do</code>, and always include <code>.php</code> (default).', 'wp-super-cache' ); ?></span>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="ossdl_off_exclude">exclude if substring</label></th>
<th scope="row"><label for="ossdl_cname"><?php _e( 'Additional CNAMES', 'wp-super-cache' ); ?></label></th>
<td>
<input type="text" name="ossdl_off_exclude" value="<?php echo(get_option('ossdl_off_exclude')); ?>" size="64" class="regular-text code" />
<span class="description">Excludes something from being rewritten if one of the above strings is found in the match. Use a comma as the delimiter. E.g. <code>.php, .flv, .do</code>, always include <code>.php</code> (default).</span>
<input type="text" name="ossdl_cname" value="<?php echo esc_attr( get_option( 'ossdl_cname' ) ); ?>" size="64" class="regular-text code" /><br />
<span class="description"><?php printf( __( 'These <a href="http://en.wikipedia.org/wiki/CNAME_record">CNAMES</a> will be used in place of %1$s for rewriting (in addition to the off-site URL above). Use a comma as the delimiter. For pages with a large number of static files, this can improve browser performance. CNAMEs may also need to be configured on your CDN.<br />Example: %2$s', 'wp-super-cache' ), get_option( 'siteurl' ), $example_cnames ); ?></span>
</td>
</tr>
</tbody></table>
......
......@@ -34,20 +34,22 @@ function get_bb_file_loc() {
function wp_supercache_badbehaviour_admin() {
global $cache_badbehaviour, $wp_cache_config_file, $valid_nonce;
$cache_badbehaviour = $cache_badbehaviour == '' ? 'no' : $cache_badbehaviour;
$cache_badbehaviour = $cache_badbehaviour == '' ? 0 : $cache_badbehaviour;
if ( $cache_badbehaviour == 'no' )
$cache_badbehaviour = 0;
$err = false;
if(isset($_POST['cache_badbehaviour']) && $valid_nonce) {
if ( isset( $_POST['cache_badbehaviour'] ) && $valid_nonce ) {
$bbfile = get_bb_file_loc();
if( !$bbfile ) {
$_POST[ 'cache_badbehaviour' ] = 0;
$err = __( 'Bad Behaviour not found. Please check your install.', 'wp-super-cache' );
}
if ( $cache_badbehaviour == (int)$_POST['cache_badbehaviour'] ) {
$changed = $false;
} else {
$changed = false;
} else {
$changed = true;
}
$cache_badbehaviour = (int)$_POST['cache_badbehaviour'];
wp_cache_replace_line('^ *\$cache_compression', "\$cache_compression = 0;", $wp_cache_config_file);
......
......@@ -46,7 +46,7 @@ $gzipped = 0;
$gzsize = 0;
function gzip_accepted(){
if( ini_get( 'zlib.output_compression' ) ) // don't compress WP-Cache data files when PHP is already doing it
if ( 1 == ini_get( 'zlib.output_compression' ) || "on" == strtolower( ini_get( 'zlib.output_compression' ) ) ) // don't compress WP-Cache data files when PHP is already doing it
return false;
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === false) return false;
......@@ -147,13 +147,20 @@ function wp_cache_serve_cache_file() {
} else {
// last chance, check if a supercache file exists. Just in case .htaccess rules don't work on this host
$file = get_current_url_supercache_dir() . "index.html";
$phpfile = get_current_url_supercache_dir() . "index.html.php";
$serving_supercache = false;
if ( file_exists( $file ) ) {
$serving_supercache = 'html';
} elseif ( file_exists( $phpfile ) ) {
$serving_supercache = 'php';
}
if (
(
$wp_cache_request_uri == '/' ||
( $wp_cache_slash_check && substr( $wp_cache_request_uri, -1 ) == '/' ) ||
( $wp_cache_slash_check == 0 && substr( $wp_cache_request_uri, -1 ) != '/' )
) &&
( wp_cache_get_cookies_values() == '' && empty( $_GET ) && file_exists( $file ) ) )
( wp_cache_get_cookies_values() == '' && empty( $_GET ) && $serving_supercache ) )
{
header( "Content-type: text/html; charset=UTF-8" ); // UTF-8 hard coded is bad but we don't know what it is this early in the process
header( "Vary: Accept-Encoding, Cookie" );
......@@ -163,11 +170,11 @@ function wp_cache_serve_cache_file() {
$file = $file . '.gz';
header( 'Content-Encoding: ' . $wp_cache_gzip_encoding );
header( 'Content-Length: ' . filesize( $file ) );
} elseif ( $wp_supercache_304 ) {
} elseif ( $serving_supercache == 'html' && $wp_supercache_304 ) {
header( 'Content-Length: ' . filesize( $file ) );
}
if ( $wp_supercache_304 ) {
if ( $serving_supercache == 'html' && $wp_supercache_304 ) {
if ( function_exists( 'apache_request_headers' ) ) {
$request = apache_request_headers();
$remote_mod_time = $request[ 'If-Modified-Since' ];
......@@ -181,9 +188,24 @@ function wp_cache_serve_cache_file() {
}
header( 'Last-Modified: ' . $local_mod_time );
}
readfile( $file );
if ( isset( $wp_super_cache_debug ) && $wp_super_cache_debug ) wp_cache_debug( "Served page from supercache file using PHP.", 5 );
exit();
if ( $serving_supercache == 'html' ) {
readfile( $file );
if ( isset( $wp_super_cache_debug ) && $wp_super_cache_debug ) wp_cache_debug( "Served page from supercache file using PHP.", 5 );
exit();
} elseif ( $serving_supercache == 'php' ) {
$cachefiledata = file_get_contents($phpfile);
if ( $cache_compression and $wp_cache_gzip_encoding ) {
ob_start("ob_gzhandler");
eval( '?>' . $cachefiledata . '<?php ' );
echo "\n<!-- Compression = gzip -->\n";
ob_end_flush();
if ( isset( $wp_super_cache_debug ) && $wp_super_cache_debug ) wp_cache_debug( "Served compressed dynamic page from supercache file using PHP. File: $file", 5 );
} else {
eval( '?>' . $cachefiledata . '<?php ' );
if ( isset( $wp_super_cache_debug ) && $wp_super_cache_debug ) wp_cache_debug( "Served dynamic page from supercache file using PHP. File: $file", 5 );
}
exit();
}
} else {
if ( isset( $wp_super_cache_debug ) && $wp_super_cache_debug ) wp_cache_debug( "No wp-cache file exists. Must generate a new one.", 5 );
return false;
......@@ -334,7 +356,11 @@ function do_cacheaction( $action, $value = '' ) {
if( array_key_exists($action, $wp_supercache_actions) && is_array( $wp_supercache_actions[ $action ] ) ) {
$actions = $wp_supercache_actions[ $action ];
foreach( $actions as $func ) {
$value = $func( $value );
if ( is_array( $func ) ) {
$value = $func[0]->{$func[1]}( $value );
} else {
$value = $func( $value );
}
}
}
......@@ -398,12 +424,12 @@ function wp_cache_check_mobile( $cache_key ) {
}
function wp_cache_debug( $message, $level = 1 ) {
global $wp_cache_debug_level, $wp_cache_debug_log, $wp_cache_debug_email, $cache_path, $wp_cache_debug_ip, $wp_super_cache_debug;
global $wp_cache_debug_level, $wp_cache_debug_log, $cache_path, $wp_cache_debug_ip, $wp_super_cache_debug;
if ( isset( $wp_super_cache_debug ) && $wp_super_cache_debug == false )
return false;
if ( isset( $wp_cache_debug_email ) == false && isset( $wp_cache_debug_log ) == false )
if ( isset( $wp_cache_debug_log ) == false )
return false;
if ( isset( $wp_cache_debug_level ) == false )
......@@ -417,11 +443,6 @@ function wp_cache_debug( $message, $level = 1 ) {
if ( isset( $wp_cache_debug_log ) && $wp_cache_debug_log != '' ) {
error_log( date( 'H:i:s' ) . " " . $_SERVER[ 'REQUEST_URI' ] . " " . $message . "\n", 3, $cache_path . str_replace( '/', '', str_replace( '..', '', $wp_cache_debug_log ) ) );
}
if ( isset( $wp_cache_debug_email ) && $wp_cache_debug_email != '' ) {
$message .= "\n\nDisable these emails by commenting out or deleting the line containing\n\$wp_cache_debug_email in wp-content/wp-cache-config.php on your server.\n";
mail( $wp_cache_debug_email, '[' . addslashes( $_SERVER[ 'HTTP_HOST' ] ) . "] WP Super Cache Debug", $message );
}
}
function wp_cache_user_agent_is_rejected() {
......
......@@ -86,7 +86,7 @@ function wp_cache_phase2() {
$do_cache = apply_filters( 'do_createsupercache', $user_info );
if( $user_info == '' || $do_cache === true ) {
$dir = get_current_url_supercache_dir();
$files_to_check = array( $dir . 'index.html', $dir . 'index.html.gz' );
$files_to_check = array( $dir . 'index.html', $dir . 'index.html.php', $dir . 'index.html.gz' );
foreach( $files_to_check as $cache_file ) {
if( !@file_exists( $cache_file . '.needs-rebuild' ) )
continue;
......@@ -308,6 +308,7 @@ function wp_cache_get_ob(&$buffer) {
global $wp_cache_404, $gzsize, $supercacheonly;
global $blog_cache_dir, $wp_cache_request_uri, $wp_supercache_cache_list;
global $wp_cache_not_logged_in, $wp_cache_object_cache, $cache_max_time;
global $wp_cache_is_home, $wp_cache_front_page_checks;
$new_cache = true;
$wp_cache_meta = '';
......@@ -464,11 +465,30 @@ function wp_cache_get_ob(&$buffer) {
$buffer .= '<!-- Super Cache dynamic page detected but $wp_super_cache_late_init not set. See the readme.txt for further details. -->';
if ( false == $wp_cache_object_cache ) {
if( $fr )
if( $fr ) { // legacy caching
fputs($fr, $store);
} elseif ( isset( $fr2 ) ) { // supercache active
$php_fname = "{$dir}index.html.php";
$tmp_php_filename = $dir . uniqid( mt_rand(), true ) . '.tmp';
$php_fd = @fopen( $tmp_php_filename, 'w' );
if ( !$php_fd ) {
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Error. Supercache could not write to " . str_replace( ABSPATH, '', $tmp_php_filename ), 1 );
$buffer .= "<!-- File not cached! Super Cache couldn't write to: " . str_replace( ABSPATH, '', $tmp_php_filename ) . " -->\n";
@fclose( $php_fd );
@unlink( $tmp_php_filename );
wp_cache_writers_exit();
return $buffer;
}
fputs( $php_fd, $store );
}
} else {
wp_cache_set( $oc_key, $store, 'supercache', $cache_max_time );
}
if ( $cache_compression && $wp_cache_gzip_encoding ) {
if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Gzipping dynamic buffer.", 5 );
$gzdata = gzencode( $buffer . "<!-- Compression = gzip -->", 6, FORCE_GZIP );
$gzsize = strlen($gzdata);
}
} else {
$buffer = apply_filters( 'wpsupercache_buffer', $buffer );
// Append WP Super Cache or Live page comment tag
......@@ -533,7 +553,7 @@ function wp_cache_get_ob(&$buffer) {
}