Adminer plugin - dump to server / dump-save-server.php

/** Dump to file
* @author Jakub Kluvánek,
* @license Apache License, Version 2.0
* @license GNU General Public License, version 2 (one or other)
*	For example when you want to do automated dumps of some databases with selenium. Selenium can't control the download dialog.
*	Just set the desired path where you want to save dump in constructor of this plugin.
*	#1 - other than sql formats shows the download dialog
class AdminerDumpSaveServer {
	/** @access protected */
	var $dir;
	var $fileName;
	function AdminerDumpSaveServer($dir = NULL)
		$this->dir = $dir;

	function dumpOutput() {
		return array('server' => 'Server');

	function _save($string, $state) {
		if($_POST['output'] == 'server')

			$file = $this->dir.$this->fileName;
			file_put_contents($file, $string);
			return "";
	function dumpHeaders($identifier, $multi_table = false) {
		if($_POST['output'] == 'server')
			$this->fileName = "$identifier." . ($multi_table && ereg("[ct]sv", $_POST["format"]) ? 'tar' : $_POST["format"]);
			ob_start(array($this, '_save'));
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.