Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31269
Modified Files:
Tag: branch-smarty
NEWS serendipity_db_mysql.inc.php
serendipity_functions.inc.php
Log Message:
Allow to cache entire entries.
Needs some further work to maybe remove plugin references from _functions completely.
Possibly add a hook to rebuild entries on certain events (like when a new textile/bbcode etc. plugin is added)
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.419.2.26
retrieving revision 1.419.2.27
diff -u -d -r1.419.2.26 -r1.419.2.27
--- serendipity_functions.inc.php 21 Sep 2004 20:43:15 -0000 1.419.2.26
+++ serendipity_functions.inc.php 22 Sep 2004 10:58:56 -0000 1.419.2.27
@@ -557,7 +557,7 @@
* (For february 2002 you would pass 200202 for all entries withing
* two timestamps you would pass array(timestamp1,timestamp2)
**/
-function serendipity_fetchEntries($range = null, $full = true, $limit = '', $fetchDrafts = false, $modified_since = false, $orderby = 'timestamp DESC', $filter_sql = '') {
+function serendipity_fetchEntries($range = null, $full = true, $limit = '', $fetchDrafts = false, $modified_since = false, $orderby = 'timestamp DESC', $filter_sql = '', $noCache = false) {
global $serendipity;
$cond = array();
@@ -672,7 +672,7 @@
}
}
- serendipity_plugin_api::hook_event('frontend_fetchentries', $cond);
+ serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('noCache' => $noCache));
if (strtolower($serendipity['dbType']) == 'postgres') {
$group = '';
@@ -696,7 +696,7 @@
{$cond['and']}";
$query = "SELECT $distinct
- {$cond['orderkey']}
+ {$cond['addkey']}
e.id,
e.title,
@@ -1087,20 +1087,7 @@
}
}
- // The unique query condition was built previously in serendipity_fetchEntries()
- if (strtolower($serendipity['dbType']) == 'sqlite') {
- $querystring = "SELECT count(e.id) {$serendipity['fullCountQuery']} GROUP BY count(e.id)";
- } else {
- $querystring = "SELECT count(distinct e.id) {$serendipity['fullCountQuery']}";
- }
-
- $query = serendipity_db_query($querystring);
-
- if (is_array($query) && isset($query[0])) {
- $totalEntries = $query[0][0];
- } else {
- $totalEntries = 0;
- }
+ $totelEntries = serendipity_getTotalEntries();
$totalPages = ceil($totalEntries / (!empty($serendipity['fetchLimit']) ? $serendipity['fetchLimit'] : 15));
if (!isset($serendipity['GET']['page'])) {
@@ -1119,6 +1106,25 @@
}
}
+function serendipity_getTotalEntries() {
+ global $serendipity;
+
+ // The unique query condition was built previously in serendipity_fetchEntries()
+ if (strtolower($serendipity['dbType']) == 'sqlite') {
+ $querystring = "SELECT count(e.id) {$serendipity['fullCountQuery']} GROUP BY count(e.id)";
+ } else {
+ $querystring = "SELECT count(distinct e.id) {$serendipity['fullCountQuery']}";
+ }
+
+ $query = serendipity_db_query($querystring);
+
+ if (is_array($query) && isset($query[0])) {
+ return $query[0][0];
+ }
+
+ return 0;
+}
+
/**
* Prints the entries you fetched with serendipity_fetchEntries/searchEntries in HTML.
**/
@@ -1154,6 +1160,16 @@
$ts = date('Ymd', $timestamp);
}
+ if (!empty($entries[$x]['properties']['ep_cache_body'])) {
+ $entries[$x]['body'] =& $entries[$x]['properties']['ep_cache_body'];
+ $entries[$x]['is_cached'] = true;
+ }
+
+ if (!empty($entries[$x]['properties']['ep_cache_extended'])) {
+ $entries[$x]['extended'] =& $entries[$x]['properties']['ep_cache_extended'];
+ $entries[$x]['is_cached'] = true;
+ }
+
if (!isset($dateseen[$ts])) {
// No entries existing for the same timestamp. Increment to the next numerical index
$datekey++;
Index: serendipity_db_mysql.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_db_mysql.inc.php,v
retrieving revision 1.22.2.1
retrieving revision 1.22.2.2
diff -u -d -r1.22.2.1 -r1.22.2.2
--- serendipity_db_mysql.inc.php 21 Sep 2004 20:43:15 -0000 1.22.2.1
+++ serendipity_db_mysql.inc.php 22 Sep 2004 10:58:56 -0000 1.22.2.2
@@ -19,12 +19,12 @@
$c = mysql_query($sql);
if (mysql_error() != '') {
- return $sql . ' / ' . mysql_error();
+ return '<pre>' . $sql . '</pre> / ' . mysql_error();
}
if (!$c) {
if (!$serendipity['production']) {
- print $sql . ' / ' . mysql_error();
+ print '<pre>' . $sql . '</pre> / ' . mysql_error();
if (function_exists('debug_backtrace') && $reportErr == true) {
highlight_string(var_export(debug_backtrace(), 1));
}
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.214.2.18
retrieving revision 1.214.2.19
diff -u -d -r1.214.2.18 -r1.214.2.19
--- NEWS 21 Sep 2004 20:43:14 -0000 1.214.2.18
+++ NEWS 22 Sep 2004 10:58:56 -0000 1.214.2.19
@@ -3,6 +3,10 @@
Version 0.8 ()
------------------------------------------------------------------------
+ * serendipity_event_entryproperties now supports entry caching to
+ pregenerate the full article and display that instead of
+ assigning event plugins time and again (garvinhicking)
+
* New plugin serendipity_event_entryproperties: You can now define
any property to an entry and query it. Currently implemented
are "sticky posts" and "private/public/members-only" entries.
|