-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Added theme is not registered during production mode #2797
Comments
Hi @moleman. Thank you for your inquiry but it is not a bug. Such actions like updating code, adding themes etc aren't supposed to be performed on production since they may lead to unpredictable and unstable site work. Usually such changes should be done not in production mode on some staging server and lately published on production. |
@slavvka Yes, and that is what we do. We have a build server that builds the sites cleanly with Composer and this is where the new code is introduced. These build artifacts are then deployed to staging and production servers and we then run setup:upgrade to upgrade the database in production after the deployment of the code is done. So, whats the correct workflow then when you want to add a new theme to a production site so that the theme gets registered in the theme database table? Because currently if we add a new theme it never gets registered because of the issue above. |
@slavvka This may not sound like a bug at first read, but the OP isn't talking about developing on a production site, but rather a deployment procedure. There are CLI commands to enable/disable modules, and to "uninstall" a theme, but none to install/activate/register a theme. Builds must be pushed to production in some fashion, and then setup:upgrade run to execute install scripts, and new components moving to production as part of a build need to be registered somehow, whether that is automatic when setup:upgrade is done (as would be expected) or at minimum via a CLI command to register them with the system so it knows about them. If there is an existing mechanism in the system to roll non-module components out to production and register them without re-installing the software from scratch, it would be great if you could make note of what that is. If there isn't a way to do this, then it is a bug and needs to be solved. |
I have the same experience. Similarly we are not attempting to install a theme directly to production, rather we are installing/creating a theme in dev. then much like @moleman, we use composer to generate a fresh code instance on a clean server before deploying the updated code to the production environment. The successful deployment then triggers 'setup:upgrade' to be run on the production servers in order to run the module updates and schema upgrades. _(I see no other sensible way of performing data-install and updates on the production DB...)_ None of this process adds a new theme record to the 'theme' table so not sure how this is supposed to be achieved.... set the site to developer mode to allow the theme to register... surely not! I too am interested in what approach is therefore recommended be to update the theme records (and other schema / record changes) in a production environment if this is by "design". Surely this is a bug that needs fixing..... |
Thank you all for your input, we have created MAGETWO-47999 to fix it. |
@moleman thank you for reporting. We have merged a fix in the develop branch, hence closing this ticket. Please create a new ticket if issues still arise. |
@mazhalai Could you comment on what the ultimate fix was/is? I'm not seeing commits tagged with this GH issue id, and it's unclear from the thread if this was being fixed by having setup:upgrade add the theme or via some other means. |
@davidalger too many commits, maybe it is easier to post the files modified/introduced: (you can look in blame/history of each file for specific commits) https://github.com/magento/magento2/blob/develop/app/code/Magento/Theme/Model/Theme/Registration.php and related tests. We also removed an obsolete event and related observer |
How do I know that the patch will be available for production if I install magento2 by below command: thank you. |
@mazhalai @slavvka @davidalger @alankent I spend a lot of time trying to figure out if that fix was released or not and still have no idea... |
@Igloczek the fix is in the develop branch, but it hasn't been added to a release yet. The way to tell if a fix is in a release version:
|
Don't you think this is a ridiculous "solution" for tracking issues status? |
@Igloczek sorry we cannot share access to our internal tracking. |
How about Github milestones and referencing Github issues in commit messages? |
@mazhalai can you at least shed some light on when the patch might make it into an official release? according to this ticket this bug was fixed mid january - since then 4 release versions happened... |
@Igloczek yes I apologize for the Github issue in the commit message, but we do not track Github milestones in tickets. @heldchen It was fixed in mid Feb and contributed in Mar, not Jan. @elenleonova any comment on next patch release date? |
Finally found this issue! So basically right now custom themes does not register. I did not understand why my theme did not appear, but this explains everything. |
hi, @mazhalai |
@woei66 No this is not added in 2.0.X yet ( It's just in develop branch ) and not 2.0: vs Search for MAGETWO-47999 on both of those links, you see that the fix is only in develop branch! This fix is urgent. Please add to 2.0.5! |
@benmarks @maksek |
What's the proper/recommended fix until this goes into a prod. release? Switch production to developer mode, run upgrade, and switch back? EDIT: my dev env is in "developer" mode and the theme files are all present. Running upgrade doesn't register the theme either. |
I fix it on production using SQL query to manually add record to |
Thanks @Igloczek - the direct SQL insert seems like the quick option. |
Not fixed in 2.0.5 either. THE PROBLEM
NOW LETS SEE:
TEMPORARY SOLUTION:
|
@peec all fixes from github are targeting 2.1 release, you won't see them in patch releases yet. For this particular i got confirmation - will be targeting 2.0.7 |
I'm using Magento 2.0.7 at this moment, and seem it still not be patched yet. |
Can someone update the documentation and explain what are virtual and staging theme types and when to use them? Can't find anything about it. Thanks! |
@erikhansen agreed. Just ran into this and followed @peec mysql code to resolve it. |
Anyway around this in production mode, using 2.1.0? I tried adding it directly in the theme table and appears to be successful, however then get an error saving products 'Required Parameter theme_dir was not passed'. If I remove the theme I entered manually in the table the error goes away when saving products. @gil-- have you tested saving products after adding the row manually? |
@jpratt are you 100% sure that |
@Igloczek running setup:upgrade doesn't detect and add the new design into the theme table as well? When I tried it, I only notices is adding 1 instead of 0 in TYPE column. |
I'm having this problem in v2.2.3 as well. This is causes problems when testing new themes in integration/staging websites, which are usually set to My workaround for that is to switch to The fix should really be formally included in releases before closing the Github issue. No integrator would use the |
This bug is still present in 2.2.5. |
This bug is still present, I add a custom adminhtml theme,but not working in developer mode |
@penglongyun admin themes work differently, your problem it's probably not related to this issue. |
2.4.3-p1 And still not fixed. But I assume since this issue is closed nobody will care... |
@OvalMedia while this is issue is not fixed you can now dump your themes in
|
It seems that added / installed themes are not registered if they are added to a site which is already installed and is set to production mode. By registered I mean that they are not added to the theme table.
After looking at the code it seems that themes are registered differently depending on mode.
In developer mode:
In production mode:
This means that if you have a running site in production mode and you decide to install a new theme it will not be registered in the theme table which means that it will not be selectable in the admin.
Steps to reproduce:
Expected result:
The installed theme should be registered in the theme table.
Actual result:
The installed theme is not registered in the theme table.
The text was updated successfully, but these errors were encountered: