[dokuwiki] Re: p_cached_instructions()

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 15 Oct 2010 20:22:34 +0100

On 15 Oct 2010, at 19:38, Chris Tapp wrote:

> I've got some code that calls p_cached_instructions() to get the instructions 
> for a page. The call is:
> 
> $ins = p_cached_instructions ( $file, false, $resolved_id );
> 
> where $file is the wikiFN ( $resolved_id ) and $resolved_id is the 
> resolve_pageid() for the page of interest.
> 
> Some pages are returning instructions, but some return an empty array. If I 
> call p_get_instructions() when I get an empty array I then get the 
> instructions for the page.
> 
> Is this as expected? I thought that p_cached_instructions() triggered a call 
> to p_get_instructions() if there are no cached instructions for the page.
> 


Basically it should be pretty much as you expect.  

In checking the code, I've noticed that it works on the assumption that if 
there is cached instruction file its contains valid instructions.  If the file 
exists but is empty, you'll get an empty array.  If the file exists and isn't 
unserializable you should get false. Ideally the code should be made robust 
enough to handle those two situations gracefully.  Feel free to open a report 
of flyspray.

To investigate, figure out the cached instruction file name and take a look at 
it.

- Chris

Other related posts: