[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/setup/ -> cache.php (source)

   1  <?php
   2  //
   3  // Created on: <15-Apr-2003 11:25:31 bf>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  $http =& eZHTTPTool::instance();
  28  $module =& $Params["Module"];
  29  
  30  include_once ( "kernel/common/template.php" );
  31  include_once ( "kernel/classes/ezcache.php" );
  32  include_once ( 'lib/ezutils/classes/ezhttptool.php' );
  33  include_once ( 'lib/ezfile/classes/ezdir.php' );
  34  
  35  $ini =& eZINI::instance( );
  36  $tpl =& templateInit();
  37  
  38  $cacheList = eZCache::fetchList();
  39  
  40  $cacheCleared = array( 'all' => false,
  41                         'content' => false,
  42                         'ini' => false,
  43                         'template' => false,
  44                         'list' => false,
  45                         'static' => false );
  46  
  47  $contentCacheEnabled = $ini->variable( 'ContentSettings', 'ViewCaching' ) == 'enabled';
  48  $iniCacheEnabled = true;
  49  $templateCacheEnabled = $ini->variable( 'TemplateSettings', 'TemplateCache' ) == 'enabled';
  50  
  51  $cacheEnabledList = array();
  52  foreach ( $cacheList as $cacheItem )
  53  {
  54      $cacheEnabledList[$cacheItem['id']] = $cacheItem['enabled'];
  55  }
  56  
  57  $cacheEnabled = array( 'all' => true,
  58                         'content' => $contentCacheEnabled,
  59                         'ini' => $iniCacheEnabled,
  60                         'template' => $templateCacheEnabled,
  61                         'list' => $cacheEnabledList );
  62  
  63  if ( $module->isCurrentAction( 'ClearAllCache' ) )
  64  {
  65      eZCache::clearAll();
  66      $cacheCleared['all'] = true;
  67  }
  68  
  69  if ( $module->isCurrentAction( 'ClearContentCache' ) )
  70  {
  71      eZCache::clearByTag( 'content' );
  72      $cacheCleared['content'] = true;
  73  }
  74  
  75  if ( $module->isCurrentAction( 'ClearINICache' ) )
  76  {
  77      eZCache::clearByTag( 'ini' );
  78      $cacheCleared['ini'] = true;
  79  }
  80  
  81  if ( $module->isCurrentAction( 'ClearTemplateCache' ) )
  82  {
  83      eZCache::clearByTag( 'template' );
  84      $cacheCleared['template'] = true;
  85  }
  86  
  87  if ( $module->isCurrentAction( 'ClearCache' ) )
  88  {
  89      $cacheClearList = $module->actionParameter( 'CacheList' );
  90      eZCache::clearByID( $cacheClearList );
  91      $cacheItemList = array();
  92      foreach ( $cacheClearList as $cacheClearItem )
  93      {
  94          foreach ( $cacheList as $cacheItem )
  95          {
  96              if ( $cacheItem['id'] == $cacheClearItem )
  97              {
  98                  $cacheItemList[] = $cacheItem;
  99                  break;
 100              }
 101          }
 102      }
 103      $cacheCleared['list'] = $cacheItemList;
 104  }
 105  
 106  if ( $module->isCurrentAction( 'RegenerateStaticCache' ) )
 107  {
 108      include_once ( 'kernel/classes/ezstaticcache.php' );
 109  
 110      $staticCache = new eZStaticCache();
 111      $staticCache->generateCache( true, true );
 112      eZStaticCache::executeActions();
 113      $cacheCleared['static'] = true;
 114  }
 115  
 116  $tpl->setVariable( "cache_cleared", $cacheCleared );
 117  $tpl->setVariable( "cache_enabled", $cacheEnabled );
 118  $tpl->setVariable( 'cache_list', $cacheList );
 119  
 120  
 121  $Result = array();
 122  $Result['content'] =& $tpl->fetch( "design:setup/cache.tpl" );
 123  $Result['path'] = array( array( 'url' => false,
 124                                  'text' => ezi18n( 'kernel/setup', 'Cache admin' ) ) );
 125  
 126  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7