mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 09:53:35 +02:00
Clean attachments command now works on secure attachments too.
This commit is contained in:
parent
63dc22f524
commit
d859d8533d
1 changed files with 7 additions and 3 deletions
|
@ -50,10 +50,15 @@ class CleanAttachmentsCommand extends Command
|
|||
|
||||
$mediaPath = $this->pathResolver->getMediaPath();
|
||||
$io->note("The media path is " . $mediaPath);
|
||||
$securePath = $this->pathResolver->getSecurePath();
|
||||
$io->note("The secure media path is ". $securePath);
|
||||
|
||||
$finder = new Finder();
|
||||
//We look for files in the media folder only
|
||||
$finder->files()->in($mediaPath);
|
||||
$finder->files()->in([$mediaPath, $securePath]);
|
||||
//Ignore image cache folder
|
||||
$finder->exclude('cache');
|
||||
|
||||
$fs = new Filesystem();
|
||||
|
||||
$file_list = array();
|
||||
|
@ -62,8 +67,7 @@ class CleanAttachmentsCommand extends Command
|
|||
$table->setHeaders(['Filename', 'MIME Type', 'Last modified date']);
|
||||
$dateformatter = \IntlDateFormatter::create(null, \IntlDateFormatter::SHORT, \IntlDateFormatter::SHORT);
|
||||
|
||||
foreach ($finder as $file)
|
||||
{
|
||||
foreach ($finder as $file) {
|
||||
//If not attachment object uses this file, print it
|
||||
if (count($this->reverseSearch->findAttachmentsByFile($file)) == 0) {
|
||||
$file_list[] = $file;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue