mirror of
https://github.com/a2nt/silverstripe-webpack.git
synced 2024-10-22 17:05:31 +02:00
IMPR: Clean page content fields task
This commit is contained in:
parent
4eeed7a894
commit
ba534a3f18
29
app/src/Tasks/CleanContentTask.php
Normal file
29
app/src/Tasks/CleanContentTask.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Site\Tasks;
|
||||
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Dev\BuildTask;
|
||||
|
||||
class CleanContentTask extends BuildTask
|
||||
{
|
||||
protected $title = 'Clean content task';
|
||||
|
||||
protected $description = 'Clean content task';
|
||||
|
||||
protected $enabled = true;
|
||||
|
||||
public function run($request)
|
||||
{
|
||||
$pages = SiteTree::get();
|
||||
foreach ($pages as $p) {
|
||||
$p->setField('Content', '');
|
||||
$p->write();
|
||||
echo '#'.$p->ID.' '.$p->getField('Title').'<br/>';
|
||||
}
|
||||
|
||||
die('Done!');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user