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.12 2006/03/13 06:13:39 slusarz Exp $
  6.  *
  7.  * Copyright 2003-2006 Michael Slusarz <slusarz@horde.org>
  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@horde.org>
  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(099== 0{
  30.             /* Make sure cleaning is done recursively. */
  31.             $files $vfs->listFolder($pathnulltruefalsetrue);
  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. }

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