The branch, master has been updated
via aed2e27b3f814c90350be72ec95d5d72e9063057 (commit)
from 2ff1245ae5b1b263f9f6c241f6d1244a231208a9 (commit)
- Log -----------------------------------------------------------------
commit aed2e27b3f814c90350be72ec95d5d72e9063057
Author: ninadsp <ninadsp16289(a)gmail.com>
Date: Thu Sep 2 21:47:46 2010 +0530
A better solution to the caching issues faced. Set jQuery's global Ajax parameter
'cache' to false, and also set the 'Cache-Control' header to
'no-cache'
-----------------------------------------------------------------------
Summary of changes:
js/db_search.js | 8 +++-----
js/server_privileges.js | 7 ++-----
js/sql.js | 8 +++-----
js/tbl_select.js | 8 +++-----
libraries/common.lib.php | 1 +
server_privileges.php | 5 +++++
6 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/js/db_search.js b/js/db_search.js
index 94fdf6c..3527b62 100644
--- a/js/db_search.js
+++ b/js/db_search.js
@@ -16,13 +16,11 @@
$(document).ready(function() {
/**
- * Set a parameter for all Ajax queries made on this page. Append a random
- * number to tell server that each Ajax request is a new one
+ * Set a parameter for all Ajax queries made on this page. Don't let the
+ * web server serve cached pages
*/
$.ajaxSetup({
- data: {'random': function() {
- return Math.random();
- }}
+ cache: 'false'
});
/**
diff --git a/js/server_privileges.js b/js/server_privileges.js
index dff2c65..4ecfea0 100644
--- a/js/server_privileges.js
+++ b/js/server_privileges.js
@@ -163,13 +163,10 @@ $(document).ready(function() {
/**
* Set a parameter for all Ajax queries made on this page. Some queries
* are affected by cache settings on the server side, and hence, show stale
- * data. Append a random number to tell server that each Ajax request is a
- * new one
+ * data. Don't let the web server serve cached pages
*/
$.ajaxSetup({
- data: {'random': function() {
- return Math.random();
- }}
+ cache: 'false'
});
/**
diff --git a/js/sql.js b/js/sql.js
index 76e6c40..ee66044 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -108,13 +108,11 @@ function appendInlineAnchor(disp_mode) {
$(document).ready(function() {
/**
- * Set a parameter for all Ajax queries made on this page. Append a random
- * number to tell server that each Ajax request is a new one
+ * Set a parameter for all Ajax queries made on this page. Don't let the
+ * web server serve cached pages
*/
$.ajaxSetup({
- data: {'random': function() {
- return Math.random();
- }}
+ cache: 'false'
});
/**
diff --git a/js/tbl_select.js b/js/tbl_select.js
index 12072b0..97de181 100644
--- a/js/tbl_select.js
+++ b/js/tbl_select.js
@@ -14,13 +14,11 @@
$(document).ready(function() {
/**
- * Set a parameter for all Ajax queries made on this page. Append a random
- * number to tell server that each Ajax request is a new one
+ * Set a parameter for all Ajax queries made on this page. Don't let the
+ * web server serve cached pages
*/
$.ajaxSetup({
- data: {'random': function() {
- return Math.random();
- }}
+ cache: 'false'
});
/**
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 2a05638..7dd39f9 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -2937,6 +2937,7 @@ function PMA_ajaxResponse($message, $success = true, $extra_data =
array())
// Set the Content-Type header to JSON so that jQuery parses the response correctly
if(!isset($GLOBALS['is_header_sent'])) {
+ header('Cache-Control: no-cache');
header("Content-Type: application/json");
}
echo json_encode($response);
diff --git a/server_privileges.php b/server_privileges.php
index 567a44c..710151e 100644
--- a/server_privileges.php
+++ b/server_privileges.php
@@ -1731,6 +1731,11 @@ if (empty($_REQUEST['adduser']) && (!
isset($checkprivs) || ! strlen($checkprivs
// A user was selected -> display the user's properties
+ // In an Ajax request, prevent cached values from showing
+ if($GLOBALS['is_ajax_request'] == true) {
+ header('Cache-Control: no-cache');
+ }
+
echo '<h2>' . "\n"
. PMA_getIcon('b_usredit.png')
. __('Edit Privileges') . ': '
hooks/post-receive
--
phpMyAdmin