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.
Fatal error: Call to undefined function field_info_field() in /var/aegir/platforms/drupal-7.0/sites/all/modules/media_gallery/media_gallery.install on line 125
Comment | File | Size | Author |
---|---|---|---|
#6 | media-gallery-profile-1087346-6.patch | 1.3 KB | David_Rothstein |
#4 | media_test.zip | 1.6 MB | Austin808 |
#1 | drush_site-install_fails-1087346-1.patch | 3.45 KB | Thomas Bosviel |
Comments
Comment #1
Thomas Bosviel CreditAttribution: Thomas Bosviel commentedThe function
field_info_field()
can be used inhook_requirements()
only during the runtime phase (http://api.drupal.org/api/drupal/developer--hooks--install.php/function/...).I found an other issue with drush site-install:
This error occurs because the install file creates a menu link but menu module isn't in dependencies.
Comment #2
Tor Arne Thune CreditAttribution: Tor Arne Thune commentedI can confirm that this patch avoids the error on drush site-install explained in the original post, but later on when my install profile tries to create the tags field (I suspect) this error occurs:
Comment #3
David_Rothstein CreditAttribution: David_Rothstein commentedI am unable to reproduce any of these errors myself. Can someone post (or link to) an example of an install profile which causes these errors to occur?
The patch itself looks a bit suspicious to me because if anything I would think we wanted the opposite (having it not run on $phase 'runtime')? It needs to run during $phase 'install' to prevent the module from being installed at all in the case where there are fields that conflict with the ones it needs.
Also, regarding this:
Which part of the install file do you think requires the Menu module? The only menu-related part I see is that it calls menu_link_save(); however, that function is part of the menu system (i.e., lives in includes/menu.inc), not the Menu module, and the menu system does not require that the Menu module be installed in order to work correctly.
Thanks for looking into this!
Comment #4
Austin808 CreditAttribution: Austin808 commentedI was able to test that this fails with the following install profile. I was able to install using the patch, but I also feel that this is not correct because now it will not block installs that have field conflicts.
Once you get past the requirements it fails with the menu error if the dependency is not included. When the dependency is included the install works properly.
I don't really know what all this means, but I hope this install profile can help people cause I need to have this module install in my install profile.
Thanks.
Comment #5
ao2 CreditAttribution: ao2 commentedAbout the message @V1 is getting in #2, I too got it in another situation, and it turned out it was because I was calling
standard_install()
frommyprofile_install()
, this was my scenario:standard_install()
called frommyprofile_install()
tried to create the 'tags' vocabulary again and it failed with that message.A possible workaround is to call
minimal_install()
intead in the profile, or maybestandard_install()
could be fixed to check for the existence of the vocabulary before creating it.I thought that
myprofile_install()
was called earlier in the installation process, while it looks like it is called after the profile dependancy have been installed already.Regards,
Antonio
Comment #6
David_Rothstein CreditAttribution: David_Rothstein commentedThanks for the example code and the analysis!
The attached patch should fix the "undefined function field_info_field" error (from the original post), as well as the "Syntax error or access violation" error from comment #1. The latter is sort of related to a core bug; see #1187906: Shortcut module cannot be installed via an install profile if the menu module wasn't installed first.
With this patch, I still get the error in #2 when using the above install profile, but that's a bug with the profile itself (it shouldn't try to create a vocabulary that it knows already exists). Once I removed that code from the profile, I was able to install Drupal using that profile either with Drush or via the UI.
I think this patch also might fix #1207274: No item created in menu.
I'll probably commit this soon since we want to get a new beta release out and I'm pretty confident it's right, but if anyone else wants to test and report back here, please do :)
Comment #7
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted: http://drupalcode.org/project/media_gallery.git/commit/d46178e