Source of file EcommerceTaskSecondHandPublishAll.php
Size: 0,872 Bytes - Last Modified: 2021-12-23T10:41:14+00:00
/var/www/docs.ssmods.com/process/src/src/Tasks/EcommerceTaskSecondHandPublishAll.php
12345678910111213141516171819202122232425262728 | <?php namespace Sunnysideup\EcommerceSecondHandProduct\Tasks; use Environment; use SilverStripe\Dev\BuildTask; use SilverStripe\ORM\DB; use Sunnysideup\EcommerceSecondHandProduct\SecondHandProduct; class EcommerceTaskSecondHandPublishAll extends BuildTask { protected $title = '(Re)publish all second hand products'; protected $description = 'Go through all second hand products that are for sale and re-publish them...'; public function run($request) { Environment::increaseTimeLimitTo(600); $products = SecondHandProduct::get(); foreach ($products as $product) { DB::alteration_message('Publish: ' . $product->Title); $product->writeToStage('Stage'); $product->publish('Stage', 'Live'); } DB::alteration_message(' ================= Completed ================= '); } } |