[pmwiki-users] Perplexing Page Exist problem...

J. Meijer commentgg at hotmail.com
Tue Aug 22 21:40:22 CDT 2006



You must have been living in a cave. PageExists relies on PHP's file_exists(), which in turn relies on a cache of the state of the underlying file system. 

You might want to relax that mind-muscle :) 

HTH,

jm





Detail: So you write a page and PHP doesn't update the cache. When you then inform yourself through a PageExists(), the state is read from the cache and you'll get false. 

http://www.php.net/manual/en/function.file-exists.php says this: 
  
  Note: The results of this function are cached. See clearstatcache() for more details.

http://www.php.net/manual/en/function.clearstatcache.php states:

  "Note: This function caches information about specific filenames, so you only need to call clearstatcache() if you are performing multiple operations on the same filename and require the information about that particular file to not be cached."

  "Affected functions include stat(), lstat(), file_exists(), is_writable(), is_readable(), is_executable(), is_file(), is_dir(), is_link(), filectime(), fileatime(), filemtime(), fileinode(), filegroup(), fileowner(), filesize(), filetype(), and fileperms()."





On 8/22/06, The Editor <editor at fast.st> wrote:

    I am working out one strange twist in the FAST Data project.  Maybe
    someone can help me figure it out.

    I'll be releasing v0.99 just as soon as this is done.  It includes an
    enumerator (for numbered forum threads, or issue tracking, etc), an
    option to hide field values, and an append feature perfect for comment
    boxes, etc, plus always a few other fixes and stuff.  It's working
    great--almost.  And this release will include the last of the
    capabilities on my to do list.

    The problem is I have two switches, one called SaveData and one called
    AppendData.  Both work fine by themselves, and if the datapage exists,
    both work fine together. But, if both switches are called on a form
    and the datapage does not exist, whichever one comes second overrides
    the first.

    Both switches are very similar.  Both check to see if the datapage
    exists, both parse various data fields and then both saves/appends it,
    creating the datapage if it doesn't yet exist.

    When whichever switch is second is called (It doesn't matter which is
    first or second), it acts as if the page still does not exists, though
    the first switch clearly created it .  Anyway, that conditional
    failure causes the data saved by the first switch to be overwritten.

    Why might the PageExists() function be failing?  Is it an indexing
    problem or does this function actually go out and check for the
    existence of a page?  I am using PageIndexUpdate("$datapage"); at the
    end of both switches, so the page should be reindexed, but perhaps the
    two switches are happening too fast--and there's not time to get it
    indexed. Is there some way to work around this?

    I included the two switches below if it helps, but I'm pretty sure I
    have the problem narrowed down to the critical issue.  Thanks again
    all!

    Cheers,
    Caveman


_________________________________________________________________
Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today!
http://get.live.com/toolbar/overview



More information about the pmwiki-users mailing list