diff options
Diffstat (limited to 'includes/api/ApiQueryAllPages.php')
-rw-r--r-- | includes/api/ApiQueryAllPages.php | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index 16cc31d2..d718b967 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -69,10 +69,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { if ( !is_null( $params['continue'] ) ) { $cont = explode( '|', $params['continue'] ); - if ( count( $cont ) != 1 ) { - $this->dieUsage( "Invalid continue param. You should pass the " . - "original value returned by the previous query", "_badcontinue" ); - } + $this->dieContinueUsageIf( count( $cont ) != 1 ); $op = $params['dir'] == 'descending' ? '<' : '>'; $cont_from = $db->addQuotes( $cont[0] ); $this->addWhere( "page_title $op= $cont_from" ); @@ -120,7 +117,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { if ( count( $params['prtype'] ) || $params['prexpiry'] != 'all' ) { $this->addTables( 'page_restrictions' ); $this->addWhere( 'page_id=pr_page' ); - $this->addWhere( 'pr_expiry>' . $db->addQuotes( $db->timestamp() ) ); + $this->addWhere( "pr_expiry > {$db->addQuotes( $db->timestamp() )} OR pr_expiry IS NULL" ); if ( count( $params['prtype'] ) ) { $this->addWhereFld( 'pr_type', $params['prtype'] ); @@ -138,8 +135,6 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { } elseif ( $params['prfiltercascade'] == 'noncascading' ) { $this->addWhereFld( 'pr_cascade', 0 ); } - - $this->addOption( 'DISTINCT' ); } $forceNameTitleIndex = false; @@ -149,6 +144,8 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { $this->addWhere( "pr_expiry != {$db->addQuotes( $db->getInfinity() )}" ); } + $this->addOption( 'DISTINCT' ); + } elseif ( isset( $params['prlevel'] ) ) { $this->dieUsage( 'prlevel may not be used without prtype', 'params' ); } @@ -226,7 +223,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { 'to' => null, 'prefix' => null, 'namespace' => array( - ApiBase::PARAM_DFLT => 0, + ApiBase::PARAM_DFLT => NS_MAIN, ApiBase::PARAM_TYPE => 'namespace', ), 'filterredir' => array( @@ -336,7 +333,6 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { return array_merge( parent::getPossibleErrors(), array( array( 'code' => 'params', 'info' => 'Use "gapfilterredir=nonredirects" option instead of "redirects" when using allpages as a generator' ), array( 'code' => 'params', 'info' => 'prlevel may not be used without prtype' ), - array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ), ) ); } @@ -351,7 +347,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { 'Show info about 4 pages starting at the letter "T"', ), 'api.php?action=query&generator=allpages&gaplimit=2&gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content' => array( - 'Show content of first 2 non-redirect pages begining at "Re"', + 'Show content of first 2 non-redirect pages beginning at "Re"', ) ); } @@ -359,8 +355,4 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/API:Allpages'; } - - public function getVersion() { - return __CLASS__ . ': $Id$'; - } } |