Пример #1
0
 /**
  * Rewrites caches for all metadata manager platforms and visibility
  *
  * @param array $platforms
  * @param bool $force Indicator that tells this method whether to force a build
  */
 public static function refreshCache($platforms = array(), $force = false)
 {
     // If we are in queue state (like in RepairAndRebuild), hold on to this
     // request until we are told to run it
     if (static::$isQueued) {
         static::$fullRefresh = array('platforms' => $platforms);
         return;
     }
     // Set our inProcess flag;
     static::$inProcess = true;
     // The basics are, for each platform, rewrite the cache for public and private
     if (empty($platforms)) {
         $platforms = static::getPlatformsWithCaches();
     }
     // Make sure the LanguageManager created modules cache is clear
     LanguageManager::resetCreatedModules();
     //No need to actually build the cache if we can't store it.
     if (static::$isCacheEnabled) {
         foreach ((array) $platforms as $platform) {
             foreach (array(true, false) as $public) {
                 $mm = static::getManager($platform, $public, true);
                 $contexts = static::getAllMetadataContexts($public);
                 foreach ($contexts as $context) {
                     if ($context instanceof MetaDataContextDefault) {
                         $mm->rebuildCache(true);
                     } else {
                         $mm->invalidateCache($platforms, $context);
                     }
                 }
             }
         }
     }
     // Reset the in process flag
     static::$inProcess = false;
 }
Пример #2
0
 /**
  * Enable/Disable conditional debugging
  *
  * @param bool $flag
  * @return void
  */
 public static function enable($flag = true)
 {
     static::$inProcess = $flag;
     $message = static::render(sprintf('Conditional debug %s', $flag ? 'enabled' : 'disabled'), 2);
     Pi::service('log')->debug($message);
 }