-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
APC is only supported up to PHP 5.5. As Cachify now requires PHP 5.6 or later, there is no point in maintaining legacy APC support. We already ignore unavailable backends silently with fallback to DB, so just removing it does not make it worse here.
- Loading branch information
Showing
9 changed files
with
13 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,7 @@ | ||
<?php | ||
/** | ||
* Proxy for APC based caching. | ||
/* | ||
* APC support was removed in Cachify 2.4.0 | ||
* | ||
* @package Cachify | ||
* This file is just here to not break any remaining "auto_prepend_file" configurations. | ||
* Will be removed with the next major update, so adjust your server's configuration, if you happen to read this notice. | ||
*/ | ||
|
||
if ( ! empty( $_COOKIE ) ) { | ||
foreach ( $_COOKIE as $k => $v ) { | ||
if ( preg_match( '/^(wp-postpass|wordpress_logged_in|comment_author)_/', $k ) ) { | ||
$_cachify_logged_in = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Determines if SSL is used. | ||
* | ||
* @see is_ssl() (wp-includes/load.php). | ||
* | ||
* @return bool True if SSL, otherwise false. | ||
*/ | ||
function cachify_is_ssl() { | ||
if ( isset( $_SERVER['HTTPS'] ) ) { | ||
$https = filter_input( INPUT_SERVER, 'HTTPS', FILTER_SANITIZE_STRING ); | ||
if ( 'on' === strtolower( $https ) || '1' === $https ) { | ||
return true; | ||
} | ||
} elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' === $_SERVER['SERVER_PORT'] ) ) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
if ( | ||
empty( $_cachify_logged_in ) | ||
&& extension_loaded( 'apc' ) | ||
&& ( strpos( filter_input( INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING ), '/wp-admin/' ) === false ) | ||
&& ( strpos( filter_input( INPUT_SERVER, 'HTTP_ACCEPT_ENCODING', FILTER_SANITIZE_STRING ), 'gzip' ) !== false ) | ||
) { | ||
$cache = apc_fetch( | ||
md5( | ||
( cachify_is_ssl() ? 'https-' : '' ) . | ||
filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING ) . | ||
filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL ) | ||
) . | ||
'.cachify' | ||
); | ||
if ( $cache ) { | ||
ini_set( 'zlib.output_compression', 'Off' ); | ||
|
||
header( 'Vary: Accept-Encoding' ); | ||
header( 'X-Powered-By: Cachify' ); | ||
header( 'Content-Encoding: gzip' ); | ||
header( 'Content-Length: ' . strlen( $cache ) ); | ||
header( 'Content-Type: text/html; charset=utf-8' ); | ||
|
||
echo $cache; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
exit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.