Index: trunk/extensions/UserDailyContribs/api/ApiUserDailyContribs.php |
— | — | @@ -9,20 +9,31 @@ |
10 | 10 | $userName = $params['user']; |
11 | 11 | $days = $params['daysago']; |
12 | 12 | $user = User::newFromName($userName); |
| 13 | + if ( !$user ) { |
| 14 | + $this->dieUsage( 'Specified user does not exist', 'bad_user' ); |
| 15 | + } |
| 16 | + |
13 | 17 | $now = time(); |
14 | | - $result->addValue( array( 'query', $this->getModuleName() ), |
| 18 | + $result->addValue( $this->getModuleName() , |
15 | 19 | 'totalEdits', |
16 | 20 | ($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() , |
18 | 23 | 'registration', $user->getRegistration() ); |
19 | | - $result->addValue( array( 'query', $this->getModuleName() ), |
| 24 | + $result->addValue( $this->getModuleName() , |
20 | 25 | 'timeFrameEdits', getUserEditCountSince( $now - ($days * 60 *60 *24) )); |
21 | 26 | } |
22 | 27 | |
23 | 28 | public function getAllowedParams() { |
24 | 29 | 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 | + |
27 | 38 | ); |
28 | 39 | } |
29 | 40 | |
— | — | @@ -44,6 +55,5 @@ |
45 | 56 | public function getVersion() { |
46 | 57 | return __CLASS__ . ': $Id$'; |
47 | 58 | } |
48 | | - //2009-05-01-18-35-35 |
49 | | - //YYYY-MM-DD-HH-MM-SS |
| 59 | + |
50 | 60 | } |
\ No newline at end of file |