mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-22 10:52:00 +02: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\Framework;
|
||||||
use EGroupware\Api\Etemplate;
|
use EGroupware\Api\Etemplate;
|
||||||
use EGroupware\Stylite\Vfs\Versioning;
|
use EGroupware\Stylite\Vfs\Versioning;
|
||||||
|
use EGroupware\Stylite\Vfs\S3;
|
||||||
use EGroupware\Api\Vfs;
|
use EGroupware\Api\Vfs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,38 +226,10 @@ class filemanager_admin extends filemanager_ui
|
|||||||
{
|
{
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
$starttime = microtime(true);
|
$starttime = microtime(true);
|
||||||
$deleted = $errors = 0;
|
$deleted = S3\StreamWrapper::purgeAllInactive($content['mtime'], $content['versionedpath']);
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$time = number_format(microtime(true) - $starttime, 1);
|
$time = number_format(microtime(true) - $starttime, 1);
|
||||||
$msg = ($errors ? lang('%1 errors deleting!', $errors) . "\n\n" : '') .
|
$msg = lang('%1 files or directories deleted in %2 seconds.', $deleted, $time);
|
||||||
lang('%1 files or directories deleted in %2 seconds.', $deleted, $time);
|
$msg_type = 'info';
|
||||||
$msg_type = $errors ? 'error' : 'info';
|
|
||||||
}
|
}
|
||||||
Vfs::$is_root = false;
|
Vfs::$is_root = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user