Translation update done using Pootle.
[phpmyadmin/ammaryasirr.git] / server_binlog.php
blob1b5545290ad2e74342df06ffaeb0c19680da1cca
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * display the binary logs and the content of the selected
6 * @package phpMyAdmin
7 */
9 /**
12 require_once './libraries/common.inc.php';
14 /**
15 * Does the common work, provides $binary_logs
17 require_once './libraries/server_common.inc.php';
19 /**
20 * Displays the links
22 require_once './libraries/server_links.inc.php';
24 $url_params = array();
26 /**
27 * Need to find the real end of rows?
29 if (! isset($_REQUEST['pos'])) {
30 $pos = 0;
31 } else {
32 /* We need this to be a integer */
33 $pos = (int) $_REQUEST['pos'];
36 if (! isset($_REQUEST['log']) || ! array_key_exists($_REQUEST['log'], $binary_logs)) {
37 $_REQUEST['log'] = '';
38 } else {
39 $url_params['log'] = $_REQUEST['log'];
42 $sql_query = 'SHOW BINLOG EVENTS';
43 if (! empty($_REQUEST['log'])) {
44 $sql_query .= ' IN \'' . $_REQUEST['log'] . '\'';
46 if ($GLOBALS['cfg']['MaxRows'] !== 'all') {
47 $sql_query .= ' LIMIT ' . $pos . ', ' . (int) $GLOBALS['cfg']['MaxRows'];
50 /**
51 * Sends the query
53 $result = PMA_DBI_query($sql_query);
55 /**
56 * prepare some vars for displaying the result table
58 // Gets the list of fields properties
59 if (isset($result) && $result) {
60 $num_rows = PMA_DBI_num_rows($result);
61 } else {
62 $num_rows = 0;
65 if (empty($_REQUEST['dontlimitchars'])) {
66 $dontlimitchars = false;
67 } else {
68 $dontlimitchars = true;
69 $url_params['dontlimitchars'] = 1;
72 /**
73 * Displays the sub-page heading
75 echo '<h2>' . "\n"
76 . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="themes/dot.gif" class="icon ic_s_tbl" alt="" />' : '')
77 . ' ' . __('Binary log') . "\n"
78 . '</h2>' . "\n";
80 /**
81 * Display log selector.
83 if (count($binary_logs) > 1) {
84 echo '<form action="server_binlog.php" method="get">';
85 echo PMA_generate_common_hidden_inputs($url_params);
86 echo '<fieldset><legend>';
87 echo __('Select binary log to view');
88 echo '</legend><select name="log">';
89 $full_size = 0;
90 foreach ($binary_logs as $each_log) {
91 echo '<option value="' . $each_log['Log_name'] . '"';
92 if ($each_log['Log_name'] == $_REQUEST['log']) {
93 echo ' selected="selected"';
95 echo '>' . $each_log['Log_name'];
96 if (isset($each_log['File_size'])) {
97 $full_size += $each_log['File_size'];
98 echo ' (' . implode(' ', PMA_formatByteDown($each_log['File_size'], 3, 2)) . ')';
100 echo '</option>';
102 echo '</select> ';
103 echo count($binary_logs) . ' ' . __('Files') . ', ';
104 if ($full_size > 0) {
105 echo implode(' ', PMA_formatByteDown($full_size));
107 echo '</fieldset>';
108 echo '<fieldset class="tblFooters">';
109 echo '<input type="submit" value="' . __('Go') . '" />';
110 echo '</fieldset>';
111 echo '</form>';
114 PMA_showMessage(PMA_Message::success());
117 * Displays the page
120 <table border="0" cellpadding="2" cellspacing="1">
121 <thead>
122 <tr>
123 <td colspan="6" align="center">
124 <?php
125 // we do not now how much rows are in the binlog
126 // so we can just force 'NEXT' button
127 if ($pos > 0) {
128 $this_url_params = $url_params;
129 if ($pos > $GLOBALS['cfg']['MaxRows']) {
130 $this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
133 echo '<a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
134 if ($GLOBALS['cfg']['NavigationBarIconic']) {
135 echo ' title="' . __('Previous') . '">';
136 } else {
137 echo '>' . __('Previous');
138 } // end if... else...
139 echo ' &lt; </a> - ';
142 $this_url_params = $url_params;
143 if ($pos > 0) {
144 $this_url_params['pos'] = $pos;
146 if ($dontlimitchars) {
147 unset($this_url_params['dontlimitchars']);
149 <a href="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
150 title="<?php __('Truncate Shown Queries'); ?>">
151 <img src="<?php echo $pmaThemeImage; ?>s_partialtext.png"
152 alt="<?php echo __('Truncate Shown Queries'); ?>" /></a>
153 <?php
154 } else {
155 $this_url_params['dontlimitchars'] = 1;
157 <a href="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
158 title="<?php __('Show Full Queries'); ?>">
159 <img src="<?php echo $pmaThemeImage; ?>s_fulltext.png"
160 alt="<?php echo __('Show Full Queries'); ?>" /></a>
161 <?php
163 // we do not now how much rows are in the binlog
164 // so we can just force 'NEXT' button
165 if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
166 $this_url_params = $url_params;
167 $this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows'];
168 echo ' - <a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
169 if ($GLOBALS['cfg']['NavigationBarIconic']) {
170 echo ' title="' . __('Next') . '">';
171 } else {
172 echo '>' . __('Next');
173 } // end if... else...
174 echo ' &gt; </a>';
177 </td>
178 </tr>
179 <tr>
180 <th><?php echo __('Log name'); ?></th>
181 <th><?php echo __('Position'); ?></th>
182 <th><?php echo __('Event type'); ?></th>
183 <th><?php echo __('Server ID'); ?></th>
184 <th><?php echo __('Original position'); ?></th>
185 <th><?php echo __('Information'); ?></th>
186 </tr>
187 </thead>
188 <tbody>
189 <?php
190 $odd_row = true;
191 while ($value = PMA_DBI_fetch_assoc($result)) {
192 if (! $dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
193 $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
196 <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
197 <td>&nbsp;<?php echo $value['Log_name']; ?>&nbsp;</td>
198 <td align="right">&nbsp;<?php echo $value['Pos']; ?>&nbsp;</td>
199 <td>&nbsp;<?php echo $value['Event_type']; ?>&nbsp;</td>
200 <td align="right">&nbsp;<?php echo $value['Server_id']; ?>&nbsp;</td>
201 <td align="right">&nbsp;<?php echo isset($value['Orig_log_pos']) ? $value['Orig_log_pos'] : $value['End_log_pos']; ?>&nbsp;</td>
202 <td>&nbsp;<?php echo htmlspecialchars($value['Info']); ?>&nbsp;</td>
203 </tr>
204 <?php
205 $odd_row = !$odd_row;
208 </tbody>
209 </table>
210 <?php
214 * Sends the footer
216 require './libraries/footer.inc.php';