Refresh all magento indexes

The indexes for your Magento site should be refreshed on a regular basis. To help you do this you can put the below code in a PHP file in the root of your web site and setup a scheduled task to call it periodically.

require_once 'app/Mage.php';
$app = Mage::app('admin');
umask(0);
for ($i = 1; $i <= 8; $i++) {
    $process = Mage::getModel('index/process')->load($i);
    $process->reindexAll();
}

Tags: phpmagentocronscriptindextaskindexesrebuild