From b9b85843572bf283f48285001e276ba7e61b63f6 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 22 Feb 2009 13:37:51 +0100 Subject: updated to MediaWiki 1.14.0 --- includes/Category.php | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'includes/Category.php') diff --git a/includes/Category.php b/includes/Category.php index acafc47a..78567add 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -1,6 +1,8 @@ mTitle; } + /** + * Fetch a TitleArray of up to $limit category members, beginning after the + * category sort key $offset. + * @param $limit integer + * @param $offset string + * @return TitleArray object for category members. + */ + public function getMembers( $limit = false, $offset = '' ) { + $dbr = wfGetDB( DB_SLAVE ); + + $conds = array( 'cl_to' => $this->getName(), 'cl_from = page_id' ); + $options = array( 'ORDER BY' => 'cl_sortkey' ); + if( $limit ) $options[ 'LIMIT' ] = $limit; + if( $offset !== '' ) $conds[] = 'cl_sortkey > ' . $dbr->addQuotes( $offset ); + + return TitleArray::newFromResult( + $dbr->select( + array( 'page', 'categorylinks' ), + array( 'page_id', 'page_namespace','page_title', 'page_len', + 'page_is_redirect', 'page_latest' ), + $conds, + __METHOD__, + $options + ) + ); + } + /** Generic accessor */ private function getX( $key ) { if( !$this->initialize() ) { @@ -228,7 +257,7 @@ class Category { } $cond1 = $dbw->conditional( 'page_namespace='.NS_CATEGORY, 1, 'NULL' ); - $cond2 = $dbw->conditional( 'page_namespace='.NS_IMAGE, 1, 'NULL' ); + $cond2 = $dbw->conditional( 'page_namespace='.NS_FILE, 1, 'NULL' ); $result = $dbw->selectRow( array( 'categorylinks', 'page' ), array( 'COUNT(*) AS pages', -- cgit v1.2.3-54-g00ecf