This file contains hidden or 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
| <p>This is a post I'm digging up from an old blog of mine, but refreshed. I needed to remove the table prefix from an existing Drupal site. The site had tables in the form of <code>drup_TABLENAME</code> and needed to be in the standard Drupal format as <code>TABLENAME</code>. I wrote a quick php script which can be called from Drush.</p> | |
| <p>The script does not delete any existing tables unless needed, and but will drop a table by the same name (without the prefix) if it exists before trying to rename it. The database I was working in was pretty dirty and had a fresh install mixed amongst the prefixed tables.</p> | |
| <p>I've tested it and run the against the site using the following steps:</p> | |
| <ol> | |
| <li><p>Run the file with drush</p> | |
| <pre><code>drush php-script fix_prefix.php |
This file contains hidden or 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
| /var/www/cashwilliams/sites/default# drush fu cashwilliams_core | |
| Module appears to already exist in sites/all/modules/features/cashwilliams_core | |
| Do you really want to continue? (y/n): y | |
| Created module: cashwilliams_core in sites/all/modules/features/cashwilliams_core [ok] | |
| li117-19:/var/www/cashwilliams/sites/default# drush fl | |
| Name Feature Status State | |
| CashWilliams Core cashwilliams_core Enabled Overridden | |
| CashWilliams Blog cashwilliams_blog Enabled | |
| CashWilliams Twitter cashwilliams_twitter Enabled | |
| Date Migration Example date_migrate_example Disabled |
This file contains hidden or 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
| <?php | |
| // current table prefix to be removed | |
| $prefix = "drup_"; | |
| // echo generated statments rather then run them | |
| $pretend = FALSE; | |
| ///////////////////////////////////////////////////////////////////// | |
| $table_list = db_query("SHOW TABLES"); |
This file contains hidden or 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
| ... | |
| if(strstr(ini_get('sendmail_from'), 'dev')) { | |
| $config['datasources']['default']['hostname'] = 'localhost'; | |
| $config['datasources']['default']['username'] = 'root'; | |
| $config['datasources']['default']['password'] = 'root'; | |
| } else { | |
| $config['datasources']['default']['hostname'] = 'badexample.com'; | |
| $config['datasources']['default']['username'] = 'badexample_user'; | |
| $config['datasources']['default']['password'] = 'badexample_pass'; | |
| } |
This file contains hidden or 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
| <?php | |
| /** | |
| * This file helps install aegir on osx, not using the standard AEgir user | |
| * create a host entry for your machine name (Cash-Williamss-MacBook-Pro.local) | |
| * run drush hostmaster-install --aegir_root=/path/to/aegir | |
| */ | |
| /** |
NewerOlder