/**
  * Fetches user ids from statsDB from last period determined by prepareTimeCondition function
  * @param DatabaseBase $oStatsDBr
  * @param string $sStartDate e.g. 2014-12-31
  * @return array of user ids
  */
 private function getListOfUsersIdsEdited(DatabaseBase $oStatsDBr, $sStartDate)
 {
     // Get user edits
     $oWikiaSQL = new WikiaSQL();
     $oWikiaSQL->SELECT()->DISTINCT('user_id')->FROM('rollup_wiki_user_events')->WHERE('time_id')->GREATER_THAN($sStartDate)->AND_('period_id')->EQUAL_TO(DataMartService::PERIOD_ID_DAILY)->AND_('user_id')->NOT_EQUAL_TO(0);
     $aUsersIdsDidEdit = $oWikiaSQL->runLoop($oStatsDBr, function (&$aUsersIdsDidEdit, $oUsersIdsDidEdit) {
         $aUsersIdsDidEdit[] = $oUsersIdsDidEdit->user_id;
     });
     return $aUsersIdsDidEdit;
 }
 /**
  * Fetches user edits from statsDB from last period determined by prepareTimeCondition function
  * e.g. result
  * [ 12345 => [ 177 => 5 ] ]; It means user 12345 made 5 edits on 177 wiki
  * @param DatabaseBase $oStatsDBr
  * @param string $sStartDate e.g. 2014-12-31
  * @param boolean|ResultWrapper $oUsersListResult
  * @return array of number of edits with merged key consisted of user_id and wiki_id
  * e.g.
  * [
  *  '12345@177' => 3,
  *  '15432@177' => 2
  * ]
  * Means user 12345 edited 3 times on 177 wikia and user 15432 edited 2 times on 177 wikia
  */
 private function getUserEdits(DatabaseBase $oStatsDBr, $sStartDate)
 {
     // Get user edits
     $oWikiaSQL = new WikiaSQL();
     $oWikiaSQL->SELECT('user_id')->FIELD('wiki_id')->FIELD('sum( edits ) + sum( creates )')->AS_('editcount')->FROM('rollup_wiki_user_events')->WHERE('time_id')->GREATER_THAN($sStartDate)->AND_('period_id')->EQUAL_TO(DataMartService::PERIOD_ID_DAILY)->AND_('user_id')->NOT_EQUAL_TO(0)->GROUP_BY('wiki_id')->GROUP_BY('user_id');
     $aUsersEditsData = $oWikiaSQL->runLoop($oStatsDBr, function (&$aUserResult, $oUserEditCountWikiResult) {
         $sMergedKey = $this->mergeKey($oUserEditCountWikiResult->user_id, $oUserEditCountWikiResult->wiki_id);
         $aUserResult[$sMergedKey] = intval($oUserEditCountWikiResult->editcount);
     });
     return $aUsersEditsData;
 }