XF 2.2 Help restore the forum

Dkf

Active member
Due to a hard drive failure, the files of the file system have been lost, but the database is still intact.
How can I restore the forum step by step?
Please provide instructions.

Thank you.
 
I want to install the same set of plugins on an empty forum that I had before. This way, after connecting the new database, the plugin files will already be in the system. How can I see in the MySQL database which plugins and their versions were installed before the crash?
Thank You

SELECT addon_id, title, version_string FROM xf_addon;
 
  • Like
Reactions: Dkf
SELECT addon_id, title, version_string FROM xf_addon;
I have a question.
I'll remind you of the situation - I want to import only two things from the Vbulletin database into XF - avatars and attachments. I don't need anything else. I will be using a different database.
If I select only avatars and attachments during the import, will their files also have the same names and be located in the same place?
Will my actions lead to the same results as if I imported the entire database, including the messages?

The import takes a huge amount of time... And I want to speed it up.

1694118445373.png
 
You can't import attachments and avatars without also importing users and user groups.

Unfortunately, though you'll be able to retain ids in the first import, when you try do a second import with the hope of matching ids, you won't be able to since Xenforo's importer will not allow the retain content id setting to be on after the first import.

Merging multiple imports so their users, attachments, avatars and threads/posts match up properly requires custom work. If you need that kind of service, contact me via conversation message. @Slavik can probably handle something like this as well.
 
You can't import attachments and avatars without also importing users and user groups.

Unfortunately, though you'll be able to retain ids in the first import, when you try do a second import with the hope of matching ids, you won't be able to since Xenforo's importer will not allow the retain content id setting to be on after the first import.

Merging multiple imports so their users, attachments, avatars and threads/posts match up properly requires custom work. If you need that kind of service, contact me via conversation message. @Slavik can probably handle something like this as well.
What is "second import"?

I want to create a file structure with attachments and avatars after importing vBulletin (2022) into empty XF.
After that, I won't need this database anymore.
I will configure the XF 2023 database in the configuration file.

Will this plan work?

Yes, I understand that I will lose the attachments and avatars created over the last year
 
To clarify:
I assumed the Xenforo database you have was imported from another forum in the past.

Even if it does not have a past import ---> You can not import data into any already populated Xenforo database and still retain proper user, attachment, and avatar IDs. The Xenforo database must be empty to retain IDs during import.
 
I am buying a server on Hetzner without administration, and I am responsible for the administration myself.

The backup scheme was taken from here "Backup VM without downtime"
https://b14esh.com/virtualization/kvm/backup-vm-qemu-kvm-libvirt.html.

However, it turned out to have significant shortcomings :(

The files were corrupted. After converting from qcow2 to raw, it was possible to partially access the file system. However, only a very small portion of the files could be retrieved...

A timely reminder to us all, me included. Not only to check that your backups are being produced, but also periodically to ensure that you can actually restore from them.
 
To clarify:

I have restored the forum's functionality.

Here's what I did - I installed a new (empty) script. Installed all the add-ons. Pointed to the old working database. Everything is fine about 99%, but there are still some questions.

Some things, namely "word translations," "styles," "prefix titles," and "help pages," do not display correctly. Although the text in the database is correct. I have to edit these things - add "." to the text and press "save," after which the entire page displays correctly publicly.

Does Xenforo use some kind of forum display cache? How can I rebuild of this cache?

Thank you.
 
A timely reminder to us all, me included. Not only to check that your backups are being produced, but also periodically to ensure that you can actually restore from them.
And something I commented on.. and got burned because highlighting that failure to do some upset some... Oh well.. reality frequently decides to bit folks.
 
Your running an add-on to minimize the FA footprint.... check with that developer.
Odds are it will be a simple index rebuild for that add-on. Only used it for a short while and had some quirks with it I didnt' want to chase down.
 
  • Like
Reactions: Dkf
Could you please explain how the directory structure and file names of attachments are organized?
What does the folder "1250" signify?
What does this number in the file name represent?
Where does the file hash in the name come from? Is it random or can it be deciphered?

1695032973749.webp
 
The directory number is based on the number of attachments.
Each directory contains 1,000 files.

The files within the directory are numbered sequentially starting from 0 to 999, prefixed with the directory number.

The file name is an md5 hash.
 
The directory number is based on the number of attachments.
Each directory contains 1,000 files.

The files within the directory are numbered sequentially starting from 0 to 999, prefixed with the directory number.

The file name is created randomly.


You are mistaken... The file name is not random. It is a sequential number + file hash. It is always the same for the same file.

So...

I have two databases, one from 2022 (backup) and one from 2023 (working).

Now I need to figure out what to do with it.


SQL:
mysql> SELECT * FROM xf.xf_attachment_data WHERE file_hash = '5a6fba36d78b7d95e643a0e70bf79d26';
+---------+---------+-------------+----------+-----------+----------------------------------+-----------+-------+--------+-----------------+------------------+--------------+
| data_id | user_id | upload_date | filename | file_size | file_hash                        | file_path | width | height | thumbnail_width | thumbnail_height | attach_count |
+---------+---------+-------------+----------+-----------+----------------------------------+-----------+-------+--------+-----------------+------------------+--------------+
| 1211358 |  294933 |  1617441709 | 1.jpg    |     80199 | 5a6fba36d78b7d95e643a0e70bf79d26 |           |  1200 |    900 |             200 |              150 |            1 |
+---------+---------+-------------+----------+-----------+----------------------------------+-----------+-------+--------+-----------------+------------------+--------------+
1 row in set (0,23 sec)

mysql> SELECT * FROM xfn.xf_attachment_data WHERE file_hash = '5a6fba36d78b7d95e643a0e70bf79d26';
+---------+---------+-------------+----------+-----------+----------------------------------+-----------+-------+--------+-----------------+------------------+--------------+
| data_id | user_id | upload_date | filename | file_size | file_hash                        | file_path | width | height | thumbnail_width | thumbnail_height | attach_count |
+---------+---------+-------------+----------+-----------+----------------------------------+-----------+-------+--------+-----------------+------------------+--------------+
| 1212223 |  294933 |  1617441709 | 1.jpg    |     80199 | 5a6fba36d78b7d95e643a0e70bf79d26 |           |  1200 |    900 |             200 |              150 |            1 |
+---------+---------+-------------+----------+-----------+----------------------------------+-----------+-------+--------+-----------------+------------------+--------------+
1 row in set (0,13 sec)

mysql>
In two different databases, only the data_id differs.
 
Last edited:
This is why I don't trust most hosts when it comes to backups. Use a service like Code Guard or a similar service that stores your files and database and can restore and rescue your forum via one click.
 
Top Bottom