Linux Sysadmin Blog

Making Changes to Drupal Core

- | Comments

Although we made it a standard not to make any changes to Drupal core and core modules, there are times that our developers really need to make changes to core modules in order to add the required functionality. Cases like additional feature for ‘user’ or ‘comment’ modules and so on. At this state we can’t perform automatic update on our sites as we might overwrite the changes - so we need to do the update manually. Well, this is ok if you maintain one or two sites, but if you have more than 100 sites then it will take you some time.

What we did to eliminate this issue and be able to update the site automatically was to create a copy of the original core modules (located in /modules), add our custom functionality, and put the modified copy into ‘contributed’ modules directory (/sites/all/modules). Drupal read the modules found on /sites/all/modules first and ignore the same copy (original) found on /modules. Also, may want to change the module info or the package name to separate the modified modules from the original ones - ex: modified_core, custom, etc. In the case that Drupal reads both of them, you can just disable the other one.

Here’s our policy on working with Drupal modules: - contributed or community modules at /sites/all/modules - custom made modules at /sites/all/modules/custom - modified core modules at /sites/all/modules/core_modified

Hope this helps. :)