WP Super Cache - Version 1.5.2

Version Description

Fix loading the REST API code, finding the .htaccess file, mobile browsers using WP-Cache caching, and more..

=

Download this release

Release Info

Developer donncha
Plugin Icon 128x128 WP Super Cache
Version 1.5.2
Comparing to
See all releases

Code changes from version 1.5.1 to 1.5.2

Changelog.txt DELETED
@@ -1,665 +0,0 @@
1
- 2017-02-03 17:17 donncha
2
-
3
- * readme.txt, wp-cache.php: Bump version number to 1.4.9 and update
4
- changelog
5
-
6
- 2017-02-03 17:11 donncha
7
-
8
- * wp-cache-phase1.php, wp-cache-phase2.php, wp-cache.php: * Github
9
- merge:
10
- * Make sure $cache_path has a trailing slash
11
- (https://github.com/Automattic/wp-super-cache/pull/77)
12
- * Remove flush()
13
- (https://github.com/Automattic/wp-super-cache/pull/127) but also
14
- check if headers are empty and flush and get headers again.
15
- (https://github.com/Automattic/wp-super-cache/pull/179)
16
- * Add fix for customizer
17
- (https://github.com/Automattic/wp-super-cache/pull/161) and don't
18
- cache PUT AND DELETE requests
19
- (https://github.com/Automattic/wp-super-cache/pull/178)
20
- * Check for superglobals before using them.
21
- (https://github.com/Automattic/wp-super-cache/pull/131)
22
-
23
- 2017-02-03 16:54 donncha
24
-
25
- * plugins/multisite.php, wp-cache-base.php, wp-cache.php: Github
26
- merge: Need to check more than WP_ALLOW_MULTISITE to detect
27
- multisite installs.
28
- https://github.com/Automattic/wp-super-cache/issues/97
29
-
30
- 2017-02-03 15:07 donncha
31
-
32
- * wp-cache-phase1.php: Github merge:
33
- https://github.com/Automattic/wp-super-cache/pull/161 and also
34
- don't cache PUT and DELETE requests (caught earlier than before)
35
-
36
- 2017-02-03 14:45 donncha
37
-
38
- * plugins/jetpack.php: Remove extra ">", props @dd32
39
- https://github.com/Automattic/wp-super-cache/pull/168
40
-
41
- 2017-02-03 14:37 donncha
42
-
43
- * wp-super-cache.pot: Updated translation file
44
-
45
- 2017-02-03 14:33 donncha
46
-
47
- * wp-cache.php: github merge: some of the changes that were
48
- supposed to be checked in the previous merge didn't make it.
49
-
50
- 2017-02-03 10:18 donncha
51
-
52
- * readme.txt: * Bump the tested version.
53
- * Update the changelog
54
-
55
- 2017-02-03 10:13 donncha
56
-
57
- * Changelog.txt: Updated changelog
58
-
59
- 2017-02-02 18:14 donncha
60
-
61
- * readme.txt: Updated readme.txt changelog and docs
62
-
63
- 2017-02-02 18:08 donncha
64
-
65
- * ossdl-cdn.php, readme.txt, wp-cache-phase2.php, wp-cache.php:
66
- Sync with GITHUB:
67
- * Don't delete so many files on blogs with static homepages.
68
- https://github.com/Automattic/wp-super-cache/pull/175
69
- * Discourage use of file locking because semaphores cause
70
- problems and it's not needed.
71
- https://github.com/Automattic/wp-super-cache/pull/174
72
- * Reorganise the settings page in small ways
73
- https://github.com/Automattic/wp-super-cache/pull/173
74
- * Fixed XSS in settings page. Props @jaypatel
75
- https://github.com/Automattic/wp-super-cache/pull/172
76
-
77
- 2017-01-11 16:58 kraftbj
78
-
79
- * readme.txt, wp-cache-phase2.php: Github #138: Do not cache
80
- PUT/DELETE requests
81
-
82
- 2016-12-09 15:38 kraftbj
83
-
84
- * wp-cache-phase2.php: Check that header parts exist to avoid
85
- `Undefined Index` notices
86
-
87
- 2016-12-09 15:37 kraftbj
88
-
89
- * wp-cache-phase2.php: Update to Git master
90
-
91
- 2016-12-09 10:25 donncha
92
-
93
- * readme.txt: Bump the "tested up to" value
94
-
95
- 2016-08-01 20:39 kraftbj
96
-
97
- * readme.txt: Bump tested version to 4.6
98
-
99
- 2016-05-09 14:56 kraftbj
100
-
101
- * readme.txt: Bump tested version
102
-
103
- 2016-03-07 15:24 kraftbj
104
-
105
- * readme.txt: Update readme for previous commit
106
-
107
- 2016-03-07 15:20 kraftbj
108
-
109
- * wp-cache-phase2.php: Catch up SVN to GH
110
-
111
- 2016-03-07 13:46 donncha
112
-
113
- * readme.txt, wp-cache.php: Bumped version to 1.4.8 and updated
114
- changelog
115
-
116
- 2016-03-07 13:39 donncha
117
-
118
- * wp-super-cache.pot: Updated translation pot file
119
-
120
- 2016-03-07 12:37 donncha
121
-
122
- * wp-cache.php: Remove this link as Google is reporting it as
123
- malware. It's still available at
124
- https://web.archive.org/web/20150914095007/http://bytes.com/topic/php/answers/3917-seconds-converted-hh-mm-ss.
125
- Ref: https://github.com/Automattic/wp-super-cache/issues/106
126
-
127
- 2015-12-16 18:14 kraftbj
128
-
129
- * readme.txt, wp-cache.php: Update readme for 1.4.7
130
-
131
- 2015-12-16 16:59 kraftbj
132
-
133
- * wp-cache.php: Fix settings page layout breakage in 4.4.
134
-
135
- 2015-12-02 15:50 kraftbj
136
-
137
- * ossdl-cdn.php, wp-cache.php: Corrects typos. See
138
- https://github.com/Automattic/wp-super-cache/issues/81
139
-
140
- props https://github.com/christophherr
141
-
142
- 2015-10-21 19:54 kraftbj
143
-
144
- * wp-cache-phase1.php: Remove variable no longer defined after
145
- previous update.
146
-
147
- 2015-10-09 18:06 donncha
148
-
149
- * Changelog.txt, readme.txt, wp-cache.php: Bump version to 1.4.6
150
- and update changelog
151
-
152
- 2015-10-08 17:14 donncha
153
-
154
- * wp-cache.php: Don't check if .htaccess already created as the
155
- index check already created it. Props Tigertech. Ref:
156
- https://wordpress.org/support/topic/all-website-pages-downloading-gz-file-after-latest-update?replies=28#post-7494087
157
-
158
- 2015-09-25 11:20 donncha
159
-
160
- * Changelog.txt: Updated changelog
161
-
162
- 2015-09-25 10:55 donncha
163
-
164
- * readme.txt, wp-cache.php: Bump version to release 1.4.5 and add
165
- changelog
166
-
167
- 2015-09-24 15:37 donncha
168
-
169
- * wp-cache-base.php, wp-cache-phase1.php, wp-cache-phase2.php,
170
- wp-cache.php: * Add index.html files and "-index" directives to
171
- stop indexing of directories
172
- * Sanitise input on settings page
173
- * MD5 the cookie, use JSON to encode meta files, and rename them
174
- to .php
175
-
176
- 2015-09-24 11:37 donncha
177
-
178
- * readme.txt: Changed homepage link and ocaoimh.ie to z9.io
179
-
180
- 2015-09-24 11:33 donncha
181
-
182
- * readme.txt: Minor update to the description of cache rebuild
183
- feature.
184
-
185
- 2015-09-24 10:39 donncha
186
-
187
- * wp-cache-phase2.php: Reduce "needs rebuild" time to 10 seconds,
188
- so those pages refresh faster.
189
-
190
- 2015-08-28 16:28 donncha
191
-
192
- * wp-cache-phase1.php: Because sometimes your editing in HTTPS
193
- while your site is on HTTP. Thanks kraftbj
194
-
195
- 2015-08-25 21:42 kraftbj
196
-
197
- * wp-cache-phase2.php: Swap post_permalink with get_permalink. Both
198
- are exactly the same and old enough to not impact any users.
199
- post_permalink slated for deprecation in 4.4.
200
-
201
- 2015-08-10 14:06 donncha
202
-
203
- * wp-cache-phase2.php: Avoid PHP warnings, props @daneodekirk
204
-
205
- 2015-08-10 13:25 donncha
206
-
207
- * wp-cache.php: Use $wpdb->blogid rather than get_current_blog_id
208
- as the former returns 0 on single site installs. Props
209
- @daneodekirk
210
-
211
- 2015-07-30 10:13 donncha
212
-
213
- * Changelog.txt, readme.txt: Updated changelog
214
-
215
- 2015-07-29 13:08 donncha
216
-
217
- * wp-cache-phase2.php: Remove this function call as it's not
218
- defined. Ref:
219
- https://github.com/Automattic/wp-super-cache/commit/4f3229009e5c6c8487dd883910ea076a8e3b7e26
220
-
221
- 2015-07-27 16:36 kraftbj
222
-
223
- * wp-cache.php: Don't flush settings for expiry time and garbage
224
- collection. See
225
- https://github.com/Automattic/wp-super-cache/pull/49
226
-
227
- 2015-07-27 16:28 donncha
228
-
229
- * wp-cache-base.php: Remove CacheMeta class as it's not used any
230
- more and caused APC errors. Ref:
231
- https://github.com/Automattic/wp-super-cache/pull/21
232
-
233
- 2015-07-24 15:21 kraftbj
234
-
235
- * wp-cache.php: Check if listfile isset to prevent PHP warning.
236
-
237
- 2015-07-23 13:56 donncha
238
-
239
- * wp-cache.php: Remember the settings on the advanced settings page
240
- when submitting the easy settings form. Thanks Jeremy Herve for
241
- the bug report!
242
-
243
- 2015-07-22 15:52 donncha
244
-
245
- * Changelog.txt, readme.txt: Updated changelog
246
-
247
- 2015-07-22 11:25 donncha
248
-
249
- * wp-cache-phase2.php: Fixed typo in debug log entry
250
-
251
- 2015-07-15 11:56 donncha
252
-
253
- * wp-cache.php: * Added uninstall function as well as deactivate
254
- function. The deactivate function does not delete the config file
255
- but it does disable caching because scheduled jobs must be
256
- enabled in the settings page when the config file is used on
257
- activation again.
258
- * Fixed a bug where deactivating the plugin without visiting the
259
- settings page causes a fatal error so the plugin can't be
260
- deactivated
261
-
262
- 2015-07-02 14:19 donncha
263
-
264
- * wp-cache-phase2.php: Minor changes to debugging
265
-
266
- 2015-07-02 13:58 donncha
267
-
268
- * wp-cache-phase2.php: * prune_super_cache: exit immediately if the
269
- file to be deleted doesn't exist
270
- * Add extra debugging
271
-
272
- 2015-07-02 12:10 donncha
273
-
274
- * wp-cache-phase2.php: Remove https from the home url as well
275
-
276
- 2015-07-01 16:37 donncha
277
-
278
- * wp-cache-phase2.php: As so many checks for "should we cache this
279
- page?" were put to the end of page generation the rebuild system
280
- was broken. This fixes it by deleting the rebuild files created
281
- earlier if the current page isn't to be cached (and thus creating
282
- new cache files)
283
-
284
- 2015-07-01 15:46 donncha
285
-
286
- * wp-cache-phase1.php: Always make sure supercachedirs have
287
- trailing slashes
288
-
289
- 2015-07-01 15:30 donncha
290
-
291
- * wp-cache-phase1.php: Cache the output of
292
- wp_cache_get_cookies_values() for repeat calls
293
-
294
- 2015-07-01 14:59 donncha
295
-
296
- * wp-cache-phase1.php: Use the pid to help logging on busy servers
297
-
298
- 2015-07-01 14:51 donncha
299
-
300
- * plugins/domain-mapping.php: Suercache urls end in slashes
301
-
302
- 2015-06-23 15:32 kraftbj
303
-
304
- * wp-cache-phase1.php: Check for If-Modified-Since before using it
305
- as it is not always defined.
306
-
307
- 2015-06-03 02:36 kraftbj
308
-
309
- * advanced-cache.php: Do not display broken messages for XMLRPC,
310
- REST, AJAX requests.
311
-
312
- 2015-05-15 14:12 kraftbj
313
-
314
- * wp-cache-phase2.php, wp-cache.php: Fix improper site_url usage
315
- * Update site_url to home_url in another e-mail subject
316
- * Use admin_url instead of constructing URL from site_url
317
-
318
- 2015-05-15 14:08 kraftbj
319
-
320
- * wp-cache.php: Use home_url in Preload Cron e-mails.
321
-
322
- 2015-05-15 11:13 donncha
323
-
324
- * wp-cache-phase1.php, wp-cache-phase2.php: Revert 1149165 as it's
325
- not needed any more.
326
-
327
- 2015-05-15 11:02 donncha
328
-
329
- * readme.txt: Bump the tested to version number to 4.2.2
330
-
331
- 2015-05-13 21:01 kraftbj
332
-
333
- * wp-cache.php: Improve the 1&1 hosting workaround to reduce false
334
- positives.
335
-
336
- 2015-05-01 13:53 donncha
337
-
338
- * wp-cache.php: Check if it's an array to avoid PHP warning
339
-
340
- 2015-05-01 13:51 donncha
341
-
342
- * wp-cache-phase2.php: Added some extra debugging
343
-
344
- 2015-04-29 16:55 kraftbj
345
-
346
- * readme.txt: Condense changelog to keep it nice and short :)
347
-
348
- 2015-04-29 15:58 kraftbj
349
-
350
- * readme.txt: Update changelog to keep pace with trunk.
351
-
352
- 2015-04-29 15:45 donncha
353
-
354
- * wp-cache-phase1.php, wp-cache-phase2.php: Check if mb_strlen()
355
- exists before WordPress loads so it doesn't use the limited
356
- mb_strlen compat function in WordPress 4.2. Ref:
357
- https://wordpress.org/support/topic/421-initial-blank-page-load?replies=11
358
-
359
- 2015-04-28 15:53 kraftbj
360
-
361
- * readme.txt: Add previous commits to readme.txt as a running
362
- changelog to make it easier to compile for next release.
363
-
364
- 2015-04-28 15:24 kraftbj
365
-
366
- * wp-cache.php: Preload Cron E-mail Updates
367
-
368
- 2015-04-28 15:17 kraftbj
369
-
370
- * wp-cache.php: Preload only public post types. See
371
- https://github.com/Automattic/wp-super-cache/pull/18
372
-
373
- 2015-04-21 18:22 kraftbj
374
-
375
- * readme.txt: Tested to tag bump to 4.2
376
-
377
- 2015-04-07 16:00 donncha
378
-
379
- * wp-cache-phase2.php: Don't disable supercache caching on CRON
380
- requests. Fixes problems clearing front page cache on scheduled
381
- posts
382
-
383
- 2015-04-04 22:57 donncha
384
-
385
- * wp-cache-phase1.php: Fix the log_message, finally. Props
386
- webaware.
387
-
388
- 2015-04-04 12:17 donncha
389
-
390
- * Changelog.txt: Updated changelog
391
-
392
- 2015-04-04 12:13 donncha
393
-
394
- * readme.txt: Updated changelog
395
-
396
- 2015-04-04 12:12 donncha
397
-
398
- * wp-cache-phase1.php: Make sure we log the actual message in the
399
- debug log.
400
-
401
- 2015-04-04 12:00 donncha
402
-
403
- * Changelog.txt: Updated changelog
404
-
405
- 2015-04-04 11:55 donncha
406
-
407
- * readme.txt, wp-cache.php: Bump version to 1.4.4 and update
408
- changelog
409
-
410
- 2015-04-04 11:47 donncha
411
-
412
- * wp-cache-phase1.php, wp-cache-phase2.php: Don't use print_r to
413
- view GET variables as it causes a fatal PHP error in the output
414
- buffer handler. Props webaware
415
- https://wordpress.org/support/topic/print_r-debug-messages-break-pages-with-query-args?replies=2
416
-
417
- 2015-04-03 16:51 donncha
418
-
419
- * Changelog.txt: Updated changelog
420
-
421
- 2015-04-03 16:44 donncha
422
-
423
- * readme.txt, wp-cache.php: Bump version to 1.4.3, update
424
- changelog, and add link to GIT repo.
425
-
426
- 2015-04-03 15:37 donncha
427
-
428
- * wp-cache.php: Escape the contents of the cache list to avoid
429
- surprises. Props Marc Montpas from Sucuri.
430
-
431
- 2014-12-18 10:55 jeherve
432
-
433
- * readme.txt: Bump testing to 4.1
434
-
435
- 2014-10-10 14:07 kraftbj
436
-
437
- * plugins/jetpack.php, wp-cache-phase1.php, wp-cache-phase2.php,
438
- wp-cache.php: Removing variable checks since wp_cache_debug does
439
- it already. Ref:
440
- https://github.com/Automattic/wp-super-cache/pull/15
441
-
442
- 2014-10-10 14:06 kraftbj
443
-
444
- * readme.txt: Catch up to SVN
445
-
446
- 2014-10-10 14:06 kraftbj
447
-
448
- * readme.txt: Add Jetpack to mobile FAQ.
449
-
450
- 2014-09-04 14:16 kraftbj
451
-
452
- * readme.txt: Bumped testing to 4.0
453
-
454
- 2014-08-11 19:06 donncha
455
-
456
- * plugins/dynamic-cache-test.php: Because without a h we'd have
457
- time keeping. Fixed a typo.
458
-
459
- 2014-08-11 18:44 donncha
460
-
461
- * plugins/dynamic-cache-test.php: Added cronology of a request
462
-
463
- 2014-08-11 18:22 donncha
464
-
465
- * plugins/dynamic-cache-test.php: Fixed the safety function in the
466
- first example test function
467
-
468
- 2014-08-08 16:27 donncha
469
-
470
- * Changelog.txt, readme.txt, wp-cache.php: Bump version to 1.4.2
471
- and update changelog
472
-
473
- 2014-08-08 13:07 donncha
474
-
475
- * wp-cache-phase1.php: Just in case the local modified time of a
476
- file is 0, disable the "last modified time" check.
477
-
478
- 2014-08-08 11:32 donncha
479
-
480
- * plugins/domain-mapping.php: Check if HTTPS exists before checking
481
- it's value to avoid warnings
482
-
483
- 2014-08-08 11:24 donncha
484
-
485
- * wp-cache.php: Replace wpdb->escape with esc_sql() as it's
486
- deprecated.
487
-
488
- 2014-08-08 11:21 donncha
489
-
490
- * wp-cache-phase2.php: Make sure $wp_cache_no_cache_for_get,
491
- $wp_cache_object_cache, $wp_cache_request_uri are visible to the
492
- OB callback to avoid warnings and fix functionality
493
-
494
- 2014-08-07 14:00 donncha
495
-
496
- * Changelog.txt, readme.txt, wp-cache.php: Updated changelog,
497
- documentation, bumped version number to 1.4.1 and tested version.
498
-
499
- 2014-08-07 12:45 donncha
500
-
501
- * wp-cache.php: Removed author information
502
-
503
- 2014-08-06 12:41 kraftbj
504
-
505
- * plugins/awaitingmoderation.php, plugins/badbehaviour.php,
506
- plugins/domain-mapping.php, plugins/jetpack.php,
507
- plugins/searchengine.php, plugins/wptouch.php, wp-cache.php: PR
508
- #13: Added .button-primary and .button-secondary classes to and
509
- removed &raquo's from buttons throughout the admin for
510
- consistency. Ref:
511
- https://github.com/Automattic/wp-super-cache/pull/13 Props:
512
- rcowles
513
-
514
- 2014-08-05 20:00 kraftbj
515
-
516
- * ossdl-cdn.php, readme.txt, wp-cache.php: Fix bad merge.
517
-
518
- 2014-08-05 19:56 kraftbj
519
-
520
- * readme.txt: Add Jetpack to mobile FAQ.
521
-
522
- 2014-08-05 19:56 kraftbj
523
-
524
- * wp-cache.php: Remove CDN Sync Tools. No longer in WP.org repo
525
-
526
- 2014-08-05 19:55 kraftbj
527
-
528
- * ossdl-cdn.php, readme.txt, wp-cache.php: Update
529
- wordpress.org/extend URLs
530
-
531
- 2014-08-05 12:42 donncha
532
-
533
- * wp-cache.php: Fix to avoid an XSS in the settings page. Props
534
- Simon Waters, Surevine Limited.
535
-
536
- 2014-08-04 22:04 kraftbj
537
-
538
- * ossdl-cdn.php: Remove reference to CDN Sync. Plugin no longer in
539
- repo.
540
-
541
- 2014-07-31 21:09 kraftbj
542
-
543
- * readme.txt: Add Jetpack to mobile FAQ.
544
-
545
- 2014-07-31 21:09 kraftbj
546
-
547
- * wp-cache.php: Remove CDN Sync Tools. No longer in WP.org repo
548
-
549
- 2014-07-31 21:08 kraftbj
550
-
551
- * ossdl-cdn.php, readme.txt, wp-cache-phase1.php, wp-cache.php:
552
- Update wordpress.org/extend URLs
553
-
554
- 2014-07-31 21:08 kraftbj
555
-
556
- * plugins/awaitingmoderation.php, plugins/badbehaviour.php,
557
- plugins/domain-mapping.php, plugins/dynamic-cache-test.php,
558
- plugins/jetpack.php, plugins/searchengine.php,
559
- plugins/wptouch.php: Trim whitespace
560
-
561
- 2014-07-31 21:07 kraftbj
562
-
563
- * wp-cache-config-sample.php, wp-cache-phase1.php, wp-cache.php:
564
- Trim whitespace
565
-
566
- 2014-07-31 21:06 kraftbj
567
-
568
- * wp-cache.php: Admin: Add clear to h3 to pretify Recommended Links
569
- title
570
-
571
- 2014-07-31 20:51 donncha
572
-
573
- * wp-cache-phase2.php: Make sure these are global so the function
574
- knows about them. Props JoHenton and richardmtl
575
- http://wordpress.org/support/topic/notices-appearing-above-site-pages-how-do-i-get-rid-of-them?replies=2
576
-
577
- 2014-04-17 16:21 donncha
578
-
579
- * readme.txt: Bump tested version to 3.9
580
-
581
- 2014-03-11 17:58 donncha
582
-
583
- * wp-cache.php: Fix undefined variables warnings. Ref:
584
- http://wordpress.org/support/topic/plugin-wp-super-cache-lot-of-undefined-variables-and-couple-of-warnings?replies=4
585
-
586
- 2014-03-07 18:00 donncha
587
-
588
- * plugins/dynamic-cache-test.php: Better comments and rearrange
589
- example scripts
590
-
591
- 2014-03-05 12:37 donncha
592
-
593
- * wp-cache-phase1.php: HTTP_IF_MODIFIED_SINCE isn't always defined,
594
- so check first.
595
- http://wordpress.org/support/topic/undefined-index-http_if_modified_since?replies=1
596
-
597
- 2014-03-05 11:54 donncha
598
-
599
- * wp-cache-phase1.php, wp-cache-phase2.php: Don't check "do not
600
- cache" conditions until after page buffer has been filled. Ref:
601
- http://wordpress.org/support/topic/bug-dynamic-cache-tags-are-not-replaced-because-of-wp_cache_phase2-conditions
602
-
603
- 2014-03-04 17:26 donncha
604
-
605
- * wp-cache-phase2.php: Added the function wp_cache_maybe_dynamic()
606
- to run buffer through the dynamic cache filter if callback
607
- returned early. Ref:
608
- http://wordpress.org/support/topic/bug-dynamic-cache-tags-are-not-replaced-because-of-wp_cache_phase2-conditions?replies=1
609
-
610
- 2014-03-04 16:27 donncha
611
-
612
- * wp-cache-phase1.php: Hide any warnings from this opendir() as it
613
- somehow fails occasionally.
614
-
615
- 2014-02-25 17:48 donncha
616
-
617
- * wp-cache.php: Clear the cache for the current blog only, don't
618
- want to mess with other multisite blogs
619
-
620
- 2014-02-25 16:24 donncha
621
-
622
- * readme.txt: Bump tested version to current WP version
623
-
624
- 2013-11-29 15:34 donncha
625
-
626
- * wp-cache-phase2.php: Check that $post is an object as this
627
- function is used for more than just post changes.
628
- http://wordpress.org/support/topic/error-switching-themes?replies=2
629
-
630
- 2013-11-12 09:55 donncha
631
-
632
- * advanced-cache.php: Don't show the "advanced-cache.php warning"
633
- when the plugin isn't loaded, props RobertHarm,
634
- http://wordpress.org/support/topic/wp-super-cache-breaks-leaflet-maps-marker-plugin
635
-
636
- 2013-10-25 14:37 donncha
637
-
638
- * wp-cache.php: Define $disable_supercache_htaccess_warning if not
639
- set to avoid PHP warnings, ref:
640
- http://wordpress.org/support/topic/just-a-few-notices-non-critical?replies=1,
641
- props @mattV
642
-
643
- 2013-10-25 14:33 donncha
644
-
645
- * wp-cache-base.php: Avoid a PHP warning if $base is not set. Ref:
646
- http://wordpress.org/support/topic/just-a-few-notices-non-critical?replies=1
647
-
648
- 2013-10-25 09:29 donncha
649
-
650
- * wp-cache.php: Only display the WPCACHEHOME warning if WP_CACHE is
651
- defined and true. Warning won't show until settings page loaded
652
- that WP_CACHE added to wp-config.php
653
-
654
- 2013-10-24 11:23 donncha
655
-
656
- * wp-cache.php: Add trailing slashes to the admin bar path, to fix
657
- the path when no trailing slash is used. Props @gonperesgmailcom
658
- http://wordpress.org/support/topic/fixed-delete-individual-pages-from-cache?replies=2
659
-
660
- 2013-10-23 10:56 donncha
661
-
662
- * readme.txt, wp-cache.php: Bump version to 1.4 and tested version
663
- to 3.6.1
664
-
665
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ossdl-cdn.php CHANGED
@@ -4,8 +4,8 @@
4
 
5
  /* Set up some defaults */
6
  if ( get_option( 'ossdl_off_cdn_url' ) == false )
7
- add_option('ossdl_off_cdn_url', get_home_url() );
8
- $ossdl_off_blog_url = apply_filters( 'ossdl_off_blog_url', get_home_url() );
9
  $ossdl_off_cdn_url = trim( get_option('ossdl_off_cdn_url') );
10
  if ( get_option( 'ossdl_off_include_dirs' ) == false )
11
  add_option('ossdl_off_include_dirs', 'wp-content,wp-includes');
@@ -149,7 +149,7 @@ function scossdl_off_update() {
149
  }
150
 
151
  function scossdl_off_options() {
152
- global $ossdlcdn, $wp_cache_config_file, $valid_nonce;
153
 
154
  scossdl_off_update();
155
 
@@ -158,11 +158,16 @@ function scossdl_off_options() {
158
  $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn2.', $example_cdn_uri );
159
  $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn3.', $example_cdn_uri );
160
 
161
- $example_cdn_uri = get_option('ossdl_off_cdn_url') == get_home_url() ? $example_cdn_uri : get_option('ossdl_off_cdn_url');
162
  $example_cdn_uri .= '/wp-includes/js/jquery/jquery-migrate.js';
163
  ?>
164
  <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="https://knowledgelayer.softlayer.com/faq/how-does-origin-pull-work" target="_blank">origin pull</a>.', 'wp-super-cache' ); ?></p>
165
  <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>
 
 
 
 
 
166
  <p><?php _e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?></p>
167
  <p><form method="post" action="">
168
  <?php wp_nonce_field('wp-cache'); ?>
4
 
5
  /* Set up some defaults */
6
  if ( get_option( 'ossdl_off_cdn_url' ) == false )
7
+ add_option( 'ossdl_off_cdn_url', get_option( 'siteurl' ) );
8
+ $ossdl_off_blog_url = apply_filters( 'ossdl_off_blog_url', get_option( 'siteurl' ) );
9
  $ossdl_off_cdn_url = trim( get_option('ossdl_off_cdn_url') );
10
  if ( get_option( 'ossdl_off_include_dirs' ) == false )
11
  add_option('ossdl_off_include_dirs', 'wp-content,wp-includes');
149
  }
150
 
151
  function scossdl_off_options() {
152
+ global $ossdlcdn, $wp_cache_config_file, $valid_nonce, $ossdl_off_blog_url;
153
 
154
  scossdl_off_update();
155
 
158
  $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn2.', $example_cdn_uri );
159
  $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn3.', $example_cdn_uri );
160
 
161
+ $example_cdn_uri = get_option('ossdl_off_cdn_url') == get_option( 'siteurl' ) ? $example_cdn_uri : get_option('ossdl_off_cdn_url');
162
  $example_cdn_uri .= '/wp-includes/js/jquery/jquery-migrate.js';
163
  ?>
164
  <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="https://knowledgelayer.softlayer.com/faq/how-does-origin-pull-work" target="_blank">origin pull</a>.', 'wp-super-cache' ); ?></p>
165
  <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>
166
+
167
+ <?php if ( $ossdl_off_blog_url != get_home_url() ) { ?>
168
+ <p><?php printf( __( '<strong style="color: red">WARNING:</strong> Your siteurl and homeurl are different. The plugin is using %s as the homepage URL of your site but if that is wrong please use the filter "ossdl_off_blog_url" to fix it.', 'wp-super-cache' ), '<code>' . $ossdl_off_blog_url . '</code>' ); ?></p>
169
+ <?php } ?>
170
+
171
  <p><?php _e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?></p>
172
  <p><form method="post" action="">
173
  <?php wp_nonce_field('wp-cache'); ?>
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: donncha, automattic, kraftbj
3
  Tags: performance,caching,wp-cache,wp-super-cache,cache
4
  Tested up to: 4.8
5
- Stable tag: 1.5.1
6
  Requires at least: 3.0
7
 
8
  A very fast caching engine for WordPress that produces static html files.
@@ -46,7 +46,7 @@ See the [WP Super Cache homepage](https://wordpress.org/plugins/wp-super-cache/)
46
 
47
  There's a [GIT repository](https://github.com/Automattic/wp-super-cache) too if you want to contribute a patch.
48
 
49
- The [changelog](http://svn.wp-plugins.org/wp-super-cache/trunk/Changelog.txt) is a good place to start if you want to know what has changed since you last downloaded the plugin.
50
 
51
  Interested in translating WP Super Cache to your language? See the [translation page](https://translate.wordpress.org/projects/wp-plugins/wp-super-cache) for the plugin.
52
 
@@ -54,11 +54,24 @@ The cache directory, usually wp-content/cache/ is only for temporary files. Do n
54
 
55
  == Upgrade Notice ==
56
 
57
- = 1.5.1 =
58
- Emergency fix for sites running outdated WordPress and PHP.
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  = 1.5.1 =
63
  * Don't use anonymous functions in REST API
64
  * Check that REST API Controller is available before loading the REST API.
2
  Contributors: donncha, automattic, kraftbj
3
  Tags: performance,caching,wp-cache,wp-super-cache,cache
4
  Tested up to: 4.8
5
+ Stable tag: 1.5.2
6
  Requires at least: 3.0
7
 
8
  A very fast caching engine for WordPress that produces static html files.
46
 
47
  There's a [GIT repository](https://github.com/Automattic/wp-super-cache) too if you want to contribute a patch.
48
 
49
+ The [commit list](https://github.com/Automattic/wp-super-cache/commits/master) is a good place to start if you want to know what has changed since you last downloaded the plugin.
50
 
51
  Interested in translating WP Super Cache to your language? See the [translation page](https://translate.wordpress.org/projects/wp-plugins/wp-super-cache) for the plugin.
52
 
54
 
55
  == Upgrade Notice ==
56
 
57
+ = 1.5.2 =
58
+ Fix loading the REST API code, finding the .htaccess file, mobile browsers using WP-Cache caching, and more..
59
 
60
  == Changelog ==
61
 
62
+ = 1.5.2 =
63
+ * Add a trailing slash to home path. Fixes problems with finding the .htaccess file.
64
+ * Delete WPCACHEHOME and WP_CACHE from wp-config.php when plugin deactivated.
65
+ * Check that WPCACHEHOME is the right path on each load of the settings page.
66
+ * Load the REST API code without using WPCACHEHOME.
67
+ * Fixed mobile browser caching when using WP-Cache caching.
68
+ * Fixed directory checks on Windows machines.
69
+ * Reverted CDN changes in 1.5.0 as they caused problems in older "WordPress in a separate directory" installs.
70
+ * Added note to CDN page when site url != home url. Site owners can use a filter to adjust the URL used.
71
+ * Stop preload quicker when requested while preloading taxonomies.
72
+ * Added more information for when updating the .htaccess file fails.
73
+ * "Served by" header is now optional. Enable it by setting $wpsc_served_header to true in the config file.
74
+
75
  = 1.5.1 =
76
  * Don't use anonymous functions in REST API
77
  * Check that REST API Controller is available before loading the REST API.
rest/class.wp-super-cache-rest-get-settings.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-settings-map.php';
4
 
5
  class WP_Super_Cache_Rest_Get_Settings extends WP_REST_Controller {
6
 
1
  <?php
2
 
3
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-settings-map.php' );
4
 
5
  class WP_Super_Cache_Rest_Get_Settings extends WP_REST_Controller {
6
 
rest/class.wp-super-cache-rest-update-settings.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-settings-map.php';
4
 
5
  class WP_Super_Cache_Rest_Update_Settings extends WP_REST_Controller {
6
 
1
  <?php
2
 
3
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-settings-map.php' );
4
 
5
  class WP_Super_Cache_Rest_Update_Settings extends WP_REST_Controller {
6
 
rest/load.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
 
3
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-rest-get-settings.php';
4
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-rest-update-settings.php';
5
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-rest-get-stats.php';
6
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-rest-get-cache.php';
7
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-rest-get-status.php';
8
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-rest-test-cache.php';
9
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-rest-delete-cache.php';
10
- require_once WPCACHEHOME . 'rest/class.wp-super-cache-rest-preload.php';
11
 
12
  class WP_Super_Cache_Router {
13
 
1
  <?php
2
 
3
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-rest-get-settings.php' );
4
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-rest-update-settings.php' );
5
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-rest-get-stats.php' );
6
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-rest-get-cache.php' );
7
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-rest-get-status.php' );
8
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-rest-test-cache.php' );
9
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-rest-delete-cache.php' );
10
+ require_once( dirname( __FILE__ ) . '/class.wp-super-cache-rest-preload.php' );
11
 
12
  class WP_Super_Cache_Router {
13
 
wp-cache-config-sample.php CHANGED
@@ -97,4 +97,5 @@ $wp_cache_preload_email_me = 0;
97
  $wp_cache_preload_email_volume = 'none';
98
  $wp_cache_mobile_prefixes = '';
99
  $cached_direct_pages = array();
 
100
  ?>
97
  $wp_cache_preload_email_volume = 'none';
98
  $wp_cache_mobile_prefixes = '';
99
  $cached_direct_pages = array();
100
+ $wpsc_served_header = false;
101
  ?>
wp-cache-phase1.php CHANGED
@@ -118,7 +118,7 @@ function get_wp_cache_key( $url = false ) {
118
  $url = $wp_cache_request_uri;
119
  }
120
  $server_port = isset( $_SERVER[ 'SERVER_PORT' ] ) ? intval( $_SERVER[ 'SERVER_PORT' ] ) : 0;
121
- return do_cacheaction( 'wp_cache_key', $WPSC_HTTP_HOST . $server_port . preg_replace('/#.*$/', '', str_replace( '/index.php', '/', $url ) ) . $wp_cache_gzip_encoding . wp_cache_get_cookies_values() );
122
  }
123
 
124
  function wp_super_cache_init() {
@@ -130,15 +130,15 @@ function wp_super_cache_init() {
130
 
131
  $cache_filename = $file_prefix . $key . '.php';
132
  $meta_file = $file_prefix . $key . '.php';
133
- $cache_file = realpath( $blog_cache_dir . $cache_filename );
134
- $meta_pathname = realpath( $blog_cache_dir . 'meta/' . $meta_file );
135
  return compact( 'key', 'cache_filename', 'meta_file', 'cache_file', 'meta_pathname' );
136
  }
137
 
138
  function wp_cache_serve_cache_file() {
139
  global $key, $blogcacheid, $wp_cache_request_uri, $file_prefix, $blog_cache_dir, $meta_file, $cache_file, $cache_filename, $meta_pathname, $wp_cache_gzip_encoding, $meta;
140
  global $wp_cache_object_cache, $cache_compression, $wp_cache_slash_check, $wp_supercache_304, $wp_cache_home_path, $wp_cache_no_cache_for_get;
141
- global $wp_cache_disable_utf8, $wp_cache_mfunc_enabled;
142
 
143
  if ( is_admin() ) {
144
  wp_cache_debug( 'Not serving wp-admin requests.', 5 );
@@ -255,14 +255,20 @@ function wp_cache_serve_cache_file() {
255
  header( "Cache-Control: max-age=3, must-revalidate" );
256
  $size = function_exists( 'mb_strlen' ) ? mb_strlen( $cachefiledata, '8bit' ) : strlen( $cachefiledata );
257
  if ( $wp_cache_gzip_encoding ) {
258
- header( "WP-Super-Cache: Served supercache gzip file from PHP" );
 
 
259
  header( 'Content-Encoding: ' . $wp_cache_gzip_encoding );
260
  header( 'Content-Length: ' . $size );
261
  } elseif ( $wp_supercache_304 ) {
262
- header( "WP-Super-Cache: Served supercache 304 file from PHP" );
 
 
263
  header( 'Content-Length: ' . $size );
264
  } else {
265
- header( "WP-Super-Cache: Served supercache file from PHP" );
 
 
266
  }
267
 
268
  // don't try to match modified dates if using dynamic code.
@@ -304,7 +310,9 @@ function wp_cache_serve_cache_file() {
304
  if( strpos( $header, 'Last-Modified:' ) === false )
305
  header($header);
306
  }
307
- header( 'WP-Super-Cache: Served WPCache cache file' );
 
 
308
  if ( $wp_cache_object_cache ) {
309
  if ( $cache ) {
310
  if ( $ungzip ) {
@@ -664,23 +672,51 @@ function wpsc_rebuild_files( $dir ) {
664
  return wpsc_delete_files( $dir, false );
665
  }
666
 
667
- function wpsc_delete_files( $dir, $delete = true ) {
 
 
 
 
 
 
 
 
 
 
 
668
  global $cache_path;
669
  static $rp_cache_path = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
670
  static $protected = '';
671
 
672
  // only do this once, this function will be called many times
673
- if ( $rp_cache_path == '' ) {
674
  $protected = array( $cache_path, $cache_path . "blogs/", $cache_path . 'supercache' );
675
  foreach( $protected as $id => $directory ) {
676
- $protected[ $id ] = trailingslashit( realpath( $directory ) );
677
  }
678
- $rp_cache_path = trailingslashit( realpath( $cache_path ) );
679
  }
680
 
681
- $dir = trailingslashit( realpath( $dir ) );
682
- if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path )
 
683
  return false;
 
684
 
685
  if ( in_array( $dir, $protected ) )
686
  return false;
@@ -704,10 +740,11 @@ function wpsc_delete_files( $dir, $delete = true ) {
704
  function get_all_supercache_filenames( $dir = '' ) {
705
  global $wp_cache_mobile_enabled, $cache_path;
706
 
707
- $dir = realpath( $dir );
708
- $rp_cache_path = realpath( $cache_path );
709
- if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path )
710
  return array();
 
711
 
712
  $filenames = array( 'index.html', 'index-https.html', 'index.html.php' );
713
 
@@ -814,16 +851,18 @@ function wp_supercache_cache_for_admins() {
814
  function wp_cache_confirm_delete( $dir ) {
815
  global $cache_path, $blog_cache_dir;
816
  // don't allow cache_path, blog cache dir, blog meta dir, supercache.
817
- $dir = realpath( $dir );
818
- $rp_cache_path = realpath( $cache_path );
819
- if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path )
820
  return false;
 
 
821
 
822
  if (
823
  $dir == $rp_cache_path ||
824
- $dir == realpath( $blog_cache_dir ) ||
825
- $dir == realpath( $blog_cache_dir . "meta/" ) ||
826
- $dir == realpath( $cache_path . "supercache" )
827
  ) {
828
  return false;
829
  } else {
118
  $url = $wp_cache_request_uri;
119
  }
120
  $server_port = isset( $_SERVER[ 'SERVER_PORT' ] ) ? intval( $_SERVER[ 'SERVER_PORT' ] ) : 0;
121
+ return do_cacheaction( 'wp_cache_key', wp_cache_check_mobile( $WPSC_HTTP_HOST . $server_port . preg_replace('/#.*$/', '', str_replace( '/index.php', '/', $url ) ) . $wp_cache_gzip_encoding . wp_cache_get_cookies_values() ) );
122
  }
123
 
124
  function wp_super_cache_init() {
130
 
131
  $cache_filename = $file_prefix . $key . '.php';
132
  $meta_file = $file_prefix . $key . '.php';
133
+ $cache_file = wpsc_get_realpath( $blog_cache_dir . $cache_filename );
134
+ $meta_pathname = wpsc_get_realpath( $blog_cache_dir . 'meta/' . $meta_file );
135
  return compact( 'key', 'cache_filename', 'meta_file', 'cache_file', 'meta_pathname' );
136
  }
137
 
138
  function wp_cache_serve_cache_file() {
139
  global $key, $blogcacheid, $wp_cache_request_uri, $file_prefix, $blog_cache_dir, $meta_file, $cache_file, $cache_filename, $meta_pathname, $wp_cache_gzip_encoding, $meta;
140
  global $wp_cache_object_cache, $cache_compression, $wp_cache_slash_check, $wp_supercache_304, $wp_cache_home_path, $wp_cache_no_cache_for_get;
141
+ global $wp_cache_disable_utf8, $wp_cache_mfunc_enabled, $wpsc_served_header;
142
 
143
  if ( is_admin() ) {
144
  wp_cache_debug( 'Not serving wp-admin requests.', 5 );
255
  header( "Cache-Control: max-age=3, must-revalidate" );
256
  $size = function_exists( 'mb_strlen' ) ? mb_strlen( $cachefiledata, '8bit' ) : strlen( $cachefiledata );
257
  if ( $wp_cache_gzip_encoding ) {
258
+ if ( isset( $wpsc_served_header ) && $wpsc_served_header ) {
259
+ header( "X-WP-Super-Cache: Served supercache gzip file from PHP" );
260
+ }
261
  header( 'Content-Encoding: ' . $wp_cache_gzip_encoding );
262
  header( 'Content-Length: ' . $size );
263
  } elseif ( $wp_supercache_304 ) {
264
+ if ( isset( $wpsc_served_header ) && $wpsc_served_header ) {
265
+ header( "X-WP-Super-Cache: Served supercache 304 file from PHP" );
266
+ }
267
  header( 'Content-Length: ' . $size );
268
  } else {
269
+ if ( isset( $wpsc_served_header ) && $wpsc_served_header ) {
270
+ header( "X-WP-Super-Cache: Served supercache file from PHP" );
271
+ }
272
  }
273
 
274
  // don't try to match modified dates if using dynamic code.
310
  if( strpos( $header, 'Last-Modified:' ) === false )
311
  header($header);
312
  }
313
+ if ( isset( $wpsc_served_header ) && $wpsc_served_header ) {
314
+ header( 'X-WP-Super-Cache: Served WPCache cache file' );
315
+ }
316
  if ( $wp_cache_object_cache ) {
317
  if ( $cache ) {
318
  if ( $ungzip ) {
672
  return wpsc_delete_files( $dir, false );
673
  }
674
 
675
+ // realpath() doesn't always remove the trailing slash
676
+ function wpsc_get_realpath( $directory ) {
677
+ $directory = realpath( $directory );
678
+ if ( substr( $directory, -1 ) == '/' || substr( $directory, -1 ) == '\\' ) {
679
+ $directory = substr( $directory, 0, -1 ); // remove trailing slash
680
+ }
681
+
682
+ return $directory;
683
+ }
684
+
685
+ // return true if directory is in the cache directory
686
+ function wpsc_is_in_cache_directory( $directory ) {
687
  global $cache_path;
688
  static $rp_cache_path = '';
689
+
690
+ if ( $rp_cache_path == '' ) {
691
+ $rp_cache_path = wpsc_get_realpath( $cache_path );
692
+ }
693
+
694
+ $directory = wpsc_get_realpath( $directory );
695
+
696
+ if ( substr( $directory, 0, strlen( $rp_cache_path ) ) == $rp_cache_path ) {
697
+ return true;
698
+ } else {
699
+ return false;
700
+ }
701
+ }
702
+
703
+ function wpsc_delete_files( $dir, $delete = true ) {
704
+ global $cache_path;
705
  static $protected = '';
706
 
707
  // only do this once, this function will be called many times
708
+ if ( $protected == '' ) {
709
  $protected = array( $cache_path, $cache_path . "blogs/", $cache_path . 'supercache' );
710
  foreach( $protected as $id => $directory ) {
711
+ $protected[ $id ] = trailingslashit( wpsc_get_realpath( $directory ) );
712
  }
 
713
  }
714
 
715
+ $dir = trailingslashit( wpsc_get_realpath( $dir ) );
716
+
717
+ if ( ! wpsc_is_in_cache_directory( $dir ) ) {
718
  return false;
719
+ }
720
 
721
  if ( in_array( $dir, $protected ) )
722
  return false;
740
  function get_all_supercache_filenames( $dir = '' ) {
741
  global $wp_cache_mobile_enabled, $cache_path;
742
 
743
+ $dir = wpsc_get_realpath( $dir );
744
+
745
+ if ( ! wpsc_is_in_cache_directory( $dir ) ) {
746
  return array();
747
+ }
748
 
749
  $filenames = array( 'index.html', 'index-https.html', 'index.html.php' );
750
 
851
  function wp_cache_confirm_delete( $dir ) {
852
  global $cache_path, $blog_cache_dir;
853
  // don't allow cache_path, blog cache dir, blog meta dir, supercache.
854
+ $dir = wpsc_get_realpath( $dir );
855
+ $rp_cache_path = wpsc_get_realpath( $cache_path );
856
+ if ( ! wpsc_is_in_cache_directory( $dir ) ) {
857
  return false;
858
+ }
859
+
860
 
861
  if (
862
  $dir == $rp_cache_path ||
863
+ $dir == wpsc_get_realpath( $blog_cache_dir ) ||
864
+ $dir == wpsc_get_realpath( $blog_cache_dir . "meta/" ) ||
865
+ $dir == wpsc_get_realpath( $cache_path . "supercache" )
866
  ) {
867
  return false;
868
  } else {
wp-cache-phase2.php CHANGED
@@ -81,7 +81,7 @@ function wpcache_do_rebuild( $dir ) {
81
  return false;
82
  }
83
 
84
- $dir = trailingslashit( realpath( $dir ) );
85
 
86
  if ( isset( $do_rebuild_list[ $dir ] ) ) {
87
  wp_cache_debug( "wpcache_do_rebuild: directory already rebuilt: $dir" );
@@ -90,11 +90,10 @@ function wpcache_do_rebuild( $dir ) {
90
 
91
  $protected = wpsc_get_protected_directories();
92
  foreach( $protected as $id => $directory ) {
93
- $protected[ $id ] = trailingslashit( realpath( $directory ) );
94
  }
95
- $rp_cache_path = trailingslashit( realpath( $cache_path ) );
96
 
97
- if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path ) {
98
  wp_cache_debug( "wpcache_do_rebuild: exiting as directory not in cache_path: $dir" );
99
  return false;
100
  }
@@ -115,6 +114,7 @@ function wpcache_do_rebuild( $dir ) {
115
  return false;
116
  }
117
 
 
118
  $wpsc_file_mtimes = array();
119
  while ( ( $file = readdir( $dh ) ) !== false ) {
120
  if ( $file == '.' || $file == '..' || false == is_file( $dir . $file ) ) {
@@ -645,9 +645,8 @@ function wp_cache_get_ob(&$buffer) {
645
 
646
  if( @is_dir( $dir ) == false )
647
  @wp_mkdir_p( $dir );
648
- $dir = realpath( $dir ) . '/';
649
- $rp_cache_path = realpath( $cache_path );
650
- if ( substr( $dir, 0, strlen( $rp_cache_path ) ) != $rp_cache_path ) {
651
  wp_cache_debug( "wp_cache_get_ob: not caching as directory is not in cache_path: $dir" );
652
  return $buffer;
653
  }
@@ -877,20 +876,15 @@ function wp_cache_phase2_clean_cache($file_prefix) {
877
  function prune_super_cache( $directory, $force = false, $rename = false ) {
878
  global $cache_max_time, $cache_path, $blog_cache_dir;
879
  static $log = 0;
880
- static $rp_cache_path = '';
881
  static $protected_directories = '';
882
 
883
- if ( $rp_cache_path == '' ) {
884
- $rp_cache_path = trailingslashit( realpath( $cache_path ) );
885
- }
886
-
887
  $dir = $directory;
888
- $directory = realpath( $directory );
889
  if ( $directory == '' ) {
890
  wp_cache_debug( "prune_super_cache: exiting as file/directory does not exist : $dir" );
891
  return false;
892
  }
893
- if ( substr( $directory, 0, strlen( $rp_cache_path ) ) != $rp_cache_path ) {
894
  wp_cache_debug( "prune_super_cache: exiting as directory is not in cache path: *$directory* (was $dir before realpath)" );
895
  return false;
896
  }
@@ -971,25 +965,21 @@ function prune_super_cache( $directory, $force = false, $rename = false ) {
971
 
972
  function wp_cache_rebuild_or_delete( $file ) {
973
  global $cache_rebuild_files, $cache_path, $file_prefix;
974
- static $rp_cache_path = '';
975
 
976
- if ( $rp_cache_path == '' ) {
977
- $rp_cache_path = trailingslashit( realpath( $cache_path ) );
978
- }
979
 
980
  if ( strpos( $file, '?' ) !== false )
981
  $file = substr( $file, 0, strpos( $file, '?' ) );
982
 
983
- $file = realpath( $file );
984
 
985
- if ( substr( $file, 0, strlen( $rp_cache_path ) ) != $rp_cache_path ) {
986
  wp_cache_debug( "rebuild_or_gc quitting because file is not in cache_path: $file" );
987
  return false;
988
  }
989
 
990
  $protected = wpsc_get_protected_directories();
991
  foreach( $protected as $id => $directory ) {
992
- $protected[ $id ] = trailingslashit( realpath( $directory ) );
993
  }
994
 
995
  if ( in_array( $file, $protected ) ) {
81
  return false;
82
  }
83
 
84
+ $dir = wpsc_get_realpath( $dir );
85
 
86
  if ( isset( $do_rebuild_list[ $dir ] ) ) {
87
  wp_cache_debug( "wpcache_do_rebuild: directory already rebuilt: $dir" );
90
 
91
  $protected = wpsc_get_protected_directories();
92
  foreach( $protected as $id => $directory ) {
93
+ $protected[ $id ] = wpsc_get_realpath( $directory );
94
  }
 
95
 
96
+ if ( ! wpsc_is_in_cache_directory( $dir ) ) {
97
  wp_cache_debug( "wpcache_do_rebuild: exiting as directory not in cache_path: $dir" );
98
  return false;
99
  }
114
  return false;
115
  }
116
 
117
+ $dir = trailingslashit( $dir );
118
  $wpsc_file_mtimes = array();
119
  while ( ( $file = readdir( $dh ) ) !== false ) {
120
  if ( $file == '.' || $file == '..' || false == is_file( $dir . $file ) ) {
645
 
646
  if( @is_dir( $dir ) == false )
647
  @wp_mkdir_p( $dir );
648
+ $dir = trailingslashit( wpsc_get_realpath( $dir ) );
649
+ if ( ! wpsc_is_in_cache_directory( $dir ) ) {
 
650
  wp_cache_debug( "wp_cache_get_ob: not caching as directory is not in cache_path: $dir" );
651
  return $buffer;
652
  }
876
  function prune_super_cache( $directory, $force = false, $rename = false ) {
877
  global $cache_max_time, $cache_path, $blog_cache_dir;
878
  static $log = 0;
 
879
  static $protected_directories = '';
880
 
 
 
 
 
881
  $dir = $directory;
882
+ $directory = wpsc_get_realpath( $directory );
883
  if ( $directory == '' ) {
884
  wp_cache_debug( "prune_super_cache: exiting as file/directory does not exist : $dir" );
885
  return false;
886
  }
887
+ if ( ! wpsc_is_in_cache_directory( $directory ) ) {
888
  wp_cache_debug( "prune_super_cache: exiting as directory is not in cache path: *$directory* (was $dir before realpath)" );
889
  return false;
890
  }
965
 
966
  function wp_cache_rebuild_or_delete( $file ) {
967
  global $cache_rebuild_files, $cache_path, $file_prefix;
 
968
 
 
 
 
969
 
970
  if ( strpos( $file, '?' ) !== false )
971
  $file = substr( $file, 0, strpos( $file, '?' ) );
972
 
973
+ $file = wpsc_get_realpath( $file );
974
 
975
+ if ( ! wpsc_is_in_cache_directory( $file ) ) {
976
  wp_cache_debug( "rebuild_or_gc quitting because file is not in cache_path: $file" );
977
  return false;
978
  }
979
 
980
  $protected = wpsc_get_protected_directories();
981
  foreach( $protected as $id => $directory ) {
982
+ $protected[ $id ] = wpsc_get_realpath( $directory );
983
  }
984
 
985
  if ( in_array( $file, $protected ) ) {
wp-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Super Cache
4
  Plugin URI: https://wordpress.org/plugins/wp-super-cache/
5
  Description: Very fast caching plugin for WordPress.
6
- Version: 1.5.1
7
  Author: Automattic
8
  Author URI: https://automattic.com/
9
  License: GPL2+
@@ -28,26 +28,39 @@ Text Domain: wp-super-cache
28
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
  */
30
 
31
- // Pre-2.6 compatibility
32
- if( !defined('WP_CONTENT_URL') )
33
- define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
34
- if( !defined('WP_CONTENT_DIR') )
35
- define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
36
-
37
- $wp_cache_config_file = WP_CONTENT_DIR . '/wp-cache-config.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
- if ( !defined( 'WPCACHEHOME' ) ) {
40
- define( 'WPCACHEHOME', dirname( __FILE__ ) . '/' );
41
- $wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
42
- $wp_cache_file = WPCACHEHOME . 'advanced-cache.php';
43
- } elseif ( WPCACHEHOME != dirname( __FILE__ ) . '/' ) {
44
- $wp_cache_config_file_sample = dirname( __FILE__ ) . '/wp-cache-config-sample.php';
45
- $wp_cache_file = dirname( __FILE__ ) . '/advanced-cache.php';
46
- } else {
47
- $wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
48
- $wp_cache_file = WPCACHEHOME . 'advanced-cache.php';
49
  }
50
 
 
 
51
  if( !@include($wp_cache_config_file) ) {
52
  get_wpcachehome();
53
  $wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
@@ -56,15 +69,9 @@ if( !@include($wp_cache_config_file) ) {
56
  get_wpcachehome();
57
  }
58
 
59
- $wp_cache_link = WP_CONTENT_DIR . '/advanced-cache.php';
60
-
61
- if( !defined( 'WP_CACHE' ) || ( defined( 'WP_CACHE' ) && constant( 'WP_CACHE' ) == false ) ) {
62
- $wp_cache_check_wp_config = true;
63
- }
64
-
65
  include(WPCACHEHOME . 'wp-cache-base.php');
66
  if ( class_exists( 'WP_REST_Controller' ) ) {
67
- include( WPCACHEHOME . 'rest/load.php' );
68
  }
69
 
70
  function wp_super_cache_text_domain() {
@@ -162,6 +169,23 @@ function wpsupercache_deactivate() {
162
  register_deactivation_hook( __FILE__, 'wpsupercache_deactivate' );
163
 
164
  function wpsupercache_activate() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  wp_schedule_single_event( time() + 10, 'wp_cache_add_site_cache_index' );
166
  }
167
  register_activation_hook( __FILE__, 'wpsupercache_activate' );
@@ -579,7 +603,7 @@ function wp_cache_manager_updates() {
579
  $super_cache_enabled = false;
580
  }
581
 
582
- if ( $_POST[ 'wp_cache_mod_rewrite' ] == 1 ) {
583
  $wp_cache_mod_rewrite = 1;
584
  add_mod_rewrite_rules();
585
  } else {
@@ -1126,6 +1150,7 @@ table.wpsc-settings-table {
1126
  if ( $cache_enabled ) {
1127
  echo "<h3>" . __( 'Cache Tester', 'wp-super-cache' ) . "</h3>";
1128
  echo '<p>' . __( 'Test your cached website by clicking the test button below.', 'wp-super-cache' ) . '</p>';
 
1129
  if ( array_key_exists('action', $_POST) && $_POST[ 'action' ] == 'test' && $valid_nonce ) {
1130
  $url = trailingslashit( get_bloginfo( 'url' ) );
1131
  if ( isset( $_POST[ 'httponly' ] ) )
@@ -1347,15 +1372,15 @@ function wsc_mod_rewrite() {
1347
  wpsc_update_htaccess_form();
1348
  }
1349
  } elseif ( $valid_nonce && isset( $_POST[ 'updatehtaccess' ] ) ) {
1350
- echo "<div style='padding:0 8px;color:#4f8a10;background-color:#dff2bf;border:1px solid #4f8a10;'>";
1351
  if ( add_mod_rewrite_rules() ) {
1352
  echo "<h4>" . __( 'Mod Rewrite rules updated!', 'wp-super-cache' ) . "</h4>";
1353
  echo "<p><strong>" . sprintf( __( '%s.htaccess has been updated with the necessary mod_rewrite rules. Please verify they are correct. They should look like this:', 'wp-super-cache' ), $home_path ) . "</strong></p>\n";
1354
  } else {
1355
  global $update_mod_rewrite_rules_error;
1356
  echo "<h4>" . __( 'Mod Rewrite rules must be updated!', 'wp-super-cache' ) . "</h4>";
1357
- echo "<p><strong>" . sprintf( __( 'The plugin could not update %1$s.htaccess file: %2$s. The new rules go above the regular WordPress rules as shown in the code below:', 'wp-super-cache' ), $home_path, $update_mod_rewrite_rules_error ) . "</strong></p>\n";
1358
  }
 
1359
  echo "<p><pre>" . esc_html( $rules ) . "</pre></p>\n</div>";
1360
  } else {
1361
  ?>
@@ -2169,9 +2194,9 @@ function wp_cache_replace_line($old, $new, $my_file) {
2169
  if ($found) {
2170
  $fd = fopen($my_file, 'w');
2171
  foreach( (array)$lines as $line ) {
2172
- if ( !preg_match("/$old/", $line))
2173
  fputs($fd, $line);
2174
- else {
2175
  fputs($fd, "$new //Added by WP-Cache Manager\n");
2176
  }
2177
  }
@@ -3140,19 +3165,23 @@ function wpsc_update_htaccess_form( $short_form = true ) {
3140
  echo "<p><pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p></div>";
3141
  } else {
3142
  if ( $short_form == false ) {
3143
- echo "<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><p>" . sprintf( __( 'To serve static html files your server must have the correct mod_rewrite rules added to a file called <code>%s.htaccess</code>', 'wp-super-cache' ), $home_path ) . " ";
3144
  _e( "You can edit the file yourself. Add the following rules.", 'wp-super-cache' );
3145
  echo __( " Make sure they appear before any existing WordPress rules. ", 'wp-super-cache' ) . "</p>";
 
3146
  echo "<pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p>";
3147
- echo "<p>" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "</p>";
 
 
3148
  echo "<pre># BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache</pre></p>";
 
3149
  }
3150
  if ( !isset( $wpmu_version ) || $wpmu_version == '' ) {
3151
  echo '<form name="updatehtaccess" action="#modrewrite" method="post">';
3152
  echo '<input type="hidden" name="updatehtaccess" value="1" />';
3153
  echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'id="updatehtaccess" value="' . __( 'Update Mod_Rewrite Rules', 'wp-super-cache' ) . '" /></div>';
3154
  wp_nonce_field('wp-cache');
3155
- echo "</form></div>\n";
3156
  }
3157
  }
3158
  }
@@ -3210,6 +3239,8 @@ function wpsc_get_htaccess_info() {
3210
  ) {
3211
  $home_path = str_replace( '//', '/', $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root );
3212
  }
 
 
3213
  $home_root_lc = str_replace( '//', '/', strtolower( $home_root ) );
3214
  $inst_root = str_replace( '//', '/', '/' . trailingslashit( str_replace( $content_dir_root, '', str_replace( '\\', '/', WP_CONTENT_DIR ) ) ) );
3215
  $wprules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WordPress' ) );
@@ -3379,6 +3410,16 @@ function wp_cron_preload_cache() {
3379
  wp_remote_get( $url, array('timeout' => 60, 'blocking' => true ) );
3380
  wp_cache_debug( "wp_cron_preload_cache: fetched $url", 5 );
3381
  sleep( 1 );
 
 
 
 
 
 
 
 
 
 
3382
  }
3383
  $fp = fopen( $taxonomy_filename, 'w' );
3384
  if ( $fp ) {
@@ -3519,8 +3560,13 @@ function wp_cache_disable_plugin( $delete_config_file = true ) {
3519
  $global_config_file = dirname(ABSPATH) . '/wp-config.php';
3520
  }
3521
  $line = 'define(\'WP_CACHE\', true);';
3522
- if ( strpos( file_get_contents( $global_config_file ), $line ) && ( !is_writeable_ACLSafe( $global_config_file ) || !wp_cache_replace_line( 'define *\( *\'WP_CACHE\'', '//' . $line, $global_config_file ) ) )
3523
  wp_die( "Could not remove WP_CACHE define from $global_config_file. Please edit that file and remove the line containing the text 'WP_CACHE'. Then refresh this page." );
 
 
 
 
 
3524
 
3525
  uninstall_supercache( WP_CONTENT_DIR . '/cache' );
3526
  $file_not_deleted = false;
@@ -3781,6 +3827,7 @@ function update_mod_rewrite_rules( $add_rules = true ) {
3781
  ) {
3782
  $home_path = str_replace( '//', '/', $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root );
3783
  }
 
3784
 
3785
  if ( ! file_exists( $home_path . ".htaccess" ) ) {
3786
  $update_mod_rewrite_rules_error = ".htaccess not found: {$home_path}.htaccess";
@@ -3825,10 +3872,31 @@ function update_mod_rewrite_rules( $add_rules = true ) {
3825
  wpsc_remove_marker( $home_path . '.htaccess', 'WordPress' ); // remove original WP rules so SuperCache rules go on top
3826
  if ( insert_with_markers( $home_path . '.htaccess', 'WPSuperCache', explode( "\n", $rules ) ) && insert_with_markers( $home_path . '.htaccess', 'WordPress', $wprules ) ) {
3827
  $new_page = wp_remote_get( $url, array( 'timeout' => 60, 'blocking' => true ) );
3828
- if ( is_wp_error( $new_page ) || $new_page[ 'body' ] != $original_page[ 'body' ] ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3829
  file_put_contents( $home_path . '.htaccess', $backup_file_contents );
3830
  unlink( $backup_filename );
3831
- $update_mod_rewrite_rules_error = "page error or pages do not match and original .htaccess restored";
 
 
 
 
 
3832
  return false;
3833
  }
3834
  } else {
3
  Plugin Name: WP Super Cache
4
  Plugin URI: https://wordpress.org/plugins/wp-super-cache/
5
  Description: Very fast caching plugin for WordPress.
6
+ Version: 1.5.2
7
  Author: Automattic
8
  Author URI: https://automattic.com/
9
  License: GPL2+
28
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
  */
30
 
31
+ function wpsc_init() {
32
+ global $wp_cache_config_file, $wp_cache_config_file_sample, $wp_cache_file, $wp_cache_check_wp_config, $wp_cache_link;
33
+ // Pre-2.6 compatibility
34
+ if ( !defined('WP_CONTENT_URL') )
35
+ define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content');
36
+ if ( !defined('WP_CONTENT_DIR') )
37
+ define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
38
+
39
+ $wp_cache_config_file = WP_CONTENT_DIR . '/wp-cache-config.php';
40
+
41
+ if ( !defined( 'WPCACHEHOME' ) ) {
42
+ define( 'WPCACHEHOME', dirname( __FILE__ ) . '/' );
43
+ $wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
44
+ $wp_cache_file = WPCACHEHOME . 'advanced-cache.php';
45
+ } elseif ( WPCACHEHOME != dirname( __FILE__ ) . '/' ) {
46
+ $wp_cache_config_file_sample = dirname( __FILE__ ) . '/wp-cache-config-sample.php';
47
+ $wp_cache_file = dirname( __FILE__ ) . '/advanced-cache.php';
48
+ if ( ! defined( 'ADVANCEDCACHEPROBLEM' ) ) {
49
+ define( 'ADVANCEDCACHEPROBLEM', 1 ); // force an update of WPCACHEHOME
50
+ }
51
+ } else {
52
+ $wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
53
+ $wp_cache_file = WPCACHEHOME . 'advanced-cache.php';
54
+ }
55
+ $wp_cache_link = WP_CONTENT_DIR . '/advanced-cache.php';
56
 
57
+ if ( !defined( 'WP_CACHE' ) || ( defined( 'WP_CACHE' ) && constant( 'WP_CACHE' ) == false ) ) {
58
+ $wp_cache_check_wp_config = true;
59
+ }
 
 
 
 
 
 
 
60
  }
61
 
62
+ wpsc_init();
63
+
64
  if( !@include($wp_cache_config_file) ) {
65
  get_wpcachehome();
66
  $wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
69
  get_wpcachehome();
70
  }
71
 
 
 
 
 
 
 
72
  include(WPCACHEHOME . 'wp-cache-base.php');
73
  if ( class_exists( 'WP_REST_Controller' ) ) {
74
+ include( dirname( __FILE__ ) . '/rest/load.php' );
75
  }
76
 
77
  function wp_super_cache_text_domain() {
169
  register_deactivation_hook( __FILE__, 'wpsupercache_deactivate' );
170
 
171
  function wpsupercache_activate() {
172
+ global $cache_path;
173
+ if ( ! isset( $cache_path ) || $cache_path == '' )
174
+ $cache_path = WP_CONTENT_DIR . '/cache/'; // from sample config file
175
+
176
+ ob_start();
177
+ wpsc_init();
178
+
179
+ if ( !wp_cache_check_link() ||
180
+ !wp_cache_verify_config_file() ||
181
+ !wp_cache_verify_cache_dir() ) {
182
+ $text = ob_get_contents();
183
+ ob_end_clean();
184
+ return false;
185
+ }
186
+ $text = ob_get_contents();
187
+ wp_cache_check_global_config();
188
+ ob_end_clean();
189
  wp_schedule_single_event( time() + 10, 'wp_cache_add_site_cache_index' );
190
  }
191
  register_activation_hook( __FILE__, 'wpsupercache_activate' );
603
  $super_cache_enabled = false;
604
  }
605
 
606
+ if ( isset( $_POST[ 'wp_cache_mod_rewrite' ] ) && $_POST[ 'wp_cache_mod_rewrite' ] == 1 ) {
607
  $wp_cache_mod_rewrite = 1;
608
  add_mod_rewrite_rules();
609
  } else {
1150
  if ( $cache_enabled ) {
1151
  echo "<h3>" . __( 'Cache Tester', 'wp-super-cache' ) . "</h3>";
1152
  echo '<p>' . __( 'Test your cached website by clicking the test button below.', 'wp-super-cache' ) . '</p>';
1153
+ echo '<p>' . __( 'Note: if you use Cloudflare or other transparent front-end proxy service this test may fail.<ol><li> If you have Cloudflare minification enabled this plugin may detect differences in the pages and report an error.</li><li> Try using the development mode of Cloudflare to perform the test. You can disable development mode afterwards if the test succeeds.</li></ol>', 'wp-super-cache' ) . '</p>';
1154
  if ( array_key_exists('action', $_POST) && $_POST[ 'action' ] == 'test' && $valid_nonce ) {
1155
  $url = trailingslashit( get_bloginfo( 'url' ) );
1156
  if ( isset( $_POST[ 'httponly' ] ) )
1372
  wpsc_update_htaccess_form();
1373
  }
1374
  } elseif ( $valid_nonce && isset( $_POST[ 'updatehtaccess' ] ) ) {
 
1375
  if ( add_mod_rewrite_rules() ) {
1376
  echo "<h4>" . __( 'Mod Rewrite rules updated!', 'wp-super-cache' ) . "</h4>";
1377
  echo "<p><strong>" . sprintf( __( '%s.htaccess has been updated with the necessary mod_rewrite rules. Please verify they are correct. They should look like this:', 'wp-super-cache' ), $home_path ) . "</strong></p>\n";
1378
  } else {
1379
  global $update_mod_rewrite_rules_error;
1380
  echo "<h4>" . __( 'Mod Rewrite rules must be updated!', 'wp-super-cache' ) . "</h4>";
1381
+ echo "<p>" . sprintf( __( 'The plugin could not update %1$s.htaccess file: %2$s.<br /> The new rules go above the regular WordPress rules as shown in the code below:', 'wp-super-cache' ), $home_path, "<strong>" . $update_mod_rewrite_rules_error . "</strong>" ) . "</p>\n";
1382
  }
1383
+ echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#4f8a10;background-color:#dff2bf;border:1px solid #4f8a10;'>";
1384
  echo "<p><pre>" . esc_html( $rules ) . "</pre></p>\n</div>";
1385
  } else {
1386
  ?>
2194
  if ($found) {
2195
  $fd = fopen($my_file, 'w');
2196
  foreach( (array)$lines as $line ) {
2197
+ if ( !preg_match( "/$old/", $line ) ) {
2198
  fputs($fd, $line);
2199
+ } elseif ( $new != '' ) {
2200
  fputs($fd, "$new //Added by WP-Cache Manager\n");
2201
  }
2202
  }
3165
  echo "<p><pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p></div>";
3166
  } else {
3167
  if ( $short_form == false ) {
3168
+ echo "<p>" . sprintf( __( 'To serve static html files your server must have the correct mod_rewrite rules added to a file called <code>%s.htaccess</code>', 'wp-super-cache' ), $home_path ) . " ";
3169
  _e( "You can edit the file yourself. Add the following rules.", 'wp-super-cache' );
3170
  echo __( " Make sure they appear before any existing WordPress rules. ", 'wp-super-cache' ) . "</p>";
3171
+ echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>";
3172
  echo "<pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p>";
3173
+ echo "</div>";
3174
+ echo "<h4>" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "</h4>";
3175
+ echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>";
3176
  echo "<pre># BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache</pre></p>";
3177
+ echo "</div>";
3178
  }
3179
  if ( !isset( $wpmu_version ) || $wpmu_version == '' ) {
3180
  echo '<form name="updatehtaccess" action="#modrewrite" method="post">';
3181
  echo '<input type="hidden" name="updatehtaccess" value="1" />';
3182
  echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'id="updatehtaccess" value="' . __( 'Update Mod_Rewrite Rules', 'wp-super-cache' ) . '" /></div>';
3183
  wp_nonce_field('wp-cache');
3184
+ echo "</form>\n";
3185
  }
3186
  }
3187
  }
3239
  ) {
3240
  $home_path = str_replace( '//', '/', $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root );
3241
  }
3242
+
3243
+ $home_path = trailingslashit( $home_path );
3244
  $home_root_lc = str_replace( '//', '/', strtolower( $home_root ) );
3245
  $inst_root = str_replace( '//', '/', '/' . trailingslashit( str_replace( $content_dir_root, '', str_replace( '\\', '/', WP_CONTENT_DIR ) ) ) );
3246
  $wprules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WordPress' ) );
3410
  wp_remote_get( $url, array('timeout' => 60, 'blocking' => true ) );
3411
  wp_cache_debug( "wp_cron_preload_cache: fetched $url", 5 );
3412
  sleep( 1 );
3413
+ if ( @file_exists( $cache_path . "stop_preload.txt" ) ) {
3414
+ wp_cache_debug( "wp_cron_preload_cache: cancelling preload. stop_preload.txt found.", 5 );
3415
+ @unlink( $mutex );
3416
+ @unlink( $cache_path . "stop_preload.txt" );
3417
+ @unlink( $taxonomy_filename );
3418
+ update_option( 'preload_cache_counter', array( 'c' => 0, 't' => time() ) );
3419
+ if ( $wp_cache_preload_email_me )
3420
+ wp_mail( get_option( 'admin_email' ), sprintf( __( '[%1$s] Cache Preload Stopped', 'wp-super-cache' ), home_url(), '' ), ' ' );
3421
+ return true;
3422
+ }
3423
  }
3424
  $fp = fopen( $taxonomy_filename, 'w' );
3425
  if ( $fp ) {
3560
  $global_config_file = dirname(ABSPATH) . '/wp-config.php';
3561
  }
3562
  $line = 'define(\'WP_CACHE\', true);';
3563
+ if ( strpos( file_get_contents( $global_config_file ), $line ) && ( !is_writeable_ACLSafe( $global_config_file ) || !wp_cache_replace_line( 'define *\( *\'WP_CACHE\'', '', $global_config_file ) ) ) {
3564
  wp_die( "Could not remove WP_CACHE define from $global_config_file. Please edit that file and remove the line containing the text 'WP_CACHE'. Then refresh this page." );
3565
+ }
3566
+ $line = 'define( \'WPCACHEHOME\',';
3567
+ if ( strpos( file_get_contents( $global_config_file ), $line ) && ( !is_writeable_ACLSafe( $global_config_file ) || !wp_cache_replace_line( 'define *\( *\'WPCACHEHOME\'', '', $global_config_file ) ) ) {
3568
+ wp_die( "Could not remove WPCACHEHOME define from $global_config_file. Please edit that file and remove the line containing the text 'WPCACHEHOME'. Then refresh this page." );
3569
+ }
3570
 
3571
  uninstall_supercache( WP_CONTENT_DIR . '/cache' );
3572
  $file_not_deleted = false;
3827
  ) {
3828
  $home_path = str_replace( '//', '/', $_SERVER[ 'DOCUMENT_ROOT' ] . $home_root );
3829
  }
3830
+ $home_path = trailingslashit( $home_path );
3831
 
3832
  if ( ! file_exists( $home_path . ".htaccess" ) ) {
3833
  $update_mod_rewrite_rules_error = ".htaccess not found: {$home_path}.htaccess";
3872
  wpsc_remove_marker( $home_path . '.htaccess', 'WordPress' ); // remove original WP rules so SuperCache rules go on top
3873
  if ( insert_with_markers( $home_path . '.htaccess', 'WPSuperCache', explode( "\n", $rules ) ) && insert_with_markers( $home_path . '.htaccess', 'WordPress', $wprules ) ) {
3874
  $new_page = wp_remote_get( $url, array( 'timeout' => 60, 'blocking' => true ) );
3875
+ $restore_backup = false;
3876
+ if ( is_wp_error( $new_page ) ) {
3877
+ $restore_backup = true;
3878
+ $update_mod_rewrite_rules_error = "Error testing page with new .htaccess rules: " . $new_page->get_error_message() . ".";
3879
+ wp_cache_debug( 'update_mod_rewrite_rules: failed to update rules. error fetching second page: ' . $new_page->get_error_message() );
3880
+ } elseif ( $new_page[ 'body' ] != $original_page[ 'body' ] ) {
3881
+ $restore_backup = true;
3882
+ $update_mod_rewrite_rules_error = "Page test failed as pages did not match with new .htaccess rules.";
3883
+ wp_cache_debug( 'update_mod_rewrite_rules: failed to update rules. page test failed as pages did not match. Files dumped in ' . $cache_path . ' for inspection.' );
3884
+ wp_cache_debug( 'update_mod_rewrite_rules: original page: 1-' . md5( $original_page[ 'body' ] ) . '.txt' );
3885
+ wp_cache_debug( 'update_mod_rewrite_rules: new page: 1-' . md5( $new_page[ 'body' ] ) . '.txt' );
3886
+ file_put_contents( $cache_path . '1-' . md5( $original_page[ 'body' ] ) . '.txt', $original_page[ 'body' ] );
3887
+ file_put_contents( $cache_path . '2-' . md5( $new_page[ 'body' ] ) . '.txt', $new_page[ 'body' ] );
3888
+ }
3889
+
3890
+ if ( $restore_backup ) {
3891
+ global $wp_cache_debug;
3892
  file_put_contents( $home_path . '.htaccess', $backup_file_contents );
3893
  unlink( $backup_filename );
3894
+ if ( $wp_cache_debug ) {
3895
+ $update_mod_rewrite_rules_error .= "<br />See debug log for further details";
3896
+ } else {
3897
+ $update_mod_rewrite_rules_error .= "<br />Enable debug log on Debugging page for further details and try again";
3898
+ }
3899
+
3900
  return false;
3901
  }
3902
  } else {