Skip to content

Commit

Permalink
Lint PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoColomb committed Jun 30, 2020
1 parent 0cf473d commit 39795c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
22 changes: 14 additions & 8 deletions dropins/advanced-cache.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

if ((! defined('WP_REDIS_DISABLED') || ! WP_REDIS_DISABLED)
if (
(! defined('WP_REDIS_DISABLED') || ! WP_REDIS_DISABLED)
&& class_exists('WP_Redis_Page_Cache')
) :

Expand All @@ -12,10 +13,12 @@
$redis_cache->cache_status_header($redis_cache::CACHE_STATUS_MISS);

// Don't cache interactive scripts or API endpoints
if (in_array(basename($_SERVER['SCRIPT_FILENAME']), [
'wp-cron.php',
'xmlrpc.php',
])) {
if (
in_array(basename($_SERVER['SCRIPT_FILENAME']), [
'wp-cron.php',
'xmlrpc.php',
])
) {
$redis_cache->cache_status_header($redis_cache::CACHE_STATUS_BYPASS);

return;
Expand All @@ -42,7 +45,8 @@
continue;
}

if (strpos($cookie, 'wp') === 0 ||
if (
strpos($cookie, 'wp') === 0 ||
strpos($cookie, 'wordpress') === 0 ||
strpos($cookie, 'comment_author') === 0
) {
Expand Down Expand Up @@ -136,14 +140,16 @@
$genlock = wp_cache_add("{$redis_cache->url_key}_genlock", 1, $redis_cache->group, 10);
}

if ($serve_cache &&
if (
$serve_cache &&
isset($cache['time'], $cache['max_age']) &&
time() < $cache['time'] + $cache['max_age']
) {
// Respect ETags
$three04 = false;

if (isset($_SERVER['HTTP_IF_NONE_MATCH'], $cache['headers']['ETag'][0]) &&
if (
isset($_SERVER['HTTP_IF_NONE_MATCH'], $cache['headers']['ETag'][0]) &&
$_SERVER['HTTP_IF_NONE_MATCH'] == $cache['headers']['ETag'][0]
) {
$three04 = true;
Expand Down
3 changes: 2 additions & 1 deletion dropins/object-cache.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

if ((! defined('WP_REDIS_DISABLED') || ! WP_REDIS_DISABLED)
if (
(! defined('WP_REDIS_DISABLED') || ! WP_REDIS_DISABLED)
&& class_exists('WP_Redis_Object_Cache')
) :

Expand Down

0 comments on commit 39795c2

Please sign in to comment.