Compare commits

..

3 Commits

Author SHA1 Message Date
626df59c38 IMPR: Publish all files 2024-04-24 14:01:37 +02:00
f4153e53f2 IMPR: Publish all files 2024-04-24 13:59:03 +02:00
6c7c210919 IMPR: Publish all files 2024-04-24 13:52:55 +02:00

31
src/Tasks/PublishAllFiles.php Executable file
View File

@ -0,0 +1,31 @@
<?php
namespace A2nt\CMSNiceties\Tasks;
use SilverStripe\Assets\File;
use SilverStripe\Dev\BuildTask;
class PublishAllFiles extends BuildTask
{
protected $title = 'Publish All Files';
protected $description = 'Publish All Files';
protected $enabled = true;
public function run($request)
{
$files = File::get();
$i = 0;
foreach ($files as $file) {
if ($file->exists()) {
echo '<b>'.$file->getField('Name').'</b><br/>';
$file->publishRecursive();
}
$i++;
}
die('Done!');
}
}