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_process.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_Message
::success()->display();
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 width
="50" height
="20" border
="0"
172 alt
="<?php echo __('Truncate Shown Queries'); ?>" /></a
>
175 $this_url_params['dontlimitchars'] = 1;
177 <a href
="./server_binlog.php<?php echo PMA_generate_common_url($this_url_params); ?>"
178 title
="<?php __('Show Full Queries'); ?>">
179 <img src
="<?php echo $pmaThemeImage; ?>s_fulltext.png"
180 width
="50" height
="20" border
="0"
181 alt
="<?php echo __('Show Full Queries'); ?>" /></a
>
184 // we do not now how much rows are in the binlog
185 // so we can just force 'NEXT' button
186 if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
187 $this_url_params = $url_params;
188 $this_url_params['pos'] = $pos +
$GLOBALS['cfg']['MaxRows'];
189 echo ' - <a href="./server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
190 if ($GLOBALS['cfg']['NavigationBarIconic']) {
191 echo ' title="' . __('Next') . '">';
193 echo '>' . __('Next');
194 } // end if... else...
201 <th
><?php
echo __('Log name'); ?
></th
>
202 <th
><?php
echo __('Position'); ?
></th
>
203 <th
><?php
echo __('Event type'); ?
></th
>
204 <th
><?php
echo __('Server ID'); ?
></th
>
205 <th
><?php
echo __('Original position'); ?
></th
>
206 <th
><?php
echo __('Information'); ?
></th
>
212 while ($value = PMA_DBI_fetch_assoc($result)) {
213 if (! $dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
214 $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
217 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
218 <td
> 
;<?php
echo $value['Log_name']; ?
> 
;</td
>
219 <td align
="right"> 
;<?php
echo $value['Pos']; ?
> 
;</td
>
220 <td
> 
;<?php
echo $value['Event_type']; ?
> 
;</td
>
221 <td align
="right"> 
;<?php
echo $value['Server_id']; ?
> 
;</td
>
222 <td align
="right"> 
;<?php
echo isset($value['Orig_log_pos']) ?
$value['Orig_log_pos'] : $value['End_log_pos']; ?
> 
;</td
>
223 <td
> 
;<?php
echo htmlspecialchars($value['Info']); ?
> 
;</td
>
226 $odd_row = !$odd_row;
237 require './libraries/footer.inc.php';