From 9ca4552a4aaa19e441e0b86580db23d5f90534e1 Mon Sep 17 00:00:00 2001 From: lakka Date: Fri, 15 Feb 2002 14:45:49 +0000 Subject: [PATCH] Orphaned pages plugin. What more is there to say? git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@2057 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/plugin/OrphanedPages.php | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 lib/plugin/OrphanedPages.php diff --git a/lib/plugin/OrphanedPages.php b/lib/plugin/OrphanedPages.php new file mode 100644 index 000000000..fc3a64d60 --- /dev/null +++ b/lib/plugin/OrphanedPages.php @@ -0,0 +1,84 @@ + false, + 'include_empty' => false, + 'exclude' => '', + 'info' => '' + ); + } + // 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) { + extract($this->getArgs($argstr, $request)); + + $pagelist = new PageList($info, $exclude); + if (!$noheader) + $pagelist->setCaption(_("Orphaned Pages in this wiki (%d total):")); + $allpages_iter = $dbi->getAllPages($include_empty); + + // There's probably a more efficient way to do this (eg a tailored SQL query via the + // backend, but this does the job + + while ($page = $allpages_iter->next()) + { + $links_iter = $page->getLinks(); + // test for absence of backlinks + if (!$links_iter->next()) + $pagelist->addPage($page); + } + return $pagelist; + + } + +}; + +// Local Variables: +// mode: php +// tab-width: 8 +// c-basic-offset: 4 +// c-hanging-comment-ender-p: nil +// indent-tabs-mode: nil +// End: +?> -- 2.45.0