[geeklog-hg] geeklog: Individual Articles can now be cached or not. Article c...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Oct 24 21:13:36 EDT 2013


changeset 9324:2569bda91fdd
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/2569bda91fdd
user: Tom <websitemaster at cogeco.net>
date: Thu Oct 24 21:13:03 2013 -0400
description:
Individual Articles can now be cached or not. Article cache files will be regenerated based on time or certian configuration changes.
Added new config options for new articles and blocks called default_cache_time_article and default_cache_time_block.
Blocks can now always use the cache file and will not be regenerated until the block is edited (-1 setting).

diffstat:

 language/english.php                                                       |    8 +-
 language/english_utf-8.php                                                 |    8 +-
 public_html/admin/block.php                                                |    8 +-
 public_html/admin/configuration_validation.php                             |    2 +
 public_html/admin/install/config-install.php                               |    2 +
 public_html/admin/plugins/staticpages/index.php                            |    4 +-
 public_html/admin/story.php                                                |    4 +
 public_html/docs/english/config.html                                       |   20 +-
 public_html/docs/japanese/config.html                                      |   22 +-
 public_html/layout/denim/admin/story/storyeditor.thtml                     |    4 +
 public_html/layout/denim/admin/story/storyeditor_advanced.thtml            |   18 +-
 public_html/layout/modern_curve/admin/story/storyeditor.thtml              |    4 +
 public_html/layout/modern_curve/admin/story/storyeditor_advanced.thtml     |   18 +-
 public_html/layout/professional/admin/story/storyeditor.thtml              |    4 +
 public_html/layout/professional/admin/story/storyeditor_advanced.thtml     |    4 +
 public_html/layout/professional_css/admin/story/storyeditor.thtml          |    4 +
 public_html/layout/professional_css/admin/story/storyeditor_advanced.thtml |   18 +-
 public_html/lib-common.php                                                 |   26 +-
 sql/mssql_tableanddata.php                                                 |    1 +
 sql/mysql_tableanddata.php                                                 |    1 +
 sql/pgsql_tableanddata.php                                                 |    1 +
 sql/updates/mssql_2.0.0_to_2.1.0.php                                       |    7 +
 sql/updates/mysql_2.0.0_to_2.1.0.php                                       |    7 +
 sql/updates/pgsql_2.0.0_to_2.1.0.php                                       |    9 +-
 system/classes/story.class.php                                             |   27 +-
 system/lib-story.php                                                       |  887 +++++----
 system/lib-template.php                                                    |   12 +-
 27 files changed, 678 insertions(+), 452 deletions(-)

diffs (truncated from 1731 to 300 lines):

diff -r d21ade11962e -r 2569bda91fdd language/english.php
--- a/language/english.php	Thu Oct 24 06:57:25 2013 -0400
+++ b/language/english.php	Thu Oct 24 21:13:03 2013 -0400
@@ -847,7 +847,7 @@
     68 => 'The feed for this portal block is too long to display. Please set a maximum number of articles to import for the block in the block setup screen, or a global maximum in Geeklog Configuration.',
     69 => 'Plugin Name',
     'cache_time'        => 'Cache Time',
-    'cache_time_desc'   => 'This block will be cached for no longer than this many seconds. If 0 caching is disabled. (3600 = 1 hour,  86400 = 1 day)'
+    'cache_time_desc'   => 'This block will be cached for no longer than this many seconds. If 0 caching is disabled. If -1 cached until block is edited again. (3600 = 1 hour,  86400 = 1 day)'
 );
 
 ###############################################################################
@@ -945,7 +945,9 @@
     89 => 'Meta Description',
     90 => 'Meta Keywords',
     91 => 'You can always hit "Preview" to extend the expiry time.',
-    'autotag_desc_story' => '[story: id alternate title] - Displays a link to a Story using the Story Title as the title. An alternate title may be specified but is not required.'  
+    'autotag_desc_story' => '[story: id alternate title] - Displays a link to a Story using the Story Title as the title. An alternate title may be specified but is not required.',
+    'cache_time'        => 'Cache Time',
+    'cache_time_desc'   => 'This article will be cached for no longer than this many seconds. If 0 caching is disabled. If -1 cached until article is edited again. (3600 = 1 hour,  86400 = 1 day)'
 );
 
 
@@ -2064,6 +2066,7 @@
     'whats_related' => "What's Related",
     'whats_related_max' => "Max What's Related to Display",
     'whats_related_trim' => "What's Related Title Length",
+    'default_cache_time_article' => "Default Article Cache Time",
     'aftersave_user' => "After Saving User",
     'show_right_blocks' => "Always Show Right Blocks?",
     'showfirstasfeatured' => "Show First Story as Featured?",
@@ -2123,6 +2126,7 @@
     'compressed_output' => 'Send compressed output?',
     'frame_options' => 'Protection against "clickjacking"',
     'page_navigation_max_pages' => 'Max Pages for Navigation',
+    'default_cache_time_block' => 'Default Block Cache Time',
     'censormode' => "Censor Mode?",
     'censorreplace' => "Censor Replace Text",
     'censorlist' => "Censor List",
diff -r d21ade11962e -r 2569bda91fdd language/english_utf-8.php
--- a/language/english_utf-8.php	Thu Oct 24 06:57:25 2013 -0400
+++ b/language/english_utf-8.php	Thu Oct 24 21:13:03 2013 -0400
@@ -847,7 +847,7 @@
     68 => 'The feed for this portal block is too long to display. Please set a maximum number of articles to import for the block in the block setup screen, or a global maximum in Geeklog Configuration.',
     69 => 'Plugin Name',
     'cache_time'        => 'Cache Time',
-    'cache_time_desc'   => 'This block will be cached for no longer than this many seconds. If 0 caching is disabled. (3600 = 1 hour,  86400 = 1 day)'
+    'cache_time_desc'   => 'This block will be cached for no longer than this many seconds. If 0 caching is disabled. If -1 cached until block is edited again. (3600 = 1 hour,  86400 = 1 day)'
 );
 
 ###############################################################################
@@ -945,7 +945,9 @@
     89 => 'Meta Description',
     90 => 'Meta Keywords',
     91 => 'You can always hit "Preview" to extend the expiry time.',
-    'autotag_desc_story' => '[story: id alternate title] - Displays a link to a Story using the Story Title as the title. An alternate title may be specified but is not required.'  
+    'autotag_desc_story' => '[story: id alternate title] - Displays a link to a Story using the Story Title as the title. An alternate title may be specified but is not required.',
+    'cache_time'        => 'Cache Time',
+    'cache_time_desc'   => 'This article will be cached for no longer than this many seconds. If 0 caching is disabled. If -1 cached until article is edited again. (3600 = 1 hour,  86400 = 1 day)'
 );
 
 
@@ -2064,6 +2066,7 @@
     'whats_related' => "What's Related",
     'whats_related_max' => "Max What's Related to Display",    
     'whats_related_trim' => "What's Related Title Length",
+    'default_cache_time_article' => "Default Article Cache Time",
     'aftersave_user' => "After Saving User",
     'show_right_blocks' => "Always Show Right Blocks?",
     'showfirstasfeatured' => "Show First Story as Featured?",
@@ -2123,6 +2126,7 @@
     'compressed_output' => 'Send compressed output?',
     'frame_options' => 'Protection against "clickjacking"',
     'page_navigation_max_pages' => 'Max Pages for Navigation',
+    'default_cache_time_block' => 'Default Block Cache Time',
     'censormode' => "Censor Mode?",
     'censorreplace' => "Censor Replace Text",
     'censorlist' => "Censor List",
diff -r d21ade11962e -r 2569bda91fdd public_html/admin/block.php
--- a/public_html/admin/block.php	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/admin/block.php	Thu Oct 24 21:13:03 2013 -0400
@@ -207,7 +207,7 @@
         $A['title'] = '';
         $A['tid'] = '';
         $A['blockorder'] = 0;
-        $A['cache_time'] = 0;
+        $A['cache_time'] = $_CONF['default_cache_time_block'];
         $A['content'] = '';
         $A['allow_autotags'] = 0;
         $A['rdfurl'] = '';
@@ -593,8 +593,8 @@
             $allow_autotags = 0;
         }
         
-        if (empty($cache_time) OR $cache_time < 0) {
-            $cache_time = 0;
+        if (empty($cache_time) OR $cache_time < -1) {
+            $cache_time = $_CONF['default_cache_time_block'];
         }        
 
         if ($type == 'portal') {
@@ -909,7 +909,7 @@
     if (isset ($_POST['allow_autotags'])) {
         $allow_autotags = $_POST['allow_autotags'];
     }
-    $cache_time = 0;
+    $cache_time = $_CONF['default_cache_time_block'];
     if (isset ($_POST['cache_time'])) {
         $cache_time = COM_applyFilter ($_POST['cache_time'], true);
     }    
diff -r d21ade11962e -r 2569bda91fdd public_html/admin/configuration_validation.php
--- a/public_html/admin/configuration_validation.php	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/admin/configuration_validation.php	Thu Oct 24 21:13:03 2013 -0400
@@ -213,6 +213,7 @@
 );    
 $_CONF_VALIDATE['Core']['whats_related_max'] = array('rule' => 'numeric');
 $_CONF_VALIDATE['Core']['whats_related_trim'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['Core']['default_cache_time_article'] = array('rule' => 'numeric');
 
 /* Subgroup Stories and Trackback, Tab Trackback */
 $_CONF_VALIDATE['Core']['trackback_enabled'] = array('rule' => 'boolean');
@@ -499,6 +500,7 @@
     'message' => isset($LANG_VALIDATION['page_navigation_max_pages']) ? 
                  $LANG_VALIDATION['page_navigation_max_pages'] : $LANG_VALIDATION['default']
 );
+$_CONF_VALIDATE['Core']['default_cache_time_block'] = array('rule' => 'numeric');
 
 /* Subgroup Misc, Tab Debug */
 $_CONF_VALIDATE['Core']['rootdebug'] = array('rule' => 'boolean');
diff -r d21ade11962e -r 2569bda91fdd public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/admin/install/config-install.php	Thu Oct 24 21:13:03 2013 -0400
@@ -149,6 +149,7 @@
     $c->add('whats_related',1,'select',1,7,33,1360,TRUE, $me, 7);
     $c->add('whats_related_max',0,'text',1,7,NULL,1370,TRUE, $me, 7);
     $c->add('whats_related_trim',26,'text',1,7,NULL,1380,TRUE, $me, 7);
+    $c->add('default_cache_time_article',0,'text',1,7,NULL,1390,TRUE, $me, 7);
 
     $c->add('tab_trackback', NULL, 'tab', 1, 8, NULL, 0, TRUE, $me, 8);
     $c->add('fs_trackback', NULL, 'fieldset', 1, 8, NULL, 0, TRUE, $me, 8);
@@ -407,6 +408,7 @@
     $c->add('compressed_output',0,'select',7,31,1,1756,TRUE, $me, 31);
     $c->add('frame_options','DENY','select',7,31,22,1758,TRUE, $me, 31);
     $c->add('page_navigation_max_pages',7,'text',7,31,NULL,1800,TRUE, $me, 31);
+    $c->add('default_cache_time_block',0,'text',7,31,NULL,1810,TRUE, $me, 31);
 
     $c->add('tab_debug', NULL, 'tab', 7, 32, NULL, 0, TRUE, $me, 32);
     $c->add('fs_debug', NULL, 'fieldset', 7, 32, NULL, 0, TRUE, $me, 32);
diff -r d21ade11962e -r 2569bda91fdd public_html/admin/plugins/staticpages/index.php
--- a/public_html/admin/plugins/staticpages/index.php	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/admin/plugins/staticpages/index.php	Thu Oct 24 21:13:03 2013 -0400
@@ -642,7 +642,7 @@
         $A['commentcode'] = $_SP_CONF['comment_code'];
         $A['sp_where'] = 1; // default new pages to "top of page"
         $A['draft_flag'] = $_SP_CONF['draft_flag'];
-        $A['cache_time'] = 0;
+        $A['cache_time'] = $_SP_CONF['default_cache_time'];
         $A['template_flag'] = ''; // Defaults to not a template
         $A['template_id'] = ''; // Defaults to None
         if ($_USER['advanced_editor'] == 1) {
@@ -841,7 +841,7 @@
             $_POST['draft_flag'] = '';
         }
         if (!isset($_POST['cache_time'])) {
-            $_POST['cache_time'] = 0;
+            $_POST['cache_time'] = $_SP_CONF['default_cache_time'];
         }
         if (!isset($_POST['template_flag'])) {
             $_POST['template_flag'] = '';
diff -r d21ade11962e -r 2569bda91fdd public_html/admin/story.php
--- a/public_html/admin/story.php	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/admin/story.php	Thu Oct 24 21:13:03 2013 -0400
@@ -571,6 +571,10 @@
     } else {
         $story_templates->set_var('show_topic_icon_checked', '');
     }
+    $story_templates->set_var('lang_cachetime', $LANG24['cache_time']);
+    $story_templates->set_var('lang_cachetime_desc', $LANG24['cache_time_desc']);
+    $story_templates->set_var('cache_time', $story->EditElements('cache_time'));    
+    
     $story_templates->set_var('lang_draft', $LANG24[34]);
     if ($story->EditElements('draft_flag')) {
         $story_templates->set_var('is_checked', 'checked="checked"');
diff -r d21ade11962e -r 2569bda91fdd public_html/docs/english/config.html
--- a/public_html/docs/english/config.html	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/docs/english/config.html	Thu Oct 24 21:13:03 2013 -0400
@@ -479,6 +479,15 @@
   <td valign="top"><a name="desc_whats_related_trim">whats_related_trim</a></td>
   <td valign="top">26</td>
   <td valign="top">Max. length of the title of items listed in the What's Related list. If 0 will not trim titles. If this option is changed this will update all related links in the database for articles.</td></tr>
+<tr>
+  <td valign="top"><a name="desc_default_cache_time_article">default_cache_time_article</a></td>
+  <td valign="top">0</td>
+  <td valign="top">The default cache time for a article. Possible values:<br>
+    <ul>
+        <li>1 or more = Amount of seconds a article will be cached before it is regenerated and saved again to a new cache file.</li>
+        <li>0 = Not cached. Article is always regenerated.</li>
+        <li>-1 = Always cached and only regenerated when the article is updated and saved through the article editor.</li>
+    </ul></td></tr>    
 </table>
 
 <h3><a name="stories_trackback">Stories and Trackback: Trackback</a></h3>
@@ -1646,7 +1655,16 @@
 <tr>
   <td valign="top"><a name="desc_page_navigation_max_pages">page_navigation_max_pages</a></td>
   <td valign="top">7</td>
-  <td valign="top">Maximum number of pages to show for the page navigation. Minimum of 3 pages to a maximum of 20 pages allowed.</td></tr>        
+  <td valign="top">Maximum number of pages to show for the page navigation. Minimum of 3 pages to a maximum of 20 pages allowed.</td></tr>
+<tr>
+  <td valign="top"><a name="desc_default_cache_time_block">default_cache_time_block</a></td>
+  <td valign="top">0</td>
+  <td valign="top">The default cache time for a block. Possible values:<br>
+    <ul>
+        <li>1 or more = Amount of seconds a block will be cached before it is regenerated and saved again to a new cache file.</li>
+        <li>0 = Not cached. Block is always regenerated.</li>
+        <li>-1 = Always cached and only regenerated when the block is updated and saved through the block editor.</li>
+    </ul></td></tr>  
 </table>
 
 <h3><a name="misc_debug">Miscellaneous: Debug</a></h3>
diff -r d21ade11962e -r 2569bda91fdd public_html/docs/japanese/config.html
--- a/public_html/docs/japanese/config.html	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/docs/japanese/config.html	Thu Oct 24 21:13:03 2013 -0400
@@ -423,7 +423,16 @@
 <tr>
   <td valign="top"><a name="desc_whats_related_trim">whats_related_trim</a></td>
   <td valign="top">26</td>
-  <td valign="top">Max. length of the title of items listed in the What's Related list. If 0 will not trim titles. If this option is changed this will update all related links in the database for articles.</td></tr>  
+  <td valign="top">Max. length of the title of items listed in the What's Related list. If 0 will not trim titles. If this option is changed this will update all related links in the database for articles.</td></tr>
+<tr>
+  <td valign="top"><a name="desc_default_cache_time_article">default_cache_time_article</a></td>
+  <td valign="top">0</td>
+  <td valign="top">The default cache time for a article. Possible values:<br>
+    <ul>
+        <li>1 or more = Amount of seconds a article will be cached before it is regenerated and saved again to a new cache file.</li>
+        <li>0 = Not cached. Article is always regenerated.</li>
+        <li>-1 = Always cached and only regenerated when the article is updated and saved through the article editor.</li>
+    </ul></td></tr>   
 </table>
 
 <h3><a name="stories_trackback">記事とトラックバック: トラックバック</a></h3>
@@ -1394,7 +1403,16 @@
 <tr>
   <td valign="top"><a name="desc_page_navigation_max_pages">ページナビゲーションのページ数(page_navigation_max_pages)</a></td>
   <td valign="top">7</td>
-  <td valign="top">ページナビゲーションに表示するページの数。最小3ページから最大20ページまでを指定できます。</td></tr>     
+  <td valign="top">ページナビゲーションに表示するページの数。最小3ページから最大20ページまでを指定できます。</td></tr>
+<tr>
+  <td valign="top"><a name="desc_default_cache_time_block">default_cache_time_block</a></td>
+  <td valign="top">0</td>
+  <td valign="top">The default cache time for a block. Possible values:<br>
+    <ul>
+        <li>1 or more = Amount of seconds a block will be cached before it is regenerated and saved again to a new cache file.</li>
+        <li>0 = Not cached. Block is always regenerated.</li>
+        <li>-1 = Always cached and only regenerated when the block is updated and saved through the block editor.</li>
+    </ul></td></tr>   
 </table>
 
 <h3><a name="misc_debug">その他: デバッグ</a></h3>
diff -r d21ade11962e -r 2569bda91fdd public_html/layout/denim/admin/story/storyeditor.thtml
--- a/public_html/layout/denim/admin/story/storyeditor.thtml	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/layout/denim/admin/story/storyeditor.thtml	Thu Oct 24 21:13:03 2013 -0400
@@ -44,6 +44,10 @@
 
       <dt><label for="admin-storyeditor-show_topic_icon">{lang_show_topic_icon}</label></dt>
       <dd><input type="checkbox" {show_topic_icon_checked} name="show_topic_icon" id="admin-storyeditor-show_topic_icon"{xhtml}></dd>
+      
+      <dt><label for="admin-storyeditor-cachetime">{lang_cachetime}</label></dt>
+      <dd><input type="text" size="8" value="{cache_time}" name="cache_time" id="admin-storyeditor-cachetime" class="text"{xhtml}></dd>
+      <dd class="description">{lang_cachetime_desc}</dd>         
 
       <dt><label for="admin-storyeditor-draft_flag">{lang_draft}</label></dt>
       <dd><input type="checkbox" {is_checked} name="draft_flag" id="admin-storyeditor-draft_flag"{xhtml}></dd>
diff -r d21ade11962e -r 2569bda91fdd public_html/layout/denim/admin/story/storyeditor_advanced.thtml
--- a/public_html/layout/denim/admin/story/storyeditor_advanced.thtml	Thu Oct 24 06:57:25 2013 -0400
+++ b/public_html/layout/denim/admin/story/storyeditor_advanced.thtml	Thu Oct 24 21:13:03 2013 -0400
@@ -30,19 +30,23 @@
       <dt><label>{lang_topic}</label></dt>
       <dd>{topic_selection}</dd>
 
+      <dt><label for="admin-storyeditor_advanced-show_topic_icon">{lang_show_topic_icon}</label></dt>
+      <dd><input type="checkbox" {show_topic_icon_checked} name="show_topic_icon" id="admin-storyeditor_advanced-show_topic_icon"{xhtml}></dd>      
+
+      <dt><label for="admin-storyeditor_advanced-cachetime">{lang_cachetime}</label></dt>
+      <dd><input type="text" size="8" value="{cache_time}" name="cache_time" id="admin-storyeditor_advanced-cachetime" class="text"{xhtml}></dd>
+      <dd class="description">{lang_cachetime_desc}</dd>            
+
+      <dt><label for="admin-storyeditor_advanced-draft_flag">{lang_draft}</label></dt>
+      <dd><input type="checkbox" {is_checked} name="draft_flag" id="admin-storyeditor_advanced-draft_flag"{xhtml}></dd>
+      
       <dt>{lang_story_stats}</dt>
       <dd><div class="clearfix">
             <span class="story_stats">{lang_hits}: {story_hits}</span>
             <span class="story_stats">{lang_comments}: {story_comments}</span>
             <span class="story_stats">{lang_trackbacks}: {story_trackbacks}</span>
             <span class="story_stats">{lang_emails}: {story_emails}</span>
-          </div></dd>
-
-      <dt><label for="admin-storyeditor_advanced-show_topic_icon">{lang_show_topic_icon}</label></dt>
-      <dd><input type="checkbox" {show_topic_icon_checked} name="show_topic_icon" id="admin-storyeditor_advanced-show_topic_icon"{xhtml}></dd>



More information about the geeklog-cvs mailing list