Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何检查Magento索引状态_Magento - Fatal编程技术网

如何检查Magento索引状态

如何检查Magento索引状态,magento,Magento,如何获取Magento索引状态的状态。如果需要,我想根据状态以编程方式重建索引。以下代码将在不考虑状态的情况下重新索引所有 我想重建索引,如果只需要 $indexCollection = Mage::getModel('index/process')->getCollection(); foreach ($indexCollection as $index) { $index->reindexAll(); } 你可以试试那样的 $myindex = Mage::getSing

如何获取Magento索引状态的状态。如果需要,我想根据状态以编程方式重建索引。以下代码将在不考虑状态的情况下重新索引所有

我想重建索引,如果只需要

$indexCollection = Mage::getModel('index/process')->getCollection();
foreach ($indexCollection as $index) {
   $index->reindexAll();
}

你可以试试那样的

$myindex = Mage::getSingleton('index/indexer')->getProcessByCode('processcode');
echo $myindex->getStatus();

你可以这样试试

for($i=1; $i<=9; $i++){
    $process = Mage::getSingleton('index/indexer')->getProcessById($i);
    $state = $process->getStatus();
    if($state == Mage_Index_Model_Process::STATUS_PENDING){
        $process->reindexEverything();
    }
}
for($i=1;$igetProcessById($i);
$state=$process->getStatus();
如果($state==Mage\u Index\u Model\u Process::STATUS\u PENDING){
$process->reindexEverything();
}
}

我认为这将有助于您这不是一个好主意,您不知道是否真的有9个索引,并且您不需要对对象进行任何检查以确保它们存在