[geeklog-hg] geeklog: Added the Caching Template Library (CTL) from glFusion....
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon Apr 15 14:46:33 EDT 2013
changeset 9049:b51c75ee556c
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/b51c75ee556c
user: Tom <websitemaster at cogeco.net>
date: Mon Apr 15 11:22:14 2013 -0400
description:
Added the Caching Template Library (CTL) from glFusion. Added required configuration options and install checks. (feature request #0001589)
diffstat:
language/english.php | 20 +-
language/english_utf-8.php | 20 +-
public_html/admin/clearctl.php | 49 +
public_html/admin/configuration_validation.php | 2 +
public_html/admin/install/config-install.php | 2 +
public_html/admin/install/index.php | 5 +
public_html/admin/install/lib-install.php | 66 +
public_html/admin/logviewer.php | 125 +
public_html/admin/moderation.php | 13 +-
public_html/article.php | 3 +-
public_html/docs/english/config.html | 20 +
public_html/docs/japanese/config.html | 20 +
public_html/layout/denim/functions.php | 5 +-
public_html/layout/denim/images/icons/ctl.png | Bin
public_html/layout/denim/images/icons/log_viewer.png | Bin
public_html/layout/modern_curve/functions.php | 5 +-
public_html/layout/modern_curve/images/icons/ctl.png | Bin
public_html/layout/modern_curve/images/icons/log_viewer.png | Bin
public_html/layout/professional/images/icons/ctl.png | Bin
public_html/layout/professional/images/icons/log_viewer.png | Bin
public_html/layout/professional_css/functions.php | 5 +-
public_html/layout/professional_css/images/icons/ctl.png | Bin
public_html/layout/professional_css/images/icons/log_viewer.png | Bin
public_html/lib-common.php | 84 +-
sql/updates/mssql_2.0.0_to_2.0.1.php | 4 +
sql/updates/mysql_2.0.0_to_2.0.1.php | 4 +
sql/updates/pgsql_2.0.0_to_2.0.1.php | 4 +
system/classes/template.class.php | 2899 +++++++--
system/lib-story.php | 3 +-
system/lib-template.php | 113 +
30 files changed, 2566 insertions(+), 905 deletions(-)
diffs (truncated from 4021 to 300 lines):
diff -r 97b04f78d957 -r b51c75ee556c language/english.php
--- a/language/english.php Thu Apr 11 09:30:08 2013 -0400
+++ b/language/english.php Mon Apr 15 11:22:14 2013 -0400
@@ -183,7 +183,8 @@
139 => "Click <a href=\"{$_CONF['site_url']}/\" rel=\"nofollow\">here</a> to return to the homepage",
'facebook' => 'Login with Facebook',
'twitter' => 'Login with Twitter',
- 'linkedin' => 'Login with LinkedIn'
+ 'linkedin' => 'Login with LinkedIn',
+ 'ctl' => 'Clear Cache'
);
###############################################################################
@@ -672,6 +673,18 @@
###############################################################################
###############################################################################
+# admin/logview.php
+
+$LANG_LOGVIEW = array(
+ 'log_viewer' => 'Log Viewer',
+ 'info' => 'Geeklog log file administration.',
+ 'logs' => 'Logs',
+ 'view' => 'View Log File',
+ 'clear' => 'Clear Log File',
+ 'log_file' => 'Log File'
+);
+
+###############################################################################
# admin/auth.inc.php
$LANG20 = array(
@@ -1339,7 +1352,8 @@
119 => 'More..',
120 => 'Send this?',
400 => 'Not all required fields have been passed validation', // Error codes in the 400 range reserved for CUSTOM membership
- 401 => 'Please enter Fullname'
+ 401 => 'Please enter Fullname',
+ 500 => 'The Template Cache has been successfully cleared.'
);
###############################################################################
@@ -1821,6 +1835,7 @@
'doctype' => 'DOCTYPE Declaration',
'menu_elements' => "Menu Elements",
'path_themes' => "Themes Path",
+ 'cache_templates' => "Cache Templates?",
'disable_new_user_registration' => "Disable New Registrations",
'allow_user_themes' => "Allow User Themes",
'allow_user_language' => "Allow User Language",
@@ -1945,6 +1960,7 @@
'aftersave_user' => "After Saving User",
'show_right_blocks' => "Always Show Right Blocks?",
'showfirstasfeatured' => "Show First Story as Featured?",
+ 'template_comments' => "Template Comments in Output?",
'backend' => "Enable Feeds?",
'rdf_file' => "Syndication Output Folder",
'rdf_limit' => "Feed Limit",
diff -r 97b04f78d957 -r b51c75ee556c language/english_utf-8.php
--- a/language/english_utf-8.php Thu Apr 11 09:30:08 2013 -0400
+++ b/language/english_utf-8.php Mon Apr 15 11:22:14 2013 -0400
@@ -183,7 +183,8 @@
139 => "Click <a href=\"{$_CONF['site_url']}/\" rel=\"nofollow\">here</a> to return to the homepage",
'facebook' => 'Login with Facebook',
'twitter' => 'Login with Twitter',
- 'linkedin' => 'Login with LinkedIn'
+ 'linkedin' => 'Login with LinkedIn',
+ 'ctl' => 'Clear Cache'
);
###############################################################################
@@ -672,6 +673,18 @@
###############################################################################
###############################################################################
+# admin/logview.php
+
+$LANG_LOGVIEW = array(
+ 'log_viewer' => 'Log Viewer',
+ 'info' => 'Geeklog log file administration.',
+ 'logs' => 'Logs',
+ 'view' => 'View Log File',
+ 'clear' => 'Clear Log File',
+ 'log_file' => 'Log File'
+);
+
+###############################################################################
# admin/auth.inc.php
$LANG20 = array(
@@ -1339,7 +1352,8 @@
119 => 'More..',
120 => 'Send this?',
400 => 'Not all required fields have been passed validation', // Error codes in the 400 range reserved for CUSTOM membership
- 401 => 'Please enter Fullname'
+ 401 => 'Please enter Fullname',
+ 500 => 'The Template Cache has been successfully cleared.'
);
###############################################################################
@@ -1821,6 +1835,7 @@
'doctype' => 'DOCTYPE Declaration',
'menu_elements' => "Menu Elements",
'path_themes' => "Themes Path",
+ 'cache_templates' => "Cache Templates?",
'disable_new_user_registration' => "Disable New Registrations",
'allow_user_themes' => "Allow User Themes",
'allow_user_language' => "Allow User Language",
@@ -1945,6 +1960,7 @@
'aftersave_user' => "After Saving User",
'show_right_blocks' => "Always Show Right Blocks?",
'showfirstasfeatured' => "Show First Story as Featured?",
+ 'template_comments' => "Template Comments in Output?",
'backend' => "Enable Feeds?",
'rdf_file' => "Syndication Output Folder",
'rdf_limit' => "Feed Limit",
diff -r 97b04f78d957 -r b51c75ee556c public_html/admin/clearctl.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/admin/clearctl.php Mon Apr 15 11:22:14 2013 -0400
@@ -0,0 +1,49 @@
+<?php
+// +--------------------------------------------------------------------------+
+// | Geeklog 2.0 |
+// +---------------------------------------------------------------------------+
+// | clearctl.php |
+// | |
+// | Removed all cached templates |
+// +--------------------------------------------------------------------------+
+// | Copyright (C) 2008 by the following authors: |
+// | |
+// | Mark R. Evans mark AT glfusion DOT org |
+// +--------------------------------------------------------------------------+
+// | |
+// | This program is free software; you can redistribute it and/or |
+// | modify it under the terms of the GNU General Public License |
+// | as published by the Free Software Foundation; either version 2 |
+// | of the License, or (at your option) any later version. |
+// | |
+// | This program is distributed in the hope that it will be useful, |
+// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+// | GNU General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software Foundation, |
+// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
+// | |
+// +--------------------------------------------------------------------------+
+
+require_once '../lib-common.php';
+
+$display = '';
+
+if (!SEC_inGroup ('Root')) {
+ $display .= COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
+ $display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
+ COM_accessLog("User {$_USER['username']} tried to illegally access the clear cache.");
+ COM_output($display);
+ exit;
+}
+
+/*
+ * Main processing
+ */
+
+CTL_clearCache();
+
+echo COM_refresh($_CONF['site_admin_url'] . '/moderation.php?msg=500');
+?>
\ No newline at end of file
diff -r 97b04f78d957 -r b51c75ee556c public_html/admin/configuration_validation.php
--- a/public_html/admin/configuration_validation.php Thu Apr 11 09:30:08 2013 -0400
+++ b/public_html/admin/configuration_validation.php Mon Apr 15 11:22:14 2013 -0400
@@ -237,10 +237,12 @@
'message' => isset($LANG_VALIDATION['path_themes']) ?
$LANG_VALIDATION['path_themes'] : $LANG_VALIDATION['default']
);
+$_CONF_VALIDATE['Core']['cache_templates'] = array('rule' => 'boolean');
/* Subgroup Theme, Tab Advanced Settings */
$_CONF_VALIDATE['Core']['show_right_blocks'] = array('rule' => 'boolean');
$_CONF_VALIDATE['Core']['showfirstasfeatured'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['Core']['template_comments'] = array('rule' => 'boolean');
/* Subgroup Blocks, Tab Admin Block */
$_CONF_VALIDATE['Core']['sort_admin'] = array('rule' => 'boolean');
diff -r 97b04f78d957 -r b51c75ee556c public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php Thu Apr 11 09:30:08 2013 -0400
+++ b/public_html/admin/install/config-install.php Mon Apr 15 11:22:14 2013 -0400
@@ -165,11 +165,13 @@
$c->add('doctype','html401strict','select',2,10,21,195,TRUE, $me, 10);
$c->add('menu_elements',array('contribute','search','stats','directory','plugins'),'%select',2,10,24,200,TRUE, $me, 10);
$c->add('path_themes','','text',2,10,NULL,210,TRUE, $me, 10);
+ $c->add('cache_templates',TRUE,'select',2,10,1,220,TRUE, $me, 10);
$c->add('tab_theme_advanced', NULL, 'tab', 2, 11, NULL, 0, TRUE, $me, 11);
$c->add('fs_theme_advanced', NULL, 'fieldset', 2, 11, NULL, 0, TRUE, $me, 11);
$c->add('show_right_blocks',FALSE,'select',2,11,1,1350,TRUE, $me, 11);
$c->add('showfirstasfeatured',0,'select',2,11,0,1360,TRUE, $me, 11);
+ $c->add('template_comments',FALSE,'select',2,11,1,1370,TRUE, $me, 11);
// Subgroup: Blocks
$c->add('sg_blocks', NULL, 'subgroup', 3, 0, NULL, 0, TRUE, $me, 0);
diff -r 97b04f78d957 -r b51c75ee556c public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Thu Apr 11 09:30:08 2013 -0400
+++ b/public_html/admin/install/index.php Mon Apr 15 11:22:14 2013 -0400
@@ -1123,6 +1123,7 @@
// Files to check if writable
$file_list = array( $_PATH['db-config.php'],
$gl_path . 'data/',
+ $gl_path . 'data/layout_cache/',
$gl_path . 'logs/error.log',
$_PATH['public_html/'] . 'siteconfig.php',
$_PATH['public_html/'] . 'backend/geeklog.rss',
@@ -1315,6 +1316,10 @@
// Run the installation function
INST_installEngine($mode, $step);
+
+ // Clear the Geeklog Cache
+ INST_clearCache();
+
break;
} // End switch ($mode)
diff -r 97b04f78d957 -r b51c75ee556c public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Thu Apr 11 09:30:08 2013 -0400
+++ b/public_html/admin/install/lib-install.php Mon Apr 15 11:22:14 2013 -0400
@@ -1368,4 +1368,70 @@
return $str;
}
+function INST_clearCacheDirectories($path, $needle = '')
+{
+ if ( $path[strlen($path)-1] != '/' ) {
+ $path .= '/';
+ }
+ if ($dir = @opendir($path)) {
+ while ($entry = readdir($dir)) {
+ if ($entry == '.' || $entry == '..' || is_link($entry) || $entry == '.svn' || $entry == 'index.html') {
+ continue;
+ } elseif (is_dir($path . $entry)) {
+ INST_clearCacheDirectories($path . $entry, $needle);
+ @rmdir($path . $entry);
+ } elseif (empty($needle) || strpos($entry, $needle) !== false) {
+ @unlink($path . $entry);
+ }
+ }
+ @closedir($dir);
+ }
+}
+
+
+function INST_clearCache($plugin='')
+{
+ global $_CONF;
+
+ if (!empty($plugin)) {
+ $plugin = '__' . $plugin . '__';
+ }
+
+ INST_clearCacheDirectories($_CONF['path'] . 'data/layout_cache/', $plugin);
+}
+
+function INST_checkCacheDir($path,$template,$classCounter)
+{
+ $permError = 0;
+
+ // special test to see if existing cache files exist and are writable...
+ if ( $dh = @opendir($path) ) {
+ while (($file = readdir($dh)) !== false ) {
+ if ( $file == '.' || $file == '..' || $file == '.svn') {
+ continue;
+ }
+ if ( is_dir($path.$file) ) {
+ $rc = INST_checkCacheDir($path.$file.'/',$template,$classCounter);
+ if ( $rc > 0 ) {
+ $permError = 1;
+ }
+ } else {
+ $ok = INST_isWritable($path.$file);
+ if ( !$ok ) {
+ $template->set_var('location',$path.$file);
+ $template->set_var('status', $ok ? '<span class="yes">OK</span>' : '<span class="Unwriteable">NOT WRITABLE</span>');
+ $template->set_var('rowclass',($classCounter % 2)+1);
+ $classCounter++;
+ $template->parse('perm','perms',true);
+ if ( !$ok ) {
+ $permError = 1;
+ }
+ }
+ }
+ }
+ closedir($dh);
+ }
+ return $permError;
+}
+
?>
diff -r 97b04f78d957 -r b51c75ee556c public_html/admin/logviewer.php
More information about the geeklog-cvs
mailing list