Skip to content
Snippets Groups Projects
Commit a28ab4fb authored by Tim Steiner's avatar Tim Steiner
Browse files

Make fix-settings respect the DB_PREFIX.

parent 6f0084aa
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/php #!/usr/bin/php
<?php <?php
require_once dirname(__FILE__) . '/config.php';
if ($_SERVER['argc'] != 2) { if ($_SERVER['argc'] != 2) {
echo 'Usage: ' . $_SERVER['argv'][0] . ' path/to/settings.php' . PHP_EOL; echo 'Usage: ' . $_SERVER['argv'][0] . ' path/to/settings.php' . PHP_EOL;
exit(-1); exit(-1);
...@@ -22,15 +24,16 @@ if (!preg_match('/^\$databases.*?\'default\' => \'(.*?)\',.*?\);/ms', $s, $match ...@@ -22,15 +24,16 @@ if (!preg_match('/^\$databases.*?\'default\' => \'(.*?)\',.*?\);/ms', $s, $match
echo 'Nothing to replace!' . PHP_EOL; echo 'Nothing to replace!' . PHP_EOL;
exit(1); exit(1);
} }
$prefix = DB_PREFIX;
$replacements = array($matches[0] => <<<EOL $replacements = array($matches[0] => <<<EOL
\$databases['default']['default']['prefix'] = array( \$databases['default']['default']['prefix'] = array(
'default' => '{$matches[1]}', 'default' => '{$matches[1]}',
'filter' => 'drupal_', 'filter' => '$prefix',
'filter_format' => 'drupal_', 'filter_format' => '$prefix',
'role' => 'drupal_', 'role' => '$prefix',
'role_permission' => 'drupal_', 'role_permission' => '$prefix',
'unl_cas_settings' => 'drupal_', 'unl_cas_settings' => '$prefix',
'wysiwyg' => 'drupal_', 'wysiwyg' => '$prefix',
); );
EOL EOL
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment