Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InstallationManager.php

function InstallationManager::update

Executes update operation.

@phpstan-return PromiseInterface<void|null>|null

Parameters

InstalledRepositoryInterface $repo repository in which to check:

UpdateOperation $operation operation instance:

File

vendor/composer/composer/src/Composer/Installer/InstallationManager.php, line 480

Class

InstallationManager
Package operation manager.

Namespace

Composer\Installer

Code

public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation) : ?PromiseInterface {
    $initial = $operation->getInitialPackage();
    $target = $operation->getTargetPackage();
    $initialType = $initial->getType();
    $targetType = $target->getType();
    if ($initialType === $targetType) {
        $installer = $this->getInstaller($initialType);
        $promise = $installer->update($repo, $initial, $target);
        $this->markForNotification($target);
    }
    else {
        $promise = $this->getInstaller($initialType)
            ->uninstall($repo, $initial);
        if (!$promise instanceof PromiseInterface) {
            $promise = \React\Promise\resolve(null);
        }
        $installer = $this->getInstaller($targetType);
        $promise = $promise->then(static function () use ($installer, $repo, $target) : PromiseInterface {
            $promise = $installer->install($repo, $target);
            if ($promise instanceof PromiseInterface) {
                return $promise;
            }
            return \React\Promise\resolve(null);
        });
    }
    return $promise;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal