/** * Tries to get the data on types of flags available for the given wikia from cache. * If it is not cached it gets it from the database and caches it. * @param $wikiId * @return bool|mixed */ private function getFlagTypesForWikiaRawData($wikiId) { $flagsCache = $this->getCache(); $flagTypesForWikia = $flagsCache->getFlagTypesForWikia(); if (!$flagTypesForWikia) { $flagTypeModel = new FlagType(); $flagTypesForWikia = $flagTypeModel->getFlagTypesForWikia($wikiId); $flagsCache->setFlagTypesForWikia($flagTypesForWikia); $this->logCache('getFlagsForPageForEdit', 'MISS'); } else { $this->logCache('getFlagsForPageForEdit', 'HIT'); } return $flagTypesForWikia; }
/** * Prepare data to add flag type */ private function prepareDataForFlagType(FlagType $flagTypeModel, $data) { if (!empty($data[4])) { $parameters = $this->prepareParametersFromCSV($data[4]); } else { $parameters = null; } $flagType = ['wiki_id' => $this->wikiId, 'flag_group' => $flagTypeModel->getFlagGroupId($data[2]), 'flag_name' => $data[1], 'flag_view' => $data[0], 'flag_targeting' => $flagTypeModel->getFlagTargetingId($data[3]), 'flag_params_names' => $parameters]; return $flagType; }