Skip to content

Commit f82883c

Browse files
mondrakeenzolutions
authored andcommitted
[module:install] Remove moduleRequirement() (#4178)
* Update services.yml * Fix Travis tests * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * 1 * Ensure $roles is an array when creating users. (#4134) This prevents an error from being thrown when constructing the success message. See #4133. * Generate revisional entity content is broken (#4139) * Add bundle permissions for content entity (#4138) * Add command option has-bundle-permissions and use on entity. * Add (Entity}Permissions.php file. * Add permission_callback to permissions.yml file. * Added fix from #4139 as it hurts. * Add own permissions checks. * Add --default option to database:add (#4143) This option allows to set the database as the default one instead of adding a new database in addition to the default one. See: #4142 * Update version to 1.9.3 (#4144) * Update version to 1.9.3 * Remove Module/InstallCommand::moduleRequirement * Remove
1 parent 9af887a commit f82883c

File tree

1 file changed

+0
-86
lines changed

1 file changed

+0
-86
lines changed

src/Command/Module/InstallCommand.php

-86
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
148148

149149
$this->site->loadLegacyFile('/core/includes/bootstrap.inc');
150150

151-
// Check module's requirements, only for Drupal below 8.7.7. From there
152-
// on, we just use Drupal's API.
153-
if (version_compare(\Drupal::VERSION, '8.7.7') < 0) {
154-
$this->moduleRequirement($module);
155-
}
156-
157151
// When --composer is specified, build a command to Composer require
158152
// all the needed modules in one go. This will just download the
159153
// modules from the composer endpoint, not do any 'installation', in
@@ -274,84 +268,4 @@ protected function execute(InputInterface $input, OutputInterface $output)
274268
$this->site->removeCachedServicesFile();
275269
$this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
276270
}
277-
278-
/**
279-
* Verify that install requirements for a list of modules are met.
280-
*
281-
* @param string[] $module
282-
* List of modules to verify.
283-
*
284-
* @throws \Exception
285-
* When one or more requirements are not met.
286-
*/
287-
public function moduleRequirement(array $module)
288-
{
289-
$modules_data = system_rebuild_module_data();
290-
291-
// for unmet requirements recursively.
292-
$fail = false;
293-
foreach ($module as $module_name) {
294-
module_load_install($module_name);
295-
if ($requirements = \Drupal::moduleHandler()->invoke($module_name, 'requirements', ['install'])) {
296-
foreach ($requirements as $requirement) {
297-
if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
298-
$this->getIo()->errorLite("Module '{$module_name}' cannot be installed: {$requirement['title']} | {$requirement['value']}");
299-
$this->getIo()->newLine();
300-
$fail = true;
301-
}
302-
}
303-
}
304-
305-
$module_data = $modules_data[$module_name];
306-
307-
// Check the core compatibility.
308-
if ($module_data->info['core'] != \Drupal::CORE_COMPATIBILITY) {
309-
$versionCore = \Drupal::CORE_COMPATIBILITY;
310-
$this->getIo()->errorLite("This version is not compatible with Drupal {$versionCore} and should be replaced.");
311-
$this->getIo()->newLine();
312-
}
313-
314-
// Ensure this module is compatible with the currently installed version of PHP.
315-
if (version_compare(phpversion(), $module_data->info['php']) < 0) {
316-
$required = $module_data->info['php'] . (substr_count($module_data->info['php'], '.') < 2 ? '.*' : '');
317-
$phpversion = phpversion();
318-
$this->getIo()->errorLite("This module requires PHP version {$required} and is incompatible with PHP version {$phpversion}.");
319-
$this->getIo()->newLine();
320-
$fail = true;
321-
}
322-
323-
// If this module requires other modules, add them to the array.
324-
foreach ($module_data->requires as $dependency => $version) {
325-
// dependency exist.
326-
if (!isset($modules_data[$dependency])) {
327-
$dependencyName = ucfirst($dependency);
328-
$this->getIo()->errorLite("{$dependencyName} missing.");
329-
$this->getIo()->newLine();
330-
$fail = true;
331-
}
332-
333-
elseif (empty($modules_data[$dependency]->hidden)) {
334-
$name = $modules_data[$dependency]->info['name'];
335-
// dependency's version.
336-
if ($incompatible_version = drupal_check_incompatibility($version, str_replace(\Drupal::CORE_COMPATIBILITY . '-', '', $modules_data[$dependency]->info['version']))) {
337-
$dependencyName = $name . $incompatible_version;
338-
$dependencyVersion = $modules_data[$dependency]->info['version'];
339-
$this->getIo()->errorLite("{$dependencyName} incompatible with version {$dependencyVersion}.");
340-
$this->getIo()->newLine();
341-
$fail = true;
342-
}
343-
344-
// version of Drupal core.
345-
elseif ($modules_data[$dependency]->info['core'] != \Drupal::CORE_COMPATIBILITY) {
346-
$this->getIo()->errorLite("{$name} incompatible with this version of Drupal core.");
347-
$this->getIo()->newLine();
348-
$fail = true;
349-
}
350-
}
351-
}
352-
}
353-
if ($fail) {
354-
throw new \Exception('Some module install requirements are not met.');
355-
}
356-
}
357271
}

0 commit comments

Comments
 (0)