On 28/07/07, Jim Hu jimhu@tamu.edu wrote:
I have a couple of questions before I do the next release of the TableEdit extension/special page
- In the TableEdit extension, the table data is stored in an
external mysql database. I had been hard-coding the name of this database into the extension to avoid creating a global variable that the user would put in LocalSettings. But it seems like that was a bad idea, especially if one wants two instances on the same mysql server... which I discovered I do want.
Is it essential to use an external database? Could you not use a number of tables in the same database as the wiki's using?
This strikes me as making life easier in terms of setup, and writing portable code, and also maintenance and backup operations.
Some trickery would be needed if you have to share data between wikis, but you could most likely achieve the desired effect by extending the shared table mechanism (which should be cleaned up, in any case) or using query groups to direct queries to the right database server and configuration, for more complex setups.
If you feel it *is* appropriate to use an external database, then I would certainly recommend making it configurable using a global (I despise globals, but we use them for configuration, so conventions are good). The "wg" prefix is a convention which was introduced to help indicate that a variable should be in the global scope; it helps us to spot missing "global $wgFoo" statements which cause notices, warnings and in some (well, a lot of) cases, downright stupid assumptions on the part of PHP.
When naming such configuration globals, be sensible; pick a name which isn't going to conflict with the core (for the foreseeable future). It's often a good idea to prefix the variable name with the extension name, e.g. $wgTableEditDatabase, etc.
Rob Church