diff --git a/fix-settings.php b/fix-settings.php index 6f10e06ff3c60ad9355846f56baa3aa9b4ce0c57..f5c4fe73377aab1f4a25a24d630e330f353696de 100755 --- a/fix-settings.php +++ b/fix-settings.php @@ -1,6 +1,8 @@ #!/usr/bin/php <?php +require_once dirname(__FILE__) . '/config.php'; + if ($_SERVER['argc'] != 2) { echo 'Usage: ' . $_SERVER['argv'][0] . ' path/to/settings.php' . PHP_EOL; exit(-1); @@ -22,15 +24,16 @@ if (!preg_match('/^\$databases.*?\'default\' => \'(.*?)\',.*?\);/ms', $s, $match echo 'Nothing to replace!' . PHP_EOL; exit(1); } +$prefix = DB_PREFIX; $replacements = array($matches[0] => <<<EOL \$databases['default']['default']['prefix'] = array( 'default' => '{$matches[1]}', - 'filter' => 'drupal_', - 'filter_format' => 'drupal_', - 'role' => 'drupal_', - 'role_permission' => 'drupal_', - 'unl_cas_settings' => 'drupal_', - 'wysiwyg' => 'drupal_', + 'filter' => '$prefix', + 'filter_format' => '$prefix', + 'role' => '$prefix', + 'role_permission' => '$prefix', + 'unl_cas_settings' => '$prefix', + 'wysiwyg' => '$prefix', ); EOL );