[wp-hackers] Caching fixes
Kimmo Suominen
kim at tac.nyc.ny.us
Sat Nov 27 06:16:23 UTC 2004
Hi!
It would be great to see the couple of changes in the patch below applied
to the CVS repo. They help to avoid copies of the login and admin pages
from being cached. It is especially disturbing when you click "Save" twice
in a row, and end up saving an old version of an article you just spent
half an hour typing in... :-)
Also available at:
ftp://ftp.gw.com/pub/people/kim/patches/wordpress/no-cache.diff
Regards,
+ Kim
--
<A HREF="http://kimmo.suominen.com/">Kimmo Suominen</A>
Index: wp-comments-post.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-comments-post.php,v
retrieving revision 1.19
diff -u -r1.19 wp-comments-post.php
--- wp-comments-post.php 11 Oct 2004 22:07:09 -0000 1.19
+++ wp-comments-post.php 27 Nov 2004 05:43:54 -0000
@@ -93,7 +93,7 @@
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
-header('Cache-Control: no-cache, must-revalidate');
+header('Cache-Control: no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
$location = get_permalink($comment_post_ID);
Index: wp-login.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-login.php,v
retrieving revision 1.43
diff -u -r1.43 wp-login.php
--- wp-login.php 13 Oct 2004 02:21:36 -0000 1.43
+++ wp-login.php 27 Nov 2004 05:43:54 -0000
@@ -54,6 +54,8 @@
setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH);
setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH);
+ header('Cache-Control: no-cache, must-revalidate, max-age=0');
+ header('Pragma: no-cache');
if ($is_IIS)
header('Refresh: 0;url=wp-login.php');
Index: wp-admin/admin-header.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/admin-header.php,v
retrieving revision 1.35
diff -u -r1.35 admin-header.php
--- wp-admin/admin-header.php 28 Oct 2004 04:03:56 -0000 1.35
+++ wp-admin/admin-header.php 27 Nov 2004 05:43:54 -0000
@@ -1,4 +1,6 @@
<?php require_once('admin.php'); ?>
+<?php header('Cache-Control: no-cache, must-revalidate, max-age=0'); ?>
+<?php header('Pragma: no-cache'); ?>
<?php get_admin_page_title(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Index: wp-admin/auth.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/auth.php,v
retrieving revision 1.15
diff -u -r1.15 auth.php
--- wp-admin/auth.php 18 Oct 2004 04:50:07 -0000 1.15
+++ wp-admin/auth.php 27 Nov 2004 05:43:54 -0000
@@ -5,7 +5,7 @@
|| (empty($_COOKIE['wordpressuser_' . COOKIEHASH])) ) {
header('Expires: Wed, 5 Jun 1979 23:41:00 GMT'); // Michel's birthday
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- header('Cache-Control: no-cache, must-revalidate');
+ header('Cache-Control: no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
More information about the hackers
mailing list