XF 1.3 Accidentally deleted a forum with no back-up

whynot

Well-known member
did it 2 minutes ago, can I recover?
Do you have a trash folder, deleted files ending up there?
If you do then check it, your forum's folder might be there.
If you don't than only your host can recover it from an an earlier backup.

Edit: Ooops, I thought that it was the whole forum.
 

petertdavis

Well-known member
Ask your host for a backup quick. They may keep backups for you (they might not too), but they also might overwrite the backups on a regular basis (daily probably). And, more importantly, start keeping regular backups of your own.
 

Jeremy P

Well-known member
Fortunately, I don't think threads are purged from the database for deleted nodes. I know this was marked a 'future fix' years ago and I don't think it's changed since.

Would take some SQL ninjaing to fix though.
 

Chris D

XenForo developer
Staff member
Fortunately, I don't think threads are purged from the database for deleted nodes. I know this was marked a 'future fix' years ago and I don't think it's changed since.

Would take some SQL ninjaing to fix though.
Unfortunately, I believe it was changed.

From the Forum DataWriter, postDelete:
PHP:
        if ($this->getOption(self::OPTION_DELETE_THREADS))
        {
            XenForo_Application::defer('ThreadDelete', array('node_id' => $nodeId), "threadDelete_$nodeId", true);
        }
That DW option is enabled by default and would require the option to be set to false to override it.

The only way to be sure is to run this query:
Code:
SELECT * FROM xf_thread WHERE node_id = 123
Where 123 is the deleted node ID.
 

RustyDogma

Member
I saw this

  • Create a new, blank forum where the one you deleted was.
  • Once created, make a note of the NEW forum's node_id.
  • Using PHP My Admin or similar, find the xf_node table and find the NEW node in the list. Change the node_id value for the NEW node so it has the node_id of the DELETED node.
  • Still in PHP My Admin, find the xf_forum table and again, find the NEW node in the list. Change the node_id value so that the new node again, has the ID of the old node.
But I don't want to make things worse, so I'm unsure on how to get the correct node numbers.

The deleted one is

Code:
array(2) {
  ["node_id"] => string(2) "54"
  ["_xfConfirm"] => string(1) "1"
}[code]

So, 54.. but not sure what the new one is.
 

Chris D

XenForo developer
Staff member
Easiest thing to do straight away is to run this query:

Code:
SELECT * FROM xf_thread WHERE node_id = 54
That will tell you whether or not there are any threads left or if they were deleted with the forum.
 

RustyDogma

Member
I contacted my host and my previously working forum is now completely inaccessible. I asked for a back-up and now it gives a db error.

He asks:

Code:
<!-- Mysqli prepare error: Table 'dominio1_DOforum.xf_data_registry' doesn't exist -->

but that table is there:

MariaDB [dominio1_DOforum]> SHOW TABLES LIKE 'xf_data_registry' ;
+-----------------------------------------------+
| Tables_in_dominio1_DOforum (xf_data_registry) |
+-----------------------------------------------+
| xf_data_registry |
+-----------------------------------------------+
1 row in set (0.00 sec)

MariaDB [dominio1_DOforum]>

I even dropped that table, but it is still complaining:.

MariaDB [dominio1_DOforum]> SHOW TABLES LIKE 'xf_data_registry' ;
Empty set (0.00 sec)

MariaDB [dominio1_DOforum]>

Can you check with forum vendor please, what we need to do in order to restore/fix exactly ?
So pissed, as while I screwed up and deleted a forum, otherwise everything was working fine - I just wanted to restore my mistake. I now have no functional site at all, just a database error.
 

Brogan

XenForo moderator
Staff member
How did your host take the backup and restore it?

We need to know the exact steps.
 

Chris D

XenForo developer
Staff member
This query will restore the xf_data_registry table:
Code:
    CREATE TABLE xf_data_registry (
        data_key VARBINARY(25) NOT NULL PRIMARY KEY,
        data_value MEDIUMBLOB NOT NULL
    ) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
 

RustyDogma

Member
I asked about the steps and was told all they can do is escalate it. So now my site is down while I wait for some poor tech to wake up on a Sunday morning.
 

RustyDogma

Member
It is possible that, at least partly, your DB is innodb, therefore messed restore, but I can't really tell you more at this point. What I suggests is to move this to our Senior Technicians so that they can try to restore and/or fix database. Please note that you will likely have to wait 1-2 hour before they come back online. Is that acceptable to you, kindly please ?
 

RustyDogma

Member
They finally figured out the issue and restored it. Unfortunately they didn't explain what happened where they lost the whole thing for 6 hours, so no helpful updates in that regard.
 
Top