Execute SQL file stored on server disk

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1015 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-08-25 15:58:04 +00:00
parent b349612063
commit b2a7c7ac62
5 changed files with 8 additions and 4 deletions

View file

@ -164,7 +164,7 @@ function get_file($key) {
function upload_error($error) {
$max_size = ($error == UPLOAD_ERR_INI_SIZE ? ini_get("upload_max_filesize") : null); // post_max_size is checked in index.php
return lang('Unable to upload a file.') . ($max_size ? " " . lang('Maximum allowed file size is %sB.', $max_size) : "");
return ($error ? lang('Unable to upload a file.') . ($max_size ? " " . lang('Maximum allowed file size is %sB.', $max_size) : "") : lang('File does not exist.'));
}
function odd($s = ' class="odd"') {

View file

@ -222,4 +222,6 @@ $translations = array(
'Maximum allowed file size is %sB.' => 'Maximální povolená velikost souboru je %sB.',
'Clear' => 'Vyčistit',
'Editor' => 'Editor',
'Webserver file %s' => 'Soubor %s na webovém serveru',
'File does not exist.' => 'Soubor neexistuje.',
);

View file

@ -8,7 +8,7 @@ if (!$error && $_POST["clear"]) {
page_header(lang('SQL command'), $error);
if (!$error && $_POST) {
$query = (isset($_POST["file"]) ? get_file("sql_file") : $_POST["query"]);
$query = ($_POST["webfile"] ? @file_get_contents("adminer.sql") : ($_POST["file"] ? get_file("sql_file") : $_POST["query"]));
if (is_string($query)) { // get_file() returns error as number
$query = str_replace("\r", "", $query); // parser looks for \n
$query = rtrim($query);
@ -109,6 +109,8 @@ if (!ini_get("file_uploads")) {
<input type="submit" name="file" value="<?php echo lang('Run file'); ?>">
<?php } ?>
<p><?php echo lang('Webserver file %s', '<code>adminer.sql</code>'); ?> <input type="submit" name="webfile" value="<?php echo lang('Run file'); ?>">
<?php
if ($history) {
echo "<fieldset><legend>" . lang('History') . "</legend>\n";

View file

@ -1,5 +1,6 @@
Adminer 2.1.0:
Adminer 2.1.0-dev:
Edit default values directly in table creation
Execute SQL file stored on server disk
Display column comments in table overview
Respect max_allowed_packet in CSV import
Click on row selects it

View file

@ -1,5 +1,4 @@
Bulk database drop
Execute SQL file stored on server disk
Print CREATE+ALTER export instead of running it
Add whisperer to fields with foreign key
Highlight found fields