[pmwiki-users] Working solution for CMS style interface with IMS caching

Patrick R. Michaud pmichaud at pobox.com
Thu Aug 10 13:51:38 CDT 2006


On Sun, Aug 06, 2006 at 06:08:08PM -0400, Henrik Bechmann wrote:
> Patrick,
> 
> I have implemented a working solution for differentiation of page layout 
> based on native PmWiki password protection state, in the presence of IMS 
> caching, as follows:
> 
> In my farmconfig.php I have:
> 
> $HandleActions['logout'] = 'CacheLogoutHandler';
> function CacheLogoutHandler($pagename, $auth = 'read') {
> global $EnableIMSCaching;
> $EnableIMSCaching = 0;
> HandleLogoutA($pagename, $auth); # call the legit handler
> }

I don't think this function really does anything, because
$EnableIMSCaching only has an effect for the actions given
by $CacheActions (which defaults to 'browse', 'diff', and 'print').
So, ?action=logout *already* acts as if $EnableIMSCaching is set to zero,
even without the above function.

> include_once('local/config.php');
> $pagename = ResolvePageName($pagename);
> $isEditAuthorized = (boolean)RetrieveAuthPage($pagename, 'edit', false, 
> READPAGE_CURRENT);

Having looked at the pmwiki code a bit more, it occurs to me
that a far better way to get $isEditAuthorized is to use 
PmWiki's built-in function for it (which I had forgotten about):

    $pagename = ResolvePageName($pagename);
    $isEditAuthorized = CondAuth($pagename, 'edit');

I'd also like to go through the pmwiki.org pages and replace
any recommendations we've made to use RetrieveAuthPage() to
instead use CondAuth (which is more robust).


> All of this works as expected in Internet Explorer. The Firefox cache is 
> not as responsive however, and requires special procedures. Also, it 
> turns out that PmWiki deletes the Author Name cookie with the logout 
> operation (which I do not think is desirable in most situations).

I'll answer the author name cookie issue in my next message.

However, for now I'll just note that as currently written, IMS
caching simply won't work with login/logout, but I'll fix that
for 2.1.13.  This should eliminate the need to put any special
notices for authors, or require authors to manually refresh
pages.

Thanks,

Pm




More information about the pmwiki-users mailing list