0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
marketting
/
system
/
application
/
models
/
[
Home
]
File: backup_model.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------------------------------------------------------------------- | COPYRIGHT NOTICE | Copyright 2008 JROX Technologies, Inc. All Rights Reserved. | ------------------------------------------------------------------------- | This script may be only used and modified in accordance to the license | agreement attached (license.txt) except where expressly noted within | commented areas of the code body. This copyright notice and the | comments above and below must remain intact at all times. By using this | code you agree to indemnify JROX Technologies, Inc, its corporate agents | and affiliates from any liability that might arise from its use. | | Selling the code for this program without prior written consent is | expressly forbidden and in violation of Domestic and International | copyright laws. | | ------------------------------------------------------------------------- | FILENAME - backup_model.php | ------------------------------------------------------------------------- | | This model handles the functions for backing up data | */ class Backup_Model extends Model { function _backup_db() { if (is_writable($this->config->item('sts_backup_path'))) { set_time_limit(0); // Load the DB utility class $this->load->dbutil(); $date = date('m-d-Y'); $prefs = array( 'ignore' => array(), // List of tables to omit from the backup 'format' => 'gzip', // gzip, zip, txt 'filename' => 'mybackup.sql', // File name - NEEDED ONLY WITH ZIP FILES 'add_drop' => TRUE, // Whether to add DROP TABLE statements to backup file 'add_insert' => TRUE, // Whether to add INSERT data to backup file 'newline' => "\n" // Newline character used in backup file ); // Backup your entire database and assign it to a variable $backup =& $this->dbutil->backup($prefs); // Load the file helper and write the file to your server $this->load->helper('file'); if (write_file($this->config->item('sts_backup_path'). $date . '-db-backup.gz', $backup)) { //log error log_message('info', 'database backed up successfully'); return $date . '-db-backup.gz'; } else { //log error log_message('error', 'Could not run database backup'); } } return false; } // ------------------------------------------------------------------------ } ?>