/** * Licenced wikis calls out to database * @group Slow */ public function testBlacklistedLicensedWikiDefaultHandling() { $licencedService = new \LicensedWikisService(); $commercialWikiIds = array_keys($licencedService->getCommercialUseNotAllowedWikis()); $filter = new BlacklistFilter(SearchCores::CORE_MAIN); $defaultIds = BlacklistFilter::materializeProvider($filter->getBlacklistedIdsProvider()); $this->assertEquals($commercialWikiIds, $defaultIds); }
public function getLicensedWikisIdsProvider() { if (class_exists('LicensedWikisService')) { return function () { $licencedService = new \LicensedWikisService(); return array_keys($licencedService->getCommercialUseNotAllowedWikis()); }; } else { return null; } }
/** * */ public function index() { $css = [AssetsManager::getInstance()->getSassCommonURL('//extensions/wikia/ApiDocs/css/ApiDocs.scss', false, ['color-header' => '#004c7f'])]; $this->setVal('css', $css); $js = AssetsManager::getInstance()->getURL('api_docs_js', $type, false); $this->setVal('js', $js); $licensedService = new LicensedWikisService(); if ($licensedService->isCommercialUseAllowedForThisWiki()) { $licenseMessage = $this->app->renderView("ApiDocsController", "licenseMessage", []); $this->getResponse()->setVal("licenseMessage", $licenseMessage); } else { $licenseWarning = $this->app->renderView("ApiDocsController", "licenseWarning", []); $this->getResponse()->setVal("licenseWarning", $licenseWarning); $this->getResponse()->setVal("bodyData", ' data-disabled="true" '); } }
public function getCommercialUseNotAllowedWikis() { if (empty(self::$wikiList)) { self::$wikiList = WikiaDataAccess::cache(wfSharedMemcKey(self::CACHE_KEY_COMMERCIAL_NOT_ALLOWED), self::CACHE_VALID_TIME, function () { return $this->getWikisWithVar(); }); } return self::$wikiList; }
/** Block content if this wiki is does not allow commercial use of it's content outside of Wikia * Raises WikiaHttpException * */ public function blockIfNonCommercialOnly() { $licensedService = new LicensedWikisService(); if (!$licensedService->isCommercialUseAllowedForThisWiki()) { throw new ApiNonCommercialOnlyException(); } }
protected function getNonCommercialWikis() { $licensed = new LicensedWikisService(); $licensedIds = array_keys($licensed->getCommercialUseNotAllowedWikis()); return $licensedIds; }
protected function getNonCommercialWikis() { $licensed = new LicensedWikisService(); return $licensed->getCommercialUseNotAllowedWikis(); }