Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: Volker S on July 04, 2025, 09:20:44 AM

Title: Alternative “Backup”
Post by: Volker S on July 04, 2025, 09:20:44 AM
If something goes seriously wrong when resetting the software or individual add-on modules in the package manager, how can you restore an older backup without creating the corresponding old database (new posts will be lost)?
Example: You transfer the backup from 2.1.5 to your server in a new directory. When you access the forum, you get the following message (see image).
To avoid losing any posts, can I fix the error using repair-settings.php?
Title: Re: Alternative “Backup”
Post by: shawnb61 on July 04, 2025, 10:01:09 AM
Two options:
 - Keep the files & db in sync
 - Update 'smfVersion' in the settings table

Note that there were a couple minor db changes in 2.1.5, so the first option is preferred.  Unless you want to revert the db changes by hand.

There were no db changes in 2.1.6.  So going from 2.1.6 back to 2.1.5 you can get away with just updating smfVersion.

Uninstalling the package keeps everything in sync, but is usually not advised.
Title: Re: Alternative “Backup”
Post by: Volker S on July 04, 2025, 10:54:27 AM
In my case, this means the following:
I can access a backup of 2.1.5 with the current database (2.1.6)  if I change the database version to 2.1.5.
For all other backups, I have to restore the old database in addition to the old forum. There is no other solution, right?

Where can I find the settings table to set the database version from 2.1.6 (which is what it is now) to 2.1.5?
Title: Re: Alternative “Backup”
Post by: CRM 114 on July 04, 2025, 12:43:22 PM
Quote from: Volker S on July 04, 2025, 10:54:27 AMWhere can I find the settings table to set the database version from 2.1.6 (which is what it is now) to 2.1.5?
I don't know, if you are familiar with this, but you can connect to your database e.g. with phpMyAdmin or a similar tool. Select the table "settings" (could have a prefix, depending on your configuration) and search for "smfVersion" in column "variable".
Title: Re: Alternative “Backup”
Post by: Doug Heffernan on July 04, 2025, 01:44:18 PM
Quote from: Volker S on July 04, 2025, 10:54:27 AMI can access a backup of 2.1.5 with the current database (2.1.6)  if I change the database version to 2.1.5.

To clarify, you mean to install a backup made on a 2.1.5. version into a 2.1.6 forum? If that is a yes, you don't need to change the version. You can simply use the update link from the Package Manager to bring the database to 2.1.6. That last step might not even be necessary seeing the fact that there weren't any database changes between those 2 versions.

Quote from: Volker S on July 04, 2025, 10:54:27 AMFor all other backups, I have to restore the old database in addition to the old forum. There is no other solution, right?

For all older backups it's the same procedure. You can install them directly on a 2.1.6. forum. If the old backups are from the 2..0 series you will have to run the 2.1.6. upgrader to bring the old database up to date to match your forum files.
Title: Re: Alternative “Backup”
Post by: shawnb61 on July 04, 2025, 02:40:36 PM
Quote from: Volker S on July 04, 2025, 10:54:27 AMI can access a backup of 2.1.5 with the current database (2.1.6)  if I change the database version to 2.1.5.
Correct.  There were no DB changes between 2.1.5 & 2.1.6.  Just change the smfVersion to match the code & you're good.

Quote from: Volker S on July 04, 2025, 10:54:27 AMFor all other backups, I have to restore the old database in addition to the old forum. There is no other solution, right?
As noted above, if you're comfortable doing the db changes by hand, you can do that.  Or just deinstall the patch.  The db changes can be read within the patch, within package-info.xml.

The changes are minor - a couple index tweaks.  But there are corresponding code changes for one of them, and the code & db must be in sync.

Quote from: Volker S on July 04, 2025, 10:54:27 AMWhere can I find the settings table to set the database version from 2.1.6 (which is what it is now) to 2.1.5?
In cPanel, in phpmyadmin.  The table is smf_settings (assuming your prefix is smf_). 

You've got to be comfortable making DB changes.  It's worth learning phpmyadmin if you are an app admin.
Title: Re: Alternative “Backup”
Post by: shawnb61 on July 04, 2025, 04:16:09 PM
Of course, the above assumes you're staying within 2.1.x.  Doug is correct, above, that you need to fully restore code & db if you're going back to 2.0.x or prior.
Title: Re: Alternative “Backup”
Post by: Volker S on July 05, 2025, 04:57:53 AM
I will now try to describe the basic situation in this Link (https://www.simplemachines.org/community/index.php?msg=4191760). Thank at all.