Solved

Mysql dump without zip

Posted on 2009-07-15
7
216 Views
Last Modified: 2013-12-13
I have this code from phpMySQLAutoBackup, its working, but I want the dump without the gz (zip).

Someone any idea how to do that?

Thanks

Here is the code I use: (part of the code, but the most important).
// zip the backup and email it
$backup_file_name = 'mysql_'.$db.strftime("_%d_%b_%Y_time_%H_%M_%S.sql",time()).'.gz';
$dump_buffer_not_zipped = $dump_buffer;
$dump_buffer = gzencode($buffer);
if ($from_emailaddress>"") xmail($to_emailaddress,$from_emailaddress, "phpMySQLAutoBackup: $backup_file_name", $dump_buffer, $backup_file_name, $backup_type, $newline);
if ($save_backup_zip_file_to_server) write_backup($dump_buffer_not_zipped, $backup_file_name);
 
//FTP backup file to remote server
if (isset($ftp_username))
{
 //write the backup file to local server ready for transfer if not already done so
 if (!$save_backup_zip_file_to_server) write_backup($dump_buffer, $backup_file_name);
 $transfer_backup = new transfer_backup();
 $transfer_backup->transfer_data($ftp_username,$ftp_password,$ftp_server,$ftp_path,$backup_file_name);
 if (!$save_backup_zip_file_to_server) unlink(LOCATION."../backups/".$backup_file_name);
}
?>

Open in new window

0
Comment
Question by:delphibeginner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 14

Accepted Solution

by:
flob9 earned 50 total points
ID: 24861008
This should work :
<?php
 
//$backup_file_name = 'mysql_'.$db.strftime("_%d_%b_%Y_time_%H_%M_%S.sql",time()).'.gz';
$backup_file_name_not_zipped = 'mysql_'.$db.strftime("_%d_%b_%Y_time_%H_%M_%S.sql",time()).'.sql';
$dump_buffer_not_zipped = $dump_buffer;
//$dump_buffer = gzencode($buffer);
if ($from_emailaddress>"") xmail($to_emailaddress,$from_emailaddress, "phpMySQLAutoBackup: $backup_file_name_not_zipped", $dump_buffer_not_zipped, $backup_file_name_not_zipped, $backup_type, $newline);
if ($save_backup_zip_file_to_server) write_backup($dump_buffer_not_zipped, $backup_file_name_not_zipped);
 
//FTP backup file to remote server
if (isset($ftp_username))
{
 //write the backup file to local server ready for transfer if not already done so
 if (!$save_backup_zip_file_to_server) write_backup($dump_buffer_not_zipped, $backup_file_name_not_zipped);
 $transfer_backup = new transfer_backup();
 $transfer_backup->transfer_data($ftp_username,$ftp_password,$ftp_server,$ftp_path,$backup_file_name_not_zipped);
 if (!$save_backup_zip_file_to_server) unlink(LOCATION."../backups/".$backup_file_name_not_zipped);
}
?>

Open in new window

0
 
LVL 14

Expert Comment

by:flob9
ID: 24861024
sorry double sql extension line 4 :

$backup_file_name_not_zipped = 'mysql_'.$db.strftime("_%d_%b_%Y_time_%H_%M_%S.sql",time());
0
 
LVL 1

Author Comment

by:delphibeginner
ID: 24861816
Thanks for the reply.

The problem now is that the size is 0.

When it's being zipped its a couple of kb's.

Why?
0
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 
LVL 1

Author Comment

by:delphibeginner
ID: 24861863
Found it.

The line:
$dump_buffer_not_zipped = $dump_buffer;

Needed to be:
$dump_buffer_not_zipped = $buffer;

Because $buffer is used in an other file, my bad didn't said that.
0
 
LVL 14

Expert Comment

by:flob9
ID: 24862064
Oh, sorry.
0
 
LVL 1

Author Closing Comment

by:delphibeginner
ID: 31603820
Many thanks
0
 
LVL 1

Author Comment

by:delphibeginner
ID: 24862414
Dont worry, I'll reward you the points
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Dynamic Table mySQL stored procedure 5 64
How do I speed up this PDO query 4 41
PHP substring 3 54
Position image fpdf 4 19
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question