当前位置: 首页>>代码示例>>PHP>>正文


PHP WikiFactory::getVarIdByName方法代码示例

本文整理汇总了PHP中WikiFactory::getVarIdByName方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::getVarIdByName方法的具体用法?PHP WikiFactory::getVarIdByName怎么用?PHP WikiFactory::getVarIdByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WikiFactory的用法示例。


在下文中一共展示了WikiFactory::getVarIdByName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     global $wgCityId;
     wfProfileIn(__METHOD__);
     $this->byFounderVarId = WikiFactory::getVarIdByName(self::WDAC_BY_FOUNDER_NAME, $wgCityId);
     $this->byStaffVarId = WikiFactory::getVarIdByName(self::WDAC_BY_STAFF_NAME, $wgCityId);
     wfProfileOut(__METHOD__);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:8,代码来源:WDACReviewHelper.class.php

示例2: collectAndSave

 /**
  * Collect restricted wiki ids
  */
 public static function collectAndSave()
 {
     global $wgExternalSharedDB;
     $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalSharedDB);
     $res = $dbr->select('city_variables', array('cv_city_id', 'cv_value'), array('cv_variable_id' => WikiFactory::getVarIdByName('wgGroupPermissionsLocal')), __FUNCTION__);
     $count = $dbr->numRows($res);
     $restrictedWikis = array();
     $i = 0;
     while ($row = $dbr->fetchRow($res)) {
         if (self::isRestrictedWiki($row['cv_value'])) {
             $restrictedWikis[] = (int) $row['cv_city_id'];
         }
         if ($i % 1000 == 0) {
             echo $i . '/' . $count . PHP_EOL;
         }
         $i++;
     }
     UserProfilePageHelper::saveRestrictedWikisDB($restrictedWikis);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:22,代码来源:collect_restricted_wikis.php

示例3: execute

 public function execute()
 {
     $wikiFactory = new WikiFactory();
     $varId = $wikiFactory->getVarIdByName(self::VAR_TO_SET);
     if ($varId === false) {
         throw new ErrorException('No such variable: ' . self::VAR_TO_SET);
     }
     $newTopWikiIds = $this->getTopWamWikiIds(self::TOP_NUMBER_OF_WIKIS);
     $oldTopWikiIds = array_keys($wikiFactory->getListOfWikisWithVar($varId, 'bool', '=', true));
     foreach ($newTopWikiIds as $wikiId) {
         if (array_search($wikiId, $oldTopWikiIds) === false) {
             $wikiFactory->setVarById($varId, $wikiId, true, __METHOD__);
             echo '+' . $wikiId . PHP_EOL;
         }
     }
     foreach ($oldTopWikiIds as $wikiId) {
         if (array_search($wikiId, $newTopWikiIds) === false) {
             $wikiFactory->removeVarById($varId, $wikiId, __METHOD__);
             echo '-' . $wikiId . PHP_EOL;
         }
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:22,代码来源:identifyTopWamWikis.php

示例4: wgUploadDirectoryExists

 /**
  * Check if the given upload directory name is available for use.
  *
  * @access public
  * @author Michał Roszka <michal@wikia-inc.com>
  *
  * @param $sDirectoryName the path to check
  */
 public static function wgUploadDirectoryExists($sDirectoryName)
 {
     wfProfileIn(__METHOD__);
     $iVarId = WikiFactory::getVarIdByName('wgUploadDirectory');
     // Crash immediately if $iVarId is not a positive integer!
     \Wikia\Util\Assert::true($iVarId);
     $aCityIds = WikiFactory::getCityIDsFromVarValue($iVarId, $sDirectoryName, '=');
     wfProfileOut(__METHOD__);
     return !empty($aCityIds);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:CreateWiki.php

示例5: getIdsBlacklistedWikis

 protected function getIdsBlacklistedWikis()
 {
     $blacklistIds = WikiaDataAccess::cache(wfSharedMemcKey('wam_blacklist', self::MEMCACHE_VER), self::CACHE_DURATION, function () {
         $contentWarningWikis = $excludedWikis = [];
         // Exlude wikias with ContentWarning extension enabled
         $blacklistExtVarId = WikiFactory::getVarIdByName(self::WAM_BLACKLIST_EXT_VAR_NAME);
         if ($blacklistExtVarId) {
             $contentWarningWikis = array_keys(WikiFactory::getListOfWikisWithVar($blacklistExtVarId, 'bool', '=', true));
         }
         // Exclude wikias with an exclusion flag set to true
         $blacklistFlagVarId = WikiFactory::getVarIdByName(self::WAM_EXCLUDE_FLAG_NAME);
         if ($blacklistFlagVarId) {
             $excludedWikis = array_keys(WikiFactory::getListOfWikisWithVar($blacklistFlagVarId, 'bool', '=', true));
         }
         return array_merge($contentWarningWikis, $excludedWikis);
     });
     return $blacklistIds;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:WAMService.class.php

示例6: fixBGImage

function fixBGImage($id, $themeSettingsArray)
{
    $themeSettingsArray['background-image'] = '';
    WikiFactory::setVarByName('wgOasisThemeSettings', $id, $themeSettingsArray);
    WikiFactory::clearCache($id);
}
function getBrokenThemeSettings($id)
{
    $themeSettings = WikiFactory::getVarByName('wgOasisThemeSettings', $id);
    if (!is_object($themeSettings) || empty($themeSettings->cv_value)) {
        return null;
    }
    $themeSettingsArray = unserialize($themeSettings->cv_value);
    $backgroundImage = $themeSettingsArray['background-image'];
    return getType($backgroundImage) !== 'string' || $backgroundImage === 'false' ? $themeSettingsArray : null;
}
$varid = WikiFactory::getVarIdByName('wgOasisThemeSettings', true);
$dbr = wfGetDB(DB_MASTER, array(), $wgExternalSharedDB);
$oRes = $dbr->select('city_list', 'city_id');
while ($oRow = $dbr->fetchObject($oRes)) {
    $themeSettingsArray = getBrokenThemeSettings($oRow->city_id);
    if (!is_null($themeSettingsArray)) {
        // IMPORTANT! Uncomment line below if you really want it to work.
        //fixBGImage( $oRow->city_id, $themeSettingsArray );
        echo "Fixed Background Image for {$oRow->city_id}\n";
    } else {
        echo "Did not fix background image because it was okay\n";
    }
    echo "########################################\n";
}
$dbr->freeResult($oRes);
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:fixThemeDesignerBGImage.php

示例7: ini_set

 * @author: Inez
 *
 * Get familiar with "How_to_run_maintenance_script" article on internal to figure out how to run it.
 */
ini_set("include_path", dirname(__FILE__) . "/../");
require_once "commandLine.inc";
function enableVEUI($id)
{
    WikiFactory::setVarByName('wgEnableVisualEditorUI', $id, true);
    WikiFactory::clearCache($id);
}
function isVEenabled($id)
{
    $out = WikiFactory::getVarByName('wgEnableVisualEditorExt', $id);
    return $out ? unserialize($out->cv_value) : false;
}
$varid = WikiFactory::getVarIdByName('wgEnableVisualEditorExt', true);
$list = WikiFactory::getListOfWikisWithVar($varid, 'bool', '=', true);
foreach ($list as $id => $val) {
    echo "Wiki id: {$id}\n";
    $isVEenabled = isVEenabled($id);
    if ($isVEenabled) {
        // IMPORTANT! Uncomment line below if you really want it to work.
        //enableVEUI( $id );
        echo "Enabled VEUI\n";
    } else {
        echo "Not enabled VEUI because VE not enabled\n";
    }
    echo "########################################\n";
}
WikiFactory::clearInterwikiCache();
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:enableVEUIforVEenabled.php

示例8: getCorporateSitesList

 /**
  * @desc Gets id of wgEnableWikiaHomePageExt variable and then loads and returns list of corporate sites
  * @return array
  */
 protected function getCorporateSitesList()
 {
     return WikiaDataAccess::cache(wfSharedMemcKey('corporate_pages_list', self::CITY_VISUALIZATION_CORPORATE_PAGE_LIST_MEMC_VERSION), WikiaResponse::CACHE_STANDARD, function () {
         // loads list of corporate sites (sites which have $wgEnableWikiaHomePageExt WF variable set to true)
         $wikiFactoryVarId = WikiFactory::getVarIdByName(self::WIKIA_HOME_PAGE_WF_VAR_NAME);
         if (is_int($wikiFactoryVarId)) {
             return WikiFactory::getListOfWikisWithVar($wikiFactoryVarId, 'bool', '=', true);
         } else {
             return [];
         }
     });
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:CityVisualization.class.php

示例9: getWikisIncludedInCorporateFooterDropdown

 public function getWikisIncludedInCorporateFooterDropdown()
 {
     $wikiFactoryList = [];
     $varId = WikiFactory::getVarIdByName(self::IS_WIKI_INCLUDED_IN_CORPORATE_FOOTER_DROPDOWN_VAR_NAME);
     if (is_int($varId)) {
         $wikiFactoryList = WikiaDataAccess::cache(wfMemcKey('wikis_included_in_corporate_footer_dropdown', self::WIKIA_HOME_PAGE_HELPER_MEMC_VERSION), 24 * 60 * 60, function () use($varId) {
             $list = WikiFactory::getListOfWikisWithVar($varId, 'bool', '=', true);
             return $this->cleanWikisDataArray($list);
         }, WikiaDataAccess::REFRESH_CACHE);
     }
     return $wikiFactoryList;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:WikiaHomePageHelper.class.php

示例10: isValidCity

 protected function isValidCity($cityId)
 {
     return WikiaDataAccess::cache('hubsapi_is_valid_cityid_' . $cityId, 6 * 60 * 60, function () use($cityId) {
         $varId = WikiFactory::getVarIdByName(self::HUBS_V3_VARIABLE_NAME);
         $varData = WikiFactory::getVarById($varId, $cityId);
         return !empty($varData) && !empty($varData->cv_value) && unserialize($varData->cv_value);
     });
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:8,代码来源:WikiaHubsApiController.class.php


注:本文中的WikiFactory::getVarIdByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。