-
Notifications
You must be signed in to change notification settings - Fork 0
/
reindex.php
36 lines (31 loc) · 1.08 KB
/
reindex.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
set_time_limit(0);
define('PATH_TO_MAGE', '/lib/Mage');
require_once realpath(PATH_TO_MAGE . '/app/Mage.php');
if (empty($argv[1])) {
echo "Usage: php " . __FILE__ . " [all|<index>[,<index>[,...]]]\n";
echo "\tIndexes:\n";
echo "\t\tcataloginventory_stock\n";
echo "\t\tcatalogsearch_fulltext\n";
echo "\t\tcatalog_category_flat\n";
echo "\t\tcatalog_category_product\n";
echo "\t\tcatalog_product_attribute\n";
echo "\t\tcatalog_product_flat\n";
echo "\t\tcatalog_product_price\n";
echo "\t\tcatalog_url\n";
echo "\t\ttag_summary\n";
}
if ($argv[1] != 'all') {
$indexes = explode(',', $argv[1]);
}
Mage::app('default', 'store')->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
echo "Reindexing:\n";
$processors = Mage::getSingleton('index/indexer')->getProcessesCollection();
foreach ($processors as $processor) {
if (empty($indexes) || in_array($processor->getIndexerCode(), $indexes)) {
echo "\t{$processor->getIndexer()->getName()}... ";
$processor->reindexEverything();
echo " [OK]\n";
}
}
echo "Done\n";