mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
IMPR: Publish all files
This commit is contained in:
parent
39ec8095e3
commit
6c7c210919
29
src/Tasks/PublishAllFiles.php
Executable file
29
src/Tasks/PublishAllFiles.php
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace A2nt\CMSNiceties\Tasks;
|
||||
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Dev\BuildTask;
|
||||
|
||||
class PublishAllFiles extends BuildTask
|
||||
{
|
||||
protected $title = 'Publish All Files Task';
|
||||
|
||||
protected $description = 'Publish All Files';
|
||||
|
||||
protected $enabled = true;
|
||||
|
||||
public function run($request)
|
||||
{
|
||||
$files = File::get();
|
||||
$i = 0;
|
||||
foreach ($files as $file) {
|
||||
if ($file->exists()) {
|
||||
$file->publishFile();
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
die('Done!');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user