summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialPagesWithProp.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-06-04 07:31:04 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-06-04 07:58:39 +0200
commitf6d65e533c62f6deb21342d4901ece24497b433e (patch)
treef28adf0362d14bcd448f7b65a7aaf38650f923aa /includes/specials/SpecialPagesWithProp.php
parentc27b2e832fe25651ef2410fae85b41072aae7519 (diff)
Update to MediaWiki 1.25.1
Diffstat (limited to 'includes/specials/SpecialPagesWithProp.php')
-rw-r--r--includes/specials/SpecialPagesWithProp.php49
1 files changed, 33 insertions, 16 deletions
diff --git a/includes/specials/SpecialPagesWithProp.php b/includes/specials/SpecialPagesWithProp.php
index f5b19cc6..670a3973 100644
--- a/includes/specials/SpecialPagesWithProp.php
+++ b/includes/specials/SpecialPagesWithProp.php
@@ -83,11 +83,13 @@ class SpecialPagesWithProp extends QueryPage {
*
* @param string $search Prefix to search for
* @param int $limit Maximum number of results to return
+ * @param int $offset Number of pages to skip
* @return string[] Matching subpages
*/
- public function prefixSearchSubpages( $search, $limit = 10 ) {
- $subpages = array_keys( $this->getExistingPropNames() );
- return self::prefixSearchArray( $search, $limit, $subpages );
+ public function prefixSearchSubpages( $search, $limit, $offset ) {
+ $subpages = array_keys( $this->queryExistingProps( $limit, $offset ) );
+ // We've already limited and offsetted, set to N and 0 respectively.
+ return self::prefixSearchArray( $search, count( $subpages ), $subpages, 0 );
}
/**
@@ -154,23 +156,38 @@ class SpecialPagesWithProp extends QueryPage {
public function getExistingPropNames() {
if ( $this->existingPropNames === null ) {
- $dbr = wfGetDB( DB_SLAVE );
- $res = $dbr->select(
- 'page_props',
- 'pp_propname',
- '',
- __METHOD__,
- array( 'DISTINCT', 'ORDER BY' => 'pp_propname' )
- );
- $propnames = array();
- foreach ( $res as $row ) {
- $propnames[$row->pp_propname] = $row->pp_propname;
- }
- $this->existingPropNames = $propnames;
+ $this->existingPropNames = $this->queryExistingProps();
}
return $this->existingPropNames;
}
+ protected function queryExistingProps( $limit = null, $offset = 0 ) {
+ $opts = array(
+ 'DISTINCT', 'ORDER BY' => 'pp_propname'
+ );
+ if ( $limit ) {
+ $opts['LIMIT'] = $limit;
+ }
+ if ( $offset ) {
+ $opts['OFFSET'] = $offset;
+ }
+
+ $res = wfGetDB( DB_SLAVE )->select(
+ 'page_props',
+ 'pp_propname',
+ '',
+ __METHOD__,
+ $opts
+ );
+
+ $propnames = array();
+ foreach ( $res as $row ) {
+ $propnames[$row->pp_propname] = $row->pp_propname;
+ }
+
+ return $propnames;
+ }
+
protected function getGroupName() {
return 'pages';
}