Jump to content

Prefixed PW database tables?


teppo
 Share

Recommended Posts

Background story: I'm installing PW for a friend to evaluate in a web hosting platform that only allows one database. That single database already contains quite a few tables for various other systems (and to be honest names of PW tables are not THAT unique, already had a table called "pages" there for an example.)

So my question is: is it already possible to prefix PW tables with something like "pw_", "mysecondpwsite_" etc?

--

As a sidenote, WordPress installer for an example allows user to easily choose which prefix (if any) he/she want's to use. Makes running multiple WP installations in one DB very easy. This may not be the best solution considering security issues etc. but it's still a very real scenario for quite a few users.

Link to comment
Share on other sites

I'm not terribly informed about the ins and outs, but judging from the source it doesn't appear to be currently supported. The easiest solution would be to buy a month of cheap hosting for evaluation or up the plan at the current host. Of course, that isn't anything you didn't already know.. It might be hackable through the __call method of the DatabaseQuery class (regex replace of all known database tables), but that would break the installer, generally be unpredictable, and likely end in catastrophic failure.

Edit: the installer definitely uses fixed table names (install.sql). Changing DatabaseQuery would not prevent the installer from overwriting your existing "pages" table. So what was a bad idea in the first place (hacking __call), is much worse than initially suspected.

Link to comment
Share on other sites

I don't think sharing one database for multiple pieces of software is a good idea. Lots of concerns there whether PW is part of it or not. A vulnerability in one piece of software suddenly becomes a vulnerability in all. Table prefixes have been intentionally left out of PW, and I'm of the opinion that this is something other software should phase out as well (especially WordPress). :)

I'm guessing this is from a legacy hosting platform or a free web hosting account, and so would say it doesn't meet PW's minimum requirements in that regard. I understand the hosting part is out of your hands, but would probably suggest kindly encouraging your friend to get a $3/month web hosting account from HostGator or something, so they can have more than one database. :) Though it surprises me even a free host would still be enforcing that limitation as it's a magnet for security problems and tech support.

  • Like 1
Link to comment
Share on other sites

Very good points there, Ryan - kinda guessed that there might be that kind of reasoning behind this, just wanted to make sure. I consider security very important and I'm well aware of various risks of sharing a database between multiple apps so I can absolutely respect this :)

Developers of WP on the other hand clearly wan't to appear as user friendly as possible - even to the point where that actually works against especially their less-informed users - and this way increase the user base of WP. Personally I don't see that as such a great way to go in the long run, but I guess both ways do have their strong points. This too depends on the audience you're trying to reach and image you're trying to achieve.

... and by the way, that friend of mine already switched his web host. So the original problem has been solved ;)

Link to comment
Share on other sites

Glad that your friend was able to solve it with the hosting change. :)

Just thinking about WP again, it would probably be very hard for them to take away the table prefixes now, since they've already been there for years. Sounds like a potential support nightmare. :) Still, I have to believe that if they were starting from scratch today, they might avoid them.

Link to comment
Share on other sites

An added complication in a WP network (running multiple blogs from one codebase), you end up with 2 levels of prefixes! So you might have a wp-posts table and a wp-1-posts and wp-2-posts tables. (I have changed the prefix to something other than the default on mine, though 8) )

Link to comment
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...