Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Simplify maintenance and promote more recommended grants.
Comment | File | Size | Author |
---|---|---|---|
#44 | simple_oauth_module.png | 10.79 KB | lcontreras |
#44 | running_updates.png | 49.32 KB | lcontreras |
#43 | 3078547-install-field-definitions-43.patch | 4.12 KB | japerry |
| |||
#38 | interdiff_34-38.txt | 3.54 KB | sam711 |
#38 | 3078547-install-field-definitions-38.patch | 3.2 KB | sam711 |
|
Comments
Comment #2
e0ipsoThis will go into v4.
Comment #3
e0ipsoLets try these additional fixes.
Comment #4
e0ipsoAnd Simple OAuth Extras is no more. This starts
8.x-4.x
!Comment #5
e0ipsoComment #6
jedgar1mx CreditAttribution: jedgar1mx commentedWhen I try to upgrade to
4.0
it throws error due tosimple_oauth_extras
. I tried to apply the patch before upgrading but #3 fails with3.16
Comment #7
hchonovWill there be an update path?
Comment #8
e0ipsoAs discussed, that responsibility will fall on the shoulders of the companies needing this (very simple) update path. I'll be willing to donate some of my free time to review the patch.
Comment #9
e0ipsoComment #10
e0ipsohttps://www.drupal.org/node/3034742 may be a good pointer to start digging.
Comment #11
hchonovNot really, because this is a removed feature and even if it was still there it is of no help, because when moving configs around and parts of them a manual update is required.
In order to not break systems updating I think that it would be great if the commit is either reverted or the v3 branch remains the recommended one until the update path has been implemented.
Comment #12
e0ipsoAwesome @hchonov! It sounds like you finally found the time to get the background on this ticket.
Comment #13
hchonovNo, I am sorry currently I don't have that much time, as I am working on higher priority issues in the Core entity API.
I had a short look at your patch and I've seen such changes, which is why I've made the suggestion in the previous comment. What about it?
Comment #14
phenaproximaAn update path is definitely needed here. The removal of the automatic entity update system in Drupal 8.7.0 squarely necessitates it, as I discovered when Lightning API implemented an update hook to uninstall simple_oauth_extras and the update path test we wrote complained about out-of-date field storage definitions.
Comment #15
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedWe worked on an update hook at
#3079468: Update [Simple OAuth] from ~3.0 to ~4.0
#3085671: Fix the update process to uninstall the Simple Oauth Extras module as it was merged into Simple Oauth to make it work without conditions
It was reported to me by Edgar Montes (jedgar1mx)
https://git.drupalcode.org/project/varbase_api/blob/8.x-7.x/varbase_api....
Varbase API is a fork of Lightning API with custom changes
Comment #16
e0ipsoThanks for the links. Is there any chance you can port any of the fixes to the module, if they can be applied?
I don't have much availability at the moment, but this is one of my priorities when I have the time.
Comment #17
jedgar1mx CreditAttribution: jedgar1mx commentedYup it works
Comment #18
hchonovYou still need the proper updates of the field definitions.
Comment #19
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedUninstall function will not work as the module will be removed on
composer update
Delete the key value for simple_oauth_extras from the system schema collection.
Entity updates to clear up any mismatched entity and/or field definitions
And Fix changes were detected in the entity type and field definitions.
Customized class from the Devel Entity Updates module
Development version of the entity definition update manager.
Support for automatic entity updates has been removed
https://www.drupal.org/node/3034742
User deprecated function: EntityDefinitionUpdateManagerInterface::applyUpdates() is deprecated in 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface::getChangeList() and execute each entity type and field storage update manually instead.
#3051884: Switch to use [Varbase Entity Definition Update Manager] and remove deprecated \Drupal::entityDefinitionUpdateManager()->applyUpdates()
Comment #20
hchonovYou should not perform automatic entity updates, one of the reasons the support for this was removed from core.
You should correspondingly update the moved field definitions.
Comment #21
e0ipso@hchonov can those be provided by an update function in Simple OAuth 4.x? How would one go about it?
Comment #22
psf_ CreditAttribution: psf_ at SDOS commentedHow workaround, I copied the simple_oauth_extras to my modules/custom and I wrote an update_N to disable it.
I'll leave the code there, and in a future updates I'll remove it.
Comment #23
geaseUpgrade path against 4.x. Except fixing field definitions, incorporated suggestion from #19 to remove schema version for simple_oauth_extras and uninstall it as in #22. But, given the codebase for extras is already removed, should this module be detected as installed and removed by corresponding services? Or it was better just to edit core.extension configuration? Not sure.
Comment #24
sam711 CreditAttribution: sam711 as a volunteer commentedI think your patch fixes field definitions @gease.
Because the codebase of Simple Oauth Extras might not exist, you need to capture
ModuleUninstallValidatorException
on uninstall and delete thekey_value
afterwards or inside the catch.\Drupal::service('module_installer')->uninstall(['simple_oauth_extras']);
Ideally
core.extension
and and config file need to be deleted too in case of non existing codebase.I would also advise to apply this patch before updating to D8.8 because due to the removal of Simple Oauth Extras, an exception is thrown during
system_update_8803
preventing the required path_alias module to be installed and stooping the rest of the updates to run. It basically breaks the whole site.Comment #25
sam711 CreditAttribution: sam711 as a volunteer commentedComment #26
geaseSubstantially rewritten the upgrade.
First, we need to install field definitions only when we need to, in fact, if simple_oauth_extras was on, definitions are already fine.
Then, there can be a configuration item from simple_oauth_extras that needs to be ported to simple_oauth config.
Third, it seems that if simple_oauth_extras was on and the codebase was removed, the module won't be detected as installed and entry will be somehow removed from core.extensions automatically. In case this did'nt happen, I still add actions to the end of update. And anyway, we'll need to remove schema number for simple_oauth_extras (if it was present, but there's no bad in running this query).
Comment #27
sam711 CreditAttribution: sam711 as a volunteer commentedIt works great for me.
Just needed to make sure this was applied before the system update hooks in D8.8.
Thanks!
Comment #28
geaseSome more tweaks. Anyway, we need to update field provider for installed field definitions, even though entityDefinitionUpdateManager::getChangeList() doesn't seem to report this as change. And there is a difference between field definition and field storage definition (though somehow it worked with field definition as well).
Comment #29
hchonovYou should not act according to the returned changes, but according to the changes in the module.
So if the module wasn't installed, then install the fields, otherwise update them. When installing a field you have to hard code its definition in the update, otherwise you might be installing charges made on the field by other modules through some hooks.
The update currently is mixing the concepts, but it should not and there should be a clear separation what is done if the module was installed and what if not.
Isn't moduleExists checking whether the module is installed instead whether it is present on the file system?
Also aren't there errors raised when Drupal tries to invoke cached method names of hook implementations in the removed module?
Comment #30
geaseThere seems to be no way of detecting if module was installed before in update hook, if its codebase is removed. DbUpdateController::handle() seems to take care of keeping the module list correct. And so the cleaning of core.extensions in this patch seems not needed. As well as uninstalling the extras module.
Implemented this, and changed a bit updating the field following core examples.
Comment #31
hchonovIf there wasn't then you wouldn't have to do this in your update:
Why not use it for a check whether the module was enabled?
Comment #32
geaseUpdated patch based on previous comment.
Comment #33
hchonovCould you please remove the unused code?
Also define the definitions only in the condition branch where they are used.
If the extras module wasn't installed then you need to provide the default value for the use implicit setting.
Comment #34
geaseSorry, previous patch was posted erroneously.
Now also loading config setting from defaults if simple_oauth_extras was not installed.
Comment #35
hchonovActually now thinking again about varbase there might be installations that have already installed the fields by themselves. Unfortunately we should account for that.
Comment #36
hchonovThe result is not a query and therefore the variable should be named properly.
Adjust the indentation level.
"Unless they have been added already by a custom update." We then need to account for this use case here.
Comment #37
e0ipsoThis is looking really close. Thank you to everyone for moving this forward!
Comment #38
sam711 CreditAttribution: sam711 as a volunteer commentedTrying to move this forward to address @hchonov comments.
For #36 3. if a different module took care of it I'd just do nothing, but not sure if that's the best approach.
Also, accounting for the case where simple_oauth_extras is installed but not the field storage definitions.
Comment #39
sam711 CreditAttribution: sam711 as a volunteer commentedComment #40
capysara CreditAttribution: capysara at Bounteous commentedI don't have a complicated setup, so I haven't done extensive testing. When I updated from 3.15 to 4.4, I hit the missing module warning. The patch applies cleanly, gets rid of the warning, and nothing broke.
Comment #41
ejanus CreditAttribution: ejanus as a volunteer commentedD8.8.4
Lightning 4.1.3
BLT 10.7.2
simple_oauth was, apparently supposed to update to 8.x-4.4 (see: https://www.drupal.org/project/lightning/releases/8.x-4.103). However, it never did with the last lightning update from 4.1.2 to 4.1.3. I didn't get any error alluding to this and, it's already on our production env with the older oauth version still.
NP, right? I just run composer require acquia/lightning:~4.1.3 and all is well?
No, I get this output and have been lost in wonderland for a 2 days now trying to upgrade the module:
I've received some help, but nothing gives way to a solution. I'm really lost. I'm probably considered OK on composer but, by all means, I look almost everything up still outside of basic commands.
I've tried the patch here. I applied it manually since, adding it to the patches in composer.json fails.
How can I get this module trued up with its latest release?
Comment #42
ejanus CreditAttribution: ejanus as a volunteer commentedMy solution was:
- removing the line from my composer.json require section: "drupal/simple_oauth":"^3.3"
running:
I use BLT and after the successful updates above, my drush failed because it continued to think there is an extras module not present.
fix:
Created a /modules/contrib/simple_oauth/simple_oauth_extras/simple_oauth_extras.info.yml file placeholder (local env only) with the following:
I did not commit the .info.yml file up.
Hope this helps!
All credit goes to phenaproxima. Thanks so much!!
Comment #43
japerryWhile this is looking better, we really need to include a deprecicated shell module to keep errors from occuring when trying to update.
See #2429191: Deprecate entity_reference.module and move its functionality to core on how Core did it.
Specifically, a hidden info.yml was added. So my proposal wraps #38 and an info.yml so upgrading doesn't error out.
Comment #44
lcontreras CreditAttribution: lcontreras commentedI didn't have any issue when running the updates and Authorization Code Grant seems to be working properly. I've attached screenshots.
Comment #45
TipiT CreditAttribution: TipiT as a volunteer and at TIP Solutions commentedI successfully updated the module from 3 to 4 using @japerry's patch from #43 and it seems to work fine - including config export and import! Now it's been in production a couple of days so thank very you much.
The only minor question I have is about the contrib/simple_oauth/simple_oauth_extras/simple_oauth_extras.info.yml file, which is just going to stay there I guess. I mean, it would be nice to get rid of the patch at some point or if this is merged to the module, can the next update hook remove it? From my understanding, it does no harm there, but it would be nice to get rid of it. :)
Comment #46
sam711 CreditAttribution: sam711 as a volunteer commentedI don't think you should remove the file with an update hook as it can be restored in a following deployment.
I understand it will be removed on the next major version of the module.
Comment #47
japerryYup, similar to how core handled the entity_reference module, this module will need to retain that blank module for probably quite a while. Even though Drupal 8 deprecated and moved all the functionality of the entity_reference module out, it looks like the stub will remain for Drupal 9.
Why? because folks upgrading from D7 to D9 would break. This is the same problem if someone tried to update from simple_oauth 3.x to 5.x someday. Most likely, you'll just have to give it some time (years) and then eventually remove the code. Luckily it doesn't do much harm staying around.
Based on the comments above, marking this RTBC.
Comment #48
TipiT CreditAttribution: TipiT as a volunteer and at TIP Solutions commentedYes, "does not do much harm staying around." is the answer I was waiting for. The legacy file just might one seem weird to someone who sees the code first time or until it does some harm. But I guess our brilliant module maintainers us save from that. :)
But upgrade path is there! Thank you guys!
Comment #50
e0ipsoThis is a great patch! Thanks for all the effort everyone put into this. I do not have the time to test this myself these days, but I trust the RTBC reports.
As usual, since this was a strenuous issue, I have granted additional credit to appreciate your dedication.