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


PHP Folder::lastModifiedFolder方法代码示例

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


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

示例1: buildPages

 /**
  * Builds pages.
  *
  * @internal
  */
 protected function buildPages()
 {
     $this->sort = array();
     /** @var Config $config */
     $config = $this->grav['config'];
     /** @var UniformResourceLocator $locator */
     $locator = $this->grav['locator'];
     $pagesDir = $locator->findResource('page://');
     if ($config->get('system.cache.enabled')) {
         /** @var Cache $cache */
         $cache = $this->grav['cache'];
         /** @var Taxonomy $taxonomy */
         $taxonomy = $this->grav['taxonomy'];
         // how should we check for last modified? Default is by file
         switch (strtolower($config->get('system.cache.check.method', 'file'))) {
             case 'none':
             case 'off':
                 $last_modified = 0;
                 break;
             case 'folder':
                 $last_modified = Folder::lastModifiedFolder($pagesDir);
                 break;
             default:
                 $last_modified = Folder::lastModifiedFile($pagesDir);
         }
         $page_cache_id = md5(USER_DIR . $last_modified . $config->checksum());
         list($this->instances, $this->routes, $this->children, $taxonomy_map, $this->sort) = $cache->fetch($page_cache_id);
         if (!$this->instances) {
             $this->grav['debugger']->addMessage('Page cache missed, rebuilding pages..');
             $this->recurse($pagesDir);
             $this->buildRoutes();
             // save pages, routes, taxonomy, and sort to cache
             $cache->save($page_cache_id, array($this->instances, $this->routes, $this->children, $taxonomy->taxonomy(), $this->sort));
         } else {
             // If pages was found in cache, set the taxonomy
             $this->grav['debugger']->addMessage('Page cache hit.');
             $taxonomy->taxonomy($taxonomy_map);
         }
     } else {
         $this->recurse($pagesDir);
         $this->buildRoutes();
     }
 }
开发者ID:alexslack,项目名称:faith-game,代码行数:48,代码来源:Pages.php

示例2: buildPages

 /**
  * Builds pages.
  *
  * @internal
  */
 protected function buildPages()
 {
     $this->sort = array();
     /** @var Config $config */
     $config = $this->grav['config'];
     if ($config->get('system.cache.enabled')) {
         /** @var Cache $cache */
         $cache = $this->grav['cache'];
         /** @var Taxonomy $taxonomy */
         $taxonomy = $this->grav['taxonomy'];
         $last_modified = 0;
         // how should we check for last modified? Default is by file
         switch (strtolower($config->get('system.cache.check.method', 'file'))) {
             case 'none':
             case 'off':
                 $last_modified = 0;
                 break;
             case 'folder':
                 $last_modified = Folder::lastModifiedFolder(PAGES_DIR);
                 break;
             default:
                 $last_modified = Folder::lastModifiedFile(PAGES_DIR);
         }
         $page_cache_id = md5(USER_DIR . $last_modified);
         list($this->instances, $this->routes, $this->children, $taxonomy_map, $this->sort) = $cache->fetch($page_cache_id);
         if (!$this->instances) {
             $this->recurse();
             $this->buildRoutes();
             // save pages, routes, taxonomy, and sort to cache
             $cache->save($page_cache_id, array($this->instances, $this->routes, $this->children, $taxonomy->taxonomy(), $this->sort));
         } else {
             // If pages was found in cache, set the taxonomy
             $taxonomy->taxonomy($taxonomy_map);
         }
     } else {
         $this->recurse();
         $this->buildRoutes();
     }
 }
开发者ID:miguelramos,项目名称:grav,代码行数:44,代码来源:Pages.php


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