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

Use DISTINCT in query to improve uninstall() method in Module class #8441

Merged
merged 1 commit into from Oct 30, 2017

Conversation

Projects
None yet
3 participants
@soee

soee commented Oct 25, 2017

Questions Answers
Branch? develop
Description? When module is beeing uninstalled it also removes relation to related hooks and exceptions (from hook_module table). To do this inside uninstall() method of Module class we are loading hook ids assigned to module. Since the hook_module table stores relation for modules and hooks in each shop (if we are using multistore) than the mentioned query will return by default duplicated id_hook values. If we use DINSTINCT on selected column we will have unique id_hook values and we will not call several times for the same id_hook unregisterHook() or unregisterExceptions() functions that will do their job only in first call. So this is small improvement to avoid unnecesary forwach calls in module uninstall() method.
Type? improvement
Category? CO
BC breaks? no
Deprecations? no
Fixed ticket? http://forge.prestashop.com/browse/BOOM-3970
How to test? Best way to test it is to dump rows returned by modified query before and after change and count foreach calls etc. or enable profiling and check query executing reports.

This change is Reviewable

@prestonBot

This comment has been minimized.

Show comment
Hide comment
@prestonBot

prestonBot Oct 25, 2017

Collaborator

Hello soee!

This is your first pull request on the PrestaShop project. Thank you, and welcome to this Open Source community!

Collaborator

prestonBot commented Oct 25, 2017

Hello soee!

This is your first pull request on the PrestaShop project. Thank you, and welcome to this Open Source community!

@soee

This comment has been minimized.

Show comment
Hide comment
@soee

soee Oct 25, 2017

This is the same PR i send before but due to wrong first commit message i ended up with 3 commits and was unable to squash them. So i removed previous PR and created new one. Previous one chnages were accepted by devs (#8424) :)

soee commented Oct 25, 2017

This is the same PR i send before but due to wrong first commit message i ended up with 3 commits and was unable to squash them. So i removed previous PR and created new one. Previous one chnages were accepted by devs (#8424) :)

@vincentbz vincentbz requested a review from Quetzacoalt91 Oct 26, 2017

@Quetzacoalt91 Quetzacoalt91 added this to the 1.7.3.0 milestone Oct 30, 2017

@Quetzacoalt91 Quetzacoalt91 merged commit 258798d into PrestaShop:develop Oct 30, 2017

2 checks passed

codacy/pr Good work! A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Quetzacoalt91

This comment has been minimized.

Show comment
Hide comment
@Quetzacoalt91

Quetzacoalt91 Oct 30, 2017

Member

Thank you @soee :)

Member

Quetzacoalt91 commented Oct 30, 2017

Thank you @soee :)

@soee soee deleted the soee:useDistinctToFetchHookIdsInModuleUninstallFunction branch Oct 30, 2017

@eternoendless eternoendless changed the title from CO: use DISTINCT in query to improve uninstall() method in Module class to Use DISTINCT in query to improve uninstall() method in Module class Dec 7, 2017

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