Commits

Jakub Kluvánek committed 11cde2a

first commit

Comments (0)

Files changed (1)

dump-save-server.php

+<?php
+/** Dump to file
+* @author Jakub Kluvánek, kluvanek@gmail.com
+* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
+* 
+*	USAGE:
+*	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.
+*
+*	BUGS:
+*	#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')
+		{
+			header_remove('Content-Disposition');
+			header_remove('Content-Type');
+
+			$file = $this->dir.$this->fileName;
+			file_put_contents($file, $string);
+			ob_end_clean();
+			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 ProjectModifiedEvent.java.
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.