本文整理汇总了PHP中LanguageManager::resetCreatedModules方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::resetCreatedModules方法的具体用法?PHP LanguageManager::resetCreatedModules怎么用?PHP LanguageManager::resetCreatedModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::resetCreatedModules方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refreshCachePart
/**
* Refreshes a single part of the cache provided there is a compatible rebuild*
* method to do so. A part of the cache can be modules, sections or languages
* since these all have their own caches that need to be dealt with.
*
* @param string $part which part of the cache to build
* @param array $items List of items to be passed to the rebuild method
* @param array $platforms List of platforms to carry out the refresh for
* @param array $params Additional metadata parameters
* @return null
*/
protected static function refreshCachePart($part, $items = array(), $platforms = array(), $params = array())
{
// No args, no worries
if (empty($items)) {
return;
}
// If we are in the middle of a refresh do nothing
if (self::$inProcess) {
return;
}
// If we are in queue state (like in RepairAndRebuild), hold on to this
// request until we are told to run it
if (self::$isQueued) {
self::buildCacheRefreshQueueSection($part, $items, array_merge($params, array('platforms' => $platforms)));
return;
}
if (empty($platforms)) {
// Only get platforms with existing caches so we don't build everything
// if we don't need to
$platforms = self::getPlatformsWithCaches();
}
// Make sure the LanguageManager created modules cache is clear
LanguageManager::resetCreatedModules();
//No need to build the cache if we can't store it
if (static::$isCacheEnabled) {
// Handle refreshing based on the cache part
$method = 'rebuild' . ucfirst(strtolower($part)) . 'Cache';
foreach ((array) $platforms as $platform) {
foreach (array(true, false) as $public) {
$mm = MetaDataManager::getManager($platform, $public, true);
if (method_exists($mm, $method)) {
$contexts = static::getMetadataContexts($public, $params);
// When a change occurs in the base metadata, we need to clear the cache for all contexts
// except the ones we are going to rebuild in this request
if (empty($params)) {
$allContexts = array_filter(static::getAllMetadataContexts($public), function ($context) use($contexts) {
foreach ($contexts as $current_context) {
if ($current_context->getHash() === $context->getHash()) {
return false;
}
}
return true;
});
foreach ($allContexts as $context) {
$mm->deletePlatformVisibilityCaches($context);
}
}
foreach ($contexts as $context) {
$mm->{$method}($items, $context);
}
}
}
}
}
}