Add ability to override file name (path) when loading dump from webserver
This commit is contained in:
parent
72aa3c5127
commit
5cc831c1e1
|
@ -850,6 +850,13 @@ class Adminer {
|
||||||
return $ext;
|
return $ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set the path of the file for webserver load
|
||||||
|
* @return string path of the sql dump file
|
||||||
|
*/
|
||||||
|
function importServerPath() {
|
||||||
|
return "adminer.sql";
|
||||||
|
}
|
||||||
|
|
||||||
/** Print homepage
|
/** Print homepage
|
||||||
* @return bool whether to print default homepage
|
* @return bool whether to print default homepage
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,9 +21,10 @@ if (!$error && $_POST) {
|
||||||
if (!isset($_GET["import"])) {
|
if (!isset($_GET["import"])) {
|
||||||
$query = $_POST["query"];
|
$query = $_POST["query"];
|
||||||
} elseif ($_POST["webfile"]) {
|
} elseif ($_POST["webfile"]) {
|
||||||
$fp = @fopen((file_exists("adminer.sql")
|
$sql_file_path = $adminer->importServerPath();
|
||||||
? "adminer.sql"
|
$fp = @fopen((file_exists($sql_file_path)
|
||||||
: "compress.zlib://adminer.sql.gz"
|
? $sql_file_path
|
||||||
|
: "compress.zlib://{$sql_file_path}.gz"
|
||||||
), "rb");
|
), "rb");
|
||||||
$query = ($fp ? fread($fp, 1e6) : false);
|
$query = ($fp ? fread($fp, 1e6) : false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -220,7 +221,7 @@ if (!isset($_GET["import"])) {
|
||||||
);
|
);
|
||||||
echo "</div></fieldset>\n";
|
echo "</div></fieldset>\n";
|
||||||
echo "<fieldset><legend>" . lang('From server') . "</legend><div>";
|
echo "<fieldset><legend>" . lang('From server') . "</legend><div>";
|
||||||
echo lang('Webserver file %s', "<code>adminer.sql" . (extension_loaded("zlib") ? "[.gz]" : "") . "</code>");
|
echo lang('Webserver file %s', "<code>" . h($adminer->importServerPath()) . (extension_loaded("zlib") ? "[.gz]" : "") . "</code>");
|
||||||
echo ' <input type="submit" name="webfile" value="' . lang('Run file') . '">';
|
echo ' <input type="submit" name="webfile" value="' . lang('Run file') . '">';
|
||||||
echo "</div></fieldset>\n";
|
echo "</div></fieldset>\n";
|
||||||
echo "<p>";
|
echo "<p>";
|
||||||
|
|
|
@ -549,6 +549,9 @@ qsl('div').onclick = whisperClick;", "")
|
||||||
return $ext;
|
return $ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function importServerPath() {
|
||||||
|
}
|
||||||
|
|
||||||
function homepage() {
|
function homepage() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,6 +347,11 @@ class AdminerPlugin extends Adminer {
|
||||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function importServerPath() {
|
||||||
|
$args = func_get_args();
|
||||||
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
|
}
|
||||||
|
|
||||||
function homepage() {
|
function homepage() {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
|
|
Loading…
Reference in a new issue