Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 public function getLicensedWikisIdsProvider()
 {
     if (class_exists('LicensedWikisService')) {
         return function () {
             $licencedService = new \LicensedWikisService();
             return array_keys($licencedService->getCommercialUseNotAllowedWikis());
         };
     } else {
         return null;
     }
 }
Ejemplo n.º 3
0
 /**
  *
  */
 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;
 }
Ejemplo n.º 5
0
 /** 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();
     }
 }
Ejemplo n.º 6
0
 protected function getNonCommercialWikis()
 {
     $licensed = new LicensedWikisService();
     $licensedIds = array_keys($licensed->getCommercialUseNotAllowedWikis());
     return $licensedIds;
 }
Ejemplo n.º 7
0
 protected function getNonCommercialWikis()
 {
     $licensed = new LicensedWikisService();
     return $licensed->getCommercialUseNotAllowedWikis();
 }