false, 'include_empty' => false, 'exclude' => '', 'info' => '', 'sortby' => false, 'limit' => 0, 'paging' => 'auto', ); } // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor,markup or all // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); // There's probably a more efficient way to do this (eg a // tailored SQL query via the backend, but this does the job $allpages_iter = $dbi->getAllPages($include_empty); $pages = array(); while ($page = $allpages_iter->next()) { $links_iter = $page->getBackLinks(); // Test for absence of backlinks. If a page is linked to // only by itself, it is still an orphan $parent = $links_iter->next(); if (!$parent // page has no parents or (($parent->getName() == $page->getName()) and !$links_iter->next()) ) // or page has only itself as a parent { $pages[] = $page; } } $args['count'] = count($pages); $pagelist = new PageList($info, $exclude, $args); if (!$noheader) $pagelist->setCaption(_("Orphaned Pages in this wiki (%d total):")); // deleted pages show up as version 0. if ($include_empty) $pagelist->_addColumn('version'); list($offset, $pagesize) = $pagelist->limit($args['limit']); if (!$pagesize) $pagelist->addPageList($pages); else { for ($i = $offset; $i < $offset + $pagesize - 1; $i++) { if ($i >= $args['count']) break; $pagelist->addPage($pages[$i]); } } return $pagelist; } } // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: