<?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
$this->run( $resultPageSet );
}
+ /**
+ * @param $resultPageSet ApiPageSet
+ * @return void
+ */
private function run( $resultPageSet = null ) {
$params = $this->extractRequestParams();
$this->addFields( array( 'pt_namespace', 'pt_title', 'pt_timestamp' ) );
$prop = array_flip( $params['prop'] );
- $this->addFieldsIf( 'pt_user', isset( $prop['user'] ) );
+ $this->addFieldsIf( 'pt_user', isset( $prop['user'] ) || isset( $prop['userid'] ) );
$this->addFieldsIf( 'pt_reason', isset( $prop['comment'] ) || isset( $prop['parsedcomment'] ) );
$this->addFieldsIf( 'pt_expiry', isset( $prop['expiry'] ) );
$this->addFieldsIf( 'pt_create_perm', isset( $prop['level'] ) );
$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...
$vals['user'] = $row->user_name;
}
+ if ( isset( $prop['user'] ) ) {
+ $vals['userid'] = $row->pt_user;
+ }
+
if ( isset( $prop['comment'] ) ) {
$vals['comment'] = $row->pt_reason;
}
}
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'] ) ) {
'dir' => array(
ApiBase::PARAM_DFLT => 'older',
ApiBase::PARAM_TYPE => array(
- 'older',
- 'newer'
+ 'newer',
+ 'older'
)
),
'start' => array(
ApiBase::PARAM_TYPE => array(
'timestamp',
'user',
+ 'userid',
'comment',
'parsedcomment',
'expiry',
'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',
+ ' 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',