Problem/Motivation
The info file contains:
files[] = jreject.admin.inc
files[] = jreject.install
files[] = jreject.module
These lines should not be in the file per Drupal API standards. The info file is only to include files containing a class or interface definition.
According to the documentation on module .info files:
- files (Optional)
- Drupal supports a dynamic-loading code registry. [...] When a module is enabled, Drupal will rescan all declared files and index all the classes and interfaces that it finds. Classes will be loaded automatically by PHP when they are first accessed.
... in other words, you only need to add a files[] line for a file that contains a class or function you want available from other parts of code without explicitly module_load_include()-ing it. Every unneeded files[] line increases Drupal's memory consumption and the time needed to execute a request.
Furthermore...
.modulefiles are automatically loaded into memory even without afiles[]line on every request.installfiles are automatically loaded into memory even without afiles[]line when enabling, disabling, installing, and uninstalling a module, when running updates, and on the status report (forhook_requirements())- If you refer to a file in
hook_menu(), it will be automatically loaded into memory also. From the documentation:
"file": A file that will be included before the page callback is called; this allows page callback functions to be in separate files. The file should be relative to the implementing module's directory unless otherwise specified by the "file path" option. Does not apply to other callbacks (only page callback).
Proposed resolution
Delete the three lines.
Remaining tasks
None.
User interface changes
None.
API changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 2309021-remove-file-entries.patch | 722 bytes | solotandem |
Comments
Comment #1
solotandem commentedAttached patch implements proposed resolution.
Comment #2
mparker17Updating issue summary.
Comment #3
mparker17The patch in #1 is clear, conforms to coding standards, does what I expect, applies cleanly, and works. RTBC.
Comment #4
mparker17Comment #6
eugene.ilyin commentedThank you guys. Committed.
Comment #7
eugene.ilyin commentedComment #8
eugene.ilyin commented