Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've added less module to my install profile, which then fails because of hook_requirements():
if (module_exists('libraries')) { // nope, it doesn't yet
if ($lessphp_path = libraries_get_path('lessphp')) { // won't work even if it did -- there is no drupal_get_path() data available
if (file_exists($lessphp_path .'/lessc.inc.php')) {
$lessphp_include = $lessphp_path .'/lessc.inc.php';
}
}
}
Issues on other modules with the same problem:
- #1283468: Install profile requirements trigger error
- #1027600: call to drupal_get_path() in hook_requirements() fails during install profile
However, in those cases they're trying to locate something inside the module's own directory so they can resort to fiddling with __FILE__. I'm not sure what kind of workarounds are possible here.
Comments
Comment #1
joachim CreditAttribution: joachim commentedFor anyone else with this problem, the workaround in an install profile is to remove 'less' from hook_profile_modules() and instead put this at the end of hook_profile_tasks():
Comment #2
corey.aufang CreditAttribution: corey.aufang commentedNice solution.
I'm going to make a quick change to the title for now and make a change to the documentation soon. Til that is done, I'm going to leave the issue open so its easily visible.
Comment #3
pirog CreditAttribution: pirog commentedlooks like this is no longer an issue in the latest dev
Comment #4
corey.aufang CreditAttribution: corey.aufang commentedThis was changed some time ago to only be a runtime requirement, but it looks like it never made it into a 6.x release.
There will not be a new release for 6.x.
It is still a runtime only check in 7.x.