protected function fillDataFromMain($solrResponse, $cityId, $category) { if (empty($solrResponse)) { return []; } $remove = strlen($cityId) + 1; $ids = []; foreach ($solrResponse as $item) { $ids[] = substr($item['id'], $remove); } $helper = $this->getSolrHelper(); $categories = $helper->findCategoriesForIds($ids); $category = ArticlesApiController::resolveCategoryName($category); if (!empty($category)) { $categoryName = $category->getBaseText(); $categories = $helper->filterIdsByCategory($categories, $categoryName); $ids = array_keys($categories); } $result = null; if (!empty($ids)) { $params = [ArticlesApiController::PARAMETER_ABSTRACT => ArticleService::MAX_LENGTH, ArticlesApiController::PARAMETER_ARTICLES => implode(',', $ids), 'height' => QuestDetailsSolrHelper::DEFAULT_THUMBNAIL_HEIGHT, 'width' => QuestDetailsSolrHelper::DEFAULT_THUMBNAIL_WIDTH, ArticlesApiController::ITEMS_PER_BATCH => self::MAX_ITEMS_RETURN]; $result = $this->app->sendRequest('ArticlesApiController', 'getDetails', $params)->getData(); } if (empty($result)) { throw new NotFoundApiException(); } $items = array_values($result['items']); $items = $helper->addCategories($items, $categories); $items = $helper->fixUrls($items, $result["basepath"]); return $items; }
/** * @param Title $title * @return bool */ public static function ArticleCommentListPurgeComplete(Title $title) { ArticlesApiController::purgeCache($title->getArticleID()); return true; }