Recent Changes - Search:

PITS main list

edit sidebar

Main sidebar



Summary: PageExists cache $PageExistsCache becomes stale after new page created
Created: 2017-01-09 16:33
Status: Discussion
Category: Bug
From: Peter Kay
Priority: 3
Version: 2.2.93

Description: If you run PageExists("Main.Test"); and then use UpdatePage to create Main.Test, any future calls to PageExists will still return false, because $PageExistsCache has not been updated after UpdatePage.

The reverse might also happen: if a page is deleted after PageExists() is called, the cache will show the page still exists.

Peter Kay January 09, 2017, at 04:33 PM

One easy solution would be to add

function ClearPageExistsCache($pagename) {



And add the line "ClearPageExistsCache($pagename);" at the very end of either PostPage() or SaveAttributes().

Peter Kay January 09, 2017, at 04:44 PM

After reviewing the entry, I may have to decline this feature request. Currently nothing prevents the core PmWiki to function properly, only a recipe may require the additional feature. Also, a recipe may have a number of different ways to create or delete pages: UpdatePage(), PostPage(), WritePage(), $WikiDir->delete() or their own implementation; a custom PageStore class may do it in more ways; additionally, UpdatePage calls two functions that may create pages: AutoCreateTargets() and PostRecentChanges(). For this reason, I'll leave it to the recipe developer who needs to clear the cache to do it when necessary. If you feel this should be documented in some way, feel free to do it. --Petko January 11, 2017, at 12:39 PM

Edit - History - Print - Recent Changes - Search
Page last modified on January 11, 2017, at 12:39 PM