IMPR: Publish all files

This commit is contained in:
Tony Air 2024-04-24 13:59:03 +02:00
parent 6c7c210919
commit f4153e53f2

View File

@ -5,11 +5,11 @@ namespace A2nt\CMSNiceties\Tasks;
use SilverStripe\Assets\File; use SilverStripe\Assets\File;
use SilverStripe\Dev\BuildTask; use SilverStripe\Dev\BuildTask;
class PublishAllFiles extends BuildTask class BrokenFilesTask extends BuildTask
{ {
protected $title = 'Publish All Files Task'; protected $title = 'Broken Files Task';
protected $description = 'Publish All Files'; protected $description = 'Broken files report';
protected $enabled = true; protected $enabled = true;
@ -19,8 +19,10 @@ class PublishAllFiles extends BuildTask
$i = 0; $i = 0;
foreach ($files as $file) { foreach ($files as $file) {
if ($file->exists()) { if ($file->exists()) {
$file->publishFile(); echo '<b>'.$file->getField('Name').'</b><br/>';
$file->publishRecursive();
} }
$i++; $i++;
} }