This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

Backup userspice files & table

In Modifications and Hackery · Started by firestorm on 2017-07-01 5:11 pm · 101441 views · 42 replies

I've completed the script for backing up userspice files and db tables, if you want it +1 in the comments, see the gif for preview:

I'm super interested in this. Care to share???
cool here goes, below is a link to a GitHub Gist which contains everything, all you guys will need to do is adapt its html to suit your styling choice and you will need to add a link to it in your navigation.

Userspice backup gist
i would also appreciate feedback on its performance on windows machines & servers both local and remote, in mamp pro and ampps on MacOS localhost I've encountered mysqldump command not found error so db tables don't get dumped, i'd be interested to see if anyone else encounters this. I'm sure its a path issue on the devices not the script.
I'm going to send you a PM to your email firestorm...thanks for all you're doing.
I'm guessing your "master" email address is the one I should use?
That works REALLY well. I love it. I only have one suggestion...

I would like to backup everything from the folder BELOW users. So if I have it in localost/userspice/users, I would like to backup everything that is in the userspice folder.
I've definitely had issues with anything other than leaving the backup path blank. That works great. No issues there.

The only thing I'm having now with the idea of backing up everything (all folders) is not recursively backing up the backups. I have to dig a little more into how the whole thing works to figure out how to exclude certain files/folders.
I've definitely had issues with anything other than leaving the backup path blank. That works great. No issues there.

The only thing I'm having now with the idea of backing up everything (all folders) is not recursively backing up the backups. I have to dig a little more into how the whole thing works to figure out how to exclude certain files/folders.
I've tested this on my various servers and the only issue I'm having is the path issue and not being exactly sure how to stop it from backing up the backups. Other than that, it works great...and once I download it, I just edit the zip file and it's perfect. THANK YOU.
awesome, thanks for inclusion into core, realy busy at the moment, daughter just had major op so will be offline for a number of days but will look at the backup all, maybe try prepending a . to the backup folder name but if im correct that would hide the file from view on a mac not sure about other systems, got a few ideas on this i'll look at soon as i can, im working on restore feature too which will be extremely experimental
Looking forward to playing with this and incorporating it into my Cron System!
Thoughts on what might be causing this error? Obviously the file name is too long - but why???

Warning: copy(): File name is longer than the maximum allowed path length on this platform (4096): /home/aircentralized/public_html/mydash/backups/backup_everything_2017-07-04T17-25-47/files//backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/backup_everything_2017-07-04T17-25-47/files/backups/b in /home/aircentralized/public_html/mydash/users/helpers/backup_util.php on line 67

The backup still succeeds and is complete...
hmm is it localhost or remote server ? what platform is it on?
Remote, cPanel, latest version.
It looks like it is backuping up the backup folder into the backup folder and just keeps going and going and going and going and doesn't stop.........any way to exclude the backup folder from the list of folders? I am using 'backup/' as the directory. Or is this the ongoing issue Mudmin had posted about? No issues when I use anything but the Database & ALL files.
That's the ongoing issue. It actually does finish, but on my 1gigabyte DMS project, it can take half an hour or so. Then I just have to open the zip and delete the backup folder and everything is good. The fix is going to be to exclude that, but it is building the array a little differently than I expected and I didn't get a chance to figure out how to stop it.
Where exactly does it pull all the directories? If I could figure that out I can work on seeing if I can figure out how to exclude it...

Thanks!
It's getting those directories from the top of the admin_backup.php file you can see where it's doing /users and /usersc and where the everything option adds /

The problem is that when it adds the array it must be doing it in memory or somewhere else, because everything I've done to exclude folders and files that begin with backup only result in the db being backed up and nothing else. The backup program itself is in the helpers folder. Feel free to take a crack at it. I ran out of time.

I'd also like to make a feature to just select folders, because, for instance, my DMS app has all the code stored in a private repository, so I really only need the receipts people upload to it and the db. There's really no reason to backup userspice itself. I already have that.
this is why left out backup all origionaly, maybe instead of back up all we could produce a checkbox list files/directories at root and just select what to backup
123Next ›