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


PHP cache_helper::siteidentifier方法代碼示例

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


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

示例1: get_site_identifier

 /**
  * Returns the site identifier.
  *
  * @return string
  */
 public static function get_site_identifier()
 {
     if (is_null(self::$siteidentifier)) {
         $factory = cache_factory::instance();
         $config = $factory->create_config_instance();
         self::$siteidentifier = $config->get_site_identifier();
     }
     return self::$siteidentifier;
 }
開發者ID:Burick,項目名稱:moodle,代碼行數:14,代碼來源:helper.php

示例2: get_site_identifier

 /**
  * Returns the site identifier.
  *
  * @return string
  */
 public static function get_site_identifier()
 {
     global $CFG;
     if (!is_null(self::$siteidentifier)) {
         return self::$siteidentifier;
     }
     // If site identifier hasn't been collected yet attempt to get it from the cache config.
     $factory = cache_factory::instance();
     // If the factory is initialising then we don't want to try to get it from the config or we risk
     // causing the cache to enter an infinite initialisation loop.
     if (!$factory->is_initialising()) {
         $config = $factory->create_config_instance();
         self::$siteidentifier = $config->get_site_identifier();
     }
     if (is_null(self::$siteidentifier)) {
         // If the site identifier is still null then config isn't aware of it yet.
         // We'll see if the CFG is loaded, and if not we will just use unknown.
         // It's very important here that we don't use get_config. We don't want an endless cache loop!
         if (!empty($CFG->siteidentifier)) {
             self::$siteidentifier = self::update_site_identifier($CFG->siteidentifier);
         } else {
             // It's not being recorded in MUC's config and the config data hasn't been loaded yet.
             // Likely we are initialising.
             return 'unknown';
         }
     }
     return self::$siteidentifier;
 }
開發者ID:Keneth1212,項目名稱:moodle,代碼行數:33,代碼來源:helper.php


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