I noticed recently that the Content Translation module still had a content_translation_enable() function even though hook_enable() has been removed.
I'm attaching a patch that moves the code that was previously in the content_translation_enable() to content_translation_install() instead.
| Comment | File | Size | Author |
|---|---|---|---|
| #67 | interdiff-58-63-do-not-test.diff | 1.46 KB | chi |
| #65 | interdiff-58-63.diff | 1.46 KB | chi |
| #62 | 2342015-63.patch | 3.79 KB | chi |
| #58 | interdiff.txt | 936 bytes | joelpittet |
| #58 | content_translation-2342015-58.patch | 4.41 KB | joelpittet |
Comments
Comment #1
matt v. commentedComment #2
plachPatch looks good, but we need some test coverage for this. Just checking whether messages are displayed.
Comment #3
joelpittet@plach should this test be for enabling/disabling modules with messages in the hook or just this specific module has that message after install?
Comment #4
plach:)
Comment #5
chi commentedRe-rolled the previous patch and added test.
Comment #8
gábor hojtsyMarked #2632560: Content translation implements nonexistent hook_enable as duplicate.
Comment #9
chi commentedComment #10
gábor hojtsyNeeds work given it fails.
Comment #12
chi commentedJust wonder if this empty patch will fail.
Comment #13
chi commentedComment #14
chi commentedComment #15
chi commentedHelpEmptyPageTest::testEmptyHookHelp() should only check hook_help() but not module installation process.
Comment #16
chi commentedMinor cleanup.
Comment #17
chi commentedComment #18
vijaycs85Discussed in #2632560-5: Content translation implements nonexistent hook_enable, we want to keep the function. So kinda like this:
Comment #19
gábor hojtsyComment #20
chi commentedI marked content_translation_enable() as deprecated.
Comment #21
swentel commentedsimultaneously
Comment #22
chi commentedFixed typo.
Comment #24
rodrigoaguileraI will give this a try for the sprint weekend
Comment #25
rodrigoaguileraComment #26
rodrigoaguileraNothing to do actually, the patch and the test look OK to me.
Comment #27
vijaycs85Patch in #22 looks fine and applies to HEAD.
Comment #28
chandeepkhosa commentedComment #29
chandeepkhosa commentedComment #30
alexpottSo the problem here is that we are not just going to remove this method we're going have to move the functionality to hook_install. BUT I have to disagree that hook implementations are API - you are not meant to call hooks directly and if you do that is wrong and contrary to our API. Therefore we should be able to remove hook implementations in minor versions at least. Especially hook implementations that have no impact.
All of this said I'm really sad that we're not using routes here - it feels really wrong. If a module depends on another module it ought to be able to rely on its routes being there. This code will break if someone installs language and alters the routes to have different paths (for whatever reason).
I think modules that need to be able to add post installation messages need to have a way to do so that is route safe. As this means a module can't even rely on its own routes.
Comment #31
berdirSee #2589967: Rebuild routes immediately when modules are installed and #2572293: Race condition triggerable by a single user due to router rebuild in kernel.terminate for some issues on that topic. We can add a @todo for those and change it back?
Comment #32
alexpottYeah an @todo would help - probably pointing to #2589967: Rebuild routes immediately when modules are installed.
Comment #33
chi commentedThe patch is the same as #16 but with different comments.
Comment #34
vijaycs85Looks good.
Comment #35
catchI know this isn't touched by the patch, but the string looks wrong to me. Sites will have one language installed, so they only need to add at least one language, not two.
Since this message isn't showing at all at the moment, seems like something we could change here. Or if not, let's open a follow-up.
Comment #36
catchFor the string something like:
This site has only a single language enabled. Add at least one more language in order to translate content.Comment #37
chi commentedComment #38
chi commentedComment #39
chi commentedI am not sure how it works before, but toUriString is not suitable here.
Comment #41
chi commentedUpdated text in the test.
Comment #42
chi commentedWe might want to assert URLs in those messages.
Comment #44
chi commentedComment #45
alexpottChanging the translated string means that we can only do this in 8.1.x. I think we should make this change without the string change because then we can fix this in 8.0.x and 8.1.x and open a followup to change the message. Thanks for all the patches @Chi.
Comment #46
alexpottBack to needs work for #45
Comment #47
chi commentedComment #48
vijaycs85created follow up for string update: #2662078: Update the misleading warning message in Content Translation module
Comment #49
gábor hojtsyLooks good, thanks for the fixes.
Comment #50
catchNo longer applies to 8.1.x now that #2662078: Update the misleading warning message in Content Translation module has been committed, so needs a quick 8.1.x re-roll.
Comment #51
vijaycs85Quick reroll...
Comment #52
vijaycs85Comment #54
vijaycs85Changing the branch and retesting...
Comment #55
gábor hojtsyYay, thanks!
Comment #58
joelpittetNew test assertion needed to change with that string change too. Here's the fix, tested locally against that fail.
Comment #59
vijaycs85ah right. I missed that why we had to re-roll. thanks @joelpittet. Now it's RTBC as per #55
Comment #60
alexpottI think this change is wrong. In reality the container should be frozen after the containerBuild is called.
Given this is a kernel test there is no need to call module install here. We can replace the module install with...
Comment #61
alexpottWe should also have a follow up to improve the HelpEmptyPageTest so that it tests that if a route is passed in to hook_help that the supernova generator does indeed throw an error.
Comment #62
chi commentedIt's not clear what is so special with menu_link_content schema. Looks as some another trick at least if it is not commented.
Comment #63
gábor hojtsy@chi: can you post an interdiff to help review?
Comment #65
chi commentedNotice that patch in #58 is outdated because of #2338747: Move {router} out of system.install and create the table lazy.
Comment #67
chi commentedComment #68
gábor hojtsy@chi: instead of an interdiff, can you roll an updated patch please?
Comment #69
chi commented@Gábor Hojtsy, patch in #62 is up to date. It's made per #60 recommendations. I can also roll patch from #58 if needed.
Comment #70
gábor hojtsyYeah sorry for the misunderstanding. The fix looks fine to me, thanks for the update!
Comment #71
alexpott@Chi it is not what is special with the menu_link_content schema - it is was is special about installing modules in a kernel test base. The module installer shouldn't be used for this and the class has it's own methods to enable modules in its funky way. We need to install the menu_link_content schema because that test depends on it.
Comment #72
alexpottCommitted 9ba7422 and pushed to 8.1.x. Thanks!
In addition to crediting those that provided a patch I've created @Gábor Hojtsy and myself for providing reviews and @catch for the suggestion that lead to #2662078: Update the misleading warning message in Content Translation module.
Given that nothing is actually broken I would hold off on porting this to 8.0.x - if people think I'm wrong please re-open the issue.
Comment #74
gábor hojtsyYay, thanks! I think its fine on the 8.1 branch, it is soon released :)