VFS
[ class tree: VFS ] [ index: VFS ] [ all elements ]

Source for file GC.php

Documentation is available at GC.php

  1. <?php
  2. /**
  3.  * Class for providing garbage collection for any VFS instance.
  4.  *
  5.  * $Horde: framework/VFS/VFS/GC.php,v 1.6 2005/03/14 02:12:13 slusarz Exp $
  6.  *
  7.  * Copyright 2003-2005 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.  * @version $Revision: 1.6 $
  14.  * @since   Horde 3.0
  15.  * @package VFS
  16.  */
  17. class VFS_GC {
  18.  
  19.     /**
  20.      * Garbage collect files in the VFS storage system.
  21.      *
  22.      * @access public
  23.      *
  24.      * @param object VFS &$vfs        The VFS object to perform
  25.      *                                 garbage collection on.
  26.      * @param string $path            The VFS path to clean.
  27.      * @param optional integer $secs  The minimum amount of time (in seconds)
  28.      *                                 required before a file is removed.
  29.      */
  30.     function gc(&$vfs$path$secs = 345600)
  31.     {
  32.         /* A 1% chance we will run garbage collection during a call. */
  33.         if (rand(099== 0{
  34.             /* Make sure cleaning is done recursively. */
  35.             $files $vfs->listFolder($pathnulltruefalsetrue);
  36.             if (!is_a($files'PEAR_Error'&& is_array($files)) {
  37.                 $modtime time($secs;
  38.                 foreach ($files as $val{
  39.                     if ($val['date'$modtime{
  40.                         $vfs->deleteFile($path$val['name']);
  41.                     }
  42.                 }
  43.             }
  44.         }
  45.     }
  46.  
  47. }

Documentation generated on Mon, 11 Mar 2019 14:31:25 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.