From: Sam Reed Date: Sat, 15 Jan 2011 00:10:57 +0000 (+0000) Subject: Last bits of bug 24650 Fix API to work with categorylinks changes X-Git-Tag: 1.31.0-rc.0~32527 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=610c943cd254de3c4e1eada6f8caaedf636cc9ea;p=lhc%2Fweb%2Fwiklou.git Last bits of bug 24650 Fix API to work with categorylinks changes Allow optional output of cl_sortkey_prefix (will anyone needed it, no idea) --- diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index 98c285e4b9..7b7586ada0 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -77,12 +77,15 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { $fld_ids = isset( $prop['ids'] ); $fld_title = isset( $prop['title'] ); $fld_sortkey = isset( $prop['sortkey'] ); + $fld_sortkeyprefix = isset( $prop['sortkeyprefix'] ); $fld_timestamp = isset( $prop['timestamp'] ); $fld_type = isset( $prop['type'] ); if ( is_null( $resultPageSet ) ) { - $this->addFields( array( 'cl_from', 'cl_sortkey', 'page_namespace', 'page_title' ) ); + $this->addFields( array( 'cl_from', 'page_namespace', 'page_title' ) ); $this->addFieldsIf( 'page_id', $fld_ids ); + $this->addFieldsIf( 'cl_sortkey_prefix', $fld_sortkeyprefix ); + $this->addFieldsIf( 'cl_sortkey', $fld_sortkey ); } else { $this->addFields( $resultPageSet->getPageTableFields() ); // will include page_ id, ns, title $this->addFields( array( 'cl_from', 'cl_sortkey' ) ); @@ -169,6 +172,9 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { if ( $fld_sortkey ) { $vals['sortkey'] = $row->cl_sortkey; } + if ( $fld_sortkeyprefix ) { + $vals['sortkeyprefix'] = $row->cl_sortkey_prefix; + } if ( $fld_type ) { $vals['type'] = $row->cl_type; } @@ -227,6 +233,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { 'ids', 'title', 'sortkey', + 'sortkeyprefix', 'type', 'timestamp', ) @@ -285,11 +292,12 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { 'pageid' => 'Page ID of the category to enumerate. Cannot be used together with cmtitle', 'prop' => array( 'What pieces of information to include', - ' ids - Adds the page ID', - ' title - Adds the title and namespace ID of the page', - ' sortkey - Adds the sortkey used for the category', - ' type - Adds the type that the page has been categorised as', - ' timestamp - Adds the timestamp of when the page was included', + ' ids - Adds the page ID', + ' title - Adds the title and namespace ID of the page', + ' sortkey - Adds the sortkey used for the category (note, may be non human readable)', + ' sortkeyprefix - Adds the sortkey prefix used for the category', + ' type - Adds the type that the page has been categorised as', + ' timestamp - Adds the timestamp of when the page was included', ), 'namespace' => 'Only include pages in these namespaces', 'type' => 'What type of category members to include',