Need to change Simple OAuth from ~3.0 to ~4.0

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jedgar1mx created an issue. See original summary.

jedgar1mx’s picture

Rajab Natshah’s picture

Title: Unsupported module » Update [Simple OAuth] from ~3.0 to ~4.0

Rajab Natshah’s picture

Assigned: Unassigned » Mohammed J. Razem
Issue tags: +varbase-8.7.2

Committed ... Thank you Edgar :)

Rajab Natshah’s picture

Assigned: Mohammed J. Razem » Unassigned
Rajab Natshah’s picture

Status: Active » Needs review
Rajab Natshah’s picture

Status: Needs review » Fixed
Rajab Natshah’s picture

Status: Fixed » Active
Rajab Natshah’s picture

Simple OAuth Extras merged down into the main project

  • RajabNatshah committed 4f92426 on 8.x-6.x
    Issue #3079468: Removed the simple_oauth:simple_oauth_extras from...

  • RajabNatshah committed 8603959 on 8.x-7.x
    Issue #3079468: Removed the simple_oauth:simple_oauth_extras from...
Rajab Natshah’s picture

Removed the simple_oauth:simple_oauth_extras from dependencies
I find out that they do not have a hook update to switch off simple_oauth_extras and migrate configs start with simple_oauth_extras to simple_oauth

More testing on updates

The following module is missing from the file system: simple_oauth_extras bootstrap.inc:277
jedgar1mx’s picture

I removed the dependency from the info.yml but still saying that simple_oath_extras is required.🤔

Rajab Natshah’s picture

Thanks for helping and testing with me

I think you will need to do a

composer clear
rm composer.lock

then
composer update
Working well with a new install on the dev branch of varbase

I think we need optimize an update function to work in varbase_api or in the simple_oauth module
Testing updates with the following in the .install file


/**
 * Uninstall the Simple Oauth Extras module as it was merged into Simple Oauth.
 */
function varbase_api_update_8701() {

  // Get list of enabled modules.
  $core_extension_config_factory = \Drupal::service('config.factory')->getEditable('core.extension');
  $core_extension_data = $core_extension_config_factory->get();

  // If Simple Oauth Extra still enabled after the update to ~4.0 version.
  if (isset($core_extension_data['module']['simple_oauth_extras'])) {

    // Unset the module from the moudles array.
    unset($core_extension_data['module']['simple_oauth_extras']);

    // Save changes for modules.
    $core_extension_config_factory->setData($core_extension_data)->save(TRUE);
    
    $query = \Drupal::database()->delete('key_value')
        ->condition('collection', 'system.schema')
        ->condition('name', 'simple_oauth_extras')
        ->execute();

    $simple_oauth_extras_config_factory = \Drupal::configFactory()
      ->getEditable("simple_oauth_extras.settings");
    $simple_oauth_extras_settings = $simple_oauth_extras_config_factory->getData();

    if (isset($simple_oauth_extras_settings['use_implicit'])) {
      $simple_oauth_config_factory = \Drupal::configFactory()
        ->getEditable("simple_oauth.settings");

      $simple_oauth_settings = $simple_oauth_config_factory->getData();

      if (!isset($simple_oauth_settings['use_implicit'])) {
        $simple_oauth_config_factory->set('use_implicit', $simple_oauth_extras_settings['use_implicit'])->save();
      }

      $simple_oauth_extras_config_factory->delete();
    }

    // Entity updates to clear up any mismatched entity and/or field definitions
    // And Fix changes were detected in the entity type and field definitions.
    \Drupal::classResolver()
      ->getInstanceFromDefinition(VarbaseEntityDefinitionUpdateManager::class)
      ->applyUpdates();

  }
}

Still having issues on update with the code, it's not taking the affect I want yet.
I do think that this hook should be in the simple_oauth

jedgar1mx’s picture

It seems like the maintainers are not providing an upgrade path see issue #3078547

Rajab Natshah’s picture

Noted;
Thank you Edgar, we will have it upgrade in Varbase, then we report back to them

#3078547: Merge Simple OAuth Extras in Simple OAuth

Having the varbase_api_update_8701 hook from #16 with more testing

In Varbase we had #3051884: Switch to use [Varbase Entity Definition Update Manager] and remove deprecated \Drupal::entityDefinitionUpdateManager()->applyUpdates()

  // Entity updates to clear up any mismatched entity and/or field definitions
  // And Fix changes were detected in the entity type and field definitions.
  \Drupal::classResolver()
    ->getInstanceFromDefinition(VarbaseEntityDefinitionUpdateManager::class)
    ->applyUpdates();

Rajab Natshah’s picture

Seems that Simple Oauth 8.x-4.1 is out

Rajab Natshah’s picture

  • RajabNatshah committed 703fefa on 8.x-7.x
    Issue #3079468: Added a hook update to removed the simple_oauth_extras...
Rajab Natshah’s picture

Updated the varbase_api_update_8701 hook update to be able to update and not to keep showing the notice

    $query = \Drupal::database()->delete('key_value')
        ->condition('collection', 'system.schema')
        ->condition('name', 'simple_oauth_extras')
        ->execute();

and

    // Entity updates to clear up any mismatched entity and/or field definitions
    // And Fix changes were detected in the entity type and field definitions.
    \Drupal::classResolver()
      ->getInstanceFromDefinition(VarbaseEntityDefinitionUpdateManager::class)
      ->applyUpdates();
Rajab Natshah’s picture

Assigned: Unassigned » Mohammed J. Razem
Status: Active » Needs review
Rajab Natshah’s picture

Assigned: Mohammed J. Razem » Unassigned
Status: Needs review » Fixed
Rajab Natshah’s picture

We could suggest the update hook to the maintainers for Simple OAuth
I think they had no free time to bring the hook out, or they may have more info if their are more to do to have the complete hook update.
as we did in
#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

jedgar1mx’s picture

It does look like they are too busy to implement it, but you can always reach out 😄

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.