コード例 #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));
 }
コード例 #2
0
ファイル: Grid.php プロジェクト: aiesh/magento2
 /**
  * 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;
 }
コード例 #3
0
ファイル: Process.php プロジェクト: aiesh/magento2
 /**
  * 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();
 }