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

Add new hooks in sql upgrade statement #1168

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
103 changes: 103 additions & 0 deletions upgrade/sql/9.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,106 @@ ALTER TABLE `PREFIX_attachment_lang` MODIFY COLUMN `name` varchar(255) DEFAULT N
/* Fix category thumbnail images */
/* https://github.com/PrestaShop/PrestaShop/pull/36877 */
/* PHP:ps_900_migrate_category_images(); */;

/* Auto generated hooks added for version 9.0.0 */
INSERT INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`) VALUES
Copy link
Contributor

Choose a reason for hiding this comment

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

Be careful the list of inserted hooks is already upper in this file The command is able to generate the SQL query but it cannot modify this file "in place", it only appends the content at the end So we need to manually keep the file consistent (either move this added code upper in the file or remove the upper part)

(NULL, 'displayNav1', '', '', '1'),
(NULL, 'displayNav2', '', '', '1'),
(NULL, 'displayFooterBefore', '', '', '1'),
(NULL, 'displayFooterAfter', '', '', '1'),
(NULL, 'displaySearch', '', '', '1'),
(NULL, 'displayNotFound', '', '', '1'),
(NULL, 'displayProductPriceBlock', '', '', '1'),
(NULL, 'displayProductListReviews', '', '', '1'),
(NULL, 'displayReassurance', '', '', '1'),
(NULL, 'displayCMSDisputeInformation', '', '', '1'),
(NULL, 'displayCMSPrintButton', '', '', '1'),
(NULL, 'displayExpressCheckout', '', '', '1'),
(NULL, 'displayCheckoutSubtotalDetails', '', '', '1'),
(NULL, 'displayOrderConfirmation1', '', '', '1'),
(NULL, 'displayOrderConfirmation2', '', '', '1'),
(NULL, 'displayCrossSellingShoppingCart', '', '', '1'),
(NULL, 'displayGDPRConsent', '', '', '1'),
(NULL, 'displayNewsletterRegistration', '', '', '1'),
(NULL, 'actionSetInvoice', '', '', '1'),
(NULL, 'actionPDFInvoiceRender', 'PDF Invoice - Render', 'This hook is called when a PDF invoice is rendered from the Front Office and the Back Office', '1'),
(NULL, 'actionOrderHistoryAddAfter', '', '', '1'),
(NULL, 'actionInvoiceNumberFormatted', '', '', '1'),
(NULL, 'actionAttributeCombinationDelete', '', '', '1'),
(NULL, 'actionAttributeCombinationSave', '', '', '1'),
(NULL, 'deleteProductAttribute', '', '', '1'),
(NULL, 'actionGetProductPropertiesBefore', '', '', '1'),
(NULL, 'actionGetProductPropertiesAfter', '', '', '1'),
(NULL, 'displayCustomization', '', '', '1'),
(NULL, 'actionDispatcher', '', '', '1'),
(NULL, 'moduleRoutes', '', '', '1'),
(NULL, 'actionGetExtraMailTemplateVars', '', '', '1'),
(NULL, 'actionModuleRegisterHookBefore', '', '', '1'),
(NULL, 'actionModuleRegisterHookAfter', '', '', '1'),
(NULL, 'actionModuleUnRegisterHookBefore', '', '', '1'),
(NULL, 'actionModuleUnRegisterHookAfter', '', '', '1'),
(NULL, 'actionObjectAddBefore', '', '', '1'),
(NULL, 'actionObjectAddAfter', '', '', '1'),
(NULL, 'actionObjectUpdateBefore', '', '', '1'),
(NULL, 'actionObjectUpdateAfter', '', '', '1'),
(NULL, 'actionObjectDeleteBefore', '', '', '1'),
(NULL, 'actionObjectDeleteAfter', '', '', '1'),
(NULL, 'actionCustomerBeforeUpdateGroup', '', '', '1'),
(NULL, 'actionCustomerAddGroups', '', '', '1'),
(NULL, 'actionGetIDZoneByAddressID', '', '', '1'),
(NULL, 'actionProductCoverage', '', '', '1'),
(NULL, 'actionSubmitCustomerAddressForm', '', '', '1'),
(NULL, 'actionDeliveryPriceByWeight', '', '', '1'),
(NULL, 'actionDeliveryPriceByPrice', '', '', '1'),
(NULL, 'actionAdminMetaBeforeWriteRobotsFile', '', '', '1'),
(NULL, 'actionAdminMetaAfterWriteRobotsFile', '', '', '1'),
(NULL, 'productSearchProvider', '', '', '1'),
(NULL, 'actionFrontControllerSetMedia', '', '', '1'),
(NULL, 'overrideLayoutTemplate', '', '', '1'),
(NULL, 'actionAdminControllerSetMedia', '', '', '1'),
(NULL, 'overrideMinimalPurchasePrice', '', '', '1'),
(NULL, 'actionCartSummary', '', '', '1'),
(NULL, 'actionOnImageResizeAfter', '', '', '1'),
(NULL, 'actionOnImageCutAfter', '', '', '1'),
(NULL, 'actionShopDataDuplication', '', '', '1'),
(NULL, 'termsAndConditions', '', '', '1'),
(NULL, 'actionValidateStepComplete', '', '', '1'),
(NULL, 'dashboardZoneOne', '', '', '1'),
(NULL, 'dashboardZoneTwo', '', '', '1'),
(NULL, 'dashboardData', '', '', '1'),
(NULL, 'actionPasswordRenew', '', '', '1'),
(NULL, 'actionDownloadAttachment', '', '', '1'),
(NULL, 'fooHook', '', '', '1'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there really a hook with this name in production?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, this is the same problem as with the generated docs, some of the hooks should be excluded, I added more comments on this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the end i don't know anymore if this command is a good idea i'm a but tired of all of this :/

Copy link
Contributor

Choose a reason for hiding this comment

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

@tleon I understand you

Copy link
Contributor

Choose a reason for hiding this comment

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

@tleon

it is a good idea and it works great, the most important remaining thing is to have block-list of hooks available, so you don't generate them, hooks from tests directory, and hooks that are deprecated :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of a s list of blocked hooks we could have instead a list of folders that the scanner shouldn't scan

(NULL, 'ppbsDeleteCartProduct', '', '', '1'),
(NULL, 'ppbsGetProducts', '', '', '1'),
(NULL, 'actionCronJob', '', '', '1'),
(NULL, 'actionPresentModule', '', '', '1'),
(NULL, 'actionSearch', '', '', '1'),
(NULL, 'actionAdminThemesControllerUpdate_optionsAfter', '', '', '1'),
(NULL, 'actionAdminDuplicateBefore', '', '', '1'),
(NULL, 'actionAdminDuplicateAfter', '', '', '1'),
(NULL, 'displayOrderPreview', '', '', '1'),
(NULL, 'displayAdminOrderSideBottom', '', '', '1'),
(NULL, 'displayAdminAfterHeader', '', '', '1'),
(NULL, 'displayAdminLogin', '', '', '1'),
(NULL, 'displayAdminNavBarBeforeEnd', '', '', '1'),
(NULL, 'displayAdminListAfter', '', '', '1'),
(NULL, 'displayAdminListBefore', '', '', '1'),
(NULL, 'displayAdminView', '', '', '1'),
(NULL, 'displayAdminOptions', '', '', '1'),
(NULL, 'displayAdminForm', '', '', '1'),
(NULL, 'actionWishlistAddProduct', '', '', '1'),
(NULL, 'actionObjectProductCommentValidateAfter', '', '', '1'),
(NULL, 'actionExportGDPRData', '', '', '1'),
(NULL, 'actionDeleteGDPRCustomer', '', '', '1'),
(NULL, 'actionNewsletterRegistrationBefore', '', '', '1'),
(NULL, 'actionNewsletterRegistrationAfter', '', '', '1'),
(NULL, 'actionModuleMailAlertSendCustomer', '', '', '1'),
(NULL, 'actionSearchTermFormBuilderModifier', 'Modify search term identifiable object form', 'This hook allows to modify search term identifiable object forms content by modifying form builder data or FormBuilder itself', '1'),
(NULL, 'actionSearchTermFormDataProviderData', 'Provide search term identifiable object form data for update', 'This hook allows to provide search term identifiable object form data which will prefill the form in update/edition page', '1'),
(NULL, 'actionSearchTermFormDataProviderDefaultData', 'Provide search term identifiable object default form data for creation', 'This hook allows to provide search term identifiable object form data which will prefill the form in creation page', '1'),
(NULL, 'actionBeforeUpdateSearchTermFormHandler', 'Modify search term identifiable object data before updating it', 'This hook allows to modify search term identifiable object forms data before it was updated', '1'),
(NULL, 'actionAfterUpdateSearchTermFormHandler', 'Modify search term identifiable object data after updating it', 'This hook allows to modify search term identifiable object forms data after it was updated', '1'),
(NULL, 'actionBeforeCreateSearchTermFormHandler', 'Modify search term identifiable object data before creating it', 'This hook allows to modify search term identifiable object forms data before it was created', '1'),
(NULL, 'actionAfterCreateSearchTermFormHandler', 'Modify search term identifiable object data after creating it', 'This hook allows to modify search term identifiable object forms data after it was created', '1')
ON DUPLICATE KEY UPDATE `title` = VALUES(`title`), `description` = VALUES(`description`);
Loading