summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LibertyContent.php25
-rw-r--r--bit_setup_inc.php24
-rw-r--r--plugins/format.tikiwiki.php8
-rw-r--r--templates/service_content_edit_mini_inc.tpl (renamed from templates/edit_content_inc.tpl)0
-rw-r--r--templates/service_content_icon_inc.tpl3
5 files changed, 40 insertions, 20 deletions
diff --git a/LibertyContent.php b/LibertyContent.php
index e2ef6f2..fd8899d 100644
--- a/LibertyContent.php
+++ b/LibertyContent.php
@@ -3,7 +3,7 @@
* Management of Liberty content
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.184 2007/03/20 17:49:45 spiderr Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.185 2007/03/21 08:58:14 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -2023,7 +2023,7 @@ class LibertyContent extends LibertyBase {
* @return integer Id of the cached item
* @todo LEGACY FUNCTIONS that need to be cleaned / moved / or deprecated & deleted
*/
- function isCached($url) {
+ function isUrlCached($url) {
$query = "select `cache_id` from `".BIT_DB_PREFIX."liberty_link_cache` where `url`=?";
// sometimes we can have a cache_id of 0(?!) - seen it with my own eyes, spiderr
$ret = $this->mDb->getOne($query, array( $url ) );
@@ -2059,7 +2059,7 @@ class LibertyContent extends LibertyBase {
// If stuff inside [] is *really* malformatted, $data
// will be empty. -rlpowell
- if (!$this->isCached( $url ) && $data)
+ if (!$this->isUrlCached( $url ) && $data)
{ global $gBitSystem;
$refresh = $gBitSystem->getUTCTime();
$query = "insert into `".BIT_DB_PREFIX."liberty_link_cache`(`url`,`data`,`refresh`) values(?,?,?)";
@@ -2123,6 +2123,21 @@ class LibertyContent extends LibertyBase {
// -------------------- Cache Funtions -------------------- //
/**
+ * Check if content has a cache file
+ *
+ * @param array $pContentId Content id of cached item
+ * @access public
+ * @return absolute path
+ */
+ function isCached( $pContentId = NULL ) {
+ if( empty( $pContentId ) && @BitBase::verifyId( $this->mContentId ) ) {
+ $pContentId = $this->mContentId;
+ }
+
+ return( is_file( LibertyContent::getCacheFile( $pContentId )));
+ }
+
+ /**
* Get the path where we store liberty cached content
*
* @access public
@@ -2135,7 +2150,7 @@ class LibertyContent extends LibertyBase {
/**
* Get the path to directory where an individual cache item is stored
*
- * @param array $pContentId
+ * @param array $pContentId Content id of cached item
* @access public
* @return path on success, FALSE on failure
*/
@@ -2170,7 +2185,7 @@ class LibertyContent extends LibertyBase {
/**
* Get the path to file where an individual cache item is stored
*
- * @param array $pContentId
+ * @param array $pContentId Content id of cached item
* @access public
* @return filename on success, FALSE on failure
*/
diff --git a/bit_setup_inc.php b/bit_setup_inc.php
index 2c97698..443f6b7 100644
--- a/bit_setup_inc.php
+++ b/bit_setup_inc.php
@@ -3,7 +3,7 @@
* base package include
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
* @package liberty
* @subpackage functions
*/
@@ -18,15 +18,13 @@ $gBitSystem->registerPackage( $registerHash );
require_once( LIBERTY_PKG_PATH.'LibertySystem.php' );
$gLibertySystem->registerService( 'liberty', LIBERTY_PKG_NAME, array(
- 'content_edit_mini_tpl' => 'bitpackage:liberty/edit_content_inc.tpl',
- 'content_edit_tab_tpl' => 'bitpackage:liberty/service_content_edit_tab_inc.tpl',
- 'content_load_sql_function' => 'liberty_content_load_sql',
- 'content_list_sql_function' => 'liberty_content_list_sql',
- // 'content_store_function' => 'liberty_content_store',
- // 'content_edit_function' => 'liberty_content_edit',
- 'content_preview_function' => 'liberty_content_preview',
- // 'content_expunge_function' => 'liberty_content_expunge',
-) );
+ 'content_edit_mini_tpl' => 'bitpackage:liberty/service_content_edit_mini_inc.tpl',
+ 'content_edit_tab_tpl' => 'bitpackage:liberty/service_content_edit_tab_inc.tpl',
+ 'content_icon_tpl' => 'bitpackage:liberty/service_content_icon_inc.tpl',
+ 'content_load_sql_function' => 'liberty_content_load_sql',
+ 'content_list_sql_function' => 'liberty_content_list_sql',
+ 'content_preview_function' => 'liberty_content_preview',
+));
// load only the active plugins unless this is the first run after an install
$current_default_format_guid = $gBitSystem->getConfig( 'default_format' );
@@ -36,6 +34,10 @@ if( empty( $current_default_format_guid ) || empty( $plugin_status ) || $plugin_
} else {
$gLibertySystem->loadActivePlugins();
}
-
$gBitSmarty->assign_by_ref( 'gLibertySystem', $gLibertySystem );
+
+// delete cache file if requested
+if( @BitBase::verifyId( $_REQUEST['refresh_liberty_cache'] )) {
+ LibertyContent::expungeCacheFile( $_REQUEST['refresh_liberty_cache'] );
+}
?>
diff --git a/plugins/format.tikiwiki.php b/plugins/format.tikiwiki.php
index 935d9ce..749b6ac 100644
--- a/plugins/format.tikiwiki.php
+++ b/plugins/format.tikiwiki.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.89 $
+ * @version $Revision: 1.90 $
* @package liberty
*/
global $gLibertySystem;
@@ -117,7 +117,7 @@ function tikiwiki_parse_data( &$pParseHash, &$pCommonObject ) {
$ret = '';
// cache data if we are using liberty cache
- if( $gBitSystem->isFeatureActive( 'liberty_cache_pages' ) && !empty( $pParseHash['content_id'] ) && empty( $pParseHash['no_cache'] ) ) {
+ if( $gBitSystem->isFeatureActive( 'liberty_cache' ) && !empty( $pParseHash['content_id'] ) && empty( $pParseHash['no_cache'] ) ) {
if( $cacheFile = LibertyContent::getCacheFile( $pParseHash['content_id'], $pParseHash['cache_extension'] ) ) {
// write / refresh cache if we are exceeding time limit of cache
if( !is_file( $cacheFile ) || ( $gBitSystem->getConfig( 'liberty_cache' ) < ( time() - filemtime( $cacheFile ) ) ) ) {
@@ -676,7 +676,7 @@ class TikiWikiParser extends BitBase {
global $gBitSystem;
if( $gBitSystem->isFeatureActive( 'liberty_cache_pages' ) && $pCommonObject ) {
foreach ($links as $link) {
- if( !$pCommonObject->isCached( $link ) ) {
+ if( !$pCommonObject->isUrlCached( $link ) ) {
// $pCommonObject->cacheUrl($link);
}
}
@@ -1115,7 +1115,7 @@ class TikiWikiParser extends BitBase {
// prepare link for pattern usage
$link2 = str_replace("/", "\/", preg_quote($link));
- if( $gBitSystem->isFeatureActive( 'liberty_cache_pages') && $pCommonObject->isCached( $link ) ) {
+ if( $gBitSystem->isFeatureActive( 'liberty_cache_pages') && $pCommonObject->isUrlCached( $link ) ) {
//use of urlencode for using cached versions of dynamic sites
$cosa = "<a class=\"bitcache\" href=\"".KERNEL_PKG_URL."view_cache.php?url=".urlencode($link)."\">(cache)</a>";
diff --git a/templates/edit_content_inc.tpl b/templates/service_content_edit_mini_inc.tpl
index f1a70ed..f1a70ed 100644
--- a/templates/edit_content_inc.tpl
+++ b/templates/service_content_edit_mini_inc.tpl
diff --git a/templates/service_content_icon_inc.tpl b/templates/service_content_icon_inc.tpl
new file mode 100644
index 0000000..83b072e
--- /dev/null
+++ b/templates/service_content_icon_inc.tpl
@@ -0,0 +1,3 @@
+{if $gBitSystem->isFeatureActive( 'liberty_cache' ) && $gContent->isCached()}
+ <a title="{tr}Refresh cache{/tr}" href="{$gContent->getDisplayUrl()}&amp;refresh_liberty_cache={$gContent->mContentId}">{biticon ipackage="icons" iname="view-refresh" iexplain="Refresh cache"}</a>
+{/if}