r84203 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84202‎ | r84203 | r84204 >
Date:21:09, 17 March 2011
Author:nimishg
Status:ok
Tags:
Comment:
Stylistic changes and some validation
Modified paths:
  • /trunk/extensions/UserDailyContribs/api/ApiUserDailyContribs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UserDailyContribs/api/ApiUserDailyContribs.php
@@ -9,20 +9,31 @@
1010 $userName = $params['user'];
1111 $days = $params['daysago'];
1212 $user = User::newFromName($userName);
 13+ if ( !$user ) {
 14+ $this->dieUsage( 'Specified user does not exist', 'bad_user' );
 15+ }
 16+
1317 $now = time();
14 - $result->addValue( array( 'query', $this->getModuleName() ),
 18+ $result->addValue( $this->getModuleName() ,
1519 'totalEdits',
1620 ($user->getEditCount() == NULL)?0:$user->getEditCount() );
17 - $result->addValue( array( 'query', $this->getModuleName() ),
 21+ //returns YYYY-MM-DD-HH-MM-SS format
 22+ $result->addValue( $this->getModuleName() ,
1823 'registration', $user->getRegistration() );
19 - $result->addValue( array( 'query', $this->getModuleName() ),
 24+ $result->addValue( $this->getModuleName() ,
2025 'timeFrameEdits', getUserEditCountSince( $now - ($days * 60 *60 *24) ));
2126 }
2227
2328 public function getAllowedParams() {
2429 return array(
25 - 'user' => null,
26 - 'daysago' => null,
 30+ 'user' => array(
 31+ ApiBase::PARAM_TYPE => 'user',
 32+ ),
 33+ 'daysago' => array(
 34+ ApiBase::PARAM_TYPE => 'integer',
 35+ ApiBase::PARAM_MIN => 0,
 36+ ),
 37+
2738 );
2839 }
2940
@@ -44,6 +55,5 @@
4556 public function getVersion() {
4657 return __CLASS__ . ': $Id$';
4758 }
48 - //2009-05-01-18-35-35
49 - //YYYY-MM-DD-HH-MM-SS
 59+
5060 }
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r84467mft: r84203nimishg17:47, 21 March 2011

Status & tagging log