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...

  • .module files are automatically loaded into memory even without a files[] line on every request
  • .install files are automatically loaded into memory even without a files[] line when enabling, disabling, installing, and uninstalling a module, when running updates, and on the status report (for hook_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.

CommentFileSizeAuthor
#1 2309021-remove-file-entries.patch722 bytessolotandem

Comments

solotandem’s picture

Status: Active » Needs review
StatusFileSize
new722 bytes

Attached patch implements proposed resolution.

mparker17’s picture

Issue summary: View changes

Updating issue summary.

mparker17’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #1 is clear, conforms to coding standards, does what I expect, applies cleanly, and works. RTBC.

mparker17’s picture

Title: Remove file entries from info file » Remove unneeded file[] entries from .info file

eugene.ilyin’s picture

Thank you guys. Committed.

eugene.ilyin’s picture

Status: Reviewed & tested by the community » Fixed
eugene.ilyin’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.