TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 04:52:47 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,105
  • Total Topics: 21,213
  • Online today: 304
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 307
  • Total: 307

Question: Database backups and Tiny Portal

Started by nokonium, August 25, 2005, 08:01:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nokonium

I have had a problem with one of my test installs of TP and thought I was OK because I had done both a file and database backup. For reasons I don't understand fully, OK I don't understand at allÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  :idiot2: I was unable to restore the database to recover from the problem. So I thought, I wonder if I can extract what I want from the sql file, no it doesn't seem to be in there.

So the $64,000 question is when you do a database backup,
A) Does it back up articles and menu settings etc?
B) If if does, where does it store them?
C) If it doesn't, what do we need to do to include all of the TP fields and tables in a database backup?

I have been using [unknown]'s create_backup.php and restore_backup.php utilities. SMF database prefix sgr_ , TP prefix (custom) sgrportal_ (I am running 4 test boards on the same database).

This is what I think is the case.

If you only have one board on its own in a database you are OK the backups of the whole database. If you do your backups with a tool that uses a table prefix, like create_backup.php, you will need to run it twice, once with your SMF_ prefix and again with your tportal_ prefix. To back the two up together you need for them to have the same prefix. The easiest way to achieve this ATM appears to be to run the TP install and then run a renaming utility to change the prefix on the TP tables, then manually change the TP files likewise.

gelsbern

My recommendation is to grab phpMyAdmin and use that for backing up and restoring your databases.  It is a nice GUI front end and has several other features that come in handy for database manipulation.  You can find phpMyAdmin here http://www.phpmyadmin.net/home_page/

Nokonium

I have that on the server control panel. My database files are circa 20Mb phpMyAdmin has a maximum restore file size of 2Mb or 8Mb depending on which version you have or is installed. I used to use that but [unknown]'s create and restore handles 20Mb without problem.

I can do regular backups to a folder on my site and then include the sql file in file backups.

What I was trying to highlight (clumsily) was the potential problem with database backups because of the different table prefixes used by SMF and TP by default. Even knowing this and using custom suffixes, I hadn't thought it through enough and made them start with exactly the same. I have with my 'Fiddlers Elbow' test site, I use elbow_ and elbow_tp_ this means that they are both backed up together. You must still allow TP to have its own set of tables otherwise there will be a problem with 'settings', you need ###_settings and ###_tportal_settings tables.

Bjørn

If the baclup-utility support backing up ALL tables with the given prefix( smf_ for example) then you can do perhaps this: rename the 4 TP tables that belong to one smf..to the same as the smf install. Meaning:

smf_messages
smf_topics
..
..
elbow_settings -> smf_elbow_settings
elbow_variables -> smf_elbow_variables
elbow_articles -> smf_elbow_articles
elbow_blocks -> smf_elbow_blocks

So, just renaming the 4 tables that belong to TP for that particualr SMF installation and run the backup script. IF it will copy every smf_xxx table regardless, you should be fine. Now, to restore again, just use the script, and then either rename the 4 tables again(removing the smf_) or change the $tp_prefix to make the tables permantly use those names.

For your other SMF/TP install you could do the same.

If it doesn't support copying ALL smf_xx tables( skips those that are unfamilar) then the script will need to be changed for this. I might help out there then. But have a try at it first.

Nokonium

#4
Quote from: Bloc on August 26, 2005, 09:47:19 AM
If the baclup-utility support backing up ALL tables with the given prefix( smf_ for example) ........

It does and that is what I have done with elbow_ and elbow_tp_

What I hadn't got for the one that I'm having to rebuild is the underscore between the sgr and portal. I didn't have the portal when I set up the d/b backup, had I used sgr_portal as the TP custom prefix all would have been OK. But I didn't think ahead when I custom named the TP prefix.

Thinking ahead to when you add extra modules, what are you going to do about the table prefixes for those? Could you extract the database prefix from Settings.php and add it to your prefixes?

Bjørn

At the moment I am staying with the 4 tables - even for extra modules. I use the same fields, but for different information. It makes for a quick table ( just the 5-6 fields) and keeping pure module settings in "settings" table - and the data in "variables" table. Blocks and articles tables are just for their meant purpose of course.

I might add another table or 2..but I don't want a whole bunch of them initially.

But..is the underscore important? or is it a undersore on SMF tables, but not on TP tables? i would think just renaming those and update $tp_prefix would fix that?

Nokonium

IIRC, when I update I need to mod the update file as well with the new prefix?

In my case I think that the underscore was important because I included it in one prefix and not in the other. I don't understand enough about SQL to know if an underscore is just another character or if it divides one part of the string from another.

Bjørn

Its just a charachter. Its used to make reading the tables easier.

And yes..the current updater use tportal_ so you need to set that. But that will probably change with the next release.