Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mage_Index - DOC block update #768

Merged
merged 1 commit into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/code/core/Mage/Index/Block/Adminhtml/Notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -34,6 +37,9 @@ protected function _prepareForm()
return parent::_prepareForm();
}

/**
* @return string
*/
public function getActionUrl()
{
return $this->getUrl('adminhtml/process/save');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
16 changes: 9 additions & 7 deletions app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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',
Expand All @@ -167,7 +168,8 @@ protected function _prepareColumns()
'filter' => false,
'sortable' => false,
'is_system' => true,
));
)
);

parent::_prepareColumns();

Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Index/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Index_Exception extends Mage_Core_Exception
{}
{

}
45 changes: 26 additions & 19 deletions app/code/core/Mage/Index/Model/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand All @@ -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()
{
Expand All @@ -102,6 +106,8 @@ public function getProcess()

/**
* Specify namespace for old and new data
* @param string $namespace
* @return $this
*/
public function setDataNamespace($namespace)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -266,24 +273,24 @@ 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;
}

/**
* 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)) {
Expand Down Expand Up @@ -326,7 +333,7 @@ public function getType()
/**
* Serelaize old and new data arrays before saving
*
* @return $this
* @inheritDoc
*/
protected function _beforeSave()
{
Expand Down
14 changes: 7 additions & 7 deletions app/code/core/Mage/Index/Model/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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));
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/Index/Model/Indexer/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
{
Expand Down
10 changes: 7 additions & 3 deletions app/code/core/Mage/Index/Model/Lock/Storage/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand All @@ -64,7 +68,7 @@ protected function _prepareLockName($name)
* Set named lock
*
* @param string $lockName
* @return int
* @return bool
*/
public function setLock($lockName)
{
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/Index/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,4 @@ public function processConfigDataSave(Varien_Event_Observer $observer)
Mage_Index_Model_Event::TYPE_SAVE
);
}

}
Loading