2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * display the binary logs and the content of the selected
12 require_once './libraries/common.inc.php';
15 * Does the common work, provides $binary_logs
17 require_once './libraries/server_common.inc.php';
22 require_once './libraries/server_links.inc.php';
24 $url_params = array();
27 * Need to find the real end of rows?
29 if (! isset($_REQUEST['pos'])) {
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'] = '';
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'];
53 $result = PMA_DBI_query($sql_query);
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);
65 if (empty($_REQUEST['dontlimitchars'])) {
66 $dontlimitchars = false;
68 $dontlimitchars = true;
69 $url_params['dontlimitchars'] = 1;
73 * Displays the sub-page heading
76 . ($GLOBALS['cfg']['MainPageIconic'] ?
'<img src="themes/dot.gif" class="icon ic_s_tbl" alt="" />' : '')
77 . ' ' . __('Binary log') . "\n"
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">';
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)) . ')';
103 echo count($binary_logs) . ' ' . __('Files') . ', ';
104 if ($full_size > 0) {
105 echo implode(' ', PMA_formatByteDown($full_size));
108 echo '<fieldset class="tblFooters">';
109 echo '<input type="submit" value="' . __('Go') . '" />';
114 PMA_showMessage(PMA_Message
::success());
120 <table border
="0" cellpadding
="2" cellspacing
="1">
123 <td colspan
="6" align
="center">
125 // we do not now how much rows are in the binlog
126 // so we can just force 'NEXT' button
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') . '">';
137 echo '>' . __('Previous');
138 } // end if... else...
139 echo ' < </a> - ';
142 $this_url_params = $url_params;
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
>
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
>
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') . '">';
172 echo '>' . __('Next');
173 } // end if... else...
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
>
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
> 
;<?php
echo $value['Log_name']; ?
> 
;</td
>
198 <td align
="right"> 
;<?php
echo $value['Pos']; ?
> 
;</td
>
199 <td
> 
;<?php
echo $value['Event_type']; ?
> 
;</td
>
200 <td align
="right"> 
;<?php
echo $value['Server_id']; ?
> 
;</td
>
201 <td align
="right"> 
;<?php
echo isset($value['Orig_log_pos']) ?
$value['Orig_log_pos'] : $value['End_log_pos']; ?
> 
;</td
>
202 <td
> 
;<?php
echo htmlspecialchars($value['Info']); ?
> 
;</td
>
205 $odd_row = !$odd_row;
216 require './libraries/footer.inc.php';