The change to hook_requirements in 1.1 has broken install. Hook requirements runs on the Verify requirements step of the installer and the module attempts to call user_roles(), throwing an Exception with the following error:

The specified database connection is not defined: default

Hook_requirements needs to check the $phase in use and wrap code accordingly, so as to prevent this.

https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...

This was caused by this change: #1524292: Use hook_requirements instead of hook_enable

Comments

xtfer’s picture

Issue summary: View changes
mikebarkas’s picture

Status: Active » Needs review
StatusFileSize
new4.82 KB

I also had build failure.

I wrapped the code with a $phase runtime check as to not run during installation.

I also changed t() function to get_t() to improve future implementations of install requirements.

Attached patch.

bdone’s picture

manually tested #2 using 7.x-1.1 and the guardr profile. confirming that this gets installs working again. thanks @mikebarkas!

Rob C’s picture

Status: Needs review » Reviewed & tested by the community

Dito #2.

Let's update that status.

rooby’s picture

+1 for getting this one in.

  • Matt V. committed cc00d6e on 7.x-1.x authored by mikebarkas
    Issue #2483015 by mikebarkas: hook_requirements usage breaks installer
    
matt v.’s picture

Status: Reviewed & tested by the community » Fixed

Thanks mikebarkas! I've committed the patch.

Status: Fixed » Closed (fixed)

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

rutiolma’s picture

Version: 7.x-1.1 » 8.x-1.x-dev
StatusFileSize
new2.58 KB

This issue is also present on the 8.x version.
I'm attaching a patch to prevent this from running during the installation phase.