<?php
defined('BASEPATH') or exit('No direct script access allowed');

use Ifsnop\Mysqldump as IMysqldump;

class Sql_dump extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        date_default_timezone_set('Asia/Jakarta');
        try {
            $dump = new IMysqldump\Mysqldump('mysql:host=localhost;dbname=tpcpack_portal', 'tpcpack_portal', 'Hud50n&12ExG3tN!c3');
            $dump->start('./db/db_tpc_'.date('Y-m-d H:i:s').'.sql');
	    echo"backup sukses";
        } catch (\Exception $e) {
            echo 'mysqldump-php error: ' . $e->getMessage();
        }
    }
}
