From a28ab4fbe23c5a62b80697c60f16eaa6eebdf09f Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Tue, 22 Jan 2013 11:58:26 -0600
Subject: [PATCH] Make fix-settings respect the DB_PREFIX.

---
 fix-settings.php | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fix-settings.php b/fix-settings.php
index 6f10e06..f5c4fe7 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
 );
-- 
GitLab