Pergunta

I am using this function for getting full backup of my mysql db.

function backup()
        {   


            date_default_timezone_set("Asia/Kolkata");
            $date  = date("d-m-Y, g:i A");

            $folder = "application/backup";

            $prefs = array(
                    'tables'      => array('table1', 'table2')
                                 );


            $backup =& $this->dbutil->backup($prefs);

            write_file("application/backup/backup $date.sql.gz", $backup);


        }

But I need to get the Incremental backup of my mysql database hourly in codeigniter. What are the changes required to this code for getting the incremental backup?.

Foi útil?

Solução

Codeigniter Database Utillity Class doesn't allow you to make a Incremental backup of the database. If you need that you should create a custom library for that. Library should be able to run sql commands. Please read for details about Incremental backup in mysql: http://dev.mysql.com/doc/mysql-enterprise-backup/3.7/en/mysqlbackup.incremental.html

Outras dicas

here, maybe you need to try this one.

ob_start();

// Generage HTML page here
generate_full_html_page();

// All magic goes here
$output = ob_get_clean();
ignore_user_abort(true);
set_time_limit(0);
header("Connection: close");
header("Content-Length: ".strlen($output));
header("Content-Encoding: none");
echo $output.str_repeat(' ', 10000) ."\n\n\n";
flush();

// Now page is sent and it safe to do all needed stuff here
cron_task1();
cron_task2();

i read this interesting technique from http://a32.me/2012/01/do-php-cron-without-cron-available/. may be you can modify your code base on that tutorial.

hopefully help you.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top