com web/php: Add a way to avoid the cache: images/logo.php
| From: | Hannes Magnusson | Date: | Sun, 29 Dec 2013 05:59:49 +0000 |
| Subject: | com web/php: Add a way to avoid the cache: images/logo.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-17874@lists.php.net to get a copy of this message | ||
Commit: e7ea447575e398917cb4f135ff5ca02286fe784f
Author: Hannes Magnusson <bjori@mongodb.com> Sat, 28 Dec 2013 21:59:49 -0800
Parents: ae561b8a7a656768c5dc160190fef434312c5965
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=e7ea447575e398917cb4f135ff5ca02286fe784f
Log:
Add a way to avoid the cache
Changed paths:
M images/logo.php
Diff:
diff --git a/images/logo.php b/images/logo.php
index c165c44..8e41e78 100644
--- a/images/logo.php
+++ b/images/logo.php
@@ -1,5 +1,7 @@
<?php
+$refresh = isset($_GET["refresh"]) ? true : false;
+
function imgheader($filename) {
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
switch($ext) {
@@ -48,8 +50,10 @@ if ($day < 7 || 365-$day < 32) {
}
/* Every so often.. give the elephpant a chance */
-if ($now % 60 == 10) {
+if ($now % 60 == 10 || $refresh) {
$logos[] = "./ele-running.gif";
+}
+if ($now % 120 == 10 || $refresh) {
$logos = array_merge($logos, glob("logos/oldschool/*"));
}
@@ -62,7 +66,7 @@ if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
$last = strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]);
/* Use the same logo for a day */
- if (strtotime("+1 day", $last) > $now) {
+ if (strtotime("+1 day", $last) > $now && !$refresh) {
header("HTTP/1.1 304 Not Modified");
exit;
}