Fixed transient behavior when the cache plugin is enabled.
authorjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2015 00:23:09 +0000 (00:23 +0000)
committerjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2015 00:23:09 +0000 (00:23 +0000)
* wp-content/themes/webkit/functions.php:
* wp-content/themes/webkit/includes.php:
* wp-content/themes/webkit/nightly.php:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193387 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/webkit.org/ChangeLog
Websites/webkit.org/wp-content/themes/webkit/functions.php
Websites/webkit.org/wp-content/themes/webkit/includes.php
Websites/webkit.org/wp-content/themes/webkit/nightly.php

index 66e1032..6e1f5bc 100644 (file)
@@ -1,5 +1,13 @@
 2015-12-03  Jonathan Davis  <jond@apple.com>
 
+        Fixed transient behavior when the cache plugin is enabled.
+
+        * wp-content/themes/webkit/functions.php:
+        * wp-content/themes/webkit/includes.php:
+        * wp-content/themes/webkit/nightly.php:
+
+2015-12-03  Jonathan Davis  <jond@apple.com>
+
         Add sub-section anchors to code style guidelines
         https://bugs.webkit.org/show_bug.cgi?id=151770
 
index 06e2630..2b86ccf 100644 (file)
@@ -92,6 +92,11 @@ function table_of_contents_index( $content, $post_id ) {
     return $content;
 }
 
+function is_super_cache_enabled() {
+    global $super_cache_enabled;
+    return (isset($super_cache_enabled) && true === $super_cache_enabled);
+}
+
 function tag_post_image_luminance( $post_id ) {
     $threshold = 128;
     $tags = array();
index d4d7e8f..b9aa13c 100644 (file)
@@ -5,16 +5,13 @@
 ?>
 <?php get_header(); ?>
 
-       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-        
-        <?php
+    <?php if (have_posts()) : while (have_posts()) : the_post(); 
             
         $path = dirname(ABSPATH);
         $file = get_post_meta(get_the_ID(), 'include-markdown', true);
 
         $cachekey = "cached_include_" . $file;
-
-        if ( false === ( $content = get_transient($cachekey) ) ) {
+        if ( is_super_cache_enabled() || false === ( $content = get_transient($cachekey) ) ) {
             ob_start();
             include $path . '/' . $file;
             $content = ob_get_clean();
             set_transient($cachekey, $content, DAY_IN_SECONDS);
         }
         
-        ?>
+    ?>
 
         <article class="page<?php if ( has_table_of_contents() ) echo ' with-toc';?>" id="post-<?php the_ID(); ?>">
                 
-                       <h1><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h1>
+            <h1><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h1>
             
-                       <div class="bodycopy">
+            <div class="bodycopy">
             <?php table_of_contents(); ?>
             <?php
                 echo apply_filters('the_content', $content);
             ?>
-                       </div>
+            </div>
         </article>
 
-       <?php //comments_template(); ?>
+    <?php //comments_template(); ?>
 
-       <?php endwhile; else:
+    <?php endwhile; else:
         include('444.php');
-       endif; ?>
+    endif; ?>
 
-<?php get_footer(); ?>
\ No newline at end of file
+<?php get_footer(); ?>
index 40c7b51..8279b4b 100644 (file)
@@ -19,7 +19,7 @@ function get_nightly_download_details( $type = 'mac' ) {
         $type = $types[0];
     
     $cachekey = 'nightly_download_' . $type;
-    if ( false !== ( $cached = get_transient($cachekey) ) )
+    if ( is_super_cache_enabled() || false !== ( $cached = get_transient($cachekey) ) )
         return json_decode($cached);
        
     $url = sprintf(WEBKIT_NIGHTLY_ARCHIVE_URL, $type);
@@ -30,7 +30,7 @@ function get_nightly_download_details( $type = 'mac' ) {
     
     if ( ! empty($data) ) {
         $record = explode(',', $data);
-        set_transient($cachekey, json_encode($record), DAY_IN_SECONDS);
+        set_transient($cachekey, json_encode($record), HOUR_IN_SECONDS * 6); // Expire every 6 hours
         return $record;
        }