splitbrain/dokuwiki — pull request #148 by michitux (2012-12-04 15:27:44+00:00)
Title: Indexer: Add the PID to INDEXER_PAGE_ADD and add getPID/getPageFromPID functions

As discussed in pull request #95 I've added the PID to the INDEXER_PAGE_ADD-event and added functions for getting the PID from a page ID and for getting the page ID from a PID.

This also adds a cache for the 10 most recently loaded PIDs.

As this cache needs to be cleaned between test cases I made $Indexer global in idx_get_indexer() in order to let PHPUnit unset it. I couldn't think of a better way to avoid problems with the PID cache not being invalidated in test cases but I don't really like it.

One could of course also simply don't use a cache, i.e. only merge the first two commits. I just thought it could make sense as during each indexer invocation the function is called three times for the same page.