Problem/Motivation

Currently we have the sub-module package_manager which a thin wrapper around the composer_stager php library.
Eventually the project_browser will probably also use package_manager(when it is core directly) to install it's modules

There are several reason why instead of just wrapping composer_stager package_manager should also handle some drupal specific task

  1. sites should be prevented from updating core and installing a new module at the same time
  2. classes like \Drupal\automatic_updates\Validation\ValidationResult may make sense to be shared
  3. firing events before different stages might be shared functionality
  4. path exclusion. excluded public and private file folders and certain settings files will be the same in both cases.

Proposed resolution

Move common functionality that is not specific to updating Drupal core

For instance ComposerExecutableValidator may make sense to be in `package_manager`

\Drupal\automatic_updates\Updater make need to extend ComposerRunner in package manager.

On way we could do this is to have a test module that installs new Drupal modules so that we would have use case for both an installer and an updater. We could remove this test module when `project_browser` starts to have this functionality.

API changes

Probably a lot.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tedbow created an issue. See original summary.

phenaproxima made their first commit to this issue’s fork.

tedbow’s picture

Issue summary: View changes
tedbow’s picture

Issue summary: View changes
tedbow’s picture

Assuming we will want the Updater inject a StagedComposer service and the StagedComposer would responsible for firing events we might want some way for modules to identify their own events.

For instance our UpdateVersionValidator should only respond to our own uses of StagedComposer

one idea would be when the Updater calls StagedComposer::begin() that it would have to send a operation name or just it's module name.

So something like

StagedComposer::begin(['drupal' => 9.8.1], 'automatic_updates')
and then have UpdateEvent::getModule() or UpdateEvent::getOperationName()

so then our UpdateVersionValidator could have

if ($event->getOperationName() !== 'automatic_updates') {
  return;
}

that way each module only validates events for it's own operations.

I like getOperationName() better than getModule() because some modules may want to multiple different types of operations

tedbow’s picture

Title: Move more functionality into package_manager sub-module to enable project_browser use case » [Plan] Move more functionality into package_manager sub-module to enable project_browser use case
tedbow’s picture

Issue tags: +8.x-2.0-alpha1 blocker
tedbow’s picture

Status: Active » Fixed

🎉

Status: Fixed » Closed (fixed)

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