PluginProbe
ActivityPub / 8.0.2
ActivityPub v8.0.2
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | integration/class-litespeed-cache.php +8 -11 9.3.08.0.2 View file →
@@ -22,9 +22,9 @@
22 22 * @var string
23 23 */
24 24 public static $rules = '<IfModule LiteSpeed>
25 25 RewriteEngine On
26 -RewriteCond %{HTTP:Accept} ^[\s,]*(application/activity\+json|application/ld\+json[^,]*activitystreams) [NC]
26 +RewriteCond %{HTTP:Accept} application
27 27 RewriteRule ^ - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+isjson]
28 28 </IfModule>';
29 29
30 30 /**
@@ -53,11 +53,9 @@
53 53 */
54 54 public static function init() {
55 55 // Add rules if LiteSpeed Cache is active and rules aren't set.
56 56 if ( is_plugin_active( self::$plugin_slug ) ) {
57 - // (Re)write when the installed rules differ from the current ones: first setup, or a rules
58 - // update that must replace a previously written (looser) block on existing installs.
59 - if ( \get_option( self::$option_name ) !== \md5( self::$rules ) ) {
57 + if ( ! \get_option( self::$option_name ) ) {
60 58 self::add_htaccess_rules();
61 59 }
62 60
63 61 \add_filter( 'site_status_tests', array( self::class, 'add_site_health_test' ) );
@@ -87,11 +85,10 @@
87 85 */
88 86 public static function add_htaccess_rules() {
89 87 $added_rules = self::append_with_markers( self::$marker, self::$rules );
90 88
91 - // Store a fingerprint of the written rules so a later change re-applies them (see init()).
92 89 if ( $added_rules ) {
93 - \update_option( self::$option_name, \md5( self::$rules ) );
90 + \update_option( self::$option_name, '1' );
94 91 } else {
95 92 \update_option( self::$option_name, '0' );
96 93 }
97 94 }
@@ -183,13 +180,13 @@
183 180
184 181 $htaccess = $wp_filesystem->get_contents( $htaccess_file );
185 182
186 183 // If marker exists, remove the old block first.
187 - if ( \strpos( $htaccess, $marker ) !== false ) {
184 + if ( strpos( $htaccess, $marker ) !== false ) {
188 185 // Remove existing marker block.
189 - $pattern = '/# BEGIN ' . \preg_quote( $marker, '/' ) . '.*?# END ' . \preg_quote( $marker, '/' ) . '\r?\n?/s';
190 - $htaccess = \preg_replace( $pattern, '', $htaccess );
191 - $htaccess = \trim( $htaccess );
186 + $pattern = '/# BEGIN ' . preg_quote( $marker, '/' ) . '.*?# END ' . preg_quote( $marker, '/' ) . '\r?\n?/s';
187 + $htaccess = preg_replace( $pattern, '', $htaccess );
188 + $htaccess = trim( $htaccess );
192 189 }
193 190
194 191 // If rules are empty, just return (for removal case).
195 192 if ( empty( $rules ) ) {
@@ -217,9 +214,9 @@
217 214 // Ensure get_home_path() is declared.
218 215 require_once ABSPATH . 'wp-admin/includes/file.php';
219 216
220 217 // phpcs:ignore WordPress.PHP.NoSilencedErrors
221 - if ( @\file_exists( \get_home_path() . '.htaccess' ) ) {
218 + if ( @file_exists( \get_home_path() . '.htaccess' ) ) {
222 219 /** The htaccess file resides in ABSPATH */
223 220 $htaccess_file = \get_home_path() . '.htaccess';
224 221 }
225 222