Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
Allow entries to be force pulled from WP (GH #8)
Browse files Browse the repository at this point in the history
If the local page cache for a blog is invalid, the component
will continue to load data from the local page cache, meaning
the blog won't appear to update in Joomla. This update allows
a URL parameter to be added to an entries view on the Joomla
frontend that forces a feed request to WP to get the page.
To use, add 'nocache=true' to the entries view URL.
  • Loading branch information
Vittal Aithal committed Jun 14, 2011
1 parent 2a7f21b commit efb8360
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions joomla_1.5/com_wordbridge/site/models/entries.php
Expand Up @@ -24,7 +24,7 @@ class WordbridgeModelEntries extends JModel
* passed in. Returns true if loaded
* @return bool
*/
function loadEntries( $page = 1, $blogInfo )
function loadEntries( $page = 1, $blogInfo, $nocache = false )
{
// Look up the local cache for this page
$db =& JFactory::getDBO();
Expand All @@ -33,7 +33,7 @@ function loadEntries( $page = 1, $blogInfo )
$blogInfo['last_post_id'], $page );
$db->setQuery( $query );
$cache_id = $db->loadResult();
if ( $cache_id != null)
if ( $cache_id != null && !$nocache )
{
// We have a cached version of this content, so we
// can load the entries up into _entries and return
Expand Down
3 changes: 2 additions & 1 deletion joomla_1.5/com_wordbridge/site/views/entries/view.html.php
Expand Up @@ -31,6 +31,7 @@ function display($tpl = null)
$this->assignRef( 'params', $params );

$page = JRequest::getInt( 'page', 1 );
$nocache = JRequest::getBool( 'nocache', false );

// Get the total number of blog entries
$blogInfo = WordbridgeHelper::getBlogInfo();
Expand Down Expand Up @@ -58,7 +59,7 @@ function display($tpl = null)

// Load the model for the desired page
$model = &$this->getModel();
$model->loadEntries( $page, $blogInfo );
$model->loadEntries( $page, $blogInfo, $nocache );
$entries = $model->getEntries();
$this->assignRef( 'entries', $entries );
$title = $blogInfo['description'];
Expand Down
4 changes: 2 additions & 2 deletions joomla_1.6/com_wordbridge/site/models/entries.php
Expand Up @@ -24,7 +24,7 @@ class WordbridgeModelEntries extends JModel
* passed in. Returns true if loaded
* @return bool
*/
function loadEntries( $page = 1, $blogInfo )
function loadEntries( $page = 1, $blogInfo, $nocache = false )
{
// Look up the local cache for this page
$db =& JFactory::getDBO();
Expand All @@ -33,7 +33,7 @@ function loadEntries( $page = 1, $blogInfo )
$blogInfo['last_post_id'], $page );
$db->setQuery( $query );
$cache_id = $db->loadResult();
if ( $cache_id != null)
if ( $cache_id != null && !$nocache )
{
// We have a cached version of this content, so we
// can load the entries up into _entries and return
Expand Down
3 changes: 2 additions & 1 deletion joomla_1.6/com_wordbridge/site/views/entries/view.html.php
Expand Up @@ -31,6 +31,7 @@ function display($tpl = null)
$this->assignRef( 'params', $params );

$page = JRequest::getInt( 'page', 1 );
$nocache = JRequest::getBool( 'nocache', false );

// Get the total number of blog entries
$blogInfo = WordbridgeHelper::getBlogInfo();
Expand Down Expand Up @@ -58,7 +59,7 @@ function display($tpl = null)

// Load the model for the desired page
$model = &$this->getModel();
$model->loadEntries( $page, $blogInfo );
$model->loadEntries( $page, $blogInfo, $nocache );
$entries = $model->getEntries();
$this->assignRef( 'entries', $entries );
$title = $blogInfo['description'];
Expand Down

0 comments on commit efb8360

Please sign in to comment.