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: 
 27: 
 28: /**
 29:  * Index Process Resource Model
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_Index
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Index_Model_Resource_Process extends Mage_Core_Model_Resource_Db_Abstract
 36: {
 37:     /**
 38:      * Initialize  table and table pk
 39:      *
 40:      */
 41:     protected function _construct()
 42:     {
 43:         $this->_init('index/process', 'process_id');
 44:     }
 45: 
 46:     /**
 47:      * Update process/event association row status
 48:      *
 49:      * @param int $processId
 50:      * @param int $eventId
 51:      * @param string $status
 52:      * @return Mage_Index_Model_Resource_Process
 53:      */
 54:     public function updateEventStatus($processId, $eventId, $status)
 55:     {
 56:         $adapter = $this->_getWriteAdapter();
 57:         $condition = array(
 58:             'process_id = ?' => $processId,
 59:             'event_id = ?'   => $eventId
 60:         );
 61:         $adapter->update($this->getTable('index/process_event'), array('status' => $status), $condition);
 62:         return $this;
 63:     }
 64: 
 65:     /**
 66:      * Register process end
 67:      *
 68:      * @param Mage_Index_Model_Process $process
 69:      * @return Mage_Index_Model_Resource_Process
 70:      */
 71:     public function endProcess(Mage_Index_Model_Process $process)
 72:     {
 73:         $data = array(
 74:             'status'    => Mage_Index_Model_Process::STATUS_PENDING,
 75:             'ended_at'  => $this->formatDate(time()),
 76:         );
 77:         $this->_updateProcessData($process->getId(), $data);
 78:         return $this;
 79:     }
 80: 
 81:     /**
 82:      * Register process start
 83:      *
 84:      * @param Mage_Index_Model_Process $process
 85:      * @return Mage_Index_Model_Resource_Process
 86:      */
 87:     public function startProcess(Mage_Index_Model_Process $process)
 88:     {
 89:         $data = array(
 90:             'status'        => Mage_Index_Model_Process::STATUS_RUNNING,
 91:             'started_at'    => $this->formatDate(time()),
 92:         );
 93:         $this->_updateProcessData($process->getId(), $data);
 94:         return $this;
 95:     }
 96: 
 97:     /**
 98:      * Register process fail
 99:      *
100:      * @param Mage_Index_Model_Process $process
101:      * @return Mage_Index_Model_Resource_Process
102:      */
103:     public function failProcess(Mage_Index_Model_Process $process)
104:     {
105:         $data = array(
106:             'status'   => Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX,
107:             'ended_at' => $this->formatDate(time()),
108:         );
109:         $this->_updateProcessData($process->getId(), $data);
110:         return $this;
111:     }
112: 
113:     /**
114:      * Update process status field
115:      *
116:      *
117:      * @param Mage_Index_Model_Process $process
118:      * @param string $status
119:      * @return Mage_Index_Model_Resource_Process
120:      */
121:     public function updateStatus($process, $status)
122:     {
123:         $data = array('status' => $status);
124:         $this->_updateProcessData($process->getId(), $data);
125:         return $this;
126:     }
127: 
128:     /**
129:      * Updates process data
130:      * @param int $processId
131:      * @param array $data
132:      * @return Mage_Index_Model_Resource_Process
133:      */
134:     protected function _updateProcessData($processId, $data)
135:     {
136:         $bind = array('process_id=?' => $processId);
137:         $this->_getWriteAdapter()->update($this->getMainTable(), $data, $bind);
138: 
139:         return $this;
140:     }
141: 
142:     /**
143:      * Update process start date
144:      *
145:      * @param Mage_Index_Model_Process $process
146:      * @return Mage_Index_Model_Resource_Process
147:      */
148:     public function updateProcessStartDate(Mage_Index_Model_Process $process)
149:     {
150:         $this->_updateProcessData($process->getId(), array('started_at' => $this->formatDate(time())));
151:         return $this;
152:     }
153: 
154:     /**
155:      * Update process end date
156:      *
157:      * @param Mage_Index_Model_Process $process
158:      * @return Mage_Index_Model_Resource_Process
159:      */
160:     public function updateProcessEndDate(Mage_Index_Model_Process $process)
161:     {
162:         $this->_updateProcessData($process->getId(), array('ended_at' => $this->formatDate(time())));
163:         return $this;
164:     }
165: 
166:     /**
167:      * Whether transaction is already started
168:      *
169:      * @return bool
170:      */
171:     public function isInTransaction()
172:     {
173:         return $this->_getWriteAdapter()->getTransactionLevel() > 0;
174:     }
175: }
176: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0