Esempio n. 1
0
 public function testHasUnprocessedReturnsFalseIfUnprocessedEventsExist()
 {
     $process = 'proc2';
     $this->_eventCollection->expects($this->once())->method('getSize')->will($this->returnValue(0));
     $this->_eventCollection->expects($this->once())->method('addProcessFilter')->with($process);
     $this->assertFalse($this->_model->hasUnprocessed($process));
 }
Esempio n. 2
0
 /**
  * Add name and description to collection elements
  *
  * @return $this
  */
 protected function _afterLoadCollection()
 {
     /** @var $item \Magento\Index\Model\Process */
     foreach ($this->_collection as $key => $item) {
         if (!$item->getIndexer()->isVisible()) {
             $this->_collection->removeItemByKey($key);
             continue;
         }
         $item->setName($item->getIndexer()->getName());
         $item->setDescription($item->getIndexer()->getDescription());
         $item->setUpdateRequired($this->_eventRepository->hasUnprocessed($item) ? 1 : 0);
         if ($item->isLocked()) {
             $item->setStatus(\Magento\Index\Model\Process::STATUS_RUNNING);
         }
     }
     return $this;
 }
Esempio n. 3
0
 /**
  * Reindex all data what this process responsible is
  * Check and using depends processes
  *
  * @return $this|void
  */
 public function reindexEverything()
 {
     if ($this->getData('runed_reindexall')) {
         return $this;
     }
     $this->setForcePartialReindex($this->getStatus() == self::STATUS_PENDING && $this->_eventRepository->hasUnprocessed($this));
     if ($this->getDepends()) {
         foreach ($this->getDepends() as $code) {
             $process = $this->_indexer->getProcessByCode($code);
             if ($process) {
                 $process->reindexEverything();
             }
         }
     }
     $this->setData('runed_reindexall', true);
     return $this->reindexAll();
 }