[ Index ]
 

Code source de Horde 3.1.3

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

title

Body

[fermer]

/lib/VFS/ -> GC.php (source)

   1  <?php
   2  /**
   3   * Class for providing garbage collection for any VFS instance.
   4   *
   5   * $Horde: framework/VFS/VFS/GC.php,v 1.4.12.8 2006/01/01 21:28:42 jan Exp $
   6   *
   7   * Copyright 2003-2006 Michael Slusarz <slusarz@bigworm.colorado.edu>
   8   *
   9   * See the enclosed file COPYING for license information (LGPL). If you
  10   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  11   *
  12   * @author  Michael Slusarz <slusarz@bigworm.colorado.edu>
  13   * @since   Horde 3.0
  14   * @package VFS
  15   */
  16  class VFS_GC {
  17  
  18      /**
  19       * Garbage collect files in the VFS storage system.
  20       *
  21       * @param VFS &$vfs      The VFS object to perform garbage collection on.
  22       * @param string $path   The VFS path to clean.
  23       * @param integer $secs  The minimum amount of time (in seconds) required
  24       *                       before a file is removed.
  25       */
  26      function gc(&$vfs, $path, $secs = 345600)
  27      {
  28          /* A 1% chance we will run garbage collection during a call. */
  29          if (rand(0, 99) == 0) {
  30              /* Make sure cleaning is done recursively. */
  31              $files = $vfs->listFolder($path, null, true, false, true);
  32              if (!is_a($files, 'PEAR_Error') && is_array($files)) {
  33                  $modtime = time() - $secs;
  34                  foreach ($files as $val) {
  35                      if ($val['date'] < $modtime) {
  36                          $vfs->deleteFile($path, $val['name']);
  37                      }
  38                  }
  39              }
  40          }
  41      }
  42  
  43  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7