User:Nx/Extensions/Editcount/Editcount.body.php

');		} elseif ($this->cutoff) {		 $res=$dbr->select('revision', array('rev_user_text','count(rev_timestamp)'), array('rev_timestamp LIKE "' . /*$dbr->escapeLike(*/$like/*)*/ . '%"',), 'SpecialEditcount::execute', array('GROUP BY' => 'rev_user_text', 'ORDER BY' => 'count(rev_timestamp) desc', 'LIMIT' => "{$this->cutoff}") );     $wgOut->addHTML(" ");		}  } }

class ApiActiveusers extends ApiQueryBase { public function __construct($query, $moduleName) { parent::__construct($query,$moduleName,'ac'); } public function execute { $db = $this->getDB; $params = $this->extractRequestParams; $month = $params['month']; if (!is_null($month)) {     $month = str_pad($month,2,'0',STR_PAD_LEFT); }   $year = $params['year']; $limit = $params['limit']; $this->addTables('revision'); //"rev_timestamp like \"{$this->year}{$this->month}%\"" if (!is_null($year) && !is_null($month)) { $this->addWhere( 'rev_timestamp LIKE "' . $db->escapeLike( "{$year}{$month}" ) . '%"' ); } elseif (!is_null($year)) { $this->addWhere( 'rev_timestamp LIKE "' . $db->escapeLike( "{$year}" ) . '%"' ); } elseif (!is_null($month)) { $this->addWhere( 'rev_timestamp LIKE "____' . $db->escapeLike( "{$month}" ) . '%"' ); }   $this->addFields( array('rev_user_text','count(rev_timestamp)') ); $this->addOption('GROUP BY', 'rev_user_text'); $this->addOption('ORDER BY', "count(rev_timestamp) desc"); $this->addOption('LIMIT', "{$limit}"); $res = $this->select(__METHOD__); $result = $this->getResult; $data = array; while ($row = $db->fetchRow($res)) { $data[] = array('name' => $row['rev_user_text'], 'editcount' => $row['count(rev_timestamp)']); }   $db->freeResult($res); $result->setIndexedTagName($data, 'u'); $result->addValue('query',$this->getModuleName,$data); } public function getAllowedParams { return array (     'month' => null,      'year' => null,      'limit' => array ( ApiBase :: PARAM_DFLT => 10, ApiBase :: PARAM_TYPE => 'limit', ApiBase :: PARAM_MIN => 1, ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1, ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2 )   );  }  public function getParamDescription { return array (     'month' => 'Get contributions for this month only',      'year' => 'Get contributions for this year only',			'limit' => 'How many total user names to return.',    ); } public function getDescription { return 'Enumerate active users'; } public function getExamples { return array(     'api.php?action=query&list=activeusers&aclimit=150',      'api.php?action=query&list=activeusers&aclimit=150&acmonth=03&acyear=2009',    ); } public function getVersion { return "1.0"; } }