diff options
Diffstat (limited to 'includes/api/ApiQueryProtectedTitles.php')
-rw-r--r-- | includes/api/ApiQueryProtectedTitles.php | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/includes/api/ApiQueryProtectedTitles.php b/includes/api/ApiQueryProtectedTitles.php index e647c39f..14df7446 100644 --- a/includes/api/ApiQueryProtectedTitles.php +++ b/includes/api/ApiQueryProtectedTitles.php @@ -1,10 +1,10 @@ <?php /** - * API for MediaWiki 1.8+ + * * * Created on Feb 13, 2009 * - * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@home.nl + * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@gmail.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,6 +48,10 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { $this->run( $resultPageSet ); } + /** + * @param $resultPageSet ApiPageSet + * @return void + */ private function run( $resultPageSet = null ) { $params = $this->extractRequestParams(); @@ -60,7 +64,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { $this->addFieldsIf( 'pt_expiry', isset( $prop['expiry'] ) ); $this->addFieldsIf( 'pt_create_perm', isset( $prop['level'] ) ); - $this->addWhereRange( 'pt_timestamp', $params['dir'], $params['start'], $params['end'] ); + $this->addTimestampWhereRange( 'pt_timestamp', $params['dir'], $params['start'], $params['end'] ); $this->addWhereFld( 'pt_namespace', $params['namespace'] ); $this->addWhereFld( 'pt_create_perm', $params['level'] ); @@ -77,6 +81,9 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { $count = 0; $result = $this->getResult(); + + $titles = array(); + foreach ( $res as $row ) { if ( ++ $count > $params['limit'] ) { // We've reached the one extra which shows that there are additional pages to be had. Stop here... @@ -110,7 +117,8 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { } if ( isset( $prop['expiry'] ) ) { - $vals['expiry'] = Block::decodeExpiry( $row->pt_expiry, TS_ISO_8601 ); + global $wgContLang; + $vals['expiry'] = $wgContLang->formatExpiry( $row->pt_expiry, TS_ISO_8601 ); } if ( isset( $prop['level'] ) ) { @@ -165,8 +173,8 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { 'dir' => array( ApiBase::PARAM_DFLT => 'older', ApiBase::PARAM_TYPE => array( - 'older', - 'newer' + 'newer', + 'older' ) ), 'start' => array( @@ -196,13 +204,13 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { 'namespace' => 'Only list titles in these namespaces', 'start' => 'Start listing at this protection timestamp', 'end' => 'Stop listing at this protection timestamp', - 'dir' => 'The direction in which to list', + 'dir' => $this->getDirectionDescription( $this->getModulePrefix() ), 'limit' => 'How many total pages to return', 'prop' => array( 'Which properties to get', ' timestamp - Adds the timestamp of when protection was added', - ' user - Adds the user to add the protection', - ' userid - Adds the user id to add the protection', + ' user - Adds the user that added the protection', + ' userid - Adds the user id that added the protection', ' comment - Adds the comment for the protection', ' parsedcomment - Adds the parsed comment for the protection', ' expiry - Adds the timestamp of when the protection will be lifted', @@ -222,7 +230,11 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { ); } + public function getHelpUrls() { + return 'https://www.mediawiki.org/wiki/API:Protectedtitles'; + } + public function getVersion() { - return __CLASS__ . ': $Id: ApiQueryProtectedTitles.php 71838 2010-08-28 01:18:18Z reedy $'; + return __CLASS__ . ': $Id: ApiQueryProtectedTitles.php 104449 2011-11-28 15:52:04Z reedy $'; } } |