http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84467

Revision: 84467
Author:   nimishg
Date:     2011-03-21 17:47:01 +0000 (Mon, 21 Mar 2011)
Log Message:
-----------
mft: r84203

Modified Paths:
--------------
    
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.hooks.php
    
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.i18n.php
    branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.php

Added Paths:
-----------
    branches/wmf/1.17wmf1/extensions/UserDailyContribs/api/
    
branches/wmf/1.17wmf1/extensions/UserDailyContribs/api/ApiUserDailyContribs.php

Modified: 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.hooks.php
===================================================================
--- 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.hooks.php  
    2011-03-21 17:42:04 UTC (rev 84466)
+++ 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.hooks.php  
    2011-03-21 17:47:01 UTC (rev 84467)
@@ -13,10 +13,14 @@
        /**
         * LoadExtensionSchemaUpdates hook
         */
-       public static function loadExtensionSchemaUpdates() {
-               global $wgExtNewTables;
-               
-               $wgExtNewTables[] = array( 'user_daily_contribs', dirname( 
__FILE__ ) . '/patches/UserDailyContribs.sql' );
+       public static function loadExtensionSchemaUpdates( $updater = null ) {
+               if ( $updater === null ) {
+                       global $wgExtNewTables;
+                       $wgExtNewTables[] = array( 'user_daily_contribs', 
dirname( __FILE__ ) . '/patches/UserDailyContribs.sql' );
+               } else {
+                       $updater->addExtensionUpdate( array( 'addTable', 
'user_daily_contribs',
+                               dirname( __FILE__ ) . 
'/patches/UserDailyContribs.sql', true ) );
+               }
                return true;
        }
        
@@ -58,4 +62,4 @@
                }
                return true;
        }
-}
\ No newline at end of file
+}

Modified: 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.i18n.php
===================================================================
--- 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.i18n.php   
    2011-03-21 17:42:04 UTC (rev 84466)
+++ 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.i18n.php   
    2011-03-21 17:47:01 UTC (rev 84467)
@@ -59,7 +59,7 @@
        'userdailycontribs-desc' => 'مساهمات المستخدمين اليويمه لامتداد تتبع 
الضغطات',
 );
 
-/** Bashkir (Башҡорт)
+/** Bashkir (Башҡортса)
  * @author Assele
  */
 $messages['ba'] = array(
@@ -73,7 +73,7 @@
        'userdailycontribs-desc' => 'Штодзённы ўклад удзельніка для гаджэта 
сачэння за націскамі мышшу',
 );
 
-/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
+/** Belarusian (Taraškievica orthography) (‪Беларуская (тарашкевіца)‬)
  * @author Jim-by
  */
 $messages['be-tarask'] = array(
@@ -344,7 +344,7 @@
  * @author Bjankuloski06
  */
 $messages['mk'] = array(
-       'userdailycontribs-desc' => 'Дневни придонеси од корисници за 
проширувањето „Следење на кликови“',
+       'userdailycontribs-desc' => 'Дневни придонеси од корисници за додатокот 
„Следење на стискања“',
 );
 
 /** Malayalam (മലയാളം)
@@ -561,8 +561,9 @@
 
 /** Traditional Chinese (‪中文(繁體)‬)
  * @author Liangent
+ * @author Mark85296341
  */
 $messages['zh-hant'] = array(
-       'userdailycontribs-desc' => '點擊跟蹤擴展的用戶每日貢獻',
+       'userdailycontribs-desc' => '點擊追蹤擴展的用戶每日貢獻',
 );
 

Modified: 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.php
===================================================================
--- branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.php    
2011-03-21 17:42:04 UTC (rev 84466)
+++ branches/wmf/1.17wmf1/extensions/UserDailyContribs/UserDailyContribs.php    
2011-03-21 17:47:01 UTC (rev 84467)
@@ -24,10 +24,12 @@
        'descriptionmsg' => 'userdailycontribs-desc',
 );
 $wgAutoloadClasses['UserDailyContribsHooks'] = dirname( __FILE__ ) . 
'/UserDailyContribs.hooks.php';
+$wgAutoloadClasses['ApiUserDailyContribs'] = dirname( __FILE__ ) . 
'/api/ApiUserDailyContribs.php';
 $wgExtensionMessagesFiles['UserDailyContribs'] = dirname( __FILE__ ) . 
'/UserDailyContribs.i18n.php';
 $wgHooks['LoadExtensionSchemaUpdates'][] = 
'UserDailyContribsHooks::loadExtensionSchemaUpdates';
 $wgHooks['ArticleSaveComplete'][] = 
'UserDailyContribsHooks::articleSaveComplete';
 $wgHooks['ParserTestTables'][] = 'UserDailyContribsHooks::parserTestTables';
+$wgAPIModules['userdailycontribs'] = 'ApiUserDailyContribs';
 
 /**
  * Get the number of revisions a user has made since a given time

Added: 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/api/ApiUserDailyContribs.php
===================================================================
--- 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/api/ApiUserDailyContribs.php 
                            (rev 0)
+++ 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/api/ApiUserDailyContribs.php 
    2011-03-21 17:47:01 UTC (rev 84467)
@@ -0,0 +1,59 @@
+<?php 
+
+class ApiUserDailyContribs extends ApiBase {
+
+       public function execute() {
+               $params = $this->extractRequestParams();
+               $result = $this->getResult();
+
+               $userName = $params['user'];
+               $days = $params['daysago'];
+               $user = User::newFromName($userName);
+               if ( !$user ) {
+                       $this->dieUsage( 'Specified user does not exist', 
'bad_user' );
+               }
+               
+               $now = time();
+               $result->addValue( $this->getModuleName() ,
+                       'totalEdits',
+                       ($user->getEditCount() == NULL)?0:$user->getEditCount() 
);
+                //returns YYYY-MM-DD-HH-MM-SS format
+               $result->addValue( $this->getModuleName() ,
+                       'registration', $user->getRegistration() );
+               $result->addValue( $this->getModuleName() ,
+                       'timeFrameEdits', getUserEditCountSince( $now - ($days 
* 60 *60 *24)  ));
+       }
+
+       public function getAllowedParams() {
+               return array(
+                       'user' => array(
+                               ApiBase::PARAM_TYPE => 'user',          
+               ),
+                       'daysago' => array(
+                               ApiBase::PARAM_TYPE => 'integer',
+                               ApiBase::PARAM_MIN => 0,
+               ),
+               
+               );
+       }
+
+       public function getParamDescription() {
+               return array(
+                       'user' => 'Username to query',
+                       'daysago' => 'Number of edits since this many days ago',
+               );
+       }
+
+       public function getDescription() {
+               return 'Get the total number of user edits, time of 
registration, and edits in a given timeframe';
+       }
+
+       protected function getExamples() {
+               return 
'api.php?action=userdailycontribs&user=WikiSysop&daysago=5';
+       }
+
+       public function getVersion() {
+               return __CLASS__ . ': $Id: ApiUserDailyContribs.php 84203 
2011-03-17 21:09:27Z nimishg $';
+       }
+       
+}
\ No newline at end of file


Property changes on: 
branches/wmf/1.17wmf1/extensions/UserDailyContribs/api/ApiUserDailyContribs.php
___________________________________________________________________
Added: svn:eol-style
   + native


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to