Cloudflare - Version 4.10.0

Version Description

  • 2022-06-03 =

  • Ignore feed URLs in cache purge operations unless a cache override is in place.

Download this release

Release Info

Developer manatarms
Plugin Icon 128x128 Cloudflare
Version 4.10.0
Comparing to
See all releases

Code changes from version 4.9.1 to 4.10.0

cloudflare.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cloudflare
4
  Plugin URI: https://blog.cloudflare.com/new-wordpress-plugin/
5
  Description: Cloudflare speeds up and protects your WordPress site.
6
- Version: 4.9.1
7
  Requires PHP: 7.2
8
  Author: Cloudflare, Inc.
9
  License: BSD-3-Clause
3
  Plugin Name: Cloudflare
4
  Plugin URI: https://blog.cloudflare.com/new-wordpress-plugin/
5
  Description: Cloudflare speeds up and protects your WordPress site.
6
+ Version: 4.10.0
7
  Requires PHP: 7.2
8
  Author: Cloudflare, Inc.
9
  License: BSD-3-Clause
composer.json CHANGED
@@ -32,7 +32,7 @@
32
  "_comment": [
33
  "php-compatibility-install comes from https://github.com/wimg/PHPCompatibility/issues/102#issuecomment-255778195"
34
  ],
35
- "version": "4.9.1",
36
  "config": {
37
  "platform": {
38
  "php": "7.2"
32
  "_comment": [
33
  "php-compatibility-install comes from https://github.com/wimg/PHPCompatibility/issues/102#issuecomment-255778195"
34
  ],
35
+ "version": "4.10.0",
36
  "config": {
37
  "platform": {
38
  "php": "7.2"
composer.lock CHANGED
@@ -4,7 +4,7 @@
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
- "content-hash": "8258814eb30e4f1d3b5fe4aa64eccea9",
8
  "packages": [
9
  {
10
  "name": "cloudflare/cf-ip-rewrite",
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
+ "content-hash": "b021219a5ffab6b04f55089d3a746e7d",
8
  "packages": [
9
  {
10
  "name": "cloudflare/cf-ip-rewrite",
config.json CHANGED
@@ -25,5 +25,5 @@
25
  },
26
  "locale": "en",
27
  "integrationName": "wordpress",
28
- "version": "4.9.1"
29
  }
25
  },
26
  "locale": "en",
27
  "integrationName": "wordpress",
28
+ "version": "4.10.0"
29
  }
output.log CHANGED
@@ -16,37 +16,37 @@ php-7.4-build2: Pulling from cloudflare/cloudflare-wordpress/php-actions_compose
16
  5571c1cd7f43: Pulling fs layer
17
  65564f077fec: Pulling fs layer
18
  4d1e94121e00: Pulling fs layer
19
- 4612e05a72cf: Waiting
20
- 9b2beae78beb: Waiting
21
  79c03e12047a: Waiting
22
  51393fef6543: Waiting
23
  5571c1cd7f43: Waiting
24
  65564f077fec: Waiting
25
  4d1e94121e00: Waiting
26
- 320f26ee9b1c: Verifying Checksum
27
- 320f26ee9b1c: Download complete
28
- 801bfaa63ef2: Verifying Checksum
29
- 801bfaa63ef2: Download complete
30
  30e209609427: Verifying Checksum
31
  30e209609427: Download complete
 
 
 
 
32
  801bfaa63ef2: Pull complete
 
33
  4612e05a72cf: Verifying Checksum
34
  4612e05a72cf: Download complete
35
- 30e209609427: Pull complete
36
  79c03e12047a: Verifying Checksum
37
  79c03e12047a: Download complete
38
- 320f26ee9b1c: Pull complete
39
  9b2beae78beb: Verifying Checksum
40
  9b2beae78beb: Download complete
41
- 4612e05a72cf: Pull complete
 
42
  5571c1cd7f43: Verifying Checksum
43
  5571c1cd7f43: Download complete
44
- 51393fef6543: Verifying Checksum
45
- 51393fef6543: Download complete
46
- 9b2beae78beb: Pull complete
47
  65564f077fec: Verifying Checksum
48
  65564f077fec: Download complete
49
- 79c03e12047a: Pull complete
 
50
  4d1e94121e00: Verifying Checksum
51
  4d1e94121e00: Download complete
52
  51393fef6543: Pull complete
16
  5571c1cd7f43: Pulling fs layer
17
  65564f077fec: Pulling fs layer
18
  4d1e94121e00: Pulling fs layer
 
 
19
  79c03e12047a: Waiting
20
  51393fef6543: Waiting
21
  5571c1cd7f43: Waiting
22
  65564f077fec: Waiting
23
  4d1e94121e00: Waiting
24
+ 4612e05a72cf: Waiting
25
+ 9b2beae78beb: Waiting
 
 
26
  30e209609427: Verifying Checksum
27
  30e209609427: Download complete
28
+ 801bfaa63ef2: Verifying Checksum
29
+ 801bfaa63ef2: Download complete
30
+ 320f26ee9b1c: Verifying Checksum
31
+ 320f26ee9b1c: Download complete
32
  801bfaa63ef2: Pull complete
33
+ 30e209609427: Pull complete
34
  4612e05a72cf: Verifying Checksum
35
  4612e05a72cf: Download complete
36
+ 320f26ee9b1c: Pull complete
37
  79c03e12047a: Verifying Checksum
38
  79c03e12047a: Download complete
39
+ 4612e05a72cf: Pull complete
40
  9b2beae78beb: Verifying Checksum
41
  9b2beae78beb: Download complete
42
+ 9b2beae78beb: Pull complete
43
+ 79c03e12047a: Pull complete
44
  5571c1cd7f43: Verifying Checksum
45
  5571c1cd7f43: Download complete
 
 
 
46
  65564f077fec: Verifying Checksum
47
  65564f077fec: Download complete
48
+ 51393fef6543: Verifying Checksum
49
+ 51393fef6543: Download complete
50
  4d1e94121e00: Verifying Checksum
51
  4d1e94121e00: Download complete
52
  51393fef6543: Pull complete
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: icyapril, manatarms, thillcf, deuill, epatryk, jacobbednarz
3
  Tags: cloudflare, seo, ssl, ddos, speed, security, cdn, performance, free
4
  Requires at least: 3.4
5
  Tested up to: 5.9
6
- Stable tag: 4.9.1
7
  Requires PHP: 7.2
8
  License: BSD-3-Clause
9
 
@@ -99,6 +99,10 @@ Yes, Cloudflare works with, and helps speed up your site even more, if you have
99
 
100
  == Changelog ==
101
 
 
 
 
 
102
  = 4.9.1 - 2022-05-04 =
103
 
104
  * Handle empty URL arrays for purging.
3
  Tags: cloudflare, seo, ssl, ddos, speed, security, cdn, performance, free
4
  Requires at least: 3.4
5
  Tested up to: 5.9
6
+ Stable tag: 4.10.0
7
  Requires PHP: 7.2
8
  License: BSD-3-Clause
9
 
99
 
100
  == Changelog ==
101
 
102
+ = 4.10.0 - 2022-06-03 =
103
+
104
+ * Ignore feed URLs in cache purge operations unless a cache override is in place.
105
+
106
  = 4.9.1 - 2022-05-04 =
107
 
108
  * Handle empty URL arrays for purging.
src/WordPress/Hooks.php CHANGED
@@ -187,10 +187,18 @@ class Hooks
187
  $urls = array_values(array_filter(array_unique($urls)));
188
 
189
  $activePageRules = $this->api->getPageRules($zoneTag, "active");
 
 
 
 
 
 
 
 
 
190
 
191
  // Fetch the page rules and should we not have any hints of cache
192
  // all behaviour or APO, filter out the non-cacheable URLs.
193
- $hasCacheOverride = $this->pageRuleContains($activePageRules, "cache_level", "cache_everything");
194
  if (!$hasCacheOverride && !$this->isAutomaticPlatformOptimizationEnabled()) {
195
  $this->logger->debug("cache everything behaviour and APO not found, filtering URLs to only be those that are cacheable by default");
196
  $urls = array_filter($urls, array($this, "pathHasCachableFileExtension"));
@@ -529,6 +537,21 @@ class Hooks
529
  return false;
530
  }
531
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
532
  /**
533
  * urlIsHTTPS determines if a scheme used for a URL is HTTPS.
534
  *
187
  $urls = array_values(array_filter(array_unique($urls)));
188
 
189
  $activePageRules = $this->api->getPageRules($zoneTag, "active");
190
+ $hasCacheOverride = $this->pageRuleContains($activePageRules, "cache_level", "cache_everything");
191
+
192
+ // Should we not have a 'cache_everything' page rule override, feeds
193
+ // shouldn't be attempted to be purged as they are not cachable by
194
+ // default.
195
+ if (!$hasCacheOverride) {
196
+ $this->logger->debug("cache everything behaviour found, filtering out feeds URLs");
197
+ $urls = array_filter($urls, array($this, "pathIsForFeeds"));
198
+ }
199
 
200
  // Fetch the page rules and should we not have any hints of cache
201
  // all behaviour or APO, filter out the non-cacheable URLs.
 
202
  if (!$hasCacheOverride && !$this->isAutomaticPlatformOptimizationEnabled()) {
203
  $this->logger->debug("cache everything behaviour and APO not found, filtering URLs to only be those that are cacheable by default");
204
  $urls = array_filter($urls, array($this, "pathHasCachableFileExtension"));
537
  return false;
538
  }
539
 
540
+ /**
541
+ * pathIsForFeeds accepts a string URL and checks if the path matches any
542
+ * known feed paths such as "/feed", "/feed/", "/feed/rdf/", "/feed/rss/",
543
+ * "/feed/atom/", "/author/foo/feed", "/comments/feed", "/shop/feed",
544
+ * "/tag/.../feed/", etc.
545
+ *
546
+ * @param mixed $value
547
+ * @return bool
548
+ */
549
+ private function pathIsForFeeds($value)
550
+ {
551
+ $parsed_url = parse_url($value, PHP_URL_PATH);
552
+ return (bool) preg_match('/\/feed(?:\/(?:atom\/?|r(?:df|ss)\/?)?)?$/', $parsed_url);
553
+ }
554
+
555
  /**
556
  * urlIsHTTPS determines if a scheme used for a URL is HTTPS.
557
  *
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit6b4c222723b6c5a25a29c3f8338d7ed4::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitb9de7da753869a269212f140b6d97421::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit6b4c222723b6c5a25a29c3f8338d7ed4
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit6b4c222723b6c5a25a29c3f8338d7ed4
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit6b4c222723b6c5a25a29c3f8338d7ed4', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit6b4c222723b6c5a25a29c3f8338d7ed4', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit6b4c222723b6c5a25a29c3f8338d7ed4::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit6b4c222723b6c5a25a29c3f8338d7ed4
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInit6b4c222723b6c5a25a29c3f8338d7ed4::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequire6b4c222723b6c5a25a29c3f8338d7ed4($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequire6b4c222723b6c5a25a29c3f8338d7ed4($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitb9de7da753869a269212f140b6d97421
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitb9de7da753869a269212f140b6d97421', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitb9de7da753869a269212f140b6d97421', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInitb9de7da753869a269212f140b6d97421::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInitb9de7da753869a269212f140b6d97421::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequireb9de7da753869a269212f140b6d97421($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequireb9de7da753869a269212f140b6d97421($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit6b4c222723b6c5a25a29c3f8338d7ed4
8
  {
9
  public static $files = array (
10
  '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
@@ -69,10 +69,10 @@ class ComposerStaticInit6b4c222723b6c5a25a29c3f8338d7ed4
69
  public static function getInitializer(ClassLoader $loader)
70
  {
71
  return \Closure::bind(function () use ($loader) {
72
- $loader->prefixLengthsPsr4 = ComposerStaticInit6b4c222723b6c5a25a29c3f8338d7ed4::$prefixLengthsPsr4;
73
- $loader->prefixDirsPsr4 = ComposerStaticInit6b4c222723b6c5a25a29c3f8338d7ed4::$prefixDirsPsr4;
74
- $loader->prefixesPsr0 = ComposerStaticInit6b4c222723b6c5a25a29c3f8338d7ed4::$prefixesPsr0;
75
- $loader->classMap = ComposerStaticInit6b4c222723b6c5a25a29c3f8338d7ed4::$classMap;
76
 
77
  }, null, ClassLoader::class);
78
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitb9de7da753869a269212f140b6d97421
8
  {
9
  public static $files = array (
10
  '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
69
  public static function getInitializer(ClassLoader $loader)
70
  {
71
  return \Closure::bind(function () use ($loader) {
72
+ $loader->prefixLengthsPsr4 = ComposerStaticInitb9de7da753869a269212f140b6d97421::$prefixLengthsPsr4;
73
+ $loader->prefixDirsPsr4 = ComposerStaticInitb9de7da753869a269212f140b6d97421::$prefixDirsPsr4;
74
+ $loader->prefixesPsr0 = ComposerStaticInitb9de7da753869a269212f140b6d97421::$prefixesPsr0;
75
+ $loader->classMap = ComposerStaticInitb9de7da753869a269212f140b6d97421::$classMap;
76
 
77
  }, null, ClassLoader::class);
78
  }