From 02b730fafb7b61c86e6f7ac45f0ab3aae598c56d Mon Sep 17 00:00:00 2001 From: rurban Date: Thu, 12 Jan 2006 16:38:07 +0000 Subject: [PATCH] add page method listRelations() fix bug #1327912 numeric pagenames can break plugins (Joachim Lous) git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@5002 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/WikiDB.php | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/lib/WikiDB.php b/lib/WikiDB.php index b4f20b7c9..1968273f6 100644 --- a/lib/WikiDB.php +++ b/lib/WikiDB.php @@ -1,5 +1,5 @@ _backend, "list_relations")) + return $this->_backend->list_relations(); + $iter = $this->getAllPages(false, false, false, $exclude); + while ($page = $iter->next()) { + $reliter = $page->getRelations(); + $names = array(); + while ($rel = $reliter->next()) { + $names[] = $rel->getName(); + } + $relations = array_merge($relations, $names); + $reliter->free(); + } + $iter->free(); + return $relations; + } /** * Call the appropriate backend method. @@ -657,8 +678,9 @@ class WikiDB_Page trigger_error("empty pagename", E_USER_WARNING); return false; } - } else + } else { assert(is_string($pagename) and $pagename != ''); + } } /** @@ -1812,12 +1834,14 @@ class WikiDB_PageIterator return false; $pagename = &$next['pagename']; + if (!is_string($pagename)) // Bug #1327912 fixed by Joachim Lous + $pagename = strval($pagename); if (!$pagename) { trigger_error('empty pagename in WikiDB_PageIterator::next()', E_USER_WARNING); var_dump($next); return false; } - // there's always hits, but we cache only if more + // There's always hits, but we cache only if more // (well not with file, cvs and dba) if (isset($next['pagedata']) and count($next['pagedata']) > 1) { $this->_wikidb->_cache->cache_data($next); @@ -2230,6 +2254,11 @@ function _sql_debuglog_shutdown_function() { } // $Log: not supported by cvs2svn $ +// Revision 1.138 2005/11/14 22:27:07 rurban +// add linkrelation support +// getPageLinks returns now an array of hashes +// pass stoplist through iterator +// // Revision 1.137 2005/10/12 06:16:18 rurban // better From header // -- 2.45.0