/**
  * Gets the information about wikis [DEPRECATED]
  *
  * @requestParam array $ids The list of wiki ids that will be fetched
  * @requestParam int $height [OPTIONAL] Thumbnail height in pixels
  * @requestParam int $width [OPTIONAL] Thumbnail width in pixels
  * @requestParam int $snippet [OPTIONAL] Maximum number of words returned in description
  *
  * @responseParam array $items The list of wikis, each containing: title, url, description, thumbnail, no. of articles, no. of photos, list of top contributors, no. of videos
  *
  * @example &ids=159,831,3125
  * @example &ids=159,831,3125&width=100
  * @example &ids=159,831,3125&height=100&width=100&snippet=25
  */
 public function getWikiData()
 {
     wfProfileIn(__METHOD__);
     $ids = $this->request->getArray('ids');
     $imageWidth = $this->request->getInt('width', static::DEFAULT_WIDTH);
     $imageHeight = $this->request->getInt('height', static::DEFAULT_HEIGHT);
     $length = $this->request->getVal('snippet', static::DEFAULT_SNIPPET_LENGTH);
     $items = array();
     $service = new WikiService();
     foreach ($ids as $wikiId) {
         if (($cached = $this->getFromCacheWiki($wikiId, __METHOD__)) !== false) {
             //get from cache
             $wikiInfo = $cached;
         } else {
             //get data providers
             $wikiObj = WikiFactory::getWikiByID($wikiId);
             $wikiStats = $service->getSiteStats($wikiId);
             $topUsers = $service->getTopEditors($wikiId, static::DEFAULT_TOP_EDITORS_NUMBER, true);
             $wikiInfo = array('id' => (int) $wikiId, 'articles' => (int) $wikiStats['articles'], 'images' => (int) $wikiStats['images'], 'videos' => (int) $service->getTotalVideos($wikiId), 'topUsers' => array_keys($topUsers), 'title' => $wikiObj->city_title, 'url' => $wikiObj->city_url);
             //cache data
             $this->cacheWikiData($wikiInfo, __METHOD__);
         }
         $wikiDesc = $service->getWikiDescription([$wikiId], $imageWidth, $imageHeight);
         //set snippet
         $wikiInfo['description'] = $this->getSnippet(isset($wikiDesc[$wikiId]) ? $wikiDesc[$wikiId]['desc'] : '', $length);
         //add image, its cached on different level
         $wikiInfo['thumbnail'] = isset($wikiDesc[$wikiId]) ? $wikiDesc[$wikiId]['image_url'] : '';
         //add to result
         $items[] = $wikiInfo;
     }
     $this->response->setVal('items', $items);
     wfProfileOut(__METHOD__);
 }
 /**
  * get list of top editor info ( name, avatarUrl, userPageUrl, edits )
  * @param integer $wikiId
  * @return array $topEditorAvatars
  */
 public function getWikiTopEditorAvatars($wikiId)
 {
     $topEditorAvatars = 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
             $topEditors = $wikiService->getTopEditors($wikiId, 100, true);
         } catch (Exception $e) {
             $topEditors = array();
         }
         foreach ($topEditors as $userId => $edits) {
             $userInfo = $wikiService->getUserInfo($userId, $wikiId, self::AVATAR_SIZE, array($this, 'isValidUserForInterstitial'));
             if (!empty($userInfo)) {
                 $userInfo['edits'] = $edits;
                 if (!empty($topEditorAvatars[$userInfo['name']])) {
                     $userInfo['edits'] += $topEditorAvatars[$userInfo['name']]['edits'];
                 }
                 $topEditorAvatars[$userInfo['name']] = $userInfo;
                 if (count($topEditorAvatars) >= self::LIMIT_TOP_EDITOR_AVATARS) {
                     break;
                 }
             }
         }
     }
     return $topEditorAvatars;
 }