isQueueActive() public method

public isQueueActive ( $storeId = null )
 public function saveSettings($isFullProductReindex = false)
 {
     foreach (Mage::app()->getStores() as $store) {
         /* @var $store Mage_Core_Model_Store */
         if ($store->getIsActive()) {
             $saveToTmpIndicesToo = $isFullProductReindex && $this->config->isQueueActive($store->getId());
             $this->helper->saveConfigurationToAlgolia($store->getId(), $saveToTmpIndicesToo);
         }
     }
 }
Example #2
0
 public function runCron()
 {
     if (!$this->config->isQueueActive()) {
         return;
     }
     $nbJobs = $this->config->getNumberOfJobToRun();
     if (getenv('EMPTY_QUEUE') && getenv('EMPTY_QUEUE') == '1') {
         $nbJobs = -1;
     }
     $this->run($nbJobs);
 }
Example #3
0
 public function rebuildProducts($reindexStoreId = null)
 {
     $this->saveSettings(true);
     /** @var Mage_Core_Model_Store $store */
     foreach (Mage::app()->getStores() as $store) {
         $storeId = $store->getId();
         if ($reindexStoreId !== null && $storeId != $reindexStoreId) {
             continue;
         }
         if ($this->config->isEnabledBackend($storeId) === false) {
             if (php_sapi_name() === 'cli') {
                 echo '[ALGOLIA] INDEXING IS DISABLED FOR ' . $this->logger->getStoreName($storeId) . "\n";
             }
             /** @var Mage_Adminhtml_Model_Session $session */
             $session = Mage::getSingleton('adminhtml/session');
             $session->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR ' . $this->logger->getStoreName($storeId));
             $this->logger->log('INDEXING IS DISABLED FOR ' . $this->logger->getStoreName($storeId));
             continue;
         }
         if ($store->getIsActive()) {
             $useTmpIndex = $this->config->isQueueActive($storeId);
             $this->_rebuildProductIndex($storeId, array(), $useTmpIndex);
             if ($this->config->isQueueActive($storeId)) {
                 $this->addToQueue('algoliasearch/observer', 'moveProductsTmpIndex', array('store_id' => $storeId), 1);
             }
         } else {
             $this->addToQueue('algoliasearch/observer', 'deleteProductsStoreIndices', array('store_id' => $storeId), 1);
         }
     }
 }