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

Removed dead code #2339

Merged
merged 3 commits into from
Jul 30, 2022
Merged

Removed dead code #2339

merged 3 commits into from
Jul 30, 2022

Conversation

sreichel
Copy link
Contributor

@sreichel sreichel commented Jul 25, 2022

Description (*)

Removed dead code ...

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added Component: AdminNotification Relates to Mage_AdminNotification Component: Adminhtml Relates to Mage_Adminhtml Component: Admin Relates to Mage_Admin Component: Api PageRelates to Mage_Api Component: Catalog Relates to Mage_Catalog Component: CatalogIndex Relates to Mage_CatalogIndex Component: CatalogSearch Relates to Mage_CatalogSearch Component: Checkout Relates to Mage_Checkout Component: Core Relates to Mage_Core Component: Customer Relates to Mage_Customer Component: Dataflow Relates to Mage_Dataflow Component: Downloadable Relates to Mage_Downloadable Component: Eav Relates to Mage_Eav Component: Payment Relates to Mage_Payment Component: PayPal Relates to Mage_Paypal Component: Rating Relates to Mage_Rating Component: Rule Relates to Mage_Rule Component: Sales Relates to Mage_Sales Component: SalesRule Relates to Mage_SalesRule Component: Tag Relates to Mage_Tag Component: Tax Relates to Mage_Tax Component: Weee Relates to Mage_Weee environment labels Jul 25, 2022
@github-actions

This comment has been minimized.

@@ -145,12 +127,11 @@ public function decorateStatus($value, $row, $column, $isExport)
/**
* Get row edit url
*
* @return string
* @return false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does other grids behave? do they return string? or string or false? is there an interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other return string, for being clickable.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions github-actions bot added the Component: Authorizenet Relates to Mage_Authorizenet label Jul 25, 2022
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@addison74
Copy link
Contributor

Check this file https://github.com/OpenMage/magento-lts/blob/1.9.4.x/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Grid.php. Maybe it should be included in the list.

line 113:

        //$this->addExportType('*/*/exportCsv', $this->__('CSV'));
        //$this->addExportType('*/*/exportXml', $this->__('XML'));
        return parent::_prepareColumns();
    }

    public function getRowUrl($row)
    {
        return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
        //return $this->getUrl('*/*/view', array('id' => $row->getId()));

The export feature does not work and the last two lines seem to do the same thing.

@sreichel
Copy link
Contributor Author

There is still commented out code in many places. This was only the beginning ... :)

@addison74
Copy link
Contributor

What do you think about the large number of TODOs that exist in the code? Will someone ever solve them? Those issues still exist?

@sreichel
Copy link
Contributor Author

sreichel commented Jul 26, 2022

I thought about this ... e.g. deleted part. I'd keep most of todo comments (for now), but not within unfinished code. This was there since 1.1.

                //$m = $e->getMessage();
                //if ( eregi("^Resource '(.*)' not found", $m) ) {
                    // Deleting non existent resource rule from rules table
                    //$cond = $this->_write->quoteInto('resource_id = ?', $resource);
                    //$this->_write->delete(Mage::getSingleton('core/resource')->getTableName('admin/rule'), $cond);
                //} else {
                    //TODO: We need to log such exceptions to somewhere like a system/errors.log
                //}
            }
            /*
            switch ($rule['permission']) {
                case Mage_Admin_Model_Acl::RULE_PERM_ALLOW:
                    $acl->allow($role, $resource, $privileges, $assert);
                    break;

                case Mage_Admin_Model_Acl::RULE_PERM_DENY:
                    $acl->deny($role, $resource, $privileges, $assert);
                    break;
            }
            */

@fballiano fballiano self-requested a review July 27, 2022 13:04
@sreichel sreichel merged commit 1699468 into 1.9.4.x Jul 30, 2022
@sreichel sreichel deleted the dead-code branch July 30, 2022 09:40
@github-actions
Copy link
Contributor

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
7 runs  ±0  5 ✔️ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit 1699468. ± Comparison against base commit cc320eb.

@Sdfendor
Copy link
Contributor

Sdfendor commented Aug 3, 2022

@sreichel I wanted to personally thank you for one of the changes in this PR. In app/code/core/Mage/Admin/Model/Resource/Acl.php you replaced dead code and this todo

//TODO: We need to log such exceptions to somewhere like a system/errors.log

with code to log the exceptions. The method this belongs to loads all acl rules e.g. during a login. All rules from table admin_rules referencing resource_ids (acl nodes in the system.xml files) that no longer exist, raise exceptions that are logged by this code change.
Our store has seen a lot of modules come and go over its lifetime thus a quite a lot of rules were outdated and caused a lot exceptions accordingly. We never really noticed this because the exceptions had been ignored before and no other negative effects arose from unnecessary iterations in this foreach loop. But still we could clean up this mess 😀👍.

@luigifab
Copy link
Contributor

luigifab commented Sep 5, 2022

We have also a lot of Zend_Acl_Exception: Resource 'admin/rewards/settings/action' not found in ... in our Sentry instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Admin Relates to Mage_Admin Component: Adminhtml Relates to Mage_Adminhtml Component: AdminNotification Relates to Mage_AdminNotification Component: Api PageRelates to Mage_Api Component: Authorizenet Relates to Mage_Authorizenet Component: Catalog Relates to Mage_Catalog Component: CatalogIndex Relates to Mage_CatalogIndex Component: CatalogSearch Relates to Mage_CatalogSearch Component: Checkout Relates to Mage_Checkout Component: Core Relates to Mage_Core Component: Customer Relates to Mage_Customer Component: Dataflow Relates to Mage_Dataflow Component: Downloadable Relates to Mage_Downloadable Component: Eav Relates to Mage_Eav Component: Payment Relates to Mage_Payment Component: PayPal Relates to Mage_Paypal Component: Rating Relates to Mage_Rating Component: Rule Relates to Mage_Rule Component: Sales Relates to Mage_Sales Component: SalesRule Relates to Mage_SalesRule Component: Tag Relates to Mage_Tag Component: Tax Relates to Mage_Tax Component: Weee Relates to Mage_Weee environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants