mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
Compare commits
3 Commits
39ec8095e3
...
626df59c38
Author | SHA1 | Date | |
---|---|---|---|
626df59c38 | |||
f4153e53f2 | |||
6c7c210919 |
31
src/Tasks/PublishAllFiles.php
Executable file
31
src/Tasks/PublishAllFiles.php
Executable 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!');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user