src/sb/PDO/Mysql/Backup.php
protected function dumpDatabases()
    {

        foreach ($this->db->query("SHOW DATABASES") as $list) {
            $database = $list->Database;

            if (!in_array($database, $this->ignore) || preg_match("~_no_backup$~", $database)) {
                $start = microtime(true);

                $dir = $this->dump_dir . '1/';

                $filename = $dir . $database;

                $this->log("Dumping Database: " . $database);
                $command = "mysqldump -u " . $this->db_user . " -h "
                    . $this->db_host . " -p" . $this->db_pass . " "
                    . $database . ">" . $filename . ".sql";

                exec($command);

                $command = "tar -zcvf " . $filename . ".gz " . $filename . ".sql";
                exec($command);
                $ms = round((microtime(true) - $start) * 1000, 2);

                clearstatcache();
                $size = round((filesize($filename . '.gz') / 1024), 2) . 'kb';

                $this->log($list->Database . " was backed up in " . $ms . ' ms and is ' . $size . ' bytes');
                unlink($filename . '.sql');
            }
        }
    }
protected function dumpDatabases()
    {

        foreach ($this->db->query("SHOW DATABASES") as $list) {
            $database = $list->Database;

            if (!in_array($database, $this->ignore) || preg_match("~_no_backup$~", $database)) {
                $start = microtime(true);

                $dir = $this->dump_dir . '1/';

                $filename = $dir . $database;

                $this->log("Dumping Database: " . $database);
                $command = "mysqldump -u " . $this->db_user . " -h "
                    . $this->db_host . " -p" . $this->db_pass . " "
                    . $database . ">" . $filename . ".sql";

                exec($command);

                $command = "tar -zcvf " . $filename . ".gz " . $filename . ".sql";
                exec($command);
                $ms = round((microtime(true) - $start) * 1000, 2);

                clearstatcache();
                $size = round((filesize($filename . '.gz') / 1024), 2) . 'kb';

                $this->log($list->Database . " was backed up in " . $ms . ' ms and is ' . $size . ' bytes');
                unlink($filename . '.sql');
            }
        }
    }
protected function dumpDatabases ( ) { foreach ( $ this -> db -> query ( "SHOW DATABASES" ) as $ list ) { $ database = $ list -> Database ; if ( ! in_array ( $ database , $ this -> ignore ) || preg_match ( "~_no_backup$~" , $ database ) ) { $ start = microtime ( true ) ; $ dir = $ this -> dump_dir . '1/' ; $ filename = $ dir . $ database ; $ this -> log ( "Dumping Database: " . $ database ) ; $ command = "mysqldump -u " . $ this -> db_user . " -h " . $ this -> db_host . " -p" . $ this -> db_pass . " " . $ database . ">" . $ filename . ".sql" ; exec ( $ command ) ; $ command = "tar -zcvf " . $ filename . ".gz " . $ filename . ".sql" ; exec ( $ command ) ; $ ms = round ( ( microtime ( true ) - $ start ) * 1000 , 2 ) ; clearstatcache ( ) ; $ size = round ( ( filesize ( $ filename . '.gz' ) / 1024 ) , 2 ) . 'kb' ; $ this -> log ( $ list -> Database . " was backed up in " . $ ms . ' ms and is ' . $ size . ' bytes' ) ; unlink ( $ filename . '.sql' ) ; } } }
Dump the database files and gzip, add version number
Dump the database files and gzip add version number