为此,您需要创建一个扩展的自定义模块:
/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php
更新
public function reindexProcessAction()
{
$process = $this->_initProcess();
// start logger here and get admin user name
if ($process) {
try {
Varien_Profiler::start('__INDEX_PROCESS_REINDEX_ALL__');
$process->reindexEverything();
Varien_Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__');
$this->_getSession()->addSuccess(
Mage::helper('index')->__('%s index was rebuilt.', $process->getIndexer()->getName())
);
} catch (Mage_Core_Exception $e) {
$this->_getSession()->addError($e->getMessage());
} catch (Exception $e) {
$this->_getSession()->addException($e,
Mage::helper('index')->__('There was a problem with reindexing process.')
);
}
} else {
$this->_getSession()->addError(
Mage::helper('index')->__('Cannot initialize the indexer process.')
);
}
// stop timer and write information to db or file
$this->_redirect('*/*/list');
}
和
public function massReindexAction()
{
// start logger here and get admin user name
/* @var $indexer Mage_Index_Model_Indexer */
$indexer = Mage::getSingleton('index/indexer');
$processIds = $this->getRequest()->getParam('process');
if (empty($processIds) || !is_array($processIds)) {
$this->_getSession()->addError(Mage::helper('index')->__('Please select Indexes'));
} else {
try {
foreach ($processIds as $processId) {
/* @var $process Mage_Index_Model_Process */
$process = $indexer->getProcessById($processId);
if ($process) {
$process->reindexEverything();
}
}
$count = count($processIds);
$this->_getSession()->addSuccess(
Mage::helper('index')->__('Total of %d index(es) have reindexed data.', $count)
);
} catch (Mage_Core_Exception $e) {
$this->_getSession()->addError($e->getMessage());
} catch (Exception $e) {
$this->_getSession()->addException($e, Mage::helper('index')->__('Cannot initialize the indexer process.'));
}
}
// stop timer and write information to db or file
$this->_redirect('*/*/list');
}