DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • April 22, 2019, 05:29:10 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1] 2 3   Go Down
  Print  
Author Topic: Site Backup (Database & Files) v2.0 : File Submission/Discussion  (Read 11010 times)
0 Members and 1 Guest are viewing this topic.
Aeolus
Mod God
*****
Offline Offline

Posts: 1929


You're welcome.


View Profile WWW
« on: June 30, 2013, 09:08:15 AM »

Name: Site Backup (Database & Files)
Author: Aeolus
Version: 2.0
Category: Administrative
Compatible: Tested and used on 1.1.2 (should work on any 1.x.x)

Description:

An easy module that allows a Megauser to backup their entire site (both files and database, together or separately) directly from their site! Features include:

  • Version 1.0:
  • Admin's choice in settings of what folder to backup, and what folder to save the backups to.
  • List of saved backups (ordered chronologically).
  • Deletion (separately or bulk) and download of all saved backups!
  • Safety check in case the directory where the backups are being saved to doesn't exist.
  • Both forms of backup are saved as ZIP files.
  • Version 1.1:
  • When you back up your site, the date is saved or both DB and Files, so you know how long it's been since you've backed up your site.
  • These dates are then displayed on the main page.
  • Version 1.2:
  • Automated backup (number of days between backups is in settings).
  • Automated backup includes period between backups, which backup to create (DB &/ Files), Account IDs that can trigger automated backups, and System YoMs for when a backup is created.
  • Automated deletion of old backups (threshold of age is in settings).
  • Setting to backup only files that have been modified within a set number of days
  • Ability to ignore certain folders and files in the backup (datacache and test are defaults).
  • Version 1.3, 1.3.1:
  • Multiple bugs fixed.
  • Version 2.0:
  • Optimization of backup code - specifics listed in forum.

VERSION USAGE: Use v1.3.1 if you are using a free server. Use v2.0 if you are using a paid server.

Suggestions, ideas and bugs are welcome.

Enjoy!
« Last Edit: December 11, 2017, 05:18:48 PM by Aeolus » Logged

Aeolus
Mod God
*****
Offline Offline

Posts: 1929


You're welcome.


View Profile WWW
« Reply #1 on: July 20, 2013, 08:59:29 PM »

Added in v1.1:
  • When you back up your site, the date is saved or both DB and Files, so you know how long it's been since you've backed up your site.
  • These dates are then displayed on the main page.

Would it be used more if I added an automatic backup feature in? For example, back up the site every seven days, and only on the new day page. (Naturally, with a notification, so if it's caused by a player, they know why the page is taking so long to load.)
« Last Edit: July 20, 2013, 09:07:33 PM by The Doctor » Logged

MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1752


View Profile
« Reply #2 on: July 21, 2013, 06:26:52 AM »

I have a YoM sent to me every time my backup happens telling me the file size etc.

I use coloured text to tell me at a glance whether or not the backup was created successfully. Though to check if it was successful and get the file size you need to have the script wait a number of seconds after executing the sqldump command  as depending on the size of the database it may take a while. Smiley
Logged

Check My Modules for the latest versions.
Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #3 on: July 22, 2013, 10:19:28 AM »

Reporting a Call Stack:
Call Stack:
2: date("d M y h:ia", "") called from /home/xxx/public_html/modules/site_backup.php on line 161
3: site_backup_recent() called from /home/xxx/public_html/modules/site_backup.php on line 133
4: site_backup_run() called from /home/xxx/public_html/runmodule.php on line 33

In: /runmodule.php?module=site_backup
« Last Edit: July 22, 2013, 10:21:49 AM by Eclypse ~ Xpert » Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1929


You're welcome.


View Profile WWW
« Reply #4 on: July 22, 2013, 07:11:39 PM »

Reporting a Call Stack:
Call Stack:
2: date("d M y h:ia", "") called from /home/xxx/public_html/modules/site_backup.php on line 161
3: site_backup_recent() called from /home/xxx/public_html/modules/site_backup.php on line 133
4: site_backup_run() called from /home/xxx/public_html/runmodule.php on line 33

In: /runmodule.php?module=site_backup

Thank you for reporting it. Have you edited the file at all (the main file, plus there's two sub-files)? If you have, please attach it so I can have a look. I've tried to reconstruct this error, but I can't seem to.
« Last Edit: July 22, 2013, 08:21:14 PM by The Doctor » Logged

Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #5 on: July 23, 2013, 08:32:41 AM »

Reporting a Call Stack:
Call Stack:
2: date("d M y h:ia", "") called from /home/xxx/public_html/modules/site_backup.php on line 161
3: site_backup_recent() called from /home/xxx/public_html/modules/site_backup.php on line 133
4: site_backup_run() called from /home/xxx/public_html/runmodule.php on line 33

In: /runmodule.php?module=site_backup

Thank you for reporting it. Have you edited the file at all (the main file, plus there's two sub-files)? If you have, please attach it so I can have a look. I've tried to reconstruct this error, but I can't seem to.

Not one file was modified. I simply placed them into my modules folder and installed, then went to test it and I saw that call stack. Using 1.1.2. Nothing in the lib/datetime.php has been modified either.

Regardless of the error, I can still do a backup of the files, but when I do a backup of the DB I get whitescreened.

Addition: I am using the 1.1 version of the module.

This also appears above the call stack, I thought I included it: PHP Warning: "date() expects parameter 2 to be long, string given"
« Last Edit: July 23, 2013, 08:41:18 AM by Eclypse ~ Xpert » Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1929


You're welcome.


View Profile WWW
« Reply #6 on: July 23, 2013, 10:19:33 AM »

Not one file was modified. I simply placed them into my modules folder and installed, then went to test it and I saw that call stack. Using 1.1.2. Nothing in the lib/datetime.php has been modified either.

Regardless of the error, I can still do a backup of the files, but when I do a backup of the DB I get whitescreened.

Addition: I am using the 1.1 version of the module.

This also appears above the call stack, I thought I included it: PHP Warning: "date() expects parameter 2 to be long, string given"

And you have backups in your backup folder? What are their files names?
Logged

Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #7 on: July 24, 2013, 12:26:14 PM »

The date call stack is no longer showing after I uninstalled and reinstalled.

But the problem with the DB still persists.

Here is a screenshot: http://prntscr.com/1har66

And this is what happens when I try to do a DB backup (After a few seconds): http://prntscr.com/1harr0

EDIT: Running bits and pieces of the function site_backup_database in RawPHP, everything worked until this:

Code:
$zip = new ZipArchive;
$res = $zip->open($file.'.zip', ZipArchive::CREATE);
if($res === FALSE){
output("`\$Error: Unable to create zip file of database!`0`n");
} else {
$zip->addFromString($filename.'.sql', $db_backup);
$zip->close();
}

And even more specifically, this part is what causes me to white screen:

Code:
else {
$zip->addFromString($filename.'.sql', $db_backup);
$zip->close();
}
« Last Edit: July 24, 2013, 01:10:38 PM by Eclypse ~ Xpert » Logged
MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1752


View Profile
« Reply #8 on: July 24, 2013, 01:43:34 PM »

The sql backup date is 2005 because that's the default date in the settings. What could be done here is a check for this date and then output text saying no sql backup has been performed yet.

Please list the files that you have in the folder you set to save the files to. Smiley
Logged

Check My Modules for the latest versions.
Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #9 on: July 24, 2013, 03:37:41 PM »

I just made a backups folder in /public_html/

http://prntscr.com/1hc2wg
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1929


You're welcome.


View Profile WWW
« Reply #10 on: July 24, 2013, 06:12:57 PM »

The sql backup date is 2005 because that's the default date in the settings. What could be done here is a check for this date and then output text saying no sql backup has been performed yet.

Already done. Wink In v1.1, that is. Check between lines 115 and 125.

The date call stack is no longer showing after I uninstalled and reinstalled.

This is good news! Curious as to why it was doing it in the first place..

But the problem with the DB still persists.

Here is a screenshot: http://prntscr.com/1har66

And this is what happens when I try to do a DB backup (After a few seconds): http://prntscr.com/1harr0

Perhaps your browser doesn't like when codes runs for more than a few seconds.. Since backing up an entire database does take a while.

EDIT: Running bits and pieces of the function site_backup_database in RawPHP, everything worked until this:

Code:
$zip = new ZipArchive;
$res = $zip->open($file.'.zip', ZipArchive::CREATE);
if($res === FALSE){
output("`\$Error: Unable to create zip file of database!`0`n");
} else {
$zip->addFromString($filename.'.sql', $db_backup);
$zip->close();
}

And even more specifically, this part is what causes me to white screen:

Code:
else {
$zip->addFromString($filename.'.sql', $db_backup);
$zip->close();
}

Well, of course it's going to white screen if you just run that! I've tried this four different sites (my public server, test server, and two of my friend's servers), and I haven't had a problem.. Most curious. I'll keep taking a look into it.
Logged

Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #11 on: July 24, 2013, 06:25:59 PM »

The sql backup date is 2005 because that's the default date in the settings. What could be done here is a check for this date and then output text saying no sql backup has been performed yet.

Already done. Wink In v1.1, that is. Check between lines 115 and 125.

The date call stack is no longer showing after I uninstalled and reinstalled.

This is good news! Curious as to why it was doing it in the first place..

But the problem with the DB still persists.

Here is a screenshot: http://prntscr.com/1har66

And this is what happens when I try to do a DB backup (After a few seconds): http://prntscr.com/1harr0

Perhaps your browser doesn't like when codes runs for more than a few seconds.. Since backing up an entire database does take a while.

EDIT: Running bits and pieces of the function site_backup_database in RawPHP, everything worked until this:

Code:
$zip = new ZipArchive;
$res = $zip->open($file.'.zip', ZipArchive::CREATE);
if($res === FALSE){
output("`\$Error: Unable to create zip file of database!`0`n");
} else {
$zip->addFromString($filename.'.sql', $db_backup);
$zip->close();
}

And even more specifically, this part is what causes me to white screen:

Code:
else {
$zip->addFromString($filename.'.sql', $db_backup);
$zip->close();
}

Well, of course it's going to white screen if you just run that! I've tried this four different sites (my public server, test server, and two of my friend's servers), and I haven't had a problem.. Most curious. I'll keep taking a look into it.

No, no. I'm not JUST running that. I ran everything before that, and it was fine, then I added the else { statement where the zip archive should be filled with the data/backup info, and then it whitescreens.

Any way I can increase the waiting times before it whitescreens? Using Chrome atm.

EDIT: Same thing on FF.
« Last Edit: July 24, 2013, 06:27:52 PM by Eclypse ~ Xpert » Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1929


You're welcome.


View Profile WWW
« Reply #12 on: July 25, 2013, 08:34:06 PM »

No, no. I'm not JUST running that. I ran everything before that, and it was fine, then I added the else { statement where the zip archive should be filled with the data/backup info, and then it whitescreens.

Any way I can increase the waiting times before it whitescreens? Using Chrome atm.

EDIT: Same thing on FF.

Try just commenting out the line with the addFromString() function. Then see if your site still white-pages. It won't fill out the info in the SQL Backup file while it's commented out, though.

If the problem is the addFromString() function, I can always try using addFile() like the files backup, by writing the SQL backup info to an actual file, adding that file to the ZIP, then deleting it.
Logged

Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #13 on: July 26, 2013, 12:43:47 AM »

Same thing..

I've been googling all over the place and found this: http://stackoverflow.com/questions/6970317/uploading-100kb-zip-files-gives-an-internal-server-error
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1929


You're welcome.


View Profile WWW
« Reply #14 on: July 26, 2013, 12:48:48 AM »

Same thing..

I've been googling all over the place and found this: http://stackoverflow.com/questions/6970317/uploading-100kb-zip-files-gives-an-internal-server-error

I doubt it's this. 1) Removing the addFromString() will result in a ZIP file of 0KB, since you're not adding anything to it. 2) You were able to create a ZIP file of over 20 MB for your files (as shown from one of your screenshots you posted).
Logged

Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
96 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search