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.
Hi,
I got the following error when moving this module to a subfolder in sites/all/modules, even after using Registry Rebuild. It might be preferable to use module_load_include() instead of require_once or include statements, as described here.
[17-Sep-2013 16:48:52 UTC] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '/path/to/drupal/sites/all/modules/media/file_entity/file_entity.file_api.inc' (include_path='.:/Applications/MAMP/bin/php/php5.3.14/lib/php') in /path/to/drupal/sites/all/modules/media/file_entity/file_entity.module on line 13
Comment | File | Size | Author |
---|---|---|---|
#3 | 2091255-3-media_module_load_include.patch | 1.66 KB | alberto56 |
#1 | 2091255-1-media_module_load_include.patch | 679 bytes | alberto56 |
Comments
Comment #1
alberto56 CreditAttribution: alberto56 commentedHere is a patch that does this.
Comment #2
alberto56 CreditAttribution: alberto56 commentedComment #3
alberto56 CreditAttribution: alberto56 commentedHere's another version with more calls changed from require_once to module_load_include.
Comment #4
osopolarThe patch works in may case after I had moved the module to a different place. But I don't think that it is the correct way to solve the issue, as the documentation for module_load_include() says:
Comment #5
alberto56 CreditAttribution: alberto56 commentedGood point. I am assuming we are loading external files because we don't want the media.module to be get too big. My approach normally is to use autoload classes, so we might have something like this...
That way we're achieving the same result, while Drupal, not the module, is dealing with file management.
Comment #6
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team