Chris@0: processInfoList(), so look there for Chris@0: * examples of how to populate the array with real values. Chris@0: * Chris@0: * @see \Drupal\Update\UpdateManager::getProjects() Chris@0: * @see \Drupal\Core\Utility\ProjectInfo::processInfoList() Chris@0: */ Chris@0: function hook_update_projects_alter(&$projects) { Chris@0: // Hide a site-specific module from the list. Chris@0: unset($projects['site_specific_module']); Chris@0: Chris@0: // Add a disabled module to the list. Chris@0: // The key for the array should be the machine-readable project "short name". Chris@0: $projects['disabled_project_name'] = [ Chris@0: // Machine-readable project short name (same as the array key above). Chris@0: 'name' => 'disabled_project_name', Chris@0: // Array of values from the main .info.yml file for this project. Chris@0: 'info' => [ Chris@0: 'name' => 'Some disabled module', Chris@0: 'description' => 'A module not enabled on the site that you want to see in the available updates report.', Chris@0: 'version' => '8.x-1.0', Chris@0: 'core' => '8.x', Chris@0: // The maximum file change time (the "ctime" returned by the filectime() Chris@0: // PHP method) for all of the .info.yml files included in this project. Chris@0: '_info_file_ctime' => 1243888165, Chris@0: ], Chris@0: // The date stamp when the project was released, if known. If the disabled Chris@0: // project was an officially packaged release from drupal.org, this will Chris@0: // be included in the .info.yml file as the 'datestamp' field. This only Chris@0: // really matters for development snapshot releases that are regenerated, Chris@0: // so it can be left undefined or set to 0 in most cases. Chris@0: 'datestamp' => 1243888185, Chris@0: // Any modules (or themes) included in this project. Keyed by machine- Chris@0: // readable "short name", value is the human-readable project name printed Chris@0: // in the UI. Chris@0: 'includes' => [ Chris@0: 'disabled_project' => 'Disabled module', Chris@0: 'disabled_project_helper' => 'Disabled module helper module', Chris@0: 'disabled_project_foo' => 'Disabled module foo add-on module', Chris@0: ], Chris@0: // Does this project contain a 'module', 'theme', 'disabled-module', or Chris@0: // 'disabled-theme'? Chris@0: 'project_type' => 'disabled-module', Chris@0: ]; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Alter the information about available updates for projects. Chris@0: * Chris@0: * @param $projects Chris@0: * Reference to an array of information about available updates to each Chris@0: * project installed on the system. Chris@0: * Chris@0: * @see update_calculate_project_data() Chris@0: */ Chris@0: function hook_update_status_alter(&$projects) { Chris@0: $settings = \Drupal::config('update_advanced.settings')->get('projects'); Chris@0: foreach ($projects as $project => $project_info) { Chris@0: if (isset($settings[$project]) && isset($settings[$project]['check']) && Chris@0: ($settings[$project]['check'] == 'never' || Chris@0: (isset($project_info['recommended']) && Chris@0: $settings[$project]['check'] === $project_info['recommended']))) { Chris@0: $projects[$project]['status'] = UPDATE_NOT_CHECKED; Chris@0: $projects[$project]['reason'] = t('Ignored from settings'); Chris@0: if (!empty($settings[$project]['notes'])) { Chris@0: $projects[$project]['extra'][] = [ Chris@0: 'class' => ['admin-note'], Chris@0: 'label' => t('Administrator note'), Chris@0: 'data' => $settings[$project]['notes'], Chris@0: ]; Chris@0: } Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Verify an archive after it has been downloaded and extracted. Chris@0: * Chris@0: * @param string $project Chris@0: * The short name of the project that has been downloaded. Chris@0: * @param string $archive_file Chris@0: * The filename of the unextracted archive. Chris@0: * @param string $directory Chris@0: * The directory that the archive was extracted into. Chris@0: * Chris@0: * @return Chris@0: * If there are any problems, return an array of error messages. If there are Chris@0: * no problems, return an empty array. Chris@0: * Chris@0: * @see update_manager_archive_verify() Chris@0: * @ingroup update_manager_file Chris@0: */ Chris@0: function hook_verify_update_archive($project, $archive_file, $directory) { Chris@0: $errors = []; Chris@0: if (!file_exists($directory)) { Chris@0: $errors[] = t('The %directory does not exist.', ['%directory' => $directory]); Chris@0: } Chris@0: // Add other checks on the archive integrity here. Chris@0: return $errors; Chris@0: } Chris@0: Chris@0: /** Chris@0: * @} End of "addtogroup hooks". Chris@0: */