Drupal 6 - Mistakenly put drupal directory in sites/all/modules

By xngo on June 23, 2010

When updating drupal and other modules at the same time, I sometimes mistakenly put drupal-6.x folder in sites/all/modules folder. Later on, I discovered my mistake and naturally, my first reflex would be to delete the drupal-6.x folder. Consequently, my website crashed and I couldn't log in. However, if I put back the drupal-6.x folder, then it is working fine. Here is how I did to resolve my issue:

  1. Ran the following queries to remove all references to the drupal-6.x folder. Depending on the version of your drupal, change drupal-6.16 in the queries accordingly. SELECT file FROM menu_router WHERE file LIKE '%drupal-6.16%'; SELECT filename FROM system WHERE filename LIKE '%drupal-6.16%';

    UPDATE menu_router SET file=REPLACE(file, 'sites/all/modules/drupal-6.16/', '') WHERE file LIKE '%drupal-6.16%'; UPDATE system SET filename=REPLACE(filename, 'sites/all/modules/drupal-6.16/', '') WHERE filename LIKE '%drupal-6.16%';

  2. Delete drupal-6.x folder from sites/all/modules folder.
  3. Log back in to the website and go to Administer->Modules. Note: You will see a lot of errors messages. It is normal. It complains about the missing paths that point to the drupal-6.x folder.
  4. Click on Save Configuration button so that drupal rebuilds all the paths itself.

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.