| Project: | Video Upload |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Issue Summary
PHP Fatal error: Call to undefined function video_upload_initialize_provider() in sites/all/modules/contrib/video_upload/video_upload.install on line 71
although it is defined in the following places, it is not recognized during install
grep -in "video_upload_init" *
video_upload.install:71: video_upload_initialize_provider();
video_upload.module:40:function video_upload_initialize_provider() {
video_upload.module:681: video_upload_initialize_provider();
video_upload.module:697: video_upload_initialize_provider();
video_upload.module:708: video_upload_initialize_provider();
video_upload.module~:40:function video_upload_initialize_provider() {
video_upload.module~:591: video_upload_initialize_provider();
video_upload.module~:607: video_upload_initialize_provider();
video_upload.module~:618: video_upload_initialize_provider();
video_upload.theme.inc:24: video_upload_initialize_provider();
video_upload.theme.inc:124: video_upload_initialize_provider();
video_upload_widget.inc:27: video_upload_initialize_provider();
Comments
#1
In the install hook, immediately prior to calling that function is this line:
<?phpinclude_once drupal_get_path('module', 'video_upload') . '/video_upload.module';
?>
so I'm not sure how this error is occuring.
#2
The problem occurs if the module is installed as part of an install profile.
This is because the system table doesn't yet exist, so drupal can't lookup module directories (e.g. drupal_load() or drupal_get_path()).
#3
I've ran into the same issue. As manarth pointed out, modules can't use drupal_get_path() in functions that are called during profile installation. That includes, but is not limited, to hook_requirements.
The attached patch is a first shot at making the module compatible for use in install profiles. Most places where it drops drupal_get_path are safe except for:
-include_once(drupal_get_path('module', 'content') .'/content.module');+include_once realpath(dirname(__FILE__)) . '/../cck/content.module';
which assumes that both video_upload and cck and are in the same modules directory. This should be true in most cases, but still not ideal...
#4
#5
Unfortunately, there's no way to assume that CCK is always in the same directory. Multisite installs commonly have modules in different directories. Acquia Drupal will also have CCK in a different directory.
#6
jquery_ui is dealing with a similar issue: http://drupal.org/node/325831
#7
As far as I can tell, the __FILE__ approach should work fine. My comment in #5 is only relevant if this line stays as is:
<?phpinclude_once(drupal_get_path('module', 'content') .'/content.module');
?>
I think it can safely be removed entirely, as the purpose is for checking during updates, and video_upload_install() already does this. If you reroll the patch in #3 to remove this, I'll try to get this in soon.
#8
Retitling.
#9
Here's an updated patch, as jhedstrom requested. Please test.
#10
This patch works for me.