mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 16:33:17 +01:00
* EPL: fix purging old versions also deletes them in S3, if used
This commit is contained in:
parent
08e170a4d5
commit
c8c8164cb1
@ -14,6 +14,7 @@ use EGroupware\Api;
|
||||
use EGroupware\Api\Framework;
|
||||
use EGroupware\Api\Etemplate;
|
||||
use EGroupware\Stylite\Vfs\Versioning;
|
||||
use EGroupware\Stylite\Vfs\S3;
|
||||
use EGroupware\Api\Vfs;
|
||||
|
||||
/**
|
||||
@ -225,38 +226,10 @@ class filemanager_admin extends filemanager_ui
|
||||
{
|
||||
@set_time_limit(0);
|
||||
$starttime = microtime(true);
|
||||
$deleted = $errors = 0;
|
||||
|
||||
// shortcut to efficently delete every old version and deleted file
|
||||
if ($content['versionedpath'] == '/')
|
||||
{
|
||||
$deleted = Versioning\StreamWrapper::purge_all_versioning($content['mtime']);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vfs::find($content['versionedpath'], array(
|
||||
'show-deleted' => true,
|
||||
'hidden' => true,
|
||||
'depth' => true,
|
||||
'path_preg' => '#/\.(attic|versions)/#',
|
||||
) + (!(int)$content['mtime'] ? array() : array(
|
||||
'mtime' => ($content['mtime'] < 0 ? '-' : '+') . (int)$content['mtime'],
|
||||
)), function ($path) use (&$deleted, &$errors) {
|
||||
if (($is_dir = Vfs::is_dir($path)) && Vfs::rmdir($path) ||
|
||||
!$is_dir && Vfs::unlink($path))
|
||||
{
|
||||
++$deleted;
|
||||
}
|
||||
else
|
||||
{
|
||||
++$errors;
|
||||
}
|
||||
});
|
||||
}
|
||||
$deleted = S3\StreamWrapper::purgeAllInactive($content['mtime'], $content['versionedpath']);
|
||||
$time = number_format(microtime(true) - $starttime, 1);
|
||||
$msg = ($errors ? lang('%1 errors deleting!', $errors) . "\n\n" : '') .
|
||||
lang('%1 files or directories deleted in %2 seconds.', $deleted, $time);
|
||||
$msg_type = $errors ? 'error' : 'info';
|
||||
$msg = lang('%1 files or directories deleted in %2 seconds.', $deleted, $time);
|
||||
$msg_type = 'info';
|
||||
}
|
||||
Vfs::$is_root = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user