當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Settings::getApcuPrefix方法代碼示例

本文整理匯總了PHP中Drupal\Core\Site\Settings::getApcuPrefix方法的典型用法代碼示例。如果您正苦於以下問題:PHP Settings::getApcuPrefix方法的具體用法?PHP Settings::getApcuPrefix怎麽用?PHP Settings::getApcuPrefix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Site\Settings的用法示例。


在下文中一共展示了Settings::getApcuPrefix方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructs an ApcuBackendFactory object.
  *
  * @param string $root
  *   The app root.
  * @param string $site_path
  *   The site path.
  * @param \Drupal\Core\Cache\CacheTagsChecksumInterface $checksum_provider
  *   The cache tags checksum provider.
  */
 public function __construct($root, $site_path, CacheTagsChecksumInterface $checksum_provider)
 {
     $this->sitePrefix = Settings::getApcuPrefix('apcu_backend', $root, $site_path);
     $this->checksumProvider = $checksum_provider;
     if (version_compare(phpversion('apcu'), '5.0.0', '>=')) {
         $this->backendClass = 'Drupal\\Core\\Cache\\ApcuBackend';
     } else {
         $this->backendClass = 'Drupal\\Core\\Cache\\Apcu4Backend';
     }
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:20,代碼來源:ApcuBackendFactory.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     // @todo Extra hack to avoid test fails, remove this once
     // https://www.drupal.org/node/2553661 is fixed.
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
     parent::setUp();
     $this->logger = $this->container->get('logger.channel.rules');
     // Clear the log from any stale entries that are bleeding over from previous
     // tests.
     $this->logger->clearLogs();
     $this->expressionManager = $this->container->get('plugin.manager.rules_expression');
     $this->conditionManager = $this->container->get('plugin.manager.condition');
     $this->typedDataManager = $this->container->get('typed_data_manager');
 }
開發者ID:shahinam,項目名稱:drupal8devel,代碼行數:17,代碼來源:RulesDrupalTestBase.php

示例3: __construct

 /**
  * Constructs an ApcuBackendFactory object.
  *
  * @param string $root
  *   The app root.
  * @param string $site_path
  *   The site path.
  * @param \Drupal\Core\Cache\CacheTagsChecksumInterface $checksum_provider
  *   The cache tags checksum provider.
  */
 public function __construct($root, $site_path, CacheTagsChecksumInterface $checksum_provider)
 {
     $this->sitePrefix = Settings::getApcuPrefix('apcu_backend', $root, $site_path);
     $this->checksumProvider = $checksum_provider;
 }
開發者ID:sarahwillem,項目名稱:OD8,代碼行數:15,代碼來源:ApcuBackendFactory.php

示例4: initializeSettings

 /**
  * Locate site path and initialize settings singleton.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The current request.
  *
  * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
  *   In case the host name in the request is not trusted.
  */
 protected function initializeSettings(Request $request)
 {
     $site_path = static::findSitePath($request);
     $this->setSitePath($site_path);
     $class_loader_class = get_class($this->classLoader);
     Settings::initialize($this->root, $site_path, $this->classLoader);
     // Initialize our list of trusted HTTP Host headers to protect against
     // header attacks.
     $host_patterns = Settings::get('trusted_host_patterns', array());
     if (PHP_SAPI !== 'cli' && !empty($host_patterns)) {
         if (static::setupTrustedHosts($request, $host_patterns) === FALSE) {
             throw new BadRequestHttpException('The provided host name is not valid for this server.');
         }
     }
     // If the class loader is still the same, possibly upgrade to the APC class
     // loader.
     if ($class_loader_class == get_class($this->classLoader) && Settings::get('class_loader_auto_detect', TRUE) && function_exists('apcu_fetch')) {
         $prefix = Settings::getApcuPrefix('class_loader', $this->root);
         $apc_loader = new ApcClassLoader($prefix, $this->classLoader);
         $this->classLoader->unregister();
         $apc_loader->register();
         $this->classLoader = $apc_loader;
     }
 }
開發者ID:sgtsaughter,項目名稱:d8portfolio,代碼行數:33,代碼來源:DrupalKernel.php

示例5: initFileCache

 /**
  * Initializes the FileCache component.
  *
  * We can not use the Settings object in a component, that's why we have to do
  * it here instead of \Drupal\Component\FileCache\FileCacheFactory.
  */
 protected function initFileCache()
 {
     $configuration = Settings::get('file_cache');
     // Provide a default configuration, if not set.
     if (!isset($configuration['default'])) {
         $configuration['default'] = ['class' => FileCache::class, 'cache_backend_class' => NULL, 'cache_backend_configuration' => []];
         // @todo Use extension_loaded('apcu') for non-testbot
         //  https://www.drupal.org/node/2447753.
         if (function_exists('apcu_fetch')) {
             $configuration['default']['cache_backend_class'] = ApcuFileCacheBackend::class;
         }
     }
     FileCacheFactory::setConfiguration($configuration);
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:21,代碼來源:KernelTestBase.php

示例6: boot

 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     if ($this->booted) {
         return $this;
     }
     // Ensure that findSitePath is set.
     if (!$this->sitePath) {
         throw new \Exception('Kernel does not have site path set before calling boot()');
     }
     // Initialize the FileCacheFactory component. We have to do it here instead
     // of in \Drupal\Component\FileCache\FileCacheFactory because we can not use
     // the Settings object in a component.
     $configuration = Settings::get('file_cache');
     // Provide a default configuration, if not set.
     if (!isset($configuration['default'])) {
         $configuration['default'] = ['class' => '\\Drupal\\Component\\FileCache\\FileCache', 'cache_backend_class' => NULL, 'cache_backend_configuration' => []];
         // @todo Use extension_loaded('apcu') for non-testbot
         //  https://www.drupal.org/node/2447753.
         if (function_exists('apc_fetch')) {
             $configuration['default']['cache_backend_class'] = '\\Drupal\\Component\\FileCache\\ApcuFileCacheBackend';
         }
     }
     FileCacheFactory::setConfiguration($configuration);
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
     // Initialize the container.
     $this->initializeContainer();
     // Ensure mt_rand() is reseeded to prevent random values from one page load
     // being exploited to predict random values in subsequent page loads.
     $seed = unpack("L", Crypt::randomBytes(4));
     mt_srand($seed[1]);
     $this->booted = TRUE;
     return $this;
 }
開發者ID:nstielau,項目名稱:drops-8,代碼行數:36,代碼來源:DrupalKernel.php


注:本文中的Drupal\Core\Site\Settings::getApcuPrefix方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。