leovirgilio
12/27/2016 - 1:12 PM

Check locks reindex Magento

Check locks reindex Magento

<?php
require_once ("app/Mage.php");
umask(0);
Mage::app();

$resource   = Mage::getSingleton('enterprise_index/resource_lock_resource');
$connection = $resource->getConnection('enterprise_index_write', 'default_lock');
$helper = Mage::getResourceHelper('enterprise_index')->setWriteAdapter($connection);

$config = $connection->getConfig();
$lockName = $config['dbname'] . '.' . 'reindex_full';


if ($helper->isLocked($lockName)) {
    echo 'lock found: ' . $lockName;
} else {
    echo 'not locked';
}