Topic: Table '#_users' isn't restored when restoring a backup

Hi,

As the title indicates : I wanted to restore the backup of a company but it seems that the users-table isn't restored.



Kind regards,

F.

Re: Table '#_users' isn't restored when restoring a backup

Hi,

I think 'Protect security settings' was enabled when restoring.

Also table #_security_roles wasn't restored.

Are there other tables that are protected when 'Protect security settings' is enabled ?

Kind regards,

F.

Re: Table '#_users' isn't restored when restoring a backup

When the 'Protect security settings' is set, the users and the security_roles tables are skipped when restoring. These are the only tables classed as security settings.

@apmuthu
Will you update the Wiki for us. Thank you in advance.

Joe

4 (edited by advocaat.pollet 12/12/2022 07:16:31 pm)

Re: Table '#_users' isn't restored when restoring a backup

@apmuthu

A daily cronjob for automatic backup in the wiki should also be great :

#!/bin/bash
url="https://[host].[domain].[tld]/"
cd "$(dirname "$1")"

curl -s -c my_session -F 'user_name_entry_field=admin' \
                      -F 'password=[password for admin]' \
                      -F 'company_login_name=[companynumber]' ${url} >/dev/null

curl -s -b my_session -F 'creat=Create Backup' ${url}admin/backups.php

echo
rm my_session

Re: Table '#_users' isn't restored when restoring a backup

The last 2 posts have been wiki-ed.

Re: Table '#_users' isn't restored when restoring a backup

I can confirm that all tables are always backed up but when Protect security settings is selected, the #_users and #_security_roles tables are not restored.

7 (edited by MacKenzie 02/02/2023 02:39:33 am)

Re: Table '#_users' isn't restored when restoring a backup

You got me curious with this so I thought I would test it.  Besides my admin account I went ahead and set up 3 additional users. Did a backup/restore and sure enough the users didn't come over.  I examined the sql backup file:
INSERT INTO `XX_users` VALUES //for some reason this doesn't work
('1', 'admin', 'blahblahblahblah', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2023-02-02 03:12:50', '10', '1', '1', '1', '1', '0', 'orders', '30', '0', '1', '0', '0', '0'),
('3', 'Larry', '66f4b449b3a98abf87f2521e35513542', '', '1', '', NULL, 'C', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', NULL, '10', '1', '1', '', '1', '0', 'orders', '30', '0', '1', '0', '0', '0'),
('4', 'Moses', 'd41d8cd98f00b204e9800998ecf8427e', '', '9', '', NULL, 'C', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', NULL, '10', '1', '1', '', '1', '0', 'orders', '30', '0', '1', '0', '0', '0'),
('5', 'Curly', 'd8000efdcdd3ee172793aa6e73bcb8b4', '', '3', '', NULL, 'C', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', NULL, '10', '1', '1', '', '1', '0', 'orders', '30', '0', '1', '0', '0', '0');

I could see no reason why this wouldn't be restored.  So I took the exact same SQL insert statement and ran it on the database using myphpadmin and it updated the XX_Users table just fine.  Seems to be some kind of bug.  One thing about code, there is ALWAYS a reason.  Not like people who maybe are just having a bad day ;-)   If you have a 'ton' of users it's easy enough to do what I did and they will restore.  If you find the bug, let us all know.

Looks like it the protect security setting.  Look there first perhaps.

Cheers.
Mac

Good luck.



advocaat.pollet wrote:

Hi,

As the title indicates : I wanted to restore the backup of a company but it seems that the users-table isn't restored.



Kind regards,

F.