I wrote a function that erases the entire cache.
------------------------------------------------------
function RemoveDir($dir, $DeleteMe) { //stolen from php.net (see
unlink)
if(!$dh = @opendir($dir)) return;
while (false !== ($obj = readdir($dh))) {
if($obj=='.' || $obj=='..') continue;
if (!...@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj,
true);
}
closedir($dh);
if ($DeleteMe){
@rmdir($dir);
}
}
function BOLTFdeletecache($args, $zone='')
{ BOLTXdeletecache('');
}
function BOLTXdeletecache($value,$zone='')
{ $BOLThtmlDir = BOLTconfig('BOLThtmlDir', 'html');
RemoveDir($BOLThtmlDir, false);
}
--------------------
I just add a "deletecache" command to the logout action. And I have
created a "action.refresh" which executes the BOLTFdeletecache and
then forwards to the current page ({p}).
This way, I can modify my site, and the cache gets refreshed.
Yes, when you use a form, the cache gets refreshed
Yes, when you press view, the cache gets refreshed
but..
- if you upload a picture (changing the upload link to a real
picture), this does not happen!
- if I do not refresh the cache when I login/logout, I get no actions
as admin, of the viewers get actions whereas the shouldn't.
On Oct 29, 9:01 am, The Editor <[email protected]> wrote:
> Thanks so much Mark. I'll add it in right this second.
>
> Cheers,
> Dan
>
> On Wed, Oct 28, 2009 at 11:36 PM, Mark Marijnissen
>
>
>
> <[email protected]> wrote:
>
> > I have found and fixed a caching bug.
>
> > action.view did not refresh because it did not delete the HTML file.
>
> > OLD CODE lines 77-98 from engine.php:
> > ------------------------------------------------------------
> > ## IF HTML CACHING ENABLED LOOKS FOR HTML PAGE AND RETURNS
> > if (BOLTconfig('BOLTcacheHTML', 'false') == 'true') {
>
> > if ($_GET['action'] == '' && $pageArray[0] != 'action' && $_POST ==
> > Array()) {
> > $BOLThtmlDir = BOLTconfig('BOLThtmlDir', 'html');
> > if (file_exists("$BOLThtmlDir/$pageLink.html")) {
>
> > ....BLABLABLA
>
> > if ($_GET['action'] == 'view' && file_exists("$BOLThtmlDir/
> > $pageLink.html")) unlink("$BOLThtmlDir/$pageLink.html");
> > }
> > ------------------
>
> > NEW CODE
> > ---------------------
>
> > ## IF HTML CACHING ENABLED LOOKS FOR HTML PAGE AND RETURNS
> > if (BOLTconfig('BOLTcacheHTML', 'false') == 'true') {
> > $BOLThtmlDir = BOLTconfig('BOLThtmlDir', 'html');
> > if ($_GET['action'] == '' && $pageArray[0] != 'action' && $_POST ==
> > Array()) {
>
> > if (file_exists("$BOLThtmlDir/$pageLink.html")) {
>
> > ....BLABLABLA
>
> > if ($_GET['action'] == 'view' && file_exists("$BOLThtmlDir/
> > $pageLink.html")) unlink("$BOLThtmlDir/$pageLink.html");
> > }
> > ------------------
>
> > Notice how the $BOLThtmlDir has moved an "if" higher. The last line,
> > that unlinked the cached copy, needs the $BOLThtmlDir... but at this
> > moment, it is empty! (Action can not both be '' and 'view' at the same
> > time!).
> > $BOLThtmlDir never gets set!
>
> > -------------------
>
> > Hope this will be in the next release!
>
> > cheers, Mark
>
> > On Oct 28, 8:58 pm, Mark Marijnissen <[email protected]>
> > wrote:
> >> I have noticed two things (bugs) about caching.
>
> >> First, If i enabled caching. This happens when I log on, and when I
> >> have all actions available. So, naturally, the pages get cached with
> >> all actions underneath! However, for the ordinary visitor, these
> >> shouldn't be visible.
>
> >> Thats not handy, but predictable. When I run the action view, I get
> >> the right content... but the cache is not updated! Because if I view
> >> the page normally again, the actions are back..
>
> >> Also, I have set the "noCacheGroup: admin". This should mean that
> >> pages are not cached when I am logged in (BOLTadmin, superadmin, or
> >> how do you call that?)... but this is not the case!
>
> >> Oh no!!
>
> >> very annoying because the cache works so wonderful, it really speeds
> >> things up A LOT! And since a lot of pages do not change.. this is
> >> perfect!
>
> >> Also, I have a commentbox on some of my pages. I would like them to
> >> refresh the cache, is there a way to do this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---