lupo49/dokuwiki-plugin-orphanswanted

Wanted Pages lists existing pages

Kempeth opened this issue · 0 comments

I've installed this plugin on Jack Jackrum and used ~~ORPHANSWANTED:wanted~~ to search for missing pages.

But the list showed several pages that exist.

I've narrowed the issue down to the _get_page_data method. The method p_get_metadata frequently returns links with an incorrect state (false instead of true). When that happens the inner loop unsets the "exists" key in the $page structure even though we already know from the first loop through $all_pages that the pages exists.

changing

$pages[$name]['exists'] = $exists;
$pages[$name]['links'] = isset($pages[$name]['links']) ? $pages[$name]['links'] + 1 : 1;

to

if (!array_key_exists($name,$pages))
    $pages[$name]['exists'] = $exists;
$pages[$name]['links'] = isset($pages[$name]['links']) ? $pages[$name]['links'] + 1 : 1;

on lines 44 & 45. Fixes this.

There are still some instances where the indexer has not yet detected that a page exist but with this fix, navigating to the false positive corrects that mistake aswell.