Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4997
categories.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:15 PM
2014-11-21 22:15:05 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
categories.diff
View Options
Index: includes/Category.php
===================================================================
--- includes/Category.php (revision 38133)
+++ includes/Category.php (working copy)
@@ -192,6 +192,33 @@
return $this->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() ) {
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4560
Default Alt Text
categories.diff (1 KB)
Attached To
Mode
T16923: Add methods for getting an array of titles from a category
Attached
Detach File
Event Timeline
Log In to Comment