[pmwiki-devel] When Readpage fails

Patrick R. Michaud pmichaud at pobox.com
Fri Mar 6 15:40:21 CST 2009


On Fri, Mar 06, 2009 at 08:27:42PM +0100, Peter Bowers wrote:
> What is the normal way of checking whether ReadPage() has been unsuccessful? 
> (Or, by extension, RetrieveAuthPage())
> 
> I see lots of this:
> 
> if (!$page) ...
> 
> but my reading of ReadPage() seems to indicate that a failed read will result
> in an array ('ctime' => now, 'time' => now).
> 
> If I'm interpreting that correctly, then what's the preferred way to check if
> the read failed?  (I'm actually more interested in the results of
> RetrieveAuthpage() than ReadPage().)

RetrieveAuthPage() returns false if the current visitor doesn't
have authorization to view a given page, otherwise it returns
the page that it read.

PmWiki doesn't consider reading a non-existent page to be a "failure" --
non-existent pages are simply treated as being empty.  To check for 
a page's existence, use PageExists() .

Pm



More information about the pmwiki-devel mailing list