コード例 #1
0
ファイル: User.php プロジェクト: Tjorriemorrie/app
 /**
  * Wikia. Get number of edits localized for wiki,
  *
  * NOTE: UserStatsService:getEditCountWiki function retrieves User object inside
  * due to this fact localized editcount shouldn't be a field of User class
  * to avoid infinite loop
  *
  * @autor Kamil Koterba
  * @since Feb 2013
  * @return Int
  */
 public function getEditCountLocal()
 {
     if ($this->getId()) {
         $userStatsService = new UserStatsService($this->mId);
         return $userStatsService->getEditCountWiki();
     } else {
         /* nil */
         return null;
     }
 }
コード例 #2
0
 /**
  * get avatars for wiki admins
  * @param integer $wikiId
  * @return array wikiAdminAvatars
  */
 public function getWikiAdminAvatars($wikiId)
 {
     $adminAvatars = array();
     if (!empty($wikiId)) {
         $wikiService = new WikiService();
         try {
             //this try-catch block is here because of devbox environments
             //where we don't have all wikis imported
             $adminAvatars = $wikiService->getMostActiveAdmins($wikiId, self::AVATAR_SIZE);
             if (count($adminAvatars) > self::LIMIT_ADMIN_AVATARS) {
                 $adminAvatars = array_slice($adminAvatars, 0, self::LIMIT_ADMIN_AVATARS);
             }
             foreach ($adminAvatars as &$admin) {
                 $userStatService = new UserStatsService($admin['userId']);
                 $admin['edits'] = $userStatService->getEditCountWiki($wikiId);
             }
         } catch (Exception $e) {
             $adminAvatars = array();
         }
     }
     return $adminAvatars;
 }