Active
Project:
Demonstration Site Install Profile
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Nov 2008 at 08:31 UTC
Updated:
14 Oct 2012 at 13:30 UTC
It would be great if somehow we could track the database prefix, and then re-save it back to settings.php when restoring the database so that the user doesn't have to worry about what database prefix they put in during installation.
Comments
Comment #1
sunCorresponding issue: #339695: Save table prefix
I'm not sure whether we really want to force the stored (previous) DB prefix. What if I create a snapshot in one database with a prefix and want to replicate this site to several other servers that do not require a db prefix?
I mean, if we could "suggest" the original prefix during the setup in the database connection settings, that would be fine - but install profiles do not allow to alter the forms at this stage, AFAIK - if we could, we could also skip the whole installation process, just restore the snapshot, and redirect to the ready site.
Comment #2
robloachSkip the installation process? But you have to know what database to restore the dump to. And which dump to restore when your installing the site..... What if we scanned the .sql file for the table_prefix (rather simple regex on the first X characters of the file), and then rewrote that change into settings.php?
Comment #3
sunNah, adding the previous db_prefix to the .info file is not a problem at all. If that helps to make this profile wicked, I'm fine with it. ;)
However, now that you mention it - Demo dumps all database tables "as is", including a prefix (if there is one), so the user is not able to change the prefix upon installation using the profile (as long as we do not implement a customized version of prefix.sh I wrote some time ago, which allows to alter the table prefix in a database dump that contains a prefix already ;).
So yes, for now the ideal solution would work like this:
If I'm not mistaken, the current profile unnecessarily performs a regular installation of Drupal core modules (and Demo module). So the goal should be to intercept the installation process as early as possible.
Slightly OT: Most probably we also want to search for snapshots in (or below) the installation profile's folder, since there is no file directory path at this stage.
Comment #4
robloachPushing to 7.x due to the awesome sauce.
Comment #5
Leeteq commentedSlightly related:
The demo_profile module's project page states:
"REQUIRED: Use the same table prefix you were using for your original site."
But the demo site module itself has no _requirement_ for a db prefix, AFAICS.
So perhaps that sentence on the project page should read something like:
"REQUIRED: Use the same table prefix you were using for your original site, if it is using one."
(Plus add it to the readme.txt file as well.)
Then users would not need to find out whether the main demo site module is requiring db prefixes...