From d68334568d2c641cd12e749542e1f4211f4ad486 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sun, 23 Jun 2019 14:31:47 +0200 Subject: [PATCH] Mage_Index - DOC block update - doc blocks added/fixed - PSR2 fixes (whitespaces, linebreaks, ...) --- .../Index/Block/Adminhtml/Notifications.php | 2 +- .../Block/Adminhtml/Process/Edit/Form.php | 6 +++ .../Block/Adminhtml/Process/Edit/Tab/Main.php | 7 +-- .../Index/Block/Adminhtml/Process/Grid.php | 16 ++++--- app/code/core/Mage/Index/Exception.php | 4 +- app/code/core/Mage/Index/Model/Event.php | 45 +++++++++++-------- app/code/core/Mage/Index/Model/Indexer.php | 14 +++--- .../Mage/Index/Model/Indexer/Abstract.php | 3 ++ .../core/Mage/Index/Model/Lock/Storage/Db.php | 10 +++-- app/code/core/Mage/Index/Model/Observer.php | 1 - app/code/core/Mage/Index/Model/Process.php | 32 ++++++------- .../core/Mage/Index/Model/Resource/Event.php | 8 ++-- .../Index/Model/Resource/Event/Collection.php | 3 +- .../Model/Resource/Helper/Lock/Interface.php | 4 +- .../Index/Model/Resource/Helper/Mysql4.php | 5 +-- .../Index/Model/Resource/Lock/Resource.php | 6 +-- .../Model/Resource/Process/Collection.php | 4 +- .../Adminhtml/ProcessController.php | 26 +++++------ .../Index/sql/index_setup/install-1.6.0.0.php | 44 ++++++++++++------ .../index_setup/mysql4-install-1.4.0.0.php | 1 + .../mysql4-upgrade-1.4.0.0-1.4.0.1.php | 1 + .../mysql4-upgrade-1.4.0.1-1.4.0.2.php | 1 + .../mysql4-upgrade-1.5.9.9-1.6.0.0.php | 2 +- 23 files changed, 147 insertions(+), 98 deletions(-) diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Notifications.php b/app/code/core/Mage/Index/Block/Adminhtml/Notifications.php index d03ac90ba62..cb54972dc3e 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Notifications.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Notifications.php @@ -35,7 +35,7 @@ public function getProcessesForReindex() { $res = array(); $processes = Mage::getSingleton('index/indexer')->getProcessesCollection()->addEventsStats(); - /** @var $process Mage_Index_Model_Process */ + /** @var Mage_Index_Model_Process $process */ foreach ($processes as $process) { if (($process->getStatus() == Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX || $process->getEvents() > 0) && $process->getIndexer()->isVisible() diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Form.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Form.php index 2975efe3150..7cdf1aa64c0 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Form.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Form.php @@ -26,6 +26,9 @@ class Mage_Index_Block_Adminhtml_Process_Edit_Form extends Mage_Adminhtml_Block_Widget_Form { + /** + * @return Mage_Adminhtml_Block_Widget_Form + */ protected function _prepareForm() { $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getActionUrl(), 'method' => 'post')); @@ -34,6 +37,9 @@ protected function _prepareForm() return parent::_prepareForm(); } + /** + * @return string + */ public function getActionUrl() { return $this->getUrl('adminhtml/process/save'); diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tab/Main.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tab/Main.php index 948e9f2fbef..9a3236fc805 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tab/Main.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tab/Main.php @@ -24,10 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -class Mage_Index_Block_Adminhtml_Process_Edit_Tab_Main - extends Mage_Adminhtml_Block_Widget_Form - implements Mage_Adminhtml_Block_Widget_Tab_Interface +class Mage_Index_Block_Adminhtml_Process_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form implements Mage_Adminhtml_Block_Widget_Tab_Interface { + /** + * @inheritDoc + */ protected function _prepareForm() { $model = Mage::registry('current_index_process'); diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php index 8321a0f1309..3f6a23a907e 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php @@ -73,7 +73,7 @@ protected function _prepareCollection() */ protected function _afterLoadCollection() { - /** @var $item Mage_Index_Model_Process */ + /** @var Mage_Index_Model_Process $item */ foreach ($this->_collection as $key => $item) { if (!$item->getIndexer()->isVisible()) { $this->_collection->removeItemByKey($key); @@ -151,7 +151,8 @@ protected function _prepareColumns() 'frame_callback' => array($this, 'decorateDate') )); - $this->addColumn('action', + $this->addColumn( + 'action', array( 'header' => Mage::helper('index')->__('Action'), 'width' => '100', @@ -167,7 +168,8 @@ protected function _prepareColumns() 'filter' => false, 'sortable' => false, 'is_system' => true, - )); + ) + ); parent::_prepareColumns(); @@ -188,13 +190,13 @@ public function decorateStatus($value, $row, $column, $isExport) { $class = ''; switch ($row->getStatus()) { - case Mage_Index_Model_Process::STATUS_PENDING : + case Mage_Index_Model_Process::STATUS_PENDING: $class = 'grid-severity-notice'; break; - case Mage_Index_Model_Process::STATUS_RUNNING : + case Mage_Index_Model_Process::STATUS_RUNNING: $class = 'grid-severity-major'; break; - case Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX : + case Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX: $class = 'grid-severity-critical'; break; } @@ -237,7 +239,7 @@ public function decorateUpdateRequired($value, $row, $column, $isExport) */ public function decorateDate($value, $row, $column, $isExport) { - if(!$value) { + if (!$value) { return $this->__('Never'); } return $value; diff --git a/app/code/core/Mage/Index/Exception.php b/app/code/core/Mage/Index/Exception.php index 81aee58a149..8f7c999a690 100644 --- a/app/code/core/Mage/Index/Exception.php +++ b/app/code/core/Mage/Index/Exception.php @@ -32,4 +32,6 @@ * @author Magento Core Team */ class Mage_Index_Exception extends Mage_Core_Exception -{} +{ + +} diff --git a/app/code/core/Mage/Index/Model/Event.php b/app/code/core/Mage/Index/Model/Event.php index cee6261e735..72f4698134f 100644 --- a/app/code/core/Mage/Index/Model/Event.php +++ b/app/code/core/Mage/Index/Model/Event.php @@ -29,15 +29,18 @@ * * @method Mage_Index_Model_Resource_Event _getResource() * @method Mage_Index_Model_Resource_Event getResource() - * @method Mage_Index_Model_Event setType(string $value) - * @method Mage_Index_Model_Event setEntity(string $value) + * @method $this setType(string $value) + * @method $this setEntity(string $value) + * @method bool hasEntityPk() * @method int getEntityPk() - * @method Mage_Index_Model_Event setEntityPk(int $value) + * @method $this setEntityPk(int $value) * @method string getCreatedAt() - * @method Mage_Index_Model_Event setCreatedAt(string $value) - * @method Mage_Index_Model_Event setOldData(string $value) - * @method Mage_Index_Model_Event setNewData(string $value) + * @method $this setCreatedAt(string $value) + * @method $this setOldData(string $value) + * @method $this setNewData(string $value) * @method Varien_Object getDataObject() + * @method $this setDataObject(Varien_Object $value) + * @method bool hasCreatedAt() * * @category Mage * @package Mage_Index @@ -82,7 +85,8 @@ protected function _construct() /** * Specify process object * - * @param null|Mage_Index_Model_Process $process + * @param Mage_Index_Model_Process $process + * @return $this */ public function setProcess($process) { @@ -93,7 +97,7 @@ public function setProcess($process) /** * Get related process object * - * @return Mage_Index_Model_Process | null + * @return Mage_Index_Model_Process */ public function getProcess() { @@ -102,6 +106,8 @@ public function getProcess() /** * Specify namespace for old and new data + * @param string $namespace + * @return $this */ public function setDataNamespace($namespace) { @@ -129,10 +135,11 @@ public function resetData() /** * Add process id to event object * - * @param $processId - * @return Mage_Index_Model_Event + * @param int $processId + * @param string $status + * @return $this */ - public function addProcessId($processId, $status=Mage_Index_Model_Process::EVENT_STATUS_NEW) + public function addProcessId($processId, $status = Mage_Index_Model_Process::EVENT_STATUS_NEW) { $this->_processIds[$processId] = $status; return $this; @@ -266,12 +273,12 @@ public function getNewData($useNamespace = true) /** * Add new values to old data array (overwrite if value with same key exist) * - * @deprecated since 1.6.2.0 - * @param array | string $data - * @param null | mixed $value + * @param array|string $key + * @param null|mixed $value * @return $this + * @deprecated since 1.6.2.0 */ - public function addOldData($key, $value=null) + public function addOldData($key, $value = null) { return $this; } @@ -279,11 +286,11 @@ public function addOldData($key, $value=null) /** * Add new values to new data array (overwrite if value with same key exist) * - * @param array | string $data - * @param null | mixed $value + * @param array|string $key + * @param null|mixed $value * @return $this */ - public function addNewData($key, $value=null) + public function addNewData($key, $value = null) { $newData = $this->getNewData(false); if (!is_array($key)) { @@ -326,7 +333,7 @@ public function getType() /** * Serelaize old and new data arrays before saving * - * @return $this + * @inheritDoc */ protected function _beforeSave() { diff --git a/app/code/core/Mage/Index/Model/Indexer.php b/app/code/core/Mage/Index/Model/Indexer.php index 8d4c7c51cf0..2a694129823 100644 --- a/app/code/core/Mage/Index/Model/Indexer.php +++ b/app/code/core/Mage/Index/Model/Indexer.php @@ -107,7 +107,7 @@ public function getProcessById($processId) * Get index process by specific code * * @param string $code - * @return Mage_Index_Model_Process | false + * @return Mage_Index_Model_Process|false */ public function getProcessByCode($code) { @@ -129,7 +129,7 @@ public function getProcessesCollectionByCodes(array $codes) { $processes = array(); $this->_errors = array(); - foreach($codes as $code) { + foreach ($codes as $code) { $process = $this->getProcessByCode($code); if (!$process) { $this->_errors[] = sprintf('Warning: Unknown indexer with code %s', trim($code)); @@ -204,11 +204,11 @@ public function isLocked() * @throws Exception * @return Mage_Index_Model_Indexer */ - public function indexEvents($entity=null, $type=null) + public function indexEvents($entity = null, $type = null) { Mage::dispatchEvent('start_index_events' . $this->_getEventTypeName($entity, $type)); - /** @var $resourceModel Mage_Index_Model_Resource_Process */ + /** @var Mage_Index_Model_Resource_Process $resourceModel */ $resourceModel = Mage::getResourceSingleton('index/process'); $allowTableChanges = $this->_allowTableChanges && !$resourceModel->isInTransaction(); @@ -268,7 +268,7 @@ public function registerEvent(Mage_Index_Model_Event $event) * @param bool $doSave * @return Mage_Index_Model_Event */ - public function logEvent(Varien_Object $entity, $entityType, $eventType, $doSave=true) + public function logEvent(Varien_Object $entity, $entityType, $eventType, $doSave = true) { $event = Mage::getModel('index/event') ->setEntity($entityType) @@ -302,7 +302,7 @@ public function processEntityAction(Varien_Object $entity, $entityType, $eventTy if ($event->getProcessIds()) { Mage::dispatchEvent('start_process_event' . $this->_getEventTypeName($entityType, $eventType)); - /** @var $resourceModel Mage_Index_Model_Resource_Process */ + /** @var Mage_Index_Model_Resource_Process $resourceModel */ $resourceModel = Mage::getResourceSingleton('index/process'); $allowTableChanges = $this->_allowTableChanges && !$resourceModel->isInTransaction(); @@ -343,7 +343,7 @@ public function processEntityAction(Varien_Object $entity, $entityType, $eventTy * * @param string $method * @param array $args - * @return $this + * @return void */ protected function _runAll($method, $args) { diff --git a/app/code/core/Mage/Index/Model/Indexer/Abstract.php b/app/code/core/Mage/Index/Model/Indexer/Abstract.php index 0f45e7f9cbc..9274ab54aa4 100644 --- a/app/code/core/Mage/Index/Model/Indexer/Abstract.php +++ b/app/code/core/Mage/Index/Model/Indexer/Abstract.php @@ -27,6 +27,8 @@ /** * Abstract index process class * Predefine list of methods required by indexer + * + * @method Mage_Index_Model_Resource_Abstract _getResource() */ abstract class Mage_Index_Model_Indexer_Abstract extends Mage_Core_Model_Abstract { @@ -82,6 +84,7 @@ abstract protected function _processEvent(Mage_Index_Model_Event $event); * Register data required by process in event object * * @param Mage_Index_Model_Event $event + * @return Mage_Index_Model_Indexer_Abstract */ public function register(Mage_Index_Model_Event $event) { diff --git a/app/code/core/Mage/Index/Model/Lock/Storage/Db.php b/app/code/core/Mage/Index/Model/Lock/Storage/Db.php index 94a088a3292..d3e7c978feb 100644 --- a/app/code/core/Mage/Index/Model/Lock/Storage/Db.php +++ b/app/code/core/Mage/Index/Model/Lock/Storage/Db.php @@ -34,7 +34,7 @@ class Mage_Index_Model_Lock_Storage_Db implements Mage_Index_Model_Lock_Storage_Interface { /** - * @var Mage_Index_Model_Resource_Helper_Abstract + * @var Mage_Core_Model_Resource_Helper_Abstract */ protected $_helper; @@ -48,12 +48,16 @@ class Mage_Index_Model_Lock_Storage_Db implements Mage_Index_Model_Lock_Storage_ */ public function __construct() { - /** @var $resource Mage_Core_Model_Resource */ + /** @var Mage_Core_Model_Resource $resource */ $resource = Mage::getSingleton('index/resource_lock_resource'); $this->_connection = $resource->getConnection('index_write', 'default_lock'); $this->_helper = Mage::getResourceHelper('index'); } + /** + * @param string $name + * @return string + */ protected function _prepareLockName($name) { $config = $this->_connection->getConfig(); @@ -64,7 +68,7 @@ protected function _prepareLockName($name) * Set named lock * * @param string $lockName - * @return int + * @return bool */ public function setLock($lockName) { diff --git a/app/code/core/Mage/Index/Model/Observer.php b/app/code/core/Mage/Index/Model/Observer.php index 402e6d0b5b5..dcea6aa2385 100644 --- a/app/code/core/Mage/Index/Model/Observer.php +++ b/app/code/core/Mage/Index/Model/Observer.php @@ -142,5 +142,4 @@ public function processConfigDataSave(Varien_Event_Observer $observer) Mage_Index_Model_Event::TYPE_SAVE ); } - } diff --git a/app/code/core/Mage/Index/Model/Process.php b/app/code/core/Mage/Index/Model/Process.php index 157dac2d7a0..e405c180515 100644 --- a/app/code/core/Mage/Index/Model/Process.php +++ b/app/code/core/Mage/Index/Model/Process.php @@ -29,16 +29,19 @@ * * @method Mage_Index_Model_Resource_Process _getResource() * @method Mage_Index_Model_Resource_Process getResource() + * @method string getIndexCode() * @method string getIndexerCode() - * @method Mage_Index_Model_Process setIndexerCode(string $value) + * @method $this setIndexerCode(string $value) * @method string getStatus() - * @method Mage_Index_Model_Process setStatus(string $value) + * @method $this setStatus(string $value) * @method string getStartedAt() - * @method Mage_Index_Model_Process setStartedAt(string $value) + * @method $this setStartedAt(string $value) * @method string getEndedAt() - * @method Mage_Index_Model_Process setEndedAt(string $value) + * @method $this setEndedAt(string $value) * @method string getMode() - * @method Mage_Index_Model_Process setMode(string $value) + * @method $this setMode(string $value) + * @method bool getForcePartialReindex() + * @method $this setForcePartialReindex(bool $value) * * @category Mage * @package Mage_Index @@ -105,7 +108,7 @@ protected function _construct() * Set indexer class name as data namespace for event object * * @param Mage_Index_Model_Event $event - * @return Mage_Index_Model_Process + * @return $this */ protected function _setEventNamespace(Mage_Index_Model_Event $event) { @@ -146,7 +149,6 @@ public function register(Mage_Index_Model_Event $event) } } return $this; - } /** @@ -192,7 +194,7 @@ public function reindexAll() try { $eventsCollection = $this->getUnprocessedEventsCollection(); - /** @var $eventResource Mage_Index_Model_Resource_Event */ + /** @var Mage_Index_Model_Resource_Event $eventResource */ $eventResource = Mage::getResourceSingleton('index/event'); if ($eventsCollection->count() > 0 && $processStatus == self::STATUS_PENDING @@ -240,13 +242,13 @@ public function reindexEverything() return $this; } - /** @var $eventResource Mage_Index_Model_Resource_Event */ + /** @var Mage_Index_Model_Resource_Event $eventResource */ $eventResource = Mage::getResourceSingleton('index/event'); $unprocessedEvents = $eventResource->getUnprocessedEvents($this); $this->setForcePartialReindex(count($unprocessedEvents) > 0 && $this->getStatus() == self::STATUS_PENDING); if ($this->getDepends()) { - /** @var $indexer Mage_Index_Model_Indexer */ + /** @var Mage_Index_Model_Indexer $indexer */ $indexer = Mage::getSingleton('index/indexer'); foreach ($this->getDepends() as $code) { $process = $indexer->getProcessByCode($code); @@ -325,9 +327,9 @@ public function getIndexer() * * @param null|string $entity * @param null|string $type - * @return Mage_Index_Model_Process + * @return $this */ - public function indexEvents($entity=null, $type=null) + public function indexEvents($entity = null, $type = null) { /** * Check if process indexer can match entity code and action type @@ -380,7 +382,7 @@ protected function _processEventsCollection( $skipUnmatched = true ) { // We can't reload the collection because of transaction - /** @var $event Mage_Index_Model_Event */ + /** @var Mage_Index_Model_Event $event */ while ($event = $eventsCollection->fetchItem()) { try { $this->processEvent($event); @@ -403,7 +405,7 @@ protected function _processEventsCollection( * * @param Mage_Index_Model_Event $event * @param string $status - * @return Mage_Index_Model_Process + * @return $this */ public function updateEventStatus(Mage_Index_Model_Event $event, $status) { @@ -634,7 +636,7 @@ public function safeProcessEvent(Mage_Index_Model_Event $event) */ public function getUnprocessedEventsCollection() { - /** @var $eventsCollection Mage_Index_Model_Resource_Event_Collection */ + /** @var Mage_Index_Model_Resource_Event_Collection $eventsCollection */ $eventsCollection = Mage::getResourceModel('index/event_collection'); $eventsCollection->addProcessFilter($this, self::EVENT_STATUS_NEW); return $eventsCollection; diff --git a/app/code/core/Mage/Index/Model/Resource/Event.php b/app/code/core/Mage/Index/Model/Resource/Event.php index e69c64089c6..da4d26f9e87 100644 --- a/app/code/core/Mage/Index/Model/Resource/Event.php +++ b/app/code/core/Mage/Index/Model/Resource/Event.php @@ -46,8 +46,8 @@ protected function _construct() /** * Check if semilar event exist before start saving data * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Index_Model_Event $object + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { @@ -74,8 +74,8 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) /** * Save assigned processes * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Index_Model_Event $object + * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $object) { diff --git a/app/code/core/Mage/Index/Model/Resource/Event/Collection.php b/app/code/core/Mage/Index/Model/Resource/Event/Collection.php index e4c81f230a3..e9331b7a8be 100644 --- a/app/code/core/Mage/Index/Model/Resource/Event/Collection.php +++ b/app/code/core/Mage/Index/Model/Resource/Event/Collection.php @@ -111,7 +111,8 @@ public function addProcessFilter($process, $status = null) protected function _joinProcessEventTable() { if (!$this->getFlag('process_event_table_joined')) { - $this->getSelect()->join(array('process_event' => $this->getTable('index/process_event')), + $this->getSelect()->join( + array('process_event' => $this->getTable('index/process_event')), 'process_event.event_id=main_table.event_id', array('process_event_status' => 'status') ); diff --git a/app/code/core/Mage/Index/Model/Resource/Helper/Lock/Interface.php b/app/code/core/Mage/Index/Model/Resource/Helper/Lock/Interface.php index 2a6b62ddf06..9e0d2c941ce 100644 --- a/app/code/core/Mage/Index/Model/Resource/Helper/Lock/Interface.php +++ b/app/code/core/Mage/Index/Model/Resource/Helper/Lock/Interface.php @@ -42,7 +42,7 @@ interface Mage_Index_Model_Resource_Helper_Lock_Interface * Set lock * * @param string $name - * @return int + * @return bool */ public function setLock($name); @@ -50,7 +50,7 @@ public function setLock($name); * Release lock * * @param string $name - * @return int + * @return bool */ public function releaseLock($name); diff --git a/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php index ec8872a87f1..fc3b8635313 100644 --- a/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php +++ b/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php @@ -31,8 +31,7 @@ * @package Mage_Index * @author Magento Core Team */ -class Mage_Index_Model_Resource_Helper_Mysql4 extends Mage_Core_Model_Resource_Helper_Mysql4 - implements Mage_Index_Model_Resource_Helper_Lock_Interface +class Mage_Index_Model_Resource_Helper_Mysql4 extends Mage_Core_Model_Resource_Helper_Mysql4 implements Mage_Index_Model_Resource_Helper_Lock_Interface { /** * Insert data from select statement @@ -42,7 +41,7 @@ class Mage_Index_Model_Resource_Helper_Mysql4 extends Mage_Core_Model_Resource_H * @param string $destTable * @param array $columns * @param bool $readToIndex - * @return $this + * @return Mage_Index_Model_Resource_Abstract */ public function insertData($object, $select, $destTable, $columns, $readToIndex) { diff --git a/app/code/core/Mage/Index/Model/Resource/Lock/Resource.php b/app/code/core/Mage/Index/Model/Resource/Lock/Resource.php index 3add101823e..cdf674055d6 100644 --- a/app/code/core/Mage/Index/Model/Resource/Lock/Resource.php +++ b/app/code/core/Mage/Index/Model/Resource/Lock/Resource.php @@ -47,7 +47,7 @@ public function __construct() * @param string $name * @param string $extendConfigWith * - * @return Varien_Db_Adapter_Interface + * @return Varien_Db_Adapter_Interface|false */ public function getConnection($name, $extendConfigWith = '') { @@ -66,7 +66,7 @@ public function getConnection($name, $extendConfigWith = '') $this->_connections[$index] = $this->_getDefaultConnection($name, $extendConfigWith); return $this->_connections[$index]; } - if (!$connConfig->is('active', 1)) { + if (!$connConfig->is('active', '1')) { return false; } @@ -114,7 +114,7 @@ public function getConnection($name, $extendConfigWith = '') * @param string $requiredConnectionName * @param string $extendConfigWith * - * @return string + * @return Varien_Db_Adapter_Interface|false */ protected function _getDefaultConnection($requiredConnectionName, $extendConfigWith = '') { diff --git a/app/code/core/Mage/Index/Model/Resource/Process/Collection.php b/app/code/core/Mage/Index/Model/Resource/Process/Collection.php index b0323daa42c..e628489bbf3 100644 --- a/app/code/core/Mage/Index/Model/Resource/Process/Collection.php +++ b/app/code/core/Mage/Index/Model/Resource/Process/Collection.php @@ -74,7 +74,9 @@ public function addEventsStats() array('e' => $countsSelect), 'e.process_id=main_table.process_id', array('events' => $this->getConnection()->getCheckSql( - $this->getConnection()->prepareSqlCondition('e.events', array('null' => null)), 0, 'e.events' + $this->getConnection()->prepareSqlCondition('e.events', array('null' => null)), + 0, + 'e.events' )) ); return $this; diff --git a/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php b/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php index 659268425e5..be67c3877ab 100644 --- a/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php +++ b/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php @@ -34,7 +34,7 @@ protected function _initProcess() { $processId = $this->getRequest()->getParam('process'); if ($processId) { - /** @var $process Mage_Index_Model_Process */ + /** @var Mage_Index_Model_Process $process */ $process = Mage::getModel('index/process')->load($processId); if ($process->getId() && $process->getIndexer()->isVisible()) { return $process; @@ -60,7 +60,7 @@ public function listAction() */ public function editAction() { - /** @var $process Mage_Index_Model_Process */ + /** @var Mage_Index_Model_Process $process */ $process = $this->_initProcess(); if ($process) { $this->_title($process->getIndexCode()); @@ -85,7 +85,7 @@ public function editAction() */ public function saveAction() { - /** @var $process Mage_Index_Model_Process */ + /** @var Mage_Index_Model_Process $process */ $process = $this->_initProcess(); if ($process) { $mode = $this->getRequest()->getPost('mode'); @@ -100,8 +100,9 @@ public function saveAction() } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, - Mage::helper('index')->__('There was a problem with saving process.') + $this->_getSession()->addException( + $e, + Mage::helper('index')->__('There was a problem with saving process.') ); } $this->_redirect('*/*/list'); @@ -118,7 +119,7 @@ public function saveAction() */ public function reindexProcessAction() { - /** @var $process Mage_Index_Model_Process */ + /** @var Mage_Index_Model_Process $process */ $process = $this->_initProcess(); if ($process) { try { @@ -132,8 +133,9 @@ public function reindexProcessAction() } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, - Mage::helper('index')->__('There was a problem with reindexing process.') + $this->_getSession()->addException( + $e, + Mage::helper('index')->__('There was a problem with reindexing process.') ); } } else { @@ -150,7 +152,6 @@ public function reindexProcessAction() */ public function reindexEventsAction() { - } /** @@ -158,7 +159,6 @@ public function reindexEventsAction() */ public function reindexAllAction() { - } /** @@ -167,7 +167,7 @@ public function reindexAllAction() */ public function massReindexAction() { - /* @var $indexer Mage_Index_Model_Indexer */ + /* @var Mage_Index_Model_Indexer $indexer */ $indexer = Mage::getSingleton('index/indexer'); $processIds = $this->getRequest()->getParam('process'); if (empty($processIds) || !is_array($processIds)) { @@ -176,7 +176,7 @@ public function massReindexAction() try { $counter = 0; foreach ($processIds as $processId) { - /* @var $process Mage_Index_Model_Process */ + /* @var Mage_Index_Model_Process $process */ $process = $indexer->getProcessById($processId); if ($process && $process->getIndexer()->isVisible()) { $process->reindexEverything(); @@ -210,7 +210,7 @@ public function massChangeModeAction() $counter = 0; $mode = $this->getRequest()->getParam('index_mode'); foreach ($processIds as $processId) { - /* @var $process Mage_Index_Model_Process */ + /* @var Mage_Index_Model_Process $process */ $process = Mage::getModel('index/process')->load($processId); if ($process->getId() && $process->getIndexer()->isVisible()) { $process->setMode($mode)->save(); diff --git a/app/code/core/Mage/Index/sql/index_setup/install-1.6.0.0.php b/app/code/core/Mage/Index/sql/index_setup/install-1.6.0.0.php index 51966b65903..c5c5aee4af5 100644 --- a/app/code/core/Mage/Index/sql/index_setup/install-1.6.0.0.php +++ b/app/code/core/Mage/Index/sql/index_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Index_Model_Resource_Setup */ +/* @var Mage_Index_Model_Resource_Setup $installer */ $installer->startSetup(); @@ -55,8 +55,11 @@ ), 'Old Data') ->addColumn('new_data', Varien_Db_Ddl_Table::TYPE_TEXT, '2M', array( ), 'New Data') - ->addIndex($installer->getIdxName('index/event', array('type', 'entity', 'entity_pk'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('type', 'entity', 'entity_pk'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) + ->addIndex( + $installer->getIdxName('index/event', array('type', 'entity', 'entity_pk'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), + array('type', 'entity', 'entity_pk'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) ->setComment('Index Event'); $installer->getConnection()->createTable($table); @@ -86,8 +89,11 @@ 'nullable' => false, 'default' => 'real_time', ), 'Mode') - ->addIndex($installer->getIdxName('index/process', array('indexer_code'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('indexer_code'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) + ->addIndex( + $installer->getIdxName('index/process', array('indexer_code'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), + array('indexer_code'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) ->setComment('Index Process'); $installer->getConnection()->createTable($table); @@ -110,14 +116,26 @@ 'nullable' => false, 'default' => 'new', ), 'Status') - ->addIndex($installer->getIdxName('index/process_event', array('event_id')), - array('event_id')) - ->addForeignKey($installer->getFkName('index/process_event', 'event_id', 'index/event', 'event_id'), - 'event_id', $installer->getTable('index/event'), 'event_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) - ->addForeignKey($installer->getFkName('index/process_event', 'process_id', 'index/process', 'process_id'), - 'process_id', $installer->getTable('index/process'), 'process_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addIndex( + $installer->getIdxName('index/process_event', array('event_id')), + array('event_id') + ) + ->addForeignKey( + $installer->getFkName('index/process_event', 'event_id', 'index/event', 'event_id'), + 'event_id', + $installer->getTable('index/event'), + 'event_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('index/process_event', 'process_id', 'index/process', 'process_id'), + 'process_id', + $installer->getTable('index/process'), + 'process_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Index Process Event'); $installer->getConnection()->createTable($table); diff --git a/app/code/core/Mage/Index/sql/index_setup/mysql4-install-1.4.0.0.php b/app/code/core/Mage/Index/sql/index_setup/mysql4-install-1.4.0.0.php index cd6417fd117..f04f491cafd 100644 --- a/app/code/core/Mage/Index/sql/index_setup/mysql4-install-1.4.0.0.php +++ b/app/code/core/Mage/Index/sql/index_setup/mysql4-install-1.4.0.0.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/* @var Mage_Index_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); $installer->run(" diff --git a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php index 829bb4e94fb..83180bdc7e3 100644 --- a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php +++ b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/* @var Mage_Index_Model_Resource_Setup $installer */ $installer = $this; $installer->getConnection()->addColumn( diff --git a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php index 76372e38810..a556183330c 100644 --- a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php +++ b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/* @var Mage_Index_Model_Resource_Setup $installer */ $installer = $this; $installer->getConnection()->changeColumn( diff --git a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php index 810f775e971..bd1663c02e6 100644 --- a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +++ b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Index_Model_Resource_Setup */ +/* @var Mage_Index_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup();