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.
When you add url_alter to an installation profile the hook_requirements implementation fails:
( ! ) Fatal error: Call to undefined function db_result() in /path/to/site/includes/path.inc on line 55
Call Stack
# Time Memory Function Location
1 0.0050 383040 {main}( ) ../install.php:0
2 0.0075 560144 install_main( ) ../install.php:1174
3 0.1351 5501956 install_check_requirements( $profile = 'small_site', $verify = FALSE ) ../install.php:109
4 0.1363 5504684 drupal_check_profile( $profile = 'small_site' ) ../install.php:914
5 51.1490 9598328 module_invoke( 'url_alter', 'requirements', 'install' ) ../install.inc:692
6 51.1490 9599092 call_user_func_array ( 'url_alter_requirements', array (2 => 'install') ) ../module.inc:462
7 51.1491 9599220 url_alter_requirements( $phase = 'install' ) ../module.inc:0
8 51.1499 9602768 url( $path = 'admin/settings/url-alter', $options = ??? ) ../url_alter.install:44
9 51.1500 9606000 drupal_get_path_alias( $path = 'admin/settings/url-alter', $path_language = '' ) ../common.inc:1715
10 51.1500 9606120 drupal_lookup_path( $action = 'alias', $path = 'admin/settings/url-alter', $path_language = '' ) ../path.inc:111
Comment | File | Size | Author |
---|---|---|---|
#20 | skip_install_profile-775478-20.patch | 2.71 KB | Anonymous (not verified) |
#19 | skip_install_profile-775478-19.patch | 1.61 KB | Anonymous (not verified) |
#18 | skip_install_profile-775478-18.patch | 2.68 KB | Anonymous (not verified) |
#17 | skip_install_profile-775478-17.patch | 2.69 KB | Anonymous (not verified) |
#10 | url_alter-n775478-10.patch | 2.92 KB | erikwebb |
Comments
Comment #1
DamienMcKennaHere's a patch against the latest DRUPAL-6--1 that uses base_path() . 'admin/settings/url-alter' during the site installation because the url() function doesn't work yet.
Comment #2
DamienMcKennaHere's another patch that works better with the code in the current DRUPAL-6--1 branch, specifically if the site is running an installation profile it does a simple estimate as to whether the custom_url_rewrite_inbound() and custom_url_rewrite_outbound() functions will work without loading the main module file itself.
Comment #3
jaydub CreditAttribution: jaydub commentedI tested this patch and it fixes the problem of the error on install via install profile. Probably could use another set of eyes but for now I'll mark as reviewed and tested.
Comment #4
jaydub CreditAttribution: jaydub commentedThis part of the patch seems to be problematic:
- drupal_load('module', 'url_alter');
+ // Don't load try to load the module during installation.
+ if (!defined('MAINTENANCE_MODE') && constant('MAINTENANCE_MODE') != 'install') {
+ drupal_load('module', 'url_alter');
+ }
+
After install via install profile (success!) the code above spits out an error when hook_requirements() gets invoked.
error was:
I presume that the problem is simply that the !defined('MAINTENANCE_MODE') should be defined('MAINTENANCE_MODE') as if the first is TRUE and then you invoke constant() you will get a PHP error.
Attached a patch of patch to flip the negation. Hopefully that results in intended behaviour.
Comment #5
Kars-T CreditAttribution: Kars-T commentedHi
we had the same problem while running a dupal_make script and needed the patch. I believe jaydub is correct that the if shouldn't be !.
Otherwise this patch fixed a WSOD on install.
I did a few changes to the patch:
Removed typo.
Changed to !== because the constant is a string and we should avoid uneccessary type checks.
Space after line end.
Changed == to === typed check.
Comments should have a . at the end.
Powered by Dreditor.
Comment #6
DamienMcKenna@jaydub, @Kars-T: Thanks for doing some cleanup on the patch, the last one in #5 works well. Is it kosher to mark it RTBC if I wrote the original patch?
Comment #7
Dave ReidCan we just make it easier and skip the requirements check if MAINTENANCE_MODE = install?
Comment #8
DamienMcKennaHow's about this? Strictly speaking I see the value of checking to see if the functions exist elsewhere, i.e. the patch from #5 above.
Comment #9
jaydub CreditAttribution: jaydub commentedThe patch in #8 resolves for me both the issue with enabling via install profile as well as an issue with regular install at /admin/build/modules after using patch in #4 (problem with url_alter_is_disabled() not being defined yes but used in hook_requirements which is called into play on install).
Comment #10
erikwebb CreditAttribution: erikwebb commentedPatch in #8 did not apply cleanly to 6.x-1.2. Re-rolled patch attached.
Comment #11
erikwebb CreditAttribution: erikwebb commentedComment #12
jhedstromPatch in #10 resolves the issue for me. Marking RTBC since it was a simple re-roll of #8. Also setting to major, as it really affects installation profiles.
Comment #13
Grayside CreditAttribution: Grayside commented#10 worked for me.
Comment #14
geaseYes,#10 solved the problem
Comment #15
hefox CreditAttribution: hefox commentedPatch needs to be applied to dev version or else causes fatal errors as url_alter_is_disabled doesn't exist in 1.2, but does in dev and patch uses it.
Comment #16
Grayside CreditAttribution: Grayside commented@hefox covered it.
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedHere is an attempt to port patch in #10 to dev branch.
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedOops. Missing }
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedPatch in #18 applies cleanly... but it doesn't seem to properly skip if running within an install profile. I'm posting a new patch that simply removes the requirements hook. This isn't a general purpose patch, it's for me personally in an install profile I control, so I don't need the requirements check.
Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedOk, what I ultimately settled on, was to disable the the requirements check if maintenance mode is set to install and if phase is set to install. This seems to make drush site-install happy.