-
Notifications
You must be signed in to change notification settings - Fork 118
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 GenerateThemeMailTemplatesCommand during upgrade #434
Conversation
@@ -28,6 +28,9 @@ | |||
namespace PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader; | |||
|
|||
use PrestaShop\Module\AutoUpgrade\UpgradeException; | |||
use PrestaShop\PrestaShop\Core\CommandBus\CommandBusInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if we are allowed to use core classes like this in the upgrade module Especially since these classes may not be available in the source version and/or the target version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -87,7 +90,33 @@ protected function upgradeLanguage($lang) | |||
\Language::installSfLanguagePack($lang_pack['locale'], $errorsLanguage); | |||
|
|||
if (!$this->container->getUpgradeConfiguration()->shouldKeepMails()) { | |||
\Language::installEmailsLanguagePack($lang_pack, $errorsLanguage); | |||
$mailTheme = \Configuration::get('PS_MAIL_THEME', null, null, null, 'modern'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we handle backward compatibility and use the Language::installEmailsLanguagePack
for versions older than the 1.7.6? If so maybe this should be extracted in a dedicated tool class or service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor to keep the backward compatibilty!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes keep it
9b79f29
to
689fd56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is OK IMO, if you apply latest feedbacks from @PierreRambaud
PHPStan issue not related to change PrestaShop/PrestaShop#26861 |
return new CoreUpgrader16($this->container, $this->logger); | ||
} | ||
|
||
return new CoreUpgrader17($this->container, $this->logger); | ||
if (version_compare($this->container->getState()->getInstallVersion(), '8.0.0.0', '<')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @atomiix for the finishing touch 😉
I'd like to approve but I can't approve my own PR 😅
Oh and it seems like PHPStan is not happy about something |
7607803
to
21978bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't approve this PR, seems legitimate I just have one suggestion
I didn't see any modif related to the bug you mentioned regarding LegacyLoader
, is it fixed in the core?
@@ -90,8 +90,8 @@ protected function upgradeLanguage($lang) | |||
$mailTheme, | |||
$lang_pack['locale'], | |||
true, | |||
$frontThemeMailsFolder, | |||
$frontThemeModulesFolder | |||
is_dir($frontThemeMailsFolder) ? $frontThemeMailsFolder : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these folders supposed to always exist? Is it really needed to check their existence?
I just checked the handler, which actually handles the default folder internally when the command parameters are empty, so maybe specifying these parameters is actually not useful here? We could ignore this and let that handler handle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These folders aren't supposed to always exist, if you check the themes/classic/
folder, you'll see no mails
folder.
Also, I see that's what we do in src/PrestaShopBundle/Controller/Admin/Improve/Design/MailThemeController.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any modif related to the bug you mentioned regarding LegacyLoader, is it fixed in the core?
@jolelievre yep, it's fixed in the core ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if ModuleAdapter:: getCommandBus
shouldn't throw an error if we're not in the context of 1.7+, but of course, this is an edge case scenario.
Hi @jolelievre,
What do you think, this error is related to the PR module or the develop PR? PS: I tried to make an upgrade from PS1778 to PS1782 using this PR => ok Thanks! |
sorry I cowardly left this PR's responsibility to @atomiix so I believe he is looking into it but can't reproduce the bug... |
Hi @jolelievre, @atomiix, I tried again with PS1782 fresh install & an upgrade to the PR & same error Untitled_.Jan.12.2022.2_59.PM.mp4Thanks! |
@khouloudbelguith it seems that your PHP version is 7.1, can you try with PHP 7.2 or above as the develop branch is not compatible with PHP < 7.2? Also, you'll have to delete ps_facebook & ps_metrics before the upgrade, they are not compatible yet with develop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @atomiix,
Yes, It is ok with PHP7.3
I tried to make an upgrade from PS1782 to PrestaShop/PrestaShop#27276
But after the upgrade, I have a lot of exceptions:
- Go to BO > Orders > View Order > See exception
- Go to BO > Orders > Shopping cart page > See exception
- Go to BO > Customers page > View customer > see exception
- Go to BO > Modules > Module Catalog > See exception
- Go to FO > Sign in > Se exception
Thanks!
@khouloudbelguith I think we might be in an infinite loop as this PR #441 seems to be solving the issue you just had but to validate it you need this one 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
21978bf
to
de5d119
Compare
…y removed Language::installEmailsLanguagePack function
…of the target version
Co-authored-by: GoT <PierreRambaud@users.noreply.github.com>
de5d119
to
b99c34d
Compare
1956b15
to
86678ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @atomiix, @jolelievre,
It is ok ✔️
I tried to upgrade PS1778 to PS1783 using this PR => OK (PHP7.3)
I tried to generate modern/classic emails in different languages (RTL & non RTL)
I tried to check the HTTP of emails 'Modern template / classic template)
I tried to translate some emails and resend them
I tried to upgrade from PS1769 to 178x branch using this PR
I tried to generate some emails with RTL to check this issue: => ok
I tried to upgrade from PS1783 to this PR: PrestaShop/PrestaShop#27276 => OK
I tried to upgrade from 178x branch to this PR: PrestaShop/PrestaShop#27276 => OK
I tried to generate some emails in Arabic language & English language
I checked Gmail, outlook web version, outlook desktop version, maildev server
Untitled_.Feb.16.2022.12_56.PM.mp4
I found some bugs but not the scope of this PR, which are blocking
PS:
Before the upgrade to this PR: PrestaShop/PrestaShop#27276
I uninstall those modules: ps_metrics, ps_facebook, Prestashop Checkout, Google marketing, welcome
After the upgrade
-
Go to BO > Orders > View Order > See exception & Add new order from BO, will be fixed with this Add SQL upgrade queries for new unit price column #441
-
Go to BO > Orders > Shopping cart page > See exception => will be fixed with this Add SQL upgrade queries for new unit price column #441
-
Go to BO > Customers page > View customer > see exception => will be fixed with this Add SQL upgrade queries for new unit price column #441
-
Go to BO > Modules > Module Catalog > See exception => I will create a new issue.
-
Go to FO > Sign in > See exception => will be fixed with this Add SQL upgrade queries for new unit price column #441
-
Go to FO as a visitor & add a product to cart > see exception => will be fixed with this Add SQL upgrade queries for new unit price column #441
-
Go to BO > SEO & URLs > Reffers Tab > see exception => will be fixed here: Remove the page
Referrers
PrestaShop#27098
-
Go to BO > SEO & URLs page > see exception => I will create a new issue
-
Go to BO > Design > Email theme > choose any theme (Classic or modern) > View Htpp or any action for order_conf > see exception => will be fixed with this Add SQL upgrade queries for new unit price column #441
-
The Security menu is not displayed => I will create a new issue.
Thanks!
Thanks @jolelievre & @khouloudbelguith |
…mand Use GenerateThemeMailTemplatesCommand during upgrade
GenerateThemeMailTemplatesCommand
which was introduced in PrestaShop 1.7.6 which means the module would now be only compatible with target versions above 1.7.6 I don't know if we should handle retrocompatibility with older versions? If so then we might need to extract this new code in a dedicated class or service to handle the switch more cleanly