当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Index_Model_Process::indexEvents方法代码示例

本文整理汇总了PHP中Mage_Index_Model_Process::indexEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Index_Model_Process::indexEvents方法的具体用法?PHP Mage_Index_Model_Process::indexEvents怎么用?PHP Mage_Index_Model_Process::indexEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Index_Model_Process的用法示例。


在下文中一共展示了Mage_Index_Model_Process::indexEvents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executePartialIndex

 /**
  * Tells the core indexer to do a partial reindex
  * @param Mage_Index_Model_Process $process
  * @throws Exception
  */
 public function executePartialIndex(Mage_Index_Model_Process $process)
 {
     /** @var $resourceModel Mage_Index_Model_Resource_Process */
     $resourceModel = Mage::getResourceSingleton('index/process');
     if (Mage::getStoreConfigFlag('system/asyncindex/use_transactions')) {
         $resourceModel->beginTransaction();
     }
     $indexMode = 'schedule';
     $pendingMode = 'pending';
     //Fallback for 1.6.2 installations > Undefined class constant 'MODE_SCHEDULE'
     if (true === defined('Mage_Index_Model_Process::MODE_SCHEDULE')) {
         $indexMode = Mage_Index_Model_Process::MODE_SCHEDULE;
         $pendingMode = Mage_Index_Model_Process::STATUS_PENDING;
     }
     try {
         $process->setMode($indexMode);
         $process->indexEvents();
         if (count(Mage::getResourceSingleton('index/event')->getUnprocessedEvents($process)) === 0) {
             $process->changeStatus($pendingMode);
         }
         if (Mage::getStoreConfigFlag('system/asyncindex/use_transactions')) {
             $resourceModel->commit();
         }
     } catch (Exception $e) {
         if (Mage::getStoreConfigFlag('system/asyncindex/use_transactions')) {
             $resourceModel->rollBack();
         }
         throw $e;
     }
 }
开发者ID:itmyprofession,项目名称:AsyncIndex,代码行数:35,代码来源:Manager.php

示例2: _execPartialIndex

 /**
  * @param Mage_Index_Model_Process $process
  *
  * @throws Exception
  */
 protected function _execPartialIndex(Mage_Index_Model_Process $process)
 {
     $this->_indexerTransactionBegin();
     // MODE_SCHEDULE available in Mage >1.8
     $indexMode = true === defined('Mage_Index_Model_Process::MODE_SCHEDULE') ? Mage_Index_Model_Process::MODE_SCHEDULE : 'schedule';
     $pendingMode = Mage_Index_Model_Process::STATUS_PENDING;
     try {
         $process->setMode($indexMode);
         $process->indexEvents();
         $unProcessedEvents = count(Mage::getResourceSingleton('index/event')->getUnprocessedEvents($process));
         if (0 === $unProcessedEvents) {
             $process->changeStatus($pendingMode);
         }
         $this->_indexerTransactionCommit();
     } catch (Exception $e) {
         $this->_indexerTransactionRollBack();
         throw $e;
     }
 }
开发者ID:ThomasNegeli,项目名称:Magento-FastIndexer,代码行数:24,代码来源:Cron.php


注:本文中的Mage_Index_Model_Process::indexEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。