vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Administrative and Maintenance Tools - vB Database Backup Pro (Lite) for vb 3.6 (https://vborg.vbsupport.ru/showthread.php?t=126925)

Paul M 06-11-2007 09:56 PM

Yes, you may post them in this thread.

Mecho 06-12-2007 03:07 PM

Thanks .. works like a charm in vb 3.6.7 PL1 .

just 2 questions :

1 - it took a backup Table by Table . i mean it gave me many files not just one .SQL file , is it right ?

2 - for the next day is it anyway that new backup will save and overwrite to last one ??

Thanks

Paul M 06-12-2007 03:23 PM

1. By default yes - you can change that in the config file.

2. No, each backup is kept (they are dated).

Deimos 06-12-2007 03:27 PM

Because I do more than one backup a day, I changed the file saving format, so it saves it by year/month/day/hour/minute

So in mysqlbackupconfig.php, on the line which reads..

$backup['DATE']

I changed it to

Code:

$backup['DATE'] = 'Y-m-d-G-i';  // Backup file date format
To add remote server backup ability, my coder added this in the mysqlbackup.php file

Below this:

Code:

                        // Unlock Tables
                        if ($this->LOCK)
                        {
                                $this->MYSQL->query($unlock);
                        }
                }
        }

Add this:

Code:

        /* ------------- Remote FTP backup - added 6.11.07 ------ */
       
        //If you want to move or replicate the folder hierarchy from your current server to another remote server. Then this will be helpful as this will browse the current server's directory and at the same time it will copy that file in the remote server in the same directory.

//This script will copy all the files from this directory and subdirectory to another remote server via FTP
// Source: http://us2.php.net/ftp

function remoteBackup() {

function rec_copy ($source_path, $destination_path, $con)
{
    ftp_mkdir($con, $destination_path);
    ftp_site($con, 'CHMOD 0777 '.$destination_path);
    ftp_chdir($con,$destination_path);

    if (is_dir($source_path))
    {
        chdir($source_path);
        $handle=opendir('.');
        while (($file = readdir($handle))!==false)
        {
            if (($file != ".") && ($file != ".."))
            {
                if (is_dir($file))
                {
                    // choose only the current backup folder
        if($file != "propertyimages")
                    {
                        rec_copy ($source_path."/".$file, $file, $con);
                        chdir($source_path);
                        ftp_cdup($con);
                    }
                }
                if (is_file($file))
                {
                    $fp = fopen($file,"r");
                    // this will convert spaces to '_' so that it will not throw error.  -- VK
                    ftp_fput ($con, str_replace(" ", "_", $file), $fp,FTP_BINARY);
                    ftp_site($con, 'CHMOD 0755 '.str_replace(" ", "_", $file));
                }
            }
        }
        closedir($handle);
    }
}

// make a FTP connection********************************** ADAM CHANGE THESE 2 LINES *********************************************************************************
$con = ftp_connect("XX.XX.XX.XX",21);
$login_result = ftp_login($con,"USERNAME","PASSWORD"); 

// this is the root path for the remote server ********************
$rootpath = "/"; 

// this is the physical path of the source directory. actually u can also use the relative path. -- VK
$sourcepath = realpath("/XXXX/XXXX/XXXX");

// this directory name will only change the top most directory and not the inner one -- VK
$destination_dir_name = "XXXX/";

rec_copy ($sourcepath, $destination_dir_name, $con);
if (function_exists("ftp_close"))
{
    ftp_close($con);
}

}
/* -------------- END FTP Remote Backup ----------------------*/

You need to change the "USERNAME" and "PASSWORD" bit
Additionally, you need to set the correct IP/hostname and the paths.

So far for me, it's working a treat
I've got it running every 3 hours to backup my database, gzip it, then ftp it to the server.

Note: You will get a warning when the backup completes that the destination directory already exists
I haven't fixed that bit yet

BadgerDog 06-13-2007 02:29 PM

Ok, installed... I install all of Paul's mods... really nice programming... :)

Set it for 4:00am EST daily as I don't think there's a lot of folks up around those times, at least in North America.... ;)

Did a "Run Now" and it completed successfully..... :up:

It created a nicely dated backup directory of files in a safe area...

Thanks Paul... I'll sleep better knowing I'm no more than 24 hours out of date if I have a systems failure that needs recovery.

Regards,
Badger

Chadi 06-14-2007 03:03 AM

Getting this error:

An error occured during the MySQL backup. Details (Could not open Destination SQL file for writing.)

Does it have to do with this?

$backup['COMMAND'] = 'exec'; // exec, system or passthru

I have exec disabled in php functions for security. Is there a workaround?

Paul M 06-14-2007 07:02 AM

If you have exec disabled then all you can do is try the other two (system,passthru). ATM you have disabled the mods ability to create/modify/delete files & folders so it obviously isn't going to work (tbh, disabling exec seems a bit of overkill to me).

Chadi 06-14-2007 10:48 AM

I'm stilling getting the same error even after enabling exec

An error occured during the MySQL backup. Details (Could not open Destination SQL file for writing.)


My config file for the mod is:

Code:

<?php

/*
  Auto-Backup for vb 3.6 - Paul M - v 2.12
  This version is adapted from the original vb 3.0 Hack by Trigunflame.
*/

  //  Forum Shutdown System
  $backup['SHUTDOWN'] = 1;
  $backup['MESSAGE'] = "The Forum is closed because a database backup is in progress.";

  // File Saving Information
  $backup['DATE'] = 'Y-m-d';  // Backup file date format
  $backup['PREFIX']    = 'Live-';  // Backup file prefix
  $backup['DUMP_PATH']    = '/private/';  // Path to backups folder, with trailing slash

  // Backup Options
  $backup['LOCK'] = 0; // Lock tables during dump
  $backup['REPAIR']    = 0; // Repair & Optimize tables before dump

  // Backup Type To Use
  $backup['TYPE'] = 2; // 1 = Only specified tables, 2 = All except specified tables
  $backup['TABLES']    = array(); // Table List - e.g. array('table1', 'table2')

  // Combine Tables into one file
  $backup['COMBINE'] = 0; 

  // Backup Optimizations
  $backup['MYSQL4']    = 1; // Set to 1 if you are using MySQL4
  $backup['INNODB'] = 0; // Set to 1 if you have Innodb Tables
  $backup['LOCKTABLES'] = 0; // Adds Lock commands to the backup file

  // Execution Function
  $backup['COMMAND'] = 'exec'; // exec, system or passthru

?>


djbaxter 06-14-2007 11:21 AM

The majority of those "Could not open Destination SQL file for writing" errors are due to permissions being incorrectly set for the destination folder and/or an incorrect path to the destination folder.

Paul M 06-14-2007 11:29 AM

I doubt that path is correct, unless you have a folder called private on the root of your server.

Chadi 06-14-2007 04:59 PM

I'm still getting the same error even after setting the path in full (/home/username/public_html/foldername) and permissions to 755.

djbaxter 06-14-2007 05:34 PM

Quote:

Originally Posted by chadi (Post 1268504)
I'm still getting the same error even after setting the path in full (/home/username/public_html/foldername) and permissions to 755.

1. check with your host - that may not be the correct path

2. the permissions must be 777, NOT 755

Paul M 06-14-2007 05:50 PM

Also check that you don't have any open_basdir restrictions in php stopping you.

Chadi 06-14-2007 07:46 PM

I do not have that enabled and I followed everything.

What else could be the problem?

Paul M 06-14-2007 08:40 PM

No idea, you have a permission problem on your server somewhere, there is not much we can tell you. I would suggest speaking to your host.

djbaxter 06-15-2007 12:57 AM

Quote:

Originally Posted by chadi (Post 1268588)
I do not have that enabled and I followed everything.

What else could be the problem?

See above.

1. If you entered the path exactly as you posted here, it is almost certainly wrong.

2. If you set the permissions to 755, the directory is NOT write-enabled and this add-on will not work. It must be set to 777.

Chadi 06-15-2007 03:33 PM

Thanks. Out of curiosity is there a swift and rather convenient way to restore the databases (or certain portions) via admincp?

I see the sql files are done per table, which is great but what is the proper way to restore these, aside phpmyadmin?

BadgerDog 06-15-2007 07:01 PM

Quote:

Originally Posted by chadi (Post 1269107)
Thanks. Out of curiosity is there a swift and rather convenient way to restore the databases (or certain portions) via admincp?

I see the sql files are done per table, which is great but what is the proper way to restore these, aside phpmyadmin?

It would be great to have a mod (or instructions) on how to restore what has been backed up with this mod.... :up:

Regards,
Badger

santimariani 06-21-2007 07:02 PM

So after changing my host, I was finally able to get this mod to work. Horrah! However, I found something peculiar...

The backup is happening randomly during the day, even though I set it up for it to happen at 4:00 in the morning. I noticed it today when using my forum at around 12:00 pm and noticing that a backup was in progress. Here are the times that the backup folders were created:

06-16-2007 19:05
06-17-2007 15:32
06-18-2007 11:23
06-19-2007 12:40
06-20-2007 11:19
06-21-2007 9:10

Any ideas? Thanks in advance.

Paul M 06-21-2007 07:49 PM

You're not getting enough visitors to trigger all your cron jobs.

santimariani 06-21-2007 10:10 PM

Quote:

Originally Posted by Paul M (Post 1273483)
You're not getting enough visitors to trigger all your cron jobs.

Paul,

Could you elaborate a bit further or point me to a topic that does? I did not know that I needed visitors to trigger cron jobs. How many visitors do I need?

Mecho 06-22-2007 12:04 PM

Quote:

Originally Posted by Paul M (Post 1266988)
1. By default yes - you can change that in the config file.

Would u plz tell me how can i set the Config file to get just a one .SQL backup file, instead of table by table ...

also what is ur suggestion ?? which one is better ( 1 file or table by table ) ?

Thanks in Advance

princeedward 06-22-2007 12:04 PM

thanks for this....it might very useful or help for me.....wonderful mod....million thanks...;)

Paul M 06-22-2007 04:13 PM

Quote:

Originally Posted by Mecho (Post 1273876)
Would u plz tell me how can i set the Config file to get just a one .SQL backup file, instead of table by table ...

Why not read the config file, since it tells you.

Quote:

Originally Posted by Mecho (Post 1273876)
also what is ur suggestion ?? which one is better ( 1 file or table by table ) ?

Neither is really better, it's personal choice and dependant on how you intend to use them.

Quote:

Originally Posted by santimariani (Post 1273565)
I did not know that I needed visitors to trigger cron jobs. How many visitors do I need?


http://www.vbulletin.com/docs/html/m...ed_tasks_intro

santimariani 06-23-2007 10:00 PM

Paul,

Thanks for the help. I now realize I should set up the task at a time when I will actually have some users, and not when I don't expect there to be any.

Chadi 06-24-2007 04:47 PM

Quote:

Originally Posted by chadi (Post 1269107)
Thanks. Out of curiosity is there a swift and rather convenient way to restore the databases (or certain portions) via admincp?

I see the sql files are done per table, which is great but what is the proper way to restore these, aside phpmyadmin?

Just curious if you plan on adding this feature. Thanks Paul.

BadgerDog 06-24-2007 05:05 PM

Quote:

Originally Posted by chadi (Post 1275517)
Just curious if you plan on adding this feature. Thanks Paul.

I second that.... :up:

Beautifully written to back us up, but I'd live to be able to do a general restore in case of crisis as easily. I know nothing about tables etc, s it would sure help to be able to do this for laymen like me.

Thanks for your work Paul.... :)

Always appreciated....

Regards,
Badger

Paul M 06-24-2007 06:00 PM

I think this line in the main post covers your question :)

Quote:

Notes:
* I will not add anything new to this, or spend vast amounts of time supporting it.

Evaporate 07-04-2007 08:50 PM

Quote:

Originally Posted by Paul M (Post 1275565)
I think this line in the main post covers your question :)

Beats me why this sort of stuff isn't default. I converted from SMF (sorry for swearing, which generally was rubbish compared to VB) . However from the admin panel I could one click bakcup or restore. Brilliant really. I want admins to be able to backup in my abscence but don;t want to give them access to my ISP cpanel etc.

This should really be out of the box stuff. Please please incorporate this sort of feature natively.

Pure Dope 07-08-2007 07:56 AM

Doing a test restore.....

root@www1 [/home/allsexre/backups/2007-07-08]# mysql -umyun -pmypw mydb < Live-2007-07-08-full-backup.sql
ERROR 1064 (42000) at line 24395714: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1812' at line 1
root@www1 [/home/allsexre/backups/2007-07-08]#

Anyone maybe know why? Is there a different way I could import this db?

Paul M 07-08-2007 05:12 PM

Once you are connected to mysql in SSH ;

Code:

use mydatabase
then

Code:

source Live-2007-07-08-full-backup.sql

Mecho 07-10-2007 05:15 PM

Paul i couldnt find how can i make database as a just one file . i read config file but i couldnt find it . would u plz tell me what exactly i have to do for make backup just one file ??

thanks

McCarroll21 07-10-2007 05:23 PM

Quote:

Originally Posted by Mecho (Post 1287738)
Paul i couldnt find how can i make database as a just one file . i read config file but i couldnt find it . would u plz tell me what exactly i have to do for make backup just one file ??

thanks

In the mysqlbackupconfig.php file, change this:
PHP Code:

$backup['COMBINE'] = 0

to this:
PHP Code:

$backup['COMBINE'] = 1


Paul M 07-10-2007 09:49 PM

Quote:

Originally Posted by Mecho (Post 1287738)
Paul i couldnt find how can i make database as a just one file . i read config file but i couldnt find it . would u plz tell me what exactly i have to do for make backup just one file ??

You read the whole config file ?

The comment for the setting seems obvious to me - please can you explain why it isn't - because you're not the first person to ask, and I really don't understand why.

Quote:

// Combine Tables into one file
$backup['COMBINE'] = 0;

Mecho 07-11-2007 12:14 PM

yea u right . maybe the reason was my bad English or ..

thanks anyway for ur help

BadgerDog 07-11-2007 10:09 PM

Anyone?

I've been backing up religiously using this mod, then manually deleting any backups that were older than 7 days. I've been using "Combine=0" and ending up with many many files.

What would be the advantage (if any) to going to a single file backup with "Combine=1"?

Second, is there a web site, or anywhere I can go to learn how I would restore my database, in either form?

Thanks

Regards,
Badger

Paul M 07-12-2007 07:39 AM

The advantage of single files is you can restore a single table if required. The disadvantage is you need to join them if you want to restore everything in one go. It's personal choice.

Distance 07-12-2007 07:50 AM

You should add how to combine the files in your first post Paul :)

Distance

Paul M 07-12-2007 11:20 AM

Quote:

Originally Posted by Distance (Post 1288993)
You should add how to combine the files in your first post Paul :)

That's entirely dependant on your OS - and I draw the line at teaching people how to use their Operating System. :)

Zidane007nl 07-12-2007 03:03 PM

Thanks for releasing this mod. It works like a charm.


All times are GMT. The time now is 07:24 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02607 seconds
  • Memory Usage 1,850KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (2)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete