Coming from #1679594: node_requirements() breaks Drupal installer

Problem

The node module currently implements hook_requirements() in node.module.

Hook_requirements() documentation states:

Note that this hook, like all others dealing with installation and updates, must reside in a module_name.install file, or it will not properly abort the installation of the module if a critical requirement is missing.

Solution

Move node_requirements() from node.module to node.install.

Comments

bneil’s picture

Assigned: bneil » Unassigned
Status: Active » Needs review
StatusFileSize
new3.43 KB
bneil’s picture

Issue tags: +Needs backport to D7
kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, yay for living up to our documentation!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 49689cf and pushed to 8.x. Thanks!

bneil’s picture

Version: 8.x-dev » 7.x-dev
Assigned: Unassigned » bneil
Status: Fixed » Needs work
bneil’s picture

Assigned: bneil » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.26 KB

Here's a patch against 7.x. I don't believe $t = get_t() is necessary since this is a runtime phase requirement.

sivaji_ganesh_jojodae’s picture

Patch looks good to me. Able to apply without any issues. +1 for changing it to RTBC.

sivaji_ganesh_jojodae’s picture

Issue summary: View changes
Issue tags: +Novice
parthipanramesh’s picture

The latest patch works fine for me. Thanks! :)

parthipanramesh’s picture

Status: Needs review » Reviewed & tested by the community
David_Rothstein’s picture

Version: 7.x-dev » 8.x-dev
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs backport to D7

Since the Node module is required in Drupal 7 (and even if it isn't, node_requirements() has no install-time checks anyway) there is no practical benefit to moving it. And since it's (sort of theoretically) a public API function that someone could be calling, I think it's best to just leave this where it is in Drupal 7.

Status: Fixed » Closed (fixed)

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