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


PHP CRM_Utils_System::isInUpgradeMode方法代码示例

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


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

示例1: register

 /**
  * Registers this instance as an autoloader.
  * @return CRM_Extension_ClassLoader
  */
 public function register()
 {
     // In pre-installation environments, don't bother with caching.
     if (!defined('CIVICRM_TEMPLATE_COMPILEDIR') || !defined('CIVICRM_DSN') || defined('CIVICRM_TEST') || \CRM_Utils_System::isInUpgradeMode()) {
         return $this->buildClassLoader()->register();
     }
     $file = $this->getCacheFile();
     if (file_exists($file)) {
         $loader = (require $file);
     } else {
         $loader = $this->buildClassLoader();
         $ser = serialize($loader);
         file_put_contents($file, sprintf("<?php\nreturn unserialize(%s);", var_export($ser, 1)));
     }
     return $loader->register();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:20,代码来源:ClassLoader.php

示例2: loadContainer

 /**
  * Find a cached container definition or construct a new one.
  *
  * There are many weird contexts in which Civi initializes (eg different
  * variations of multitenancy and different permutations of CMS/CRM bootstrap),
  * and hook_container may fire a bit differently in each context. To mitigate
  * risk of leaks between environments, we compute a unique envID
  * (md5(DB_NAME, HTTP_HOST, SCRIPT_FILENAME, etc)) and use separate caches for
  * each (eg "templates_c/CachedCiviContainer.$ENVID.php").
  *
  * Constants:
  *   - CIVICRM_CONTAINER_CACHE -- 'always' [default], 'never', 'auto'
  *   - CIVICRM_DSN
  *   - CIVICRM_DOMAIN_ID
  *   - CIVICRM_TEMPLATE_COMPILEDIR
  *
  * @return ContainerInterface
  */
 public function loadContainer()
 {
     // Note: The container's raison d'etre is to manage construction of other
     // services. Consequently, we assume a minimal service available -- the classloader
     // has been setup, and civicrm.settings.php is loaded, but nothing else works.
     $cacheMode = defined('CIVICRM_CONTAINER_CACHE') ? CIVICRM_CONTAINER_CACHE : 'always';
     // In pre-installation environments, don't bother with caching.
     if (!defined('CIVICRM_TEMPLATE_COMPILEDIR') || !defined('CIVICRM_DSN') || $cacheMode === 'never' || \CRM_Utils_System::isInUpgradeMode()) {
         return $this->createContainer();
     }
     $envId = \CRM_Core_Config_Runtime::getId();
     $file = CIVICRM_TEMPLATE_COMPILEDIR . "/CachedCiviContainer.{$envId}.php";
     $containerConfigCache = new ConfigCache($file, $cacheMode === 'auto');
     if (!$containerConfigCache->isFresh()) {
         $containerBuilder = $this->createContainer();
         $containerBuilder->compile();
         $dumper = new PhpDumper($containerBuilder);
         $containerConfigCache->write($dumper->dump(array('class' => 'CachedCiviContainer')), $containerBuilder->getResources());
     }
     require_once $file;
     $c = new \CachedCiviContainer();
     $c->set('service_container', $c);
     return $c;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:42,代码来源:Container.php


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