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


PHP LocalRepo::getDescriptionRenderUrl方法代码示例

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


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

示例1: getDescriptionText

 /**
  * Get the HTML text of the description page, if available
  *
  * @return string
  */
 function getDescriptionText()
 {
     global $wgMemc, $wgLang;
     if (!$this->repo->fetchDescription) {
         return false;
     }
     $renderUrl = $this->repo->getDescriptionRenderUrl($this->getName(), $wgLang->getCode());
     if ($renderUrl) {
         if ($this->repo->descriptionCacheExpiry > 0) {
             wfDebug("Attempting to get the description from cache...");
             $key = $this->repo->getLocalCacheKey('RemoteFileDescription', 'url', $wgLang->getCode(), $this->getName());
             $obj = $wgMemc->get($key);
             if ($obj) {
                 wfDebug("success!\n");
                 return $obj;
             }
             wfDebug("miss\n");
         }
         wfDebug("Fetching shared description from {$renderUrl}\n");
         $res = Http::get($renderUrl);
         if ($res && $this->repo->descriptionCacheExpiry > 0) {
             $wgMemc->set($key, $res, $this->repo->descriptionCacheExpiry);
         }
         return $res;
     } else {
         return false;
     }
 }
开发者ID:namrenni,项目名称:mediawiki,代码行数:33,代码来源:File.php

示例2: getDescriptionText

 /**
  * Get the HTML text of the description page, if available
  *
  * @param bool|Language $lang Optional language to fetch description in
  * @return string
  */
 function getDescriptionText($lang = false)
 {
     global $wgLang;
     if (!$this->repo || !$this->repo->fetchDescription) {
         return false;
     }
     $lang = $lang ?: $wgLang;
     $renderUrl = $this->repo->getDescriptionRenderUrl($this->getName(), $lang->getCode());
     if ($renderUrl) {
         $cache = ObjectCache::getMainWANInstance();
         $key = null;
         if ($this->repo->descriptionCacheExpiry > 0) {
             wfDebug("Attempting to get the description from cache...");
             $key = $this->repo->getLocalCacheKey('RemoteFileDescription', 'url', $lang->getCode(), $this->getName());
             $obj = $cache->get($key);
             if ($obj) {
                 wfDebug("success!\n");
                 return $obj;
             }
             wfDebug("miss\n");
         }
         wfDebug("Fetching shared description from {$renderUrl}\n");
         $res = Http::get($renderUrl, array(), __METHOD__);
         if ($res && $key) {
             $cache->set($key, $res, $this->repo->descriptionCacheExpiry);
         }
         return $res;
     } else {
         return false;
     }
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:37,代码来源:File.php

示例3: getDescriptionText

 /**
  * Get the HTML text of the description page, if available
  *
  * @param bool|Language $lang Optional language to fetch description in
  * @return string
  */
 function getDescriptionText($lang = false)
 {
     global $wgLang;
     if (!$this->repo || !$this->repo->fetchDescription) {
         return false;
     }
     $lang = $lang ?: $wgLang;
     $renderUrl = $this->repo->getDescriptionRenderUrl($this->getName(), $lang->getCode());
     if ($renderUrl) {
         $cache = ObjectCache::getMainWANInstance();
         $key = $this->repo->getLocalCacheKey('RemoteFileDescription', 'url', $lang->getCode(), $this->getName());
         return $cache->getWithSetCallback($key, $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE, function ($oldValue, &$ttl, array &$setOpts) use($renderUrl) {
             wfDebug("Fetching shared description from {$renderUrl}\n");
             $res = Http::get($renderUrl, [], __METHOD__);
             if (!$res) {
                 $ttl = WANObjectCache::TTL_UNCACHEABLE;
             }
             return $res;
         });
     }
     return false;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:28,代码来源:File.php


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