allow caching of phpmyadmin.css.php

This commit is contained in:
Marc Delisle
2006-12-10 13:30:40 +00:00
parent 6a4e2a1164
commit 8cda2c9b41
5 changed files with 27 additions and 2 deletions

View File

@@ -11,6 +11,10 @@ $HeadURL$
by removing this uva prefix
* libraries/export/sql.php: patch #1595784, add charset information
to SQL export, thanks to Christian Schmidt
* css/phpmyadmin.css.php, libraries/session.inc.php,
libraries/Config.class.php, libraries/header_meta_style.inc.php:
patch #1611684, allow client caching of phpmyadmin.css.php,
thanks to Christian Schmidt
2006-12-07 Marc Delisle <lem9@users.sourceforge.net>
* libraries/ip_allow_deny.lib.php: checks that the header contains

View File

@@ -25,6 +25,10 @@ if ($GLOBALS['text_dir'] === 'ltr') {
// Send correct type:
header('Content-Type: text/css; charset=ISO-8859-1');
// Cache output in client - the nocache query parameter makes sure that this
// file is reloaded when config changes
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
?>
html {
font-size: <?php echo $_SESSION['PMA_Config']->get('fontsize'); ?>;

View File

@@ -28,6 +28,7 @@ class PMA_Config
*/
var $source_mtime = 0;
var $default_source_mtime = 0;
var $set_mtime = 0;
/**
* @var boolean
@@ -496,7 +497,10 @@ class PMA_Config
*/
function set($setting, $value)
{
$this->settings[$setting] = $value;
if (!isset($this->settings[$setting]) || $this->settings[$setting] != $value) {
$this->settings[$setting] = $value;
$this->set_mtime = time();
}
}
/**
@@ -518,6 +522,15 @@ class PMA_Config
$this->__construct($source);
}
/**
* returns time of last config change.
* @return int Unix timestamp
*/
function getMtime()
{
return max($this->source_mtime, $this->default_source_mtime, $this->set_mtime);
}
/**
* $cfg['PmaAbsoluteUri'] is a required directive else cookies won't be
* set properly and, depending on browsers, inserting or updating a

View File

@@ -36,5 +36,5 @@ if ($GLOBALS['text_dir'] == 'ltr') {
}
?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&amp;nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/print.css?<?php echo PMA_generate_common_url(); ?>" media="print" />

View File

@@ -70,6 +70,10 @@ if (version_compare(PHP_VERSION, '5.0.0', 'ge')
ini_set('session.hash_bits_per_character', 6);
}
// some pages (e.g. stylesheet) may be cached on clients, but not in shared
// proxy servers
session_cache_limiter('private');
// start the session
// on some servers (for example, sourceforge.net), we get a permission error
// on the session data directory, so I add some "@"