<?php

use Ifsnop\Mysqldump as IMysqldump;


/**
 * Get database dump of the current WP installation
 */
function wpdav_get_database_dump(){

    ob_start();

    $connection_string = 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME;

    $dump = new IMysqldump\Mysqldump( $connection_string, DB_USER, DB_PASSWORD, [
        'compress' => IMysqldump\Mysqldump::NONE
    ] );
    
    $dump->start('php://output');

    $dump = ob_get_contents();
    ob_end_clean();

    return $dump;

}
