Source of file VirtualFieldIndexQueuedJob.php
Size: 1,491 Bytes - Last Modified: 2021-12-23T10:03:27+00:00
/var/www/docs.ssmods.com/process/src/code/helpers/VirtualFieldIndexQueuedJob.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 | <?php /** * If the queued jobs module is installed, this will be used instead of * updating vfi's in onBeforeWrite. * * @author Mark Guinn <mark@adaircreative.com> * @date 07.02.2015 * @package shop_search * @subpackage helpers */ if (!interface_exists('QueuedJob')) { return; } class VirtualFieldIndexQueuedJob extends AbstractQueuedJob implements QueuedJob { /** * The QueuedJob queue to use when processing updates * @config * @var int */ private static $reindex_queue = 2; // QueuedJob::QUEUED; /** * @param DataObject $object * @param array $fields */ public function __construct($object = null, $fields = array()) { if ($object) { $this->setObject($object); } $this->rebuildFields = $fields; } /** * Helper method */ public function triggerProcessing() { singleton('QueuedJobService')->queueJob($this); } /** * @return string */ public function getTitle() { $obj = $this->getObject(); return "Update Virtual Field Indexes: " . ($obj ? $obj->getTitle() : '???'); } /** * Reprocess any needed fields */ public function process() { Versioned::reading_stage('Stage'); /** @var DataObject|VirtualFieldIndex $obj */ $obj = $this->getObject(); if ($obj) { $obj->rebuildVFI(); } $this->isComplete = true; } } |