Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64918 - in website/public_html/beta: common/code doc
From: dnljms_at_[hidden]
Date: 2010-08-19 06:33:44


Author: danieljames
Date: 2010-08-19 06:33:42 EDT (Thu, 19 Aug 2010)
New Revision: 64918
URL: http://svn.boost.org/trac/boost/changeset/64918

Log:
Only use expire dates on main documentation.

Text files modified:
   website/public_html/beta/common/code/boost_archive.php | 35 ++++++++++++++++++++++++-----------
   website/public_html/beta/doc/display_libs.php | 4 +++-
   2 files changed, 27 insertions(+), 12 deletions(-)

Modified: website/public_html/beta/common/code/boost_archive.php
==============================================================================
--- website/public_html/beta/common/code/boost_archive.php (original)
+++ website/public_html/beta/common/code/boost_archive.php 2010-08-19 06:33:42 EDT (Thu, 19 Aug 2010)
@@ -45,7 +45,8 @@
 function display_from_archive(
     $params,
     $content_map = array(),
- $override_extractor = null)
+ $override_extractor = null,
+ $expires = null)
 {
     $params['template'] = dirname(__FILE__)."/template.php";
     $params['title'] = NULL;
@@ -117,12 +118,14 @@
           .' '.escapeshellarg($params['file']);
 
         if($extractor == 'raw') {
- display_raw_file($unzip, $type);
+ display_raw_file($unzip, $type, $expires);
             return;
         }
 
- header('Expires: '.date(DATE_RFC2822, strtotime("+1 month")));
- header('Cache-Control: max-age=2592000'); // 30 days
+ if ($expires) {
+ header('Expires: '.date(DATE_RFC2822, strtotime($expires)));
+ header('Cache-Control: '.strtotime($expires, 0)); // 30 days
+ }
 
         // Note: this sets $params['content'] with either the content or an error
         // message:
@@ -134,12 +137,14 @@
     else
     {
         if($extractor == 'raw') {
- display_unzipped_file($params['file'], $type);
+ display_unzipped_file($params['file'], $type, $expires);
             return;
         }
 
- header('Expires: '.date(DATE_RFC2822, strtotime("+1 month")));
- header('Cache-Control: max-age=2592000'); // 30 days
+ if ($expires) {
+ header('Expires: '.date(DATE_RFC2822, strtotime($expires)));
+ header('Cache-Control: '.strtotime($expires, 0)); // 30 days
+ }
 
         $params['content'] = file_get_contents($params['file']);
     }
@@ -218,7 +223,8 @@
     }
 }
 
-function display_raw_file($unzip, $type) {
+function display_raw_file($unzip, $type, $expires = null)
+ {
     header('Content-type: '.$type);
     switch($type) {
         case 'image/png':
@@ -231,8 +237,10 @@
             header('Expires: '.date(DATE_RFC2822, strtotime("+1 year")));
             header('Cache-Control: max-age=31556926'); // A year, give or take a day.
         default:
- header('Expires: '.date(DATE_RFC2822, strtotime("+1 month")));
- header('Cache-Control: max-age=2592000'); // 30 days
+ if($expires) {
+ header('Expires: '.date(DATE_RFC2822, strtotime($expires)));
+ header('Cache-Control: '.strtotime($expires, 0));
+ }
     }
 
     // Since we're not returning a HTTP error for non-existant files,
@@ -251,7 +259,7 @@
         echo 'Error extracting file: '.unzip_error($exit_status);
 };
 
-function display_unzipped_file($file, $type) {
+function display_unzipped_file($file, $type, $expires = null) {
     header('Content-type: '.$type);
     switch($type) {
         case 'image/png':
@@ -263,6 +271,11 @@
         case 'application/xml-dtd':
             header('Expires: '.date(DATE_RFC2822, strtotime("+1 year")));
             header('Cache-Control: max-age=31556926'); // A year, give or take a day.
+ default:
+ if($expires) {
+ header('Expires: '.date(DATE_RFC2822, strtotime($expires)));
+ header('Cache-Control: '.strtotime($expires, 0));
+ }
     }
 
     // Since we're not returning a HTTP error for non-existant files,

Modified: website/public_html/beta/doc/display_libs.php
==============================================================================
--- website/public_html/beta/doc/display_libs.php (original)
+++ website/public_html/beta/doc/display_libs.php 2010-08-19 06:33:42 EDT (Thu, 19 Aug 2010)
@@ -99,4 +99,6 @@
   array('@.*@','@^more/.*html$@i','basic','text/html'),
   //~ the headers are text files displayed in an embeded page
   array('@.*@','@^boost/.*$@i','cpp','text/plain')
-));
+ ),
+ null, "+1 year"
+);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk