Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Index_Adminhtml_ProcessController
  • Mage_Index_Block_Adminhtml_Notifications
  • Mage_Index_Block_Adminhtml_Process
  • Mage_Index_Block_Adminhtml_Process_Edit
  • Mage_Index_Block_Adminhtml_Process_Edit_Form
  • Mage_Index_Block_Adminhtml_Process_Edit_Tab_Main
  • Mage_Index_Block_Adminhtml_Process_Edit_Tabs
  • Mage_Index_Block_Adminhtml_Process_Grid
  • Mage_Index_Block_Adminhtml_Process_Grid_Massaction
  • Mage_Index_Helper_Data
  • Mage_Index_Model_Event
  • Mage_Index_Model_Indexer
  • Mage_Index_Model_Indexer_Abstract
  • Mage_Index_Model_Mysql4_Abstract
  • Mage_Index_Model_Mysql4_Event
  • Mage_Index_Model_Mysql4_Event_Collection
  • Mage_Index_Model_Mysql4_Process
  • Mage_Index_Model_Mysql4_Process_Collection
  • Mage_Index_Model_Mysql4_Setup
  • Mage_Index_Model_Observer
  • Mage_Index_Model_Process
  • Mage_Index_Model_Resource_Abstract
  • Mage_Index_Model_Resource_Event
  • Mage_Index_Model_Resource_Event_Collection
  • Mage_Index_Model_Resource_Helper_Mysql4
  • Mage_Index_Model_Resource_Process
  • Mage_Index_Model_Resource_Process_Collection
  • Mage_Index_Model_Resource_Setup
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Index
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: class Mage_Index_Adminhtml_ProcessController extends Mage_Adminhtml_Controller_Action
 27: {
 28:     /**
 29:      * Initialize process object by request
 30:      *
 31:      * @return Mage_Index_Model_Process|false
 32:      */
 33:     protected function _initProcess()
 34:     {
 35:         $processId = $this->getRequest()->getParam('process');
 36:         if ($processId) {
 37:             $process = Mage::getModel('index/process')->load($processId);
 38:             if ($process->getId()) {
 39:                 return $process;
 40:             }
 41:         }
 42:         return false;
 43:     }
 44: 
 45:     /**
 46:      * Display processes grid action
 47:      */
 48:     public function listAction()
 49:     {
 50:         $this->_title($this->__('System'))->_title($this->__('Index Management'));
 51: 
 52:         $this->loadLayout();
 53:         $this->_setActiveMenu('system/index');
 54:         $this->_addContent($this->getLayout()->createBlock('index/adminhtml_process'));
 55:         $this->renderLayout();
 56:     }
 57: 
 58:     /**
 59:      * Process detail and edit action
 60:      */
 61:     public function editAction()
 62:     {
 63:         $process = $this->_initProcess();
 64:         if ($process) {
 65:             $this->_title($process->getIndexCode());
 66: 
 67:             $this->_title($this->__('System'))
 68:                  ->_title($this->__('Index Management'))
 69:                  ->_title($this->__($process->getIndexer()->getName()));
 70: 
 71:             Mage::register('current_index_process', $process);
 72:             $this->loadLayout();
 73:             $this->renderLayout();
 74:         } else {
 75:             $this->_getSession()->addError(
 76:                 Mage::helper('index')->__('Cannot initialize the indexer process.')
 77:             );
 78:             $this->_redirect('*/*/list');
 79:         }
 80:     }
 81: 
 82:     /**
 83:      * Save process data
 84:      */
 85:     public function saveAction()
 86:     {
 87:         $process = $this->_initProcess();
 88:         if ($process) {
 89:             $mode = $this->getRequest()->getPost('mode');
 90:             if ($mode) {
 91:                 $process->setMode($mode);
 92:             }
 93:             try {
 94:                 $process->save();
 95:                 $this->_getSession()->addSuccess(
 96:                     Mage::helper('index')->__('The index has been saved.')
 97:                 );
 98:             } catch (Mage_Core_Exception $e) {
 99:                 $this->_getSession()->addError($e->getMessage());
100:             } catch (Exception $e) {
101:                 $this->_getSession()->addException($e,
102:                      Mage::helper('index')->__('There was a problem with saving process.')
103:                 );
104:             }
105:             $this->_redirect('*/*/list');
106:         } else {
107:             $this->_getSession()->addError(
108:                 Mage::helper('index')->__('Cannot initialize the indexer process.')
109:             );
110:             $this->_redirect('*/*/list');
111:         }
112:     }
113: 
114:     /**
115:      * Reindex all data what process is responsible
116:      */
117:     public function reindexProcessAction()
118:     {
119:         $process = $this->_initProcess();
120:         if ($process) {
121:             try {
122:                 Varien_Profiler::start('__INDEX_PROCESS_REINDEX_ALL__');
123: 
124:                 $process->reindexEverything();
125:                 Varien_Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__');
126:                 $this->_getSession()->addSuccess(
127:                     Mage::helper('index')->__('%s index was rebuilt.', $process->getIndexer()->getName())
128:                 );
129:             } catch (Mage_Core_Exception $e) {
130:                 $this->_getSession()->addError($e->getMessage());
131:             } catch (Exception $e) {
132:                 $this->_getSession()->addException($e,
133:                      Mage::helper('index')->__('There was a problem with reindexing process.')
134:                 );
135:             }
136:         } else {
137:             $this->_getSession()->addError(
138:                 Mage::helper('index')->__('Cannot initialize the indexer process.')
139:             );
140:         }
141: 
142:         $this->_redirect('*/*/list');
143:     }
144: 
145:     /**
146:      * Reindex pending events for index process
147:      */
148:     public function reindexEventsAction()
149:     {
150: 
151:     }
152: 
153:     /**
154:      * Rebiuld all processes index
155:      */
156:     public function reindexAllAction()
157:     {
158: 
159:     }
160: 
161:     /**
162:      * Mass rebuild selected processes index
163:      *
164:      */
165:     public function massReindexAction()
166:     {
167:         /* @var $indexer Mage_Index_Model_Indexer */
168:         $indexer    = Mage::getSingleton('index/indexer');
169:         $processIds = $this->getRequest()->getParam('process');
170:         if (empty($processIds) || !is_array($processIds)) {
171:             $this->_getSession()->addError(Mage::helper('index')->__('Please select Indexes'));
172:         } else {
173:             try {
174:                 foreach ($processIds as $processId) {
175:                     /* @var $process Mage_Index_Model_Process */
176:                     $process = $indexer->getProcessById($processId);
177:                     if ($process) {
178:                         $process->reindexEverything();
179:                     }
180:                 }
181:                 $count = count($processIds);
182:                 $this->_getSession()->addSuccess(
183:                     Mage::helper('index')->__('Total of %d index(es) have reindexed data.', $count)
184:                 );
185:             } catch (Mage_Core_Exception $e) {
186:                 $this->_getSession()->addError($e->getMessage());
187:             } catch (Exception $e) {
188:                 $this->_getSession()->addException($e, Mage::helper('index')->__('Cannot initialize the indexer process.'));
189:             }
190:         }
191: 
192:         $this->_redirect('*/*/list');
193:     }
194: 
195:     /**
196:      * Mass change index mode of selected processes index
197:      *
198:      */
199:     public function massChangeModeAction()
200:     {
201:         $processIds = $this->getRequest()->getParam('process');
202:         if (empty($processIds) || !is_array($processIds)) {
203:             $this->_getSession()->addError(Mage::helper('index')->__('Please select Index(es)'));
204:         } else {
205:             try {
206:                 $mode = $this->getRequest()->getParam('index_mode');
207:                 foreach ($processIds as $processId) {
208:                     /* @var $process Mage_Index_Model_Process */
209:                     $process = Mage::getModel('index/process')->load($processId);
210:                     if ($process->getId()) {
211:                         $process->setMode($mode)
212:                             ->save();
213:                     }
214:                 }
215:                 $count = count($processIds);
216:                 $this->_getSession()->addSuccess(
217:                     Mage::helper('index')->__('Total of %d index(es) have changed index mode.', $count)
218:                 );
219:             } catch (Mage_Core_Exception $e) {
220:                 $this->_getSession()->addError($e->getMessage());
221:             } catch (Exception $e) {
222:                 $this->_getSession()->addException($e, Mage::helper('index')->__('Cannot initialize the indexer process.'));
223:             }
224:         }
225: 
226:         $this->_redirect('*/*/list');
227:     }
228: 
229:     /**
230:      * Check ACL permissins
231:      *
232:      * @return bool
233:      */
234:     protected function _isAllowed()
235:     {
236:         return Mage::getSingleton('admin/session')->isAllowed('system/index');
237:     }
238: }
239: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0