Events (MySQL 5.1)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@473 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
7022ab930f
commit
ff97ef97ba
|
@ -9,7 +9,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.7.1-dev"; ?></title>
|
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.8.0-dev"; ?></title>
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||||
<link rel="stylesheet" type="text/css" href="default.css" /><?php // Ondrej Valka, http://valka.info ?>
|
<link rel="stylesheet" type="text/css" href="default.css" /><?php // Ondrej Valka, http://valka.info ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
17
dump.inc.php
17
dump.inc.php
|
@ -33,21 +33,24 @@ if ($_POST) {
|
||||||
}
|
}
|
||||||
if ($style && $_POST["format"] != "csv") {
|
if ($style && $_POST["format"] != "csv") {
|
||||||
echo "USE " . idf_escape($db) . ";\n\n";
|
echo "USE " . idf_escape($db) . ";\n\n";
|
||||||
if ($mysql->server_info >= 5) {
|
|
||||||
$out = "";
|
$out = "";
|
||||||
|
if ($mysql->server_info >= 5) {
|
||||||
foreach (array("FUNCTION", "PROCEDURE") as $routine) {
|
foreach (array("FUNCTION", "PROCEDURE") as $routine) {
|
||||||
$result = $mysql->query("SHOW $routine STATUS WHERE Db = '" . $mysql->escape_string($db) . "'");
|
$result = $mysql->query("SHOW $routine STATUS WHERE Db = '" . $mysql->escape_string($db) . "'");
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
if (!$out) {
|
$out .= $mysql->result($mysql->query("SHOW CREATE $routine " . idf_escape($row["Name"])), 2) . ";;\n\n";
|
||||||
echo "DELIMITER ;;\n\n";
|
|
||||||
$out = "DELIMITER ;\n\n";
|
|
||||||
}
|
|
||||||
echo $mysql->result($mysql->query("SHOW CREATE $routine " . idf_escape($row["Name"])), 2) . ";;\n\n";
|
|
||||||
}
|
}
|
||||||
$result->free();
|
$result->free();
|
||||||
}
|
}
|
||||||
echo $out;
|
|
||||||
}
|
}
|
||||||
|
if ($mysql->server_info >= 5.1) {
|
||||||
|
$result = $mysql->query("SHOW EVENTS");
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
$out .= $mysql->result($mysql->query("SHOW CREATE EVENT " . idf_escape($row["Name"])), 1) . ";;\n\n";
|
||||||
|
}
|
||||||
|
$result->free();
|
||||||
|
}
|
||||||
|
echo ($out ? "DELIMITER ;;\n\n$out" . "DELIMITER ;\n\n" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($style || strlen($_GET["db"])) && (array_filter($_POST["tables"]) || array_filter($_POST["data"]))) {
|
if (($style || strlen($_GET["db"])) && (array_filter($_POST["tables"]) || array_filter($_POST["data"]))) {
|
||||||
|
|
41
event.inc.php
Normal file
41
event.inc.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
$intervals = array("YEAR", "QUARTER", "MONTH", "DAY", "HOUR", "MINUTE", "WEEK", "SECOND", "YEAR_MONTH", "DAY_HOUR", "DAY_MINUTE", "DAY_SECOND", "HOUR_MINUTE", "HOUR_SECOND", "MINUTE_SECOND");
|
||||||
|
|
||||||
|
if ($_POST && !$error) {
|
||||||
|
if ($_POST["drop"]) {
|
||||||
|
if ($mysql->query("DROP EVENT " . idf_escape($_GET["event"]))) {
|
||||||
|
redirect(substr($SELF, 0, -1), lang('Event has been dropped.'));
|
||||||
|
}
|
||||||
|
} elseif (in_array($_POST["INTERVAL_FIELD"], $intervals)) {
|
||||||
|
$schedule = " ON SCHEDULE " . ($_POST["INTERVAL_VALUE"] ? "EVERY '" . $mysql->escape_string($_POST["INTERVAL_VALUE"]) . "' $_POST[INTERVAL_FIELD]" : "AT '" . $mysql->escape_string($_POST["EXECUTE_AT"]) . "'");
|
||||||
|
if ($mysql->query((strlen($_GET["event"]) ? "ALTER EVENT " . idf_escape($_GET["event"]) . $schedule . ($_GET["event"] != $_POST["EVENT_NAME"] ? " RENAME TO " . idf_escape($_POST["EVENT_NAME"]) : "") : "CREATE EVENT " . idf_escape($_POST["EVENT_NAME"]) . $schedule) . " DO $_POST[EVENT_DEFINITION]")) {
|
||||||
|
redirect(substr($SELF, 0, -1), (strlen($_GET["event"]) ? lang('Event has been altered.') : lang('Event has been created.')));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$error = $mysql->error;
|
||||||
|
}
|
||||||
|
page_header((strlen($_GET["event"]) ? lang('Alter event') . ": " . htmlspecialchars($_GET["event"]) : lang('Create event')), $error);
|
||||||
|
|
||||||
|
$row = array();
|
||||||
|
if ($_POST) {
|
||||||
|
$row = $_POST;
|
||||||
|
} elseif (strlen($_GET["event"])) {
|
||||||
|
$result = $mysql->query("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = '" . $mysql->escape_string($_GET["db"]) . "' AND EVENT_NAME = '" . $mysql->escape_string($_GET["event"]) . "'");
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
$result->free();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<form action="" method="post">
|
||||||
|
<table border="0" cellspacing="0" cellpadding="2">
|
||||||
|
<tr><th><?php echo lang('Name'); ?></th><td><input name="EVENT_NAME" value="<?php echo htmlspecialchars($row["EVENT_NAME"]); ?>" maxlength="64" /></td></tr>
|
||||||
|
<tr><th><?php echo lang('At given time'); ?></th><td><input name="EXECUTE_AT" value="<?php echo htmlspecialchars($row["EXECUTE_AT"]); ?>" /></td></tr>
|
||||||
|
<tr><th><?php echo lang('Every'); ?></th><td><input name="INTERVAL_VALUE" value="<?php echo htmlspecialchars($row["INTERVAL_VALUE"]); ?>" /> <select name="INTERVAL_FIELD"><?php echo optionlist($intervals, $row["INTERVAL_FIELD"]); ?></select></td></tr>
|
||||||
|
</table>
|
||||||
|
<p><textarea name="EVENT_DEFINITION" rows="10" cols="80" style="width: 98%;"><?php echo htmlspecialchars($row["EVENT_DEFINITION"]); ?></textarea></p>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="token" value="<?php echo $token; ?>" />
|
||||||
|
<input type="submit" value="<?php echo lang('Save'); ?>" />
|
||||||
|
<?php if (strlen($_GET["event"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>" onclick="return confirm('<?php echo lang('Are you sure?'); ?>');" /><?php } ?>
|
||||||
|
</p>
|
||||||
|
</form>
|
20
index.php
20
index.php
|
@ -105,6 +105,8 @@ if (isset($_GET["download"])) {
|
||||||
include "./foreign.inc.php";
|
include "./foreign.inc.php";
|
||||||
} elseif (isset($_GET["createv"])) {
|
} elseif (isset($_GET["createv"])) {
|
||||||
include "./createv.inc.php";
|
include "./createv.inc.php";
|
||||||
|
} elseif (isset($_GET["event"])) {
|
||||||
|
include "./event.inc.php";
|
||||||
} elseif (isset($_GET["procedure"])) {
|
} elseif (isset($_GET["procedure"])) {
|
||||||
include "./procedure.inc.php";
|
include "./procedure.inc.php";
|
||||||
} elseif (isset($_GET["trigger"])) {
|
} elseif (isset($_GET["trigger"])) {
|
||||||
|
@ -138,6 +140,24 @@ if (isset($_GET["download"])) {
|
||||||
$result->free();
|
$result->free();
|
||||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'procedure=">' . lang('Create procedure') . '</a> <a href="' . htmlspecialchars($SELF) . 'function=">' . lang('Create function') . "</a></p>\n";
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'procedure=">' . lang('Create procedure') . '</a> <a href="' . htmlspecialchars($SELF) . 'function=">' . lang('Create function') . "</a></p>\n";
|
||||||
}
|
}
|
||||||
|
if ($mysql->server_info >= 5.1) {
|
||||||
|
echo "<h3>" . lang('Events') . "</h3>\n";
|
||||||
|
$result = $mysql->query("SHOW EVENTS");
|
||||||
|
if ($result->num_rows) {
|
||||||
|
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
||||||
|
echo "<thead><tr><th>" . lang('Name') . "</th><td>" . lang('Schedule') . "</td><td>" . lang('Start') . "</td><td>" . lang('End') . "</td></tr></thead>\n";
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo '<th><a href="' . htmlspecialchars($SELF) . 'event=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th>";
|
||||||
|
echo "<td>" . ($row["Execute at"] ? lang('At given time') . "</td><td>" . $row["Execute at"] : lang('Every') . " " . $row["Interval value"] . " " . $row["Interval field"] . "</td><td>$row[Starts]") . "</td>";
|
||||||
|
echo "<td>$row[Ends]</td>";
|
||||||
|
echo "</tr>\n";
|
||||||
|
}
|
||||||
|
echo "</table>\n";
|
||||||
|
}
|
||||||
|
$result->free();
|
||||||
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'event=">' . lang('Create event') . "</a></p>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
page_footer();
|
page_footer();
|
||||||
|
|
|
@ -174,4 +174,15 @@ $translations = array(
|
||||||
'Data' => 'Data',
|
'Data' => 'Data',
|
||||||
'Export selected' => 'Exportovat označené',
|
'Export selected' => 'Exportovat označené',
|
||||||
'Export result' => 'Exportovat výsledek',
|
'Export result' => 'Exportovat výsledek',
|
||||||
|
'Event has been dropped.' => 'Událost byla odstraněna.',
|
||||||
|
'Event has been altered.' => 'Událost byla změněna.',
|
||||||
|
'Event has been created.' => 'Událost byla vytvořena.',
|
||||||
|
'Alter event' => 'Pozměnit událost',
|
||||||
|
'Create event' => 'Vytvořit událost',
|
||||||
|
'At given time' => 'V daný čas',
|
||||||
|
'Every' => 'Každých',
|
||||||
|
'Events' => 'Události',
|
||||||
|
'Schedule' => 'Plán',
|
||||||
|
'Start' => 'Začátek',
|
||||||
|
'End' => 'Konec',
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue