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
12 * @uses PMA_generate_common_hidden_inputs()
13 * @uses PMA_generate_common_url()
14 * @uses PMA_formatByteDown()
15 * @uses PMA_DBI_fetch_assoc()
18 * @uses $_REQUEST['pos']
19 * @uses $_REQUEST['log']
20 * @uses $_REQUEST['dontlimitchars']
22 * @uses array_key_exists()
24 * @uses htmlspecialchars()
31 require_once './libraries/common.inc.php';
34 * Does the common work, provides $binary_logs
36 require_once './libraries/server_common.inc.php';
41 require_once './libraries/server_links.inc.php';
43 $url_params = array();
46 * Need to find the real end of rows?
48 if (! isset($_REQUEST['pos'])) {
51 /* We need this to be a integer */
52 $pos = (int) $_REQUEST['pos'];
55 if (! isset($_REQUEST['log']) ||
! array_key_exists($_REQUEST['log'], $binary_logs)) {
56 $_REQUEST['log'] = '';
58 $url_params['log'] = $_REQUEST['log'];
61 $sql_query = 'SHOW BINLOG EVENTS';
62 if (! empty($_REQUEST['log'])) {
63 $sql_query .= ' IN \'' . $_REQUEST['log'] . '\'';
65 if ($GLOBALS['cfg']['MaxRows'] !== 'all') {
66 $sql_query .= ' LIMIT ' . $pos . ', ' . (int) $GLOBALS['cfg']['MaxRows'];
72 $result = PMA_DBI_query($sql_query);
75 * prepare some vars for displaying the result table
77 // Gets the list of fields properties
78 if (isset($result) && $result) {
79 $num_rows = PMA_DBI_num_rows($result);
84 if (empty($_REQUEST['dontlimitchars'])) {
85 $dontlimitchars = false;
87 $dontlimitchars = true;
88 $url_params['dontlimitchars'] = 1;
92 * Displays the sub-page heading
95 . ($GLOBALS['cfg']['MainPageIconic'] ?
'<img src="' . $pmaThemeImage . 's_tbl.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '')
96 . ' ' . __('Binary log') . "\n"
100 * Display log selector.
102 if (count($binary_logs) > 1) {
103 echo '<form action="server_binlog.php" method="get">';
104 echo PMA_generate_common_hidden_inputs($url_params);
105 echo '<fieldset><legend>';
106 echo __('Select binary log to view');
107 echo '</legend><select name="log">';
109 foreach ($binary_logs as $each_log) {
110 echo '<option value="' . $each_log['Log_name'] . '"';
111 if ($each_log['Log_name'] == $_REQUEST['log']) {
112 echo ' selected="selected"';
114 echo '>' . $each_log['Log_name'];
115 if (isset($each_log['File_size'])) {
116 $full_size +
= $each_log['File_size'];
117 echo ' (' . implode(' ', PMA_formatByteDown($each_log['File_size'], 3, 2)) . ')';
122 echo count($binary_logs) . ' ' . __('Files') . ', ';
123 if ($full_size > 0) {
124 echo implode(' ', PMA_formatByteDown($full_size));
127 echo '<fieldset class="tblFooters">';
128 echo '<input type="submit" value="' . __('Go') . '" />';
133 PMA_showMessage(PMA_Message
::success());
139 <table border
="0" cellpadding
="2" cellspacing
="1">
142 <td colspan
="6" align
="center">
144 // we do not now how much rows are in the binlog
145 // so we can just force 'NEXT' button
147 $this_url_params = $url_params;
148 if ($pos > $GLOBALS['cfg']['MaxRows']) {
149 $this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
152 echo '<a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
153 if ($GLOBALS['cfg']['NavigationBarIconic']) {
154 echo ' title="' . __('Previous') . '">';
156 echo '>' . __('Previous');
157 } // end if... else...
158 echo ' < </a> - ';
161 $this_url_params = $url_params;
163 $this_url_params['pos'] = $pos;
165 if ($dontlimitchars) {
166 unset($this_url_params['dontlimitchars']);
168 <a href
="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
169 title
="<?php __('Truncate Shown Queries'); ?>">
170 <img src
="<?php echo $pmaThemeImage; ?>s_partialtext.png"
171 alt
="<?php echo __('Truncate Shown Queries'); ?>" /></a
>
174 $this_url_params['dontlimitchars'] = 1;
176 <a href
="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
177 title
="<?php __('Show Full Queries'); ?>">
178 <img src
="<?php echo $pmaThemeImage; ?>s_fulltext.png"
179 alt
="<?php echo __('Show Full Queries'); ?>" /></a
>
182 // we do not now how much rows are in the binlog
183 // so we can just force 'NEXT' button
184 if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
185 $this_url_params = $url_params;
186 $this_url_params['pos'] = $pos +
$GLOBALS['cfg']['MaxRows'];
187 echo ' - <a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
188 if ($GLOBALS['cfg']['NavigationBarIconic']) {
189 echo ' title="' . __('Next') . '">';
191 echo '>' . __('Next');
192 } // end if... else...
199 <th
><?php
echo __('Log name'); ?
></th
>
200 <th
><?php
echo __('Position'); ?
></th
>
201 <th
><?php
echo __('Event type'); ?
></th
>
202 <th
><?php
echo __('Server ID'); ?
></th
>
203 <th
><?php
echo __('Original position'); ?
></th
>
204 <th
><?php
echo __('Information'); ?
></th
>
210 while ($value = PMA_DBI_fetch_assoc($result)) {
211 if (! $dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
212 $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
215 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
216 <td
> 
;<?php
echo $value['Log_name']; ?
> 
;</td
>
217 <td align
="right"> 
;<?php
echo $value['Pos']; ?
> 
;</td
>
218 <td
> 
;<?php
echo $value['Event_type']; ?
> 
;</td
>
219 <td align
="right"> 
;<?php
echo $value['Server_id']; ?
> 
;</td
>
220 <td align
="right"> 
;<?php
echo isset($value['Orig_log_pos']) ?
$value['Orig_log_pos'] : $value['End_log_pos']; ?
> 
;</td
>
221 <td
> 
;<?php
echo htmlspecialchars($value['Info']); ?
> 
;</td
>
224 $odd_row = !$odd_row;
235 require './libraries/footer.inc.php';