Example #1
0
 /**
  * Removes redirect rows which have no corresponding records in redirect table from index.
  *
  * @return Enterprise_UrlRewrite_Model_Index_Action_Url_Rewrite_Redirect_Refresh_Orphan
  * @throws Enterprise_Index_Model_Action_Exception
  */
 public function execute()
 {
     try {
         $select = $this->_connection->select()->from(array('ur' => $this->_getTable('enterprise_urlrewrite/url_rewrite')), '*')->joinInner(array('rr' => $this->_getTable('enterprise_urlrewrite/redirect_rewrite')), 'ur.url_rewrite_id = rr.url_rewrite_id')->joinLeft(array('redirect' => $this->_getTable('enterprise_urlrewrite/redirect')), 'redirect.redirect_id = rr.redirect_id')->where('ur.entity_type = ?', Enterprise_UrlRewrite_Model_Redirect::URL_REWRITE_ENTITY_TYPE)->where('redirect.redirect_id IS NULL');
         $this->_connection->query($this->_connection->deleteFromSelect($select, 'ur'));
     } catch (Exception $e) {
         $this->_metadata->setInvalidStatus()->save();
         throw new Enterprise_Index_Model_Action_Exception($e->getMessage(), $e->getCode(), $e);
     }
     return $this;
 }
 /**
  * Refresh rows by ids from changelog.
  *
  * @return Smile_VirtualCategories_Model_Index_Action_VirtualCategories_Product_Position_Refresh_Changelog
  *
  * @throws Enterprise_Index_Model_Action_Exception
  */
 public function execute()
 {
     if (!$this->_metadata->isValid()) {
         throw new Enterprise_Index_Model_Action_Exception("Can't perform operation, incomplete metadata!");
     }
     if (Mage::helper('smile_elasticsearch')->isActiveEngine() == true) {
         try {
             if (!empty($this->_changedIds)) {
                 $this->_metadata->setInProgressStatus()->save();
                 $engine = Mage::helper('catalogsearch')->getEngine();
                 $mapping = $engine->getCurrentIndex()->getMapping('product');
                 $dataprovider = $mapping->getDataProvider('virtual_categories_products_position');
                 $dataprovider->updateAllData(null, $this->_changedIds);
                 $this->_updateMetadata();
             }
         } catch (Exception $e) {
             $this->_metadata->setInvalidStatus()->save();
             throw new Enterprise_Index_Model_Action_Exception($e->getMessage(), $e->getCode());
         }
     }
     return $this;
 }
 /**
  * Refresh materialized view
  *
  * @return Enterprise_Mview_Model_Action_Mview_Refresh
  * @throws Exception
  */
 public function execute()
 {
     try {
         $insert = $this->_connection->insertFromSelect($this->_connection->select()->from($this->_metadata->getViewName()), $this->_metadata->getTableName());
         $this->_connection->delete($this->_metadata->getTableName());
         $this->_connection->query($insert);
         $this->_metadata->setValidStatus()->setVersionId($this->_selectLastVersionId())->save();
     } catch (Exception $e) {
         $this->_metadata->setInvalidStatus()->save();
         throw $e;
     }
     return $this;
 }
 /**
  * Execute refresh operation.
  *  - clean redirect url rewrites
  *  - refresh redirect url rewrites
  *  - refresh redirect to url rewrite relations
  *
  * @return Enterprise_Mview_Model_Action_Interface
  * @throws Enterprise_Index_Model_Action_Exception
  */
 public function execute()
 {
     try {
         $this->_metadata->setInProgressStatus()->save();
         $this->_cleanOldUrlRewrite();
         $this->_refreshUrlRewrite();
         $this->_refreshRelation();
         $this->_setChangelogValid();
     } catch (Exception $e) {
         $this->_metadata->setInvalidStatus()->save();
         throw new Enterprise_Index_Model_Action_Exception($e->getMessage(), $e->getCode());
     }
     return $this;
 }
Example #5
0
 /**
  * Run full reindex
  *
  * @return Enterprise_Catalog_Model_Index_Action_Catalog_Category_Product_Refresh
  * @throws Enterprise_Index_Model_Action_Exception
  */
 public function execute()
 {
     if (!$this->_metadata->isValid()) {
         throw new Enterprise_Index_Model_Action_Exception("Can't perform operation, incomplete metadata!");
     }
     try {
         $this->_reindex();
         $this->_app->dispatchEvent('enterprise_after_reindex_process_catalog_category_product', array());
         $this->_dispatchNotification();
     } catch (Exception $e) {
         $this->_metadata->setInvalidStatus()->save();
         throw new Enterprise_Index_Model_Action_Exception($e->getMessage(), $e->getCode(), $e);
     }
     return $this;
 }
Example #6
0
 /**
  * Run full reindex
  *
  * @return Enterprise_CatalogSearch_Model_Index_Action_Fulltext_Refresh
  * @throws Enterprise_Index_Model_Action_Exception
  */
 public function execute()
 {
     if (!$this->_metadata->isValid()) {
         throw new Enterprise_Index_Model_Action_Exception("Can't perform operation, incomplete metadata!");
     }
     try {
         $this->_getLastVersionId();
         $this->_metadata->setInProgressStatus()->save();
         // Reindex all products
         $this->_indexer->rebuildIndex();
         // Clear search results
         $this->_resetSearchResults();
         $this->_updateMetadata();
         $this->_app->dispatchEvent('after_reindex_process_catalogsearch_index', array());
     } catch (Exception $e) {
         $this->_metadata->setInvalidStatus()->save();
         throw new Enterprise_Index_Model_Action_Exception($e->getMessage(), $e->getCode());
     }
     return $this;
 }