Commit:    7ad7846937817cdcee859594e0804f686b984d2f
Author:    Levi Morrison <[email protected]>         Fri, 28 Mar 2014 
13:00:10 -0600
Parents:   33d0eab77f69dd6fbf2c88816cdb1d60d9776c7a
Branches:  master

Link:       
http://git.php.net/?p=web/shared.git;a=commitdiff;h=7ad7846937817cdcee859594e0804f686b984d2f

Log:
Some more filemtime caching cleanup.

Changed paths:
  M  templates/footer.inc
  M  templates/header.inc


Diff:
diff --git a/templates/footer.inc b/templates/footer.inc
index d269cc5..45d3d7b 100644
--- a/templates/footer.inc
+++ b/templates/footer.inc
@@ -11,12 +11,6 @@
 isset($JS) || $JS = array();
 isset($SECONDSCREEN) || $SECONDSCREEN = "";
 $ROOT = substr($_SERVER["SERVER_NAME"], -8) == ".php.net" ? "//shared.php.net" 
: "/shared";
-$current_time = time();
-$scripts = array_merge($JS, array(
-    '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js',
-    '/js/external/mousetrap.min.js',
-    '/js/common.js'
-));
 ?>
 
 <?php if ($SECONDSCREEN): ?>
@@ -36,15 +30,20 @@ $scripts = array_merge($JS, array(
 </footer>
 
 <?php
-foreach ($scripts as $script) {
+$current_time = time();
+$scripts = array_merge($JS, array(
+  '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js',
+  '/js/external/mousetrap.min.js',
+  '/js/common.js'
+));
+foreach ($scripts as $script):
   if (strncmp($script, "//", 2) == 0) {
     echo "<script src='$script'></script>\n";
   } else { 
-    $filemtime = filemtime(__DIR__ . "/..{$script}") ?: time();
+    $filemtime = filemtime(__DIR__ . "/..{$script}") ?: $current_time;
     echo "<script src='{$ROOT}{$script}?filemtime=$filemtime'></script>\n";
   }
-}
-?>
+endforeach ?>
 </body>
 </html>
 <?php /* vim: set ft=html et ts=2 sw=2: : */ ?>
diff --git a/templates/header.inc b/templates/header.inc
index 6a96f71..03ea33c 100644
--- a/templates/header.inc
+++ b/templates/header.inc
@@ -27,7 +27,6 @@ isset($CSS)       || $CSS       = array();
 isset($SEARCH)    || $SEARCH    = array();
 $ROOT = substr($_SERVER["SERVER_NAME"], -8) == ".php.net" ? "//shared.php.net" 
: "/shared";
 $current_time = time();
-$default_css_mtime = filemtime(__DIR__ . '/../styles/defaults.css') ?: 
$current_time;
 ?>
 <!DOCTYPE html>
 <html>
@@ -36,10 +35,12 @@ $default_css_mtime = filemtime(__DIR__ . 
'/../styles/defaults.css') ?: $current_
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
   <title>PHP: <?=$TITLE ?></title>
-  <link media="all" rel="stylesheet" href="<?php echo 
"$ROOT/styles/defaults.css?filemtime=$default_css_mtime";?>">
 
 <?php
-foreach($CSS as $style):
+$styles = array_merge($CSS, array(
+  '/styles/defaults.css'
+));
+foreach($styles as $style):
   // note that $style should have a leading slash
   $filemtime = filemtime(__DIR__ . '/..' . $style) ?: $current_time;
   echo "  <link media='all' rel='stylesheet' 
href='{$ROOT}{$style}?filemtime=$filemtime'/>\n";


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to