/usr/share/php/Horde/Vfs/Gc.php is in php-horde-vfs 2.1.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | <?php
/**
* Class for providing garbage collection for any VFS instance.
*
* Copyright 2003-2013 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @author Michael Slusarz <slusarz@horde.org>
* @package Vfs
*/
class Horde_Vfs_Gc
{
/**
* Garbage collect files in the VFS storage system.
*
* @param VFS $vfs The VFS object to perform garbage collection on.
* @param string $path The VFS path to clean.
* @param integer $secs The minimum amount of time (in seconds) required
* before a file is removed.
*/
public function gc($vfs, $path, $secs = 345600)
{
/* A 1% chance we will run garbage collection during a call. */
if (rand(0, 99) != 0) {
return;
}
/* Use a backend-specific method if one exists. */
if (is_callable(array($vfs, 'gc'))) {
$vfs->gc($path, $secs);
}
/* Make sure cleaning is done recursively. */
try {
$modtime = time() - $secs;
foreach ($vfs->listFolder($path, null, true, false, true) as $val) {
if ($val['date'] < $modtime) {
$vfs->deleteFile($path, $val['name']);
}
}
} catch (Horde_Vfs_Exception $e) {
}
}
}
|