Skip to content
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
258 changes: 6 additions & 252 deletions .phpstan.dist.baseline.neon

Large diffs are not rendered by default.

37 changes: 23 additions & 14 deletions app/code/core/Mage/Admin/Model/Resource/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,46 +39,50 @@ protected function _construct()
/**
* Process role before saving
*
* @param Mage_Admin_Model_Roles $object
* @throws Mage_Core_Exception
* @return $this
*/
protected function _beforeSave(Mage_Core_Model_Abstract $role)
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if ($role->getId() == '') {
if ($role->getIdFieldName()) {
$role->unsetData($role->getIdFieldName());
if ($object->getId() == '') {
if ($object->getIdFieldName()) {
$object->unsetData($object->getIdFieldName());
} else {
$role->unsetData('id');
$object->unsetData('id');
}
}

if ($role->getPid() > 0) {
if ($object->getPid() > 0) {
$select = $this->_getReadAdapter()->select()
->from($this->getMainTable(), ['tree_level'])
->where("{$this->getIdFieldName()} = :pid");

$binds = [
'pid' => (int) $role->getPid(),
'pid' => (int) $object->getPid(),
];

$treeLevel = $this->_getReadAdapter()->fetchOne($select, $binds);
} else {
$treeLevel = 0;
}

$role->setTreeLevel($treeLevel + 1);
$role->setRoleName($role->getName());
$object->setTreeLevel($treeLevel + 1);
$object->setRoleName($object->getName());

return $this;
}

/**
* Process role after saving
*
* @param Mage_Admin_Model_Roles $object
* @throws Zend_Cache_Exception
* @return $this
*/
protected function _afterSave(Mage_Core_Model_Abstract $role)
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$this->_updateRoleUsersAcl($role);
$this->_updateRoleUsersAcl($object);
Mage::app()->getCache()->clean(
Zend_Cache::CLEANING_MODE_MATCHING_TAG,
[Mage_Adminhtml_Block_Page_Menu::CACHE_TAGS],
Expand All @@ -89,19 +93,22 @@ protected function _afterSave(Mage_Core_Model_Abstract $role)
/**
* Process role after deleting
*
* @param Mage_Admin_Model_Roles $object
* @throws Mage_Core_Exception
* @return $this
*/
protected function _afterDelete(Mage_Core_Model_Abstract $role)
protected function _afterDelete(Mage_Core_Model_Abstract $object)
{
$adapter = $this->_getWriteAdapter();
$adapter->delete($this->getMainTable(), ['parent_id = ?' => (int) $role->getId()]);
$adapter->delete($this->_ruleTable, ['role_id = ?' => (int) $role->getId()]);
$adapter->delete($this->getMainTable(), ['parent_id = ?' => (int) $object->getId()]);
$adapter->delete($this->_ruleTable, ['role_id = ?' => (int) $object->getId()]);
return $this;
}

/**
* Get role users
*
* @throws Mage_Core_Exception
* @return array
*/
public function getRoleUsers(Mage_Admin_Model_Roles $role)
Expand All @@ -118,6 +125,8 @@ public function getRoleUsers(Mage_Admin_Model_Roles $role)
/**
* Update role users
*
* @throws Mage_Core_Exception
* @throws Zend_Db_Adapter_Exception
* @return bool
*/
private function _updateRoleUsersAcl(Mage_Admin_Model_Roles $role)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,17 @@ protected function _prepareForm()
->addFieldDependence(
$couponCodeFiled->getName(),
$couponTypeFiled->getName(),
Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
(string) Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
)
->addFieldDependence(
$autoGenerationCheckbox->getName(),
$couponTypeFiled->getName(),
Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
(string) Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
)
->addFieldDependence(
$usesPerCouponFiled->getName(),
$couponTypeFiled->getName(),
Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
(string) Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
));

Mage::dispatchEvent('adminhtml_promo_quote_edit_tab_main_prepare_form', ['form' => $form]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct()
$this->setFilterVisibility(false);
$this->setPagerVisibility(false);
$this->setUseAjax(false);
if (isset($this->_columnGroupBy)) {
if (!is_null($this->_columnGroupBy)) {
$this->isColumnGrouped($this->_columnGroupBy, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public function newAction()

/**
* Edit action
*
* @throws Mage_Core_Exception
*/
public function editAction()
{
Expand Down Expand Up @@ -88,7 +90,7 @@ public function editAction()

Mage::register('permissions_block', $model);

if (isset($id)) {
if ($id) {
$breadcrumb = $this->__('Edit Block');
} else {
$breadcrumb = $this->__('New Block');
Expand All @@ -106,6 +108,8 @@ public function editAction()
/**
* Save action
*
* @throws Mage_Core_Exception
* @throws Zend_Validate_Exception
* @return $this|void
*/
public function saveAction()
Expand Down Expand Up @@ -144,9 +148,9 @@ public function saveAction()

$this->_redirect('*/*/');
return;
} catch (Exception $e) {
} catch (Exception $exception) {
// display error message
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->addError($exception->getMessage());
// save data in session
Mage::getSingleton('adminhtml/session')->setFormData($data);
// redirect to edit form
Expand All @@ -172,8 +176,8 @@ public function deleteAction()
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Block has been deleted.'));
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
} catch (Exception $exception) {
Mage::getSingleton('adminhtml/session')->addError($exception->getMessage());
$this->_redirect('*/*/edit', ['block_id' => $id]);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public function newAction()

/**
* Edit action
*
* @throws Mage_Core_Exception
*/
public function editAction()
{
Expand Down Expand Up @@ -87,7 +89,7 @@ public function editAction()

Mage::register('permissions_variable', $model);

if (isset($id)) {
if ($id) {
$breadcrumb = $this->__('Edit Variable');
} else {
$breadcrumb = $this->__('New Variable');
Expand All @@ -105,6 +107,8 @@ public function editAction()
/**
* Save action
*
* @throws Mage_Core_Exception
* @throws Zend_Validate_Exception
* @return $this|void
*/
public function saveAction()
Expand Down Expand Up @@ -143,9 +147,9 @@ public function saveAction()

$this->_redirect('*/*/');
return;
} catch (Exception $e) {
} catch (Exception $exception) {
// display error message
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->addError($exception->getMessage());
// save data in session
Mage::getSingleton('adminhtml/session')->setFormData($data);
// redirect to edit form
Expand All @@ -171,8 +175,8 @@ public function deleteAction()
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Variable has been deleted.'));
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
} catch (Exception $exception) {
Mage::getSingleton('adminhtml/session')->addError($exception->getMessage());
$this->_redirect('*/*/edit', ['variable_id' => $id]);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class Mage_Adminhtml_System_Convert_ProfileController extends Mage_Adminhtml_Con
*/
public const ADMIN_RESOURCE = 'admin/system/convert/profiles';

/**
* @throws Mage_Core_Exception
*/
protected function _initProfile($idFieldName = 'id')
{
$this->_title($this->__('System'))
Expand Down Expand Up @@ -98,6 +101,8 @@ public function gridAction()

/**
* Profile edit action
*
* @throws Mage_Core_Exception
*/
public function editAction()
{
Expand Down Expand Up @@ -139,6 +144,8 @@ public function newAction()

/**
* Delete profile action
*
* @throws Mage_Core_Exception
*/
public function deleteAction()
{
Expand All @@ -150,8 +157,8 @@ public function deleteAction()
Mage::getSingleton('adminhtml/session')->addSuccess(
Mage::helper('adminhtml')->__('The profile has been deleted.'),
);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
} catch (Exception $exception) {
Mage::getSingleton('adminhtml/session')->addError($exception->getMessage());
}
}

Expand All @@ -160,6 +167,8 @@ public function deleteAction()

/**
* Save profile action
*
* @throws Mage_Core_Exception
*/
public function saveAction()
{
Expand All @@ -171,19 +180,17 @@ public function saveAction()
$profile = Mage::registry('current_convert_profile');

// Prepare profile saving data
if (isset($data)) {
$profile->addData($data);
}
$profile->addData($data);

try {
$profile->save();

Mage::getSingleton('adminhtml/session')->addSuccess(
Mage::helper('adminhtml')->__('The profile has been saved.'),
);
} catch (Exception $e) {
Mage::logException($e);
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
} catch (Exception $exception) {
Mage::logException($exception);
Mage::getSingleton('adminhtml/session')->addError($exception->getMessage());
Mage::getSingleton('adminhtml/session')->setConvertProfileData($data);
$this->getResponse()->setRedirect($this->getUrl('*/*/edit', ['id' => $profile->getId()]));
return;
Expand All @@ -202,13 +209,19 @@ public function saveAction()
}
}

/**
* @throws Mage_Core_Exception
*/
public function runAction()
{
$this->_initProfile();
$this->loadLayout();
$this->renderLayout();
}

/**
* @throws Mage_Core_Exception
*/
public function batchRunAction()
{
if ($this->getRequest()->isPost()) {
Expand All @@ -231,7 +244,6 @@ public function batchRunAction()
}

$batchImportModel = $batchModel->getBatchImportModel();
$importIds = $batchImportModel->getIdCollection();

/** @var Mage_Catalog_Model_Convert_Adapter_Product $adapter */
$adapter = Mage::getModel($batchModel->getAdapter());
Expand All @@ -249,8 +261,8 @@ public function batchRunAction()
try {
$importData = $batchImportModel->getBatchData();
$adapter->saveRow($importData);
} catch (Exception $e) {
$errors[] = $e->getMessage();
} catch (Exception $exception) {
$errors[] = $exception->getMessage();
continue;
}

Expand Down Expand Up @@ -279,12 +291,16 @@ public function batchRunAction()
}
}

/**
* @throws Throwable
* @throws Mage_Core_Exception
*/
public function batchFinishAction()
{
$batchId = $this->getRequest()->getParam('id');
if ($batchId) {
$batchModel = Mage::getModel('dataflow/batch')->load($batchId);
/** @var Mage_Dataflow_Model_Batch $batchModel */
$batchModel = Mage::getModel('dataflow/batch')->load($batchId);

if ($batchModel->getId()) {
$result = [];
Expand All @@ -304,6 +320,8 @@ public function batchFinishAction()

/**
* Customer orders grid
*
* @throws Mage_Core_Exception
*/
public function historyAction()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Captcha/Model/Zend.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ protected function _getFontPath()
*/
protected function _getHelper()
{
if (empty($this->_helper)) {
if (is_null($this->_helper)) {
$this->_helper = Mage::helper('captcha');
}

Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Catalog/Model/Resource/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class Mage_Catalog_Model_Resource_Category extends Mage_Catalog_Model_Resource_A
/**
* Id of 'is_active' category attribute
*
* @var int
* @var null|int
*/
protected $_isActiveAttributeId = null;

/**
* Store id
*
* @var int
* @var null|int
*/
protected $_storeId = null;

Expand Down
Loading
Loading