From: <ru...@us...> - 2010-06-08 10:42:15
|
Revision: 7495 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7495&view=rev Author: rurban Date: 2010-06-08 10:42:09 +0000 (Tue, 08 Jun 2010) Log Message: ----------- support backend slicing Modified Paths: -------------- trunk/lib/WikiDB/backend/dbaBase.php trunk/lib/WikiDB/backend/file.php trunk/lib/WikiDB/backend.php Modified: trunk/lib/WikiDB/backend/dbaBase.php =================================================================== --- trunk/lib/WikiDB/backend/dbaBase.php 2010-06-08 10:41:29 UTC (rev 7494) +++ trunk/lib/WikiDB/backend/dbaBase.php 2010-06-08 10:42:09 UTC (rev 7495) @@ -355,8 +355,7 @@ } return new WikiDB_backend_dbaBase_pageiter ($this, $pages, - array('sortby'=>$sortby/*, - 'limit' =>$limit*/)); + array('sortby'=>$sortby)); // already limited } function set_links($pagename, $links) { Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2010-06-08 10:41:29 UTC (rev 7494) +++ trunk/lib/WikiDB/backend/file.php 2010-06-08 10:42:09 UTC (rev 7495) @@ -695,9 +695,10 @@ class WikiDB_backend_file_iter extends WikiDB_backend_iterator { - function WikiDB_backend_file_iter(&$backend, &$query_result) { + function WikiDB_backend_file_iter(&$backend, &$query_result, $options=array()) { $this->_backend = &$backend; $this->_result = $query_result; + $this->_options = $options; if (count($this->_result) > 0) reset($this->_result); Modified: trunk/lib/WikiDB/backend.php =================================================================== --- trunk/lib/WikiDB/backend.php 2010-06-08 10:41:29 UTC (rev 7494) +++ trunk/lib/WikiDB/backend.php 2010-06-08 10:42:09 UTC (rev 7495) @@ -692,6 +692,15 @@ return $result; } } + + /** + * limit - if empty the pagelist iterator will do nothing. + * Some backends limit the result set itself (dba, file, flatfile), + * Some SQL based leave it to WikiDB/PageList - deferred filtering in the iterator. + */ + function limit() { + return empty($this->_options['limit']) ? 0 : $this->_options['limit']; + } /** * Release resources held by this iterator. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |