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

Improved performance of product category rewrites (disabled product & categories and product_use_categories) #3267

Closed
wants to merge 9 commits into from

Conversation

fballiano
Copy link
Contributor

This PR is a new version of #1405 since the original one was not editable by admin, was on the wrong branch and there was no feedback since a while.

@colinmollenhour I've also applied your PR macopedia#8 here in this code already.

@github-actions github-actions bot added Component: Adminhtml Relates to Mage_Adminhtml Component: Catalog Relates to Mage_Catalog labels May 16, 2023
@@ -265,6 +265,16 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</product_use_categories>
<create_url_for_disabled translate="label">
<label>Generate URL rewrites for disabled categories and products</label>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should go in a translation file too

@fballiano fballiano changed the title Improve performance of product category rewrites (disabled product & categories and product_use_categories) Improved performance of product category rewrites (disabled product & categories and product_use_categories) May 16, 2023
@colinmollenhour
Copy link
Member

Thanks for rebasing and submitting a new PR!

However, I think it would be good to retain the original authorship of the commits. You can use git rebase -i origin/main and then change "pick" to "edit", then git commit --amend --author="Author Name <email@address.com>" to change the main author. You can also add additional authors by adding new lines to the message like "Co-authored-by: Author Name email@address.com".

@fballiano
Copy link
Contributor Author

fballiano commented May 16, 2023

I'll manually add the you and @MarcinNowakMacopedia in the commit message if that's ok

@colinmollenhour
Copy link
Member

Are you talking about adding "@" with teh github username to the commit message? It's not a big deal but I think that is not the best.. I end up getting emails over time when those commits are rebased and pushed even on other projects - also I think it might not update the Contributors section in the README automatically to add Marcin. But again, not blocker per-se.

@fballiano
Copy link
Contributor Author

no I add the "coauthored by" message in the squash commit, I always do

empiricompany
empiricompany previously approved these changes May 16, 2023
Copy link
Contributor

@empiricompany empiricompany left a comment

Choose a reason for hiding this comment

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

I did some testing and looks good to me

@empiricompany
Copy link
Contributor

I did some testing and looks good to me

The only thing is that it doesn't prevent generating rewrites for child categories of a disabled category

@@ -974,6 +985,7 @@ protected function _saveRewriteHistory($rewriteData, $rewrite)
$rewriteData['options'] = 'RP'; // Redirect = Permanent
$this->getResource()->saveRewriteHistory($rewriteData);
}
$this->getResource()->clearProductRewrites($productId, $storeId);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the fact that this PR has so many undefined variables really makes me wonder.

is this call necessary here? should it be removed?

@@ -375,7 +364,7 @@ protected function _refreshCategoryProductRewrites(Varien_Object $category)
$process = true;
$lastEntityId = 0;
$firstIteration = true;
while ($process == true) {
while ($process === true) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the way the $process variable is handled... PHPStan complains that's actually a "while true"... which is not the best

@empiricompany
Copy link
Contributor

this and mine #3251
should be merged into next rc for me, it's an important feature of perfomance improvement

@fballiano
Copy link
Contributor Author

this PR has too many problems that have to be addressed before merging, it's also a quite big one so I think it should go to a later release.

@MarcinNowakMacopedia are you still interested in checking what's reported by phpstan?

@addison74
Copy link
Contributor

Most likely such PRs and those marked with "Don't Forget" will have to be promoted by a maintainer so that they can be corrected and approved by the others.

@fballiano fballiano marked this pull request as draft July 21, 2023 20:06
@fballiano
Copy link
Contributor Author

Because of #3267 (comment) I'm closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants