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

Breadcrumb

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

function DownloaderInterface::prepare

Do anything that needs to be done between all downloads have been completed and the actual operation is executed

All packages get first downloaded, then all together prepared, then all together installed/updated/uninstalled. Therefore for error recovery it is important to avoid failing during install/update/uninstall as much as possible, and risky things or user prompts should happen in the prepare step rather. In case of failure, cleanup() will be called so that changes can be undone as much as possible.

@phpstan-return PromiseInterface<void|null>

Parameters

string $type one of install/update/uninstall:

PackageInterface $package package instance:

string $path download path:

PackageInterface $prevPackage previous package instance in case of an update:

2 methods override DownloaderInterface::prepare()
FileDownloader::prepare in vendor/composer/composer/src/Composer/Downloader/FileDownloader.php
@inheritDoc
VcsDownloader::prepare in vendor/composer/composer/src/Composer/Downloader/VcsDownloader.php
@inheritDoc

File

vendor/composer/composer/src/Composer/Downloader/DownloaderInterface.php, line 55

Class

DownloaderInterface
Downloader interface.

Namespace

Composer\Downloader

Code

public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null) : PromiseInterface;

API Navigation

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