function hook_verify_update_archive

Same name in other branches
  1. 7.x modules/update/update.api.php \hook_verify_update_archive()
  2. 9 core/modules/update/update.api.php \hook_verify_update_archive()
  3. 8.9.x core/modules/update/update.api.php \hook_verify_update_archive()
  4. 10 core/modules/update/update.api.php \hook_verify_update_archive()

Verify an archive after it has been downloaded and extracted.

Parameters

string $project: The short name of the project that has been downloaded.

string $archive_file: The filename of the un-extracted archive.

string $directory: The directory that the archive was extracted into.

Return value

array If there are any problems, return an array of error messages. If there are no problems, return an empty array.

Deprecated

in drupal:11.2.0 and is removed from drupal:12.0.0. There is no replacement. Use composer to manage the code for your site.

See also

https://www.drupal.org/node/3512364

update_manager_archive_verify()

Related topics

1 invocation of hook_verify_update_archive()
UpdateManagerInstall::submitForm in core/modules/update/src/Form/UpdateManagerInstall.php
Form submission handler.

File

core/modules/update/update.api.php, line 128

Code

function hook_verify_update_archive($project, $archive_file, $directory) : array {
    $errors = [];
    if (!file_exists($directory)) {
        $errors[] = t('The %directory does not exist.', [
            '%directory' => $directory,
        ]);
    }
    // Add other checks on the archive integrity here.
    return $errors;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.