This is a good function Mark, and should be made into a plugin. Some
would find it useful. Could you bother to do this?

As for your issues:

1) I've looked at the code on the noCacheGroup thing and to be honest
I'm not sure what it is supposed to do. I think it was a hook for
potential plugins. It could be reworked to do something more like what
you have in mind.  Regardless, we definitely need a way to block
caching--when logged in as certain users.

2)  You should be able to add a [session touch {p}] to any form to get
it to update the cache. It seems better to have an easy way to update
a single page than to have to regenerate the entire cache folder.
Likewise, we could have a simple touch action, perhaps nothing more
than this:

action.touch:

[(touch {p})]
<(touch {p})>

Then you click your.page&action=touch and it instantly gets updated.

3) As for commentboxes, I think they should update automatically when
the form submits, because it gives the newer timestamp on the page.
Are you sure it is not doing this? Are you comments in subpages or on
the same page you are viewing.

I'll see what I can come up with--though I'm very open to suggestions.
 Will try to make a few enhancements as soon as I get back from
running into town.

Cheers,
Dan



On Thu, Oct 29, 2009 at 7:32 AM, Mark Marijnissen
<[email protected]> wrote:
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to