2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * display the binary logs and the content of the selected
6 * @uses $cfg['MainPageIconic']
7 * @uses $cfg['NavigationBarIconic']
8 * @uses $cfg['MaxRows']
9 * @uses $cfg['LimitChars']
10 * @uses $pmaThemeImage
11 * @uses __('Binary log')
13 * @uses __('Truncate Shown Queries')
14 * @uses __('Show Full Queries')
15 * @uses __('Log name')
16 * @uses __('Position')
17 * @uses __('Event type')
18 * @uses __('Server ID')
19 * @uses __('Original position')
20 * @uses __('Information')
22 * @uses __('Previous')
25 * @uses PMA_generate_common_hidden_inputs()
26 * @uses PMA_generate_common_url()
27 * @uses PMA_formatByteDown()
28 * @uses PMA_DBI_fetch_assoc()
31 * @uses $_REQUEST['pos']
32 * @uses $_REQUEST['log']
33 * @uses $_REQUEST['dontlimitchars']
35 * @uses array_key_exists()
37 * @uses htmlspecialchars()
45 require_once './libraries/common.inc.php';
48 * Does the common work, provides $binary_logs
50 require_once './libraries/server_common.inc.php';
55 require_once './libraries/server_links.inc.php';
57 $url_params = array();
60 * Need to find the real end of rows?
62 if (! isset($_REQUEST['pos'])) {
65 /* We need this to be a integer */
66 $pos = (int) $_REQUEST['pos'];
69 if (! isset($_REQUEST['log']) ||
! array_key_exists($_REQUEST['log'], $binary_logs)) {
70 $_REQUEST['log'] = '';
72 $url_params['log'] = $_REQUEST['log'];
75 $sql_query = 'SHOW BINLOG EVENTS';
76 if (! empty($_REQUEST['log'])) {
77 $sql_query .= ' IN \'' . $_REQUEST['log'] . '\'';
79 if ($GLOBALS['cfg']['MaxRows'] !== 'all') {
80 $sql_query .= ' LIMIT ' . $pos . ', ' . (int) $GLOBALS['cfg']['MaxRows'];
86 $result = PMA_DBI_query($sql_query);
89 * prepare some vars for displaying the result table
91 // Gets the list of fields properties
92 if (isset($result) && $result) {
93 $num_rows = PMA_DBI_num_rows($result);
98 if (empty($_REQUEST['dontlimitchars'])) {
99 $dontlimitchars = false;
101 $dontlimitchars = true;
102 $url_params['dontlimitchars'] = 1;
106 * Displays the sub-page heading
109 . ($GLOBALS['cfg']['MainPageIconic'] ?
'<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '')
110 . ' ' . __('Binary log') . "\n"
114 * Display log selector.
116 if (count($binary_logs) > 1) {
117 echo '<form action="server_binlog.php" method="get">';
118 echo PMA_generate_common_hidden_inputs($url_params);
119 echo '<fieldset><legend>';
120 echo __('Select binary log to view');
121 echo '</legend><select name="log">';
123 foreach ($binary_logs as $each_log) {
124 echo '<option value="' . $each_log['Log_name'] . '"';
125 if ($each_log['Log_name'] == $_REQUEST['log']) {
126 echo ' selected="selected"';
128 echo '>' . $each_log['Log_name'];
129 if (isset($each_log['File_size'])) {
130 $full_size +
= $each_log['File_size'];
131 echo ' (' . implode(' ', PMA_formatByteDown($each_log['File_size'], 3, 2)) . ')';
136 echo count($binary_logs) . ' ' . __('Files') . ', ';
137 if ($full_size > 0) {
138 echo implode(' ', PMA_formatByteDown($full_size));
141 echo '<fieldset class="tblFooters">';
142 echo '<input type="submit" value="' . __('Go') . '" />';
147 PMA_Message
::success()->display();
153 <table border
="0" cellpadding
="2" cellspacing
="1">
156 <td colspan
="6" align
="center">
158 // we do not now how much rows are in the binlog
159 // so we can just force 'NEXT' button
161 $this_url_params = $url_params;
162 if ($pos > $GLOBALS['cfg']['MaxRows']) {
163 $this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
166 echo '<a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
167 if ($GLOBALS['cfg']['NavigationBarIconic']) {
168 echo ' title="' . __('Previous') . '">';
170 echo '>' . __('Previous');
171 } // end if... else...
172 echo ' < </a> - ';
175 $this_url_params = $url_params;
177 $this_url_params['pos'] = $pos;
179 if ($dontlimitchars) {
180 unset($this_url_params['dontlimitchars']);
182 <a href
="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
183 title
="<?php __('Truncate Shown Queries'); ?>">
184 <img src
="<?php echo $pmaThemeImage; ?>s_partialtext.png"
185 width
="50" height
="20" border
="0"
186 alt
="<?php echo __('Truncate Shown Queries'); ?>" /></a
>
189 $this_url_params['dontlimitchars'] = 1;
191 <a href
="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
192 title
="<?php __('Show Full Queries'); ?>">
193 <img src
="<?php echo $pmaThemeImage; ?>s_fulltext.png"
194 width
="50" height
="20" border
="0"
195 alt
="<?php echo __('Show Full Queries'); ?>" /></a
>
198 // we do not now how much rows are in the binlog
199 // so we can just force 'NEXT' button
200 if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
201 $this_url_params = $url_params;
202 $this_url_params['pos'] = $pos +
$GLOBALS['cfg']['MaxRows'];
203 echo ' - <a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
204 if ($GLOBALS['cfg']['NavigationBarIconic']) {
205 echo ' title="' . __('Next') . '">';
207 echo '>' . __('Next');
208 } // end if... else...
215 <th
><?php
echo __('Log name'); ?
></th
>
216 <th
><?php
echo __('Position'); ?
></th
>
217 <th
><?php
echo __('Event type'); ?
></th
>
218 <th
><?php
echo __('Server ID'); ?
></th
>
219 <th
><?php
echo __('Original position'); ?
></th
>
220 <th
><?php
echo __('Information'); ?
></th
>
226 while ($value = PMA_DBI_fetch_assoc($result)) {
227 if (! $dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
228 $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
231 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
232 <td
> 
;<?php
echo $value['Log_name']; ?
> 
;</td
>
233 <td align
="right"> 
;<?php
echo $value['Pos']; ?
> 
;</td
>
234 <td
> 
;<?php
echo $value['Event_type']; ?
> 
;</td
>
235 <td align
="right"> 
;<?php
echo $value['Server_id']; ?
> 
;</td
>
236 <td align
="right"> 
;<?php
echo isset($value['Orig_log_pos']) ?
$value['Orig_log_pos'] : $value['End_log_pos']; ?
> 
;</td
>
237 <td
> 
;<?php
echo htmlspecialchars($value['Info']); ?
> 
;</td
>
240 $odd_row = !$odd_row;
251 require_once './libraries/footer.inc.php';