3 * Copyright © 2001 Jeff Dairiki
5 * This file is part of PhpWiki.
7 * PhpWiki is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * PhpWiki is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 * SPDX-License-Identifier: GPL-2.0-or-later
25 require_once 'lib/WikiDB/backend.php';
28 * This backlink iterator will work with any WikiDB_backend
29 * which has a working get_links(,'links_from') method.
31 * This is mostly here for testing, 'cause it's slow,slow,slow.
34 class WikiDB_backend_dumb_BackLinkIter
35 extends WikiDB_backend_iterator
37 function __construct($backend, $all_pages, $pagename)
39 $this->_pages = $all_pages;
40 $this->_backend = &$backend;
41 $this->_target = $pagename;
46 while ($page = $this->_pages->next()) {
47 $pagename = $page['pagename'];
48 $links = $this->_backend->get_links($pagename, false);
49 while ($link = $links->next()) {
50 if ($link['pagename'] == $this->_target) {
60 $this->_pages->free();