PHP Classes
elePHPant
Icontem

File: backup.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Anish Karim C  >  MySQL Database Backup  >  backup.php  >  Download  
File: backup.php
Role: Example script
Content type: text/plain
Description: Function Invoker
Class: MySQL Database Backup
Backup MySQL databases generating SQL files
Author: By
Last change: Changes with Delete After Send section
Date: 5 years ago
Size: 1,774 bytes
 

Contents

Class file image Download
<?php
/**Developer: Anish Karim C*[thecoderin@gmail.com]***** * * *
***ClassFor: MySQL Database BackUP[backup.php]*********** * * *
***CreatedOn: 19th November 2009**U:3,Dec09****************** * * *
***Details: Configuration data will set to class variables****** * * * C * * *
************** Create an object call************************** * * *
**************Assign Variables and call Function BackUp****** * * *
***Suggestions and Comments are welcome****************** * * *
*/

include_once("mysql.class.inc");
include_once(
"config.php");

$backup = new MyBackUp(); //creating an object of MyBackUp

//SERVER CONFIG
if(!empty($server['host']))
   
$backup->server = $server['host']; //Joining the configuration Server data to class Server variables.
if(!empty($server['port']))
   
$backup->port = $server['port'];
if(!empty(
$server['user']))
   
$backup->usern = $server['user'];

$backup->userp = $server['pass'];
$backup->dbase = $server['database'];

//Mail Config
if(!empty($mailer["FromMail"]))
   
$backup->mailFrom = $mailer["FromMail"];
if(!empty(
$mailer["ToMail"]))
   
$backup->mailTo = $mailer["ToMail"];

   
$backup->body = $mailer["MailBody"];
   
$backup->isDel= $mailer["DAS"];

//FILENAME GENERATION
//UNIQUE FILE NAME GENERATION TO SET ONE BACKUP A DAY. Change the date function to time if you need more than on file per day.
   
$backup->filename = $backUpFolder."/".$server['database']."_".date("Y_M_d").".sql";

//Calling generator Function
if(!$backup->BackUp())
    echo
$backup->error; //On error this function returns back. Error details will be in this variable.

//For more details Please visit: http://is.gd/5b3Xk

?>