2 rcs_id('$Id: WantedPagesIter.php,v 1.1 2004-11-20 17:35:58 rurban Exp $');
4 //require_once('lib/WikiDB/backend.php');
7 * This iterator will work with any WikiDB_backend
8 * which has a working get_links(,'links_from') method.
10 * This is mostly here for testing, 'cause it's slow,slow,slow.
12 class WikiDB_backend_dumb_WantedPagesIter
13 extends WikiDB_backend_iterator
15 function WikiDB_backend_dumb_WantedPagesIter(&$backend, &$all_pages, $exclude='', $sortby=false, $limit=false) {
16 $this->_allpages = $all_pages;
17 $this->_allpages_array = $all_pages->asArray();
18 $this->_backend = &$backend;
19 if (!is_array($exclude))
20 $this->exclude = $exclude ? PageList::explodePageList($exclude) : array();
22 $this->exclude = $exclude;
26 while ($page = $this->_allpages->next()) {
27 $pagename = $page['pagename'];
28 $links = $this->_backend->get_links($pagename, false);
29 while ($link = $links->next()) {
30 if ($this->exclude and in_array($link['pagename'], $this->exclude)) continue;
31 // better membership for a pageiterator???
32 if (! in_array($link['pagename'], $this->_allpages_array)) {
34 $link['wantedfrom'] = $pagename;
44 unset($this->_allpages_array);
45 $this->_allpages->free();
54 // c-hanging-comment-ender-p: nil
55 // indent-tabs-mode: nil