public
Last active

  • Download Gist
adminer_dump.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
<?php
define('DUMP_FILENAME', 'dump.sql');
define('SERVER', 'localhost');
define('USERNAME', 'ODBC');
define('PASSWORD', '');
define('DB', 'software');
define('ADMINER_ROOT', 'adminer/');
 
function adminer_object() {
class AdminerDump extends Adminer {
function credentials() {
return array(SERVER, USERNAME, PASSWORD);
}
}
return new AdminerDump;
}
 
function save_output($buffer) {
file_put_contents(DUMP_FILENAME, $buffer, FILE_APPEND);
}
 
error_reporting(E_ALL & ~E_NOTICE);
include ADMINER_ROOT . "adminer/include/functions.inc.php";
include ADMINER_ROOT . "adminer/include/lang.inc.php";
include ADMINER_ROOT . "adminer/include/pdo.inc.php";
include ADMINER_ROOT . "adminer/include/driver.inc.php";
include ADMINER_ROOT . "adminer/drivers/mysql.inc.php";
include ADMINER_ROOT . "adminer/include/adminer.inc.php";
include ADMINER_ROOT . "adminer/include/editing.inc.php";
 
$connection = connect();
$connection->select_db(DB);
$tables = tables_list();
 
$_POST = array(
'output' => 'text',
'format' => 'sql',
'table_style' => 'CREATE',
'data_style' => 'INSERT',
'tables' => array_keys($tables),
'data' => array_keys($tables),
);
 
file_put_contents(DUMP_FILENAME, '');
ob_start('save_output', 1e6);
include ADMINER_ROOT . "adminer/dump.inc.php";

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.