public function __construct(TargetInterface $target) { parent::__construct($target); $this->setQueue(Queue::get('multilingual_section_processor')); $this->registerTask(new ReplaceContentLinksTask()); $this->registerTask(new ReplaceBlockPageRelationsTask()); }
public function rescanMultiple() { $files = $this->getRequestFiles('canEditFileContents'); $q = Queue::get('rescan_files'); if ($_POST['process']) { $obj = new stdClass(); $messages = $q->receive(5); foreach ($messages as $key => $msg) { // delete the page here $file = unserialize($msg->body); $f = \Concrete\Core\File\File::getByID($file['fID']); if (is_object($f)) { $this->doRescan($f); } $q->deleteMessage($msg); } $obj->totalItems = $q->count(); if ($q->count() == 0) { $q->deleteQueue(5); } print json_encode($obj); exit; } else { if ($q->count() == 0) { foreach ($files as $f) { $q->send(serialize(array('fID' => $f->getFileID()))); } } } $totalItems = $q->count(); Loader::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d file", "%d files", $totalItems))); return; }
public function queueForDefaultsUpdate($data, $queue, $includeThisBlock = true) { $blocks = array(); $db = \Database::connection(); $rows = $db->GetAll('select cID, max(cvID) as cvID, cbRelationID from CollectionVersionBlocks where cbRelationID = ? group by cID order by cID', [$this->getBlockRelationID()]); $oc = $this->getBlockCollectionObject(); $ocID = $oc->getCollectionID(); $ocvID = $oc->getVersionID(); foreach ($rows as $row) { $row2 = $db->GetRow('select bID, arHandle from CollectionVersionBlocks where cID = ? and cvID = ? and cbRelationID = ?', [$row['cID'], $row['cvID'], $row['cbRelationID']]); if ($includeThisBlock || ($row['cID'] != $ocID || $row['cvID'] != $ocvID || $row2['arHandle'] != $this->getAreaHandle() || $row2['bID'] != $this->getBlockID())) { $blocks[] = array('cID' => $row['cID'], 'cvID' => $row['cvID'], 'cbRelationID' => $row['cbRelationID'], 'bID' => $row2['bID'], 'arHandle' => $row2['arHandle'], 'data' => $data); } } $name = $queue->getName(); $queue->deleteQueue(); $queue = Queue::get($name); foreach ($blocks as $block) { $queue->send(serialize($block)); } return $queue; }