Make WordPress Core

Opened 19 years ago

Closed 19 years ago

Last modified 8 years ago

#2799 closed defect (bug) (fixed)

Cache 'dynamic' Javascript

Reported by: mdawaffe's profile mdawaffe Owned by: mdawaffe's profile mdawaffe
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.1
Component: Administration Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

The PHP generated Javascript files are not being cached properly.

Attached:

  1. Call wp-config.php instead of admin.php to avoid cache blocking and unnecessary overhead.
  2. Send Cache-control: max-age=2600000, must-revalidate

These scripts only need the PHP for i18n (if that), so the ~1 month long freshness period shouldn't hurt.

Attachments (2)

2799.diff (1.8 KB) - added by mdawaffe 19 years ago.
2799b.diff (2.2 KB) - added by mdawaffe 19 years ago.

Download all attachments as: .zip

Change History (6)

@mdawaffe
19 years ago

#1 @markjaquith
19 years ago

require_once('../wp-config.php');
header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true);
header('Cache-control: max-age=2600000, must-revalidate', true);  // ~1 month

I see those three lines listed three times, and there will probably be other times as we add more JS functionality in the future. Wanna move that to an include so that there's one place to go to edit it all?

@mdawaffe
19 years ago

#2 @mdawaffe
19 years ago

Well if you'd like to be clever about it, sure :)

2799b.diff

  1. wp-includes/js/js-headers.php gets the include right and sends the headers.

#3 @ryan
19 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4109]) cache_javascript_headers() from masquerade. fixes #3059 #2799

This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.


8 years ago

Note: See TracTickets for help on using tickets.