5

I foolishly created a features module and named it events. This is bad because, of course, there is a registered module with that same name. So the update status report is always in error and drush has to lock the module so it doesn't attempt to "update" it.

I would rather not uninstall, recreate, reinstall because I will have to recreate content (yes, I have backup/restore installed).

Is it possible (advisable) to rename the directory and files, edit the .info, and edit the record in system?

     ericx ** drupal_addicted ** Wed Sep  3 15:26:29 2014
     sql> select * from system where name='events'\G
    *************************** 1. row ***************************
          filename: sites/dev.addictedtoagility.com/modules/custom/events/events.module
              name: events
              type: module
             owner: 
            status: 1
         bootstrap: 0
    schema_version: 0
            weight: 0
              info: a:11:{s:4:"name";s:6:"Events";s:11:"description";s:49:"Adds the Events content type and supporting stuff";s:4:"core";s:3:"7.x";s:7:"package";s:8:"addicted";s:7:"version";s:7:"7.x-0.1";s:7:"project";s:6:"events";s:12:"dependencies";a:8:{i:0;s:4:"date";i:1;s:11:"event_sites";i:2;s:8:"fe_block";i:3;s:4:"file";i:4;s:4:"list";i:5;s:14:"node_reference";i:6;s:9:"strongarm";i:7;s:5:"views";}s:8:"features";a:7:{s:6:"ctools";a:2:{i:0;s:21:"strongarm:strongarm:1";i:1;s:23:"views:views_default:3.0";}s:17:"fe_block_settings";a:1:{i:0;s:20:"views-events-block_1";}s:12:"features_api";a:1:{i:0;s:5:"api:1";}s:5:"field";a:5:{i:0;s:22:"node-event-field_dates";i:1;s:33:"node-event-field_event_event_site";i:2;s:22:"node-event-field_judge";i:3;s:24:"node-event-field_premium";i:4;s:27:"node-event-field_start_time";}s:4:"node";a:1:{i:0;s:5:"event";}s:8:"variable";a:14:{i:0;s:23:"comment_anonymous_event";i:1;s:26:"comment_default_mode_event";i:2;s:30:"comment_default_per_page_event";i:3;s:13:"comment_event";i:4;s:27:"comment_form_location_event";i:5;s:21:"comment_preview_event";i:6;s:27:"comment_subject_field_event";i:7;s:25:"date_format_month_and_day";i:8;s:33:"field_bundle_settings_node__event";i:9;s:18:"menu_options_event";i:10;s:17:"menu_parent_event";i:11;s:18:"node_options_event";i:12;s:18:"node_preview_event";i:13;s:20:"node_submitted_event";}s:10:"views_view";a:1:{i:0;s:6:"events";}}s:3:"php";s:5:"5.2.4";s:5:"files";a:0:{}s:9:"bootstrap";i:0;}

1 row in set (0.00 sec)

  • 1
    sure it's possible so long as like variable names aren't using the module name directly. Unfortunately I'm saying you either know all the places you're module name is being used and where to alter it appropriately. Unfortunately, I'm also saying only you would be the one to have that knowledge ... there is nothing wrong with the approach you've outlined though. – tenken Sep 3 '14 at 20:18
2

Renaming a Drupal feature requires additional steps than rename a custom module.

Solution 1 (without un/install)

  1. Backup the DB.
  2. Put the site on maintenance mode.
  3. Rename the feature with an IDE or bash script (don't access/edit any content of the site while you are doing this).
  4. Run:

    • drush php-eval 'registry_rebuild();'
    • drush updb -n. (forces drupal to reload caches related to module/features)
    • drush cc all

Solution 2 (more proved but requires un/install)

  1. Backup the DB.
  2. Follow the steps to rename the feature on this thread.

To replace the new name (the human and the machine name) on each file, I suggest you to use an IDE like NetBeans (or similar).

You can also use cool unix commands like sed and find to do it.

Try to make a code review after the changes to make sure that the rename was done on the right places.

Note: to make sure that the name I choose for a module/feature is not already used, I use the following command:

drush pm-list --type=Module --no-core --status=enabled --pipe | sort
  • ... he said he didn't want to uninstall the module ... – tenken Sep 3 '14 at 20:26
  • Thanks, I added another way without uninstall the module. – gerzenstl Sep 3 '14 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.