Modified Drupal Core
Considerations when using modified versions of Drupal that have altered files in core.
What is modified Drupal core?
When a version of Drupal has been altered from the original open source version, there are often changes to core files which may make it difficult to do the normal drop-in replacement of the HeroDevs Drupal NES.
These versions are often found as install profiles, custom forks, or altered versions that hosting providers use to include their own code to make it easier to integrate with their systems.
Please note HeroDevs provides the Subscription Services for the HeroDevs drop-in replacement version of Drupal 7. For more information see the Subscription Agreement.
Always back up your project before installing Drupal NES.
Patching requires that your codebase uses version control like git.
Git Based Install
Create an orphan branch to unzip Drupal NES
Download the HeroDevs Drupal NES
Follow the download instructions found on the installation page to download Drupal NES.
Remove the modified version of Drupal from the docroot folder
Ensure that you are on the nes-drupal
branch before continuing.
Delete the contents of the folder where your version of Drupal lives. In some cases this may be the root folder of your codebase, however in many cases it will be at /web
or /docroot
. This folder will contain index.php
and install.php
in addition to other files.
Assuming your installation lives at /web
, from your project root, run
Do not run this command if your project root is the same as your docroot. It will remove your .git folder.
If your project root is the same as your docroot, delete all files and folders EXCEPT .git
Unzip Drupal NES into the Drupal folder
From your project root, where the zip file should live, run
Commit the unzipped files to your branch
Merge your main branch into NES branch
At this point, you are ready to merge in the modified Drupal into Drupal NES so that any changes to core are kept after upgrading to HeroDevs Drupal NES. Because this is an orphan branch, it does not share history with your main branch so you will need to add the --allow-unrelated-histories
flag in order for the merge to work.
It is not uncommon to have merge errors at this point. Common files with merge errors will be CHANGELOG.txt
and bootstrap.inc
, however, there may be more depending on how modified your version of Drupal is. You will need to manually fix any merge errors and keep changes from either the main branch, nes-drupal branch, or both.
While resolving merge conflicts, compare the conflicting changes between the modified and NES versions of Drupal 7. Retain custom modifications that are essential for the modified install profile and not present in the NES version. Accept changes from the NES version if they provide necessary updates or fixes. If both sets of changes are needed, merge them carefully. It is recommended to document each decision made during this process for future reference.
Once merge errors are fixed, add the files to the commit.
Then commit the result
Create a patchfile of the changes to apply over modified core
Generally, it is not recommended to directly change core. For this reason, creating a patch to be applied over the modified version.
First, review the differences between the main branch and the Drupal NES branch.
After verifying your changes, create the patch.
This file can be kept in version control as a reference of changes to core files that have been made. It is recommended that you keep patch files together in a /patches
folder in the top level folder of your project.
Create a new branch off of main and test the patch
Checkout your main branch
And branch off of the main branch for testing.
Try to apply the patch.
or if using patch
Clear cache and test your site's functionality
Clear caches with
Verify your site is working locally or in a development environment before committing and releasing to production.
Once site functionality is verified, commit the patch and changed files to version control.
At this point you should have a working Drupal 7 site with modified core files and the protection of HeroDevs Drupal NES.
If you require further assistance, reach out to sales@herodevs.com.