Created
July 3, 2016 07:10
-
-
Save kossoff/812c3ffd466e5a6e11739e7f583eaff5 to your computer and use it in GitHub Desktop.
How to move installed modules from /sites/all/modules/* to /sites/all/contrib/modules/*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I restored a backup from production locally and tried to just move things and hit admin/modules or to run registry_rebuild() but it didn't stop fatal errors from being thrown. This makes sense to me since some modules may use includes or whatever in their hook_init(), or you may have a menu router path set that depends on a module or include that Drupal can't find on bootstrap. Ultimately, this is what I did (your paths may be different): | |
Step 1: Replace sites/all/modules with sites/all/modules/contrib | |
UPDATE system SET filename = REPLACE(filename, 'sites/all/modules', 'sites/all/modules/contrib'); | |
UPDATE registry SET filename = REPLACE(filename, 'sites/all/modules', 'sites/all/modules/contrib'); | |
UPDATE registry_file SET filename = REPLACE(filename, 'sites/all/modules', 'sites/all/modules/contrib'); | |
Step 2: Replace sites/all/modules/contrib with sites/all/modules/custom for custom namespaced modules | |
UPDATE system SET filename = REPLACE(filename, 'sites/all/modules/contrib', 'sites/all/modules/custom') WHERE name LIKE 'my_custom_namespace_%'; | |
UPDATE registry SET filename = REPLACE(filename, 'sites/all/modules/contrib', 'sites/all/modules/custom') WHERE name LIKE 'my_custom_namespace_%'; | |
UPDATE registry_file SET filename = REPLACE(filename, 'sites/all/modules/contrib', 'sites/all/modules/custom') WHERE filename LIKE '%my_custom_namespace_%'; | |
Step 3: Move dev modules into sites/all/modules/dev | |
UPDATE system SET filename = REPLACE(filename, 'sites/all/modules/contrib', 'sites/all/modules/dev') WHERE name LIKE 'devel%'; | |
UPDATE registry SET filename = REPLACE(filename, 'sites/all/modules/contrib', 'sites/all/modules/dev') WHERE name LIKE 'devel%'; | |
UPDATE registry_file SET filename = REPLACE(filename, 'sites/all/modules/contrib', 'sites/all/modules/dev') WHERE filename LIKE '%devel%'; | |
Step 4: Clear caches so that things will bootstrap properly | |
TRUNCATE TABLE cache | |
TRUNCATE TABLE cache_bootstrap | |
TRUNCATE TABLE cache_menu | |
TRUNCATE TABLE cache_page | |
TRUNCATE TABLE cache_path | |
Note: If you use a custom module or a contrib like LoginToboggan to handle 403 (access denied) and you've gotten logged out during this process, you may need to update the include_file column in the menu_roter table to use the new path for the include file. This is probably a rare occurrence. | |
UPDATE menu_router SET include_file = 'sites/all/modules/custom/my_custom_namespace/includes/foo.inc' WHERE path = 'access-denied' | |
Once these queries have run – which will only take a split second – hit up admin/config/development/performance and clear the cache so that menu paths rebuild. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment