Problem/Motivation

Currently, installation profiles cannot implement hook_requirements(). Well, technically, they can, but it's not invoked during an install - it is only invoked after an install during updates or visiting the status report. This can be problematic for distributions, which may want to specify requirements that transcend the scope of any one module or feature of the distribution.

Proposed resolution

drupal_check_profile(), which verifies the requirements of all modules listed by an install profile, should also verify the requirements of the profile itself.

Remaining tasks

User interface changes

None.

API changes

Installation profiles support hook_requirements().

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

alexpott’s picture

Category: Feature request » Bug report

Repeating a comment from a duplicate issue - #3005965: Allow installation profiles to have requirements.

One thing I ponder is a distribution requirements already checked during update.php - my bet is they are. Let's look...

/**
 * Checks update requirements and reports errors and (optionally) warnings.
 */
function update_check_requirements() {
  // Check requirements of all loaded modules.
  $requirements = \Drupal::moduleHandler()->invokeAll('requirements', ['update']);
  $requirements += update_system_schema_requirements();
  return $requirements;
}

Yep they are! So if an install profile implements this at the moment there is the chance that they'll be installable but not updatable :) nice. I think whilst install profiles are module (not the biggest fan fwiw) having differences like this introduces cognitive load that we shouldn't have. So +1 to implementing and testing and since we check them once everything is installed just not before that makes this a bug.

alexpott’s picture

Title: drupal_check_profile is missing profile requirements » drupal_check_profile() does not invoke the profile's hook_requirements()
Issue summary: View changes
Issue tags: +Needs tests

Borrowed issue summary from the duplicate issue.

alexpott’s picture

Crediting @phenaproxima who wrote the issue summary that I copied over here.

phenaproxima’s picture

Version: 8.6.x-dev » 8.7.x-dev

Targeting 8.7.x.

bendeguz.csirmaz’s picture

Rerolled the old patch.

bendeguz.csirmaz’s picture

Status: Active » Needs review
Issue tags: -Needs tests
FileSize
2.2 KB
2.65 KB

Added test.

The last submitted patch, 14: 2309731-14-testonly.patch, failed testing. View results

phenaproxima’s picture

I love it! Fail patch and everything. Makes perfect sense to me. Thanks, @bendeguz.csirmaz!

One suggestion I have, if possible, is not to have the test create a profile in the site directory. Instead, let's just add a new testing profile to core, called testing_requirements or something like that, and try to install it.

bendeguz.csirmaz’s picture

Okay, I created a testing profile for this - on one hand the code is cleaner, on the other hand the test is 3 files.

bendeguz.csirmaz’s picture

I realized the test probably should stay in the Drupal\FunctionalTests\Installer namespace.

The last submitted patch, 17: 2309731-17-testonly.patch, failed testing. View results

The last submitted patch, 18: 2309731-18-testonly.patch, failed testing. View results

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/profiles/testing_requirements/testing_requirements.install
@@ -0,0 +1,23 @@
+  if ('install' === $phase) {

Nitpick: I've never seen a Yoda condition in core, and I'm not sure the coding standards allow it. Can we make this $phase === 'install'?

Other than that, it's perfect. Please send this directly to RTBC once the nitpick is fixed.

phenaproxima’s picture

Status: Reviewed & tested by the community » Needs work

I meant to set that back to "Needs work".

bendeguz.csirmaz’s picture

Sure. Actually, I copied that part from Drupal\Tests\system\Functional\Module\HookRequirementsTest, so I think it's allowed.

The last submitted patch, 23: 2309731-23-testonly.patch, failed testing. View results

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

We could do with a change record for this one. http://drupal.org/list-changes/drupal

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs change record
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 04a706f63d to 8.7.x and c70cc7ee40 to 8.6.x. Thanks!

Since this is a bugfix backported to 8.6.x - see #8 for why this is a bugfix.

  • alexpott committed 04a706f on 8.7.x
    Issue #2309731 by bendeguz.csirmaz, phenaproxima, alexpott:...

  • alexpott committed c70cc7e on 8.6.x
    Issue #2309731 by bendeguz.csirmaz, phenaproxima, alexpott:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.