Index: branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.i18n.php |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | 'userdailycontribs-desc' => 'مساهمات المستخدمين اليويمه لامتداد تتبع الضغطات', |
61 | 61 | ); |
62 | 62 | |
63 | | -/** Bashkir (Башҡорт) |
| 63 | +/** Bashkir (Башҡортса) |
64 | 64 | * @author Assele |
65 | 65 | */ |
66 | 66 | $messages['ba'] = array( |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | 'userdailycontribs-desc' => 'Штодзённы ўклад удзельніка для гаджэта сачэння за націскамі мышшу', |
75 | 75 | ); |
76 | 76 | |
77 | | -/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 77 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
78 | 78 | * @author Jim-by |
79 | 79 | */ |
80 | 80 | $messages['be-tarask'] = array( |
— | — | @@ -344,7 +344,7 @@ |
345 | 345 | * @author Bjankuloski06 |
346 | 346 | */ |
347 | 347 | $messages['mk'] = array( |
348 | | - 'userdailycontribs-desc' => 'Дневни придонеси од корисници за проширувањето „Следење на кликови“', |
| 348 | + 'userdailycontribs-desc' => 'Дневни придонеси од корисници за додатокот „Следење на стискања“', |
349 | 349 | ); |
350 | 350 | |
351 | 351 | /** Malayalam (മലയാളം) |
— | — | @@ -561,8 +561,9 @@ |
562 | 562 | |
563 | 563 | /** Traditional Chinese (中文(繁體)) |
564 | 564 | * @author Liangent |
| 565 | + * @author Mark85296341 |
565 | 566 | */ |
566 | 567 | $messages['zh-hant'] = array( |
567 | | - 'userdailycontribs-desc' => '點擊跟蹤擴展的用戶每日貢獻', |
| 568 | + 'userdailycontribs-desc' => '點擊追蹤擴展的用戶每日貢獻', |
568 | 569 | ); |
569 | 570 | |
Index: branches/wmf/1.17wmf1/extensions/UserDailyContribs/api/ApiUserDailyContribs.php |
— | — | @@ -0,0 +1,59 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class ApiUserDailyContribs extends ApiBase { |
| 5 | + |
| 6 | + public function execute() { |
| 7 | + $params = $this->extractRequestParams(); |
| 8 | + $result = $this->getResult(); |
| 9 | + |
| 10 | + $userName = $params['user']; |
| 11 | + $days = $params['daysago']; |
| 12 | + $user = User::newFromName($userName); |
| 13 | + if ( !$user ) { |
| 14 | + $this->dieUsage( 'Specified user does not exist', 'bad_user' ); |
| 15 | + } |
| 16 | + |
| 17 | + $now = time(); |
| 18 | + $result->addValue( $this->getModuleName() , |
| 19 | + 'totalEdits', |
| 20 | + ($user->getEditCount() == NULL)?0:$user->getEditCount() ); |
| 21 | + //returns YYYY-MM-DD-HH-MM-SS format |
| 22 | + $result->addValue( $this->getModuleName() , |
| 23 | + 'registration', $user->getRegistration() ); |
| 24 | + $result->addValue( $this->getModuleName() , |
| 25 | + 'timeFrameEdits', getUserEditCountSince( $now - ($days * 60 *60 *24) )); |
| 26 | + } |
| 27 | + |
| 28 | + public function getAllowedParams() { |
| 29 | + return array( |
| 30 | + 'user' => array( |
| 31 | + ApiBase::PARAM_TYPE => 'user', |
| 32 | + ), |
| 33 | + 'daysago' => array( |
| 34 | + ApiBase::PARAM_TYPE => 'integer', |
| 35 | + ApiBase::PARAM_MIN => 0, |
| 36 | + ), |
| 37 | + |
| 38 | + ); |
| 39 | + } |
| 40 | + |
| 41 | + public function getParamDescription() { |
| 42 | + return array( |
| 43 | + 'user' => 'Username to query', |
| 44 | + 'daysago' => 'Number of edits since this many days ago', |
| 45 | + ); |
| 46 | + } |
| 47 | + |
| 48 | + public function getDescription() { |
| 49 | + return 'Get the total number of user edits, time of registration, and edits in a given timeframe'; |
| 50 | + } |
| 51 | + |
| 52 | + protected function getExamples() { |
| 53 | + return 'api.php?action=userdailycontribs&user=WikiSysop&daysago=5'; |
| 54 | + } |
| 55 | + |
| 56 | + public function getVersion() { |
| 57 | + return __CLASS__ . ': $Id: ApiUserDailyContribs.php 84203 2011-03-17 21:09:27Z nimishg $'; |
| 58 | + } |
| 59 | + |
| 60 | +} |
\ No newline at end of file |
Property changes on: branches/wmf/1.17wmf1/extensions/UserDailyContribs/api/ApiUserDailyContribs.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 61 | + native |
Index: branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.php |
— | — | @@ -24,10 +24,12 @@ |
25 | 25 | 'descriptionmsg' => 'userdailycontribs-desc', |
26 | 26 | ); |
27 | 27 | $wgAutoloadClasses['UserDailyContribsHooks'] = dirname( __FILE__ ) . '/UserDailyContribs.hooks.php'; |
| 28 | +$wgAutoloadClasses['ApiUserDailyContribs'] = dirname( __FILE__ ) . '/api/ApiUserDailyContribs.php'; |
28 | 29 | $wgExtensionMessagesFiles['UserDailyContribs'] = dirname( __FILE__ ) . '/UserDailyContribs.i18n.php'; |
29 | 30 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'UserDailyContribsHooks::loadExtensionSchemaUpdates'; |
30 | 31 | $wgHooks['ArticleSaveComplete'][] = 'UserDailyContribsHooks::articleSaveComplete'; |
31 | 32 | $wgHooks['ParserTestTables'][] = 'UserDailyContribsHooks::parserTestTables'; |
| 33 | +$wgAPIModules['userdailycontribs'] = 'ApiUserDailyContribs'; |
32 | 34 | |
33 | 35 | /** |
34 | 36 | * Get the number of revisions a user has made since a given time |
Index: branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.hooks.php |
— | — | @@ -13,10 +13,14 @@ |
14 | 14 | /** |
15 | 15 | * LoadExtensionSchemaUpdates hook |
16 | 16 | */ |
17 | | - public static function loadExtensionSchemaUpdates() { |
18 | | - global $wgExtNewTables; |
19 | | - |
20 | | - $wgExtNewTables[] = array( 'user_daily_contribs', dirname( __FILE__ ) . '/patches/UserDailyContribs.sql' ); |
| 17 | + public static function loadExtensionSchemaUpdates( $updater = null ) { |
| 18 | + if ( $updater === null ) { |
| 19 | + global $wgExtNewTables; |
| 20 | + $wgExtNewTables[] = array( 'user_daily_contribs', dirname( __FILE__ ) . '/patches/UserDailyContribs.sql' ); |
| 21 | + } else { |
| 22 | + $updater->addExtensionUpdate( array( 'addTable', 'user_daily_contribs', |
| 23 | + dirname( __FILE__ ) . '/patches/UserDailyContribs.sql', true ) ); |
| 24 | + } |
21 | 25 | return true; |
22 | 26 | } |
23 | 27 | |
— | — | @@ -58,4 +62,4 @@ |
59 | 63 | } |
60 | 64 | return true; |
61 | 65 | } |
62 | | -} |
\ No newline at end of file |
| 66 | +} |