TYPO3 CMS  TYPO3_6-2
ModuleController.php
Go to the documentation of this file.
1 <?php
3 
18 
26 
30  protected $thisScript;
31 
37  public function menuConfig() {
38  $this->MOD_MENU = array(
39  'function' => array(
40  0 => $GLOBALS['LANG']->getLL('Debug_log'),
41  'info' => $GLOBALS['LANG']->getLL('Cached_info'),
42  'sqlcheck' => $GLOBALS['LANG']->getLL('SQL_check')
43  )
44  );
45  parent::menuConfig();
46  }
47 
53  public function main() {
54  $this->thisScript = BackendUtility::getModuleUrl($this->MCONF['name']);
55  // Clean up settings:
56  $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SET'), $this->MCONF['name']);
57  // Draw the header
58  $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
59  $this->doc->backPath = $GLOBALS['BACK_PATH'];
60  $this->doc->form = '<form action="" method="post">';
61  // DBAL page title:
62  $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
63  $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
64  $this->content .= $this->doc->spacer(5);
65  $this->content .= $this->doc->section('', $this->doc->funcMenu('', BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'])));
66  // Debug log:
67  switch ($this->MOD_SETTINGS['function']) {
68  case 'info':
69  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Cached_info'), $this->printCachedInfo());
70  break;
71  case 'sqlcheck':
72  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('SQL_check'), $this->printSqlCheck());
73  break;
74  case 0:
75  $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Debug_log'), $this->printLogMgm());
76  break;
77  }
78  // ShortCut
79  if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
80  $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']));
81  }
82  $this->content .= $this->doc->spacer(10);
83  }
84 
90  public function printContent() {
91  $this->content .= $this->doc->endPage();
92  echo $this->content;
93  }
94 
100  protected function printSqlCheck() {
102  $out = '
103  <form name="sql_check" action="' . $this->thisScript . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">
104  <script type="text/javascript">
105 /*<![CDATA[*/
106 function updateQryForm(s) {
107  document.getElementById(\'tx-dbal-result\').style.display = \'none\';
108  switch(s) {
109  case \'SELECT\':
110  document.getElementById(\'tx-dbal-qryupdate\').style.display = \'none\';
111  document.getElementById(\'tx-dbal-qryfields\').style.display = \'table-row\';
112  document.getElementById(\'tx-dbal-qryinsertvalues\').style.display = \'none\';
113  document.getElementById(\'tx-dbal-qryupdatevalues\').style.display = \'none\';
114  document.getElementById(\'tx-dbal-qryfrom\').style.display = \'table-row\';
115  document.getElementById(\'tx-dbal-qryinto\').style.display = \'none\';
116  document.getElementById(\'tx-dbal-qrywhere\').style.display = \'table-row\';
117  document.getElementById(\'tx-dbal-qrygroup\').style.display = \'table-row\';
118  document.getElementById(\'tx-dbal-qryorder\').style.display = \'table-row\';
119  document.getElementById(\'tx-dbal-qrylimit\').style.display = \'table-row\';
120  break;
121  case \'INSERT\':
122  document.getElementById(\'tx-dbal-qryupdate\').style.display = \'none\';
123  document.getElementById(\'tx-dbal-qryfields\').style.display = \'none\';
124  document.getElementById(\'tx-dbal-qryinsertvalues\').style.display = \'table-row\';
125  document.getElementById(\'tx-dbal-qryupdatevalues\').style.display = \'none\';
126  document.getElementById(\'tx-dbal-qryfrom\').style.display = \'none\';
127  document.getElementById(\'tx-dbal-qryinto\').style.display = \'table-row\';
128  document.getElementById(\'tx-dbal-qrywhere\').style.display = \'table-row\';
129  document.getElementById(\'tx-dbal-qrygroup\').style.display = \'table-row\';
130  document.getElementById(\'tx-dbal-qryorder\').style.display = \'table-row\';
131  document.getElementById(\'tx-dbal-qrylimit\').style.display = \'table-row\';
132  break;
133  case \'UPDATE\':
134  document.getElementById(\'tx-dbal-qryupdate\').style.display = \'table-row\';
135  document.getElementById(\'tx-dbal-qryfields\').style.display = \'none\';
136  document.getElementById(\'tx-dbal-qryinsertvalues\').style.display = \'none\';
137  document.getElementById(\'tx-dbal-qryupdatevalues\').style.display = \'table-row\';
138  document.getElementById(\'tx-dbal-qryfrom\').style.display = \'none\';
139  document.getElementById(\'tx-dbal-qryinto\').style.display = \'none\';
140  document.getElementById(\'tx-dbal-qryupdate\').style.display = \'table-row\';
141  document.getElementById(\'tx-dbal-qrywhere\').style.display = \'table-row\';
142  document.getElementById(\'tx-dbal-qrygroup\').style.display = \'none\';
143  document.getElementById(\'tx-dbal-qryorder\').style.display = \'none\';
144  document.getElementById(\'tx-dbal-qrylimit\').style.display = \'none\';
145  break;
146  case \'DELETE\':
147  document.getElementById(\'tx-dbal-qryupdate\').style.display = \'none\';
148  document.getElementById(\'tx-dbal-qryfields\').style.display = \'none\';
149  document.getElementById(\'tx-dbal-qryinsertvalues\').style.display = \'none\';
150  document.getElementById(\'tx-dbal-qryupdatevalues\').style.display = \'none\';
151  document.getElementById(\'tx-dbal-qryfrom\').style.display = \'table-row\';
152  document.getElementById(\'tx-dbal-qryinto\').style.display = \'none\';
153  document.getElementById(\'tx-dbal-qrywhere\').style.display = \'table-row\';
154  document.getElementById(\'tx-dbal-qrygroup\').style.display = \'none\';
155  document.getElementById(\'tx-dbal-qryorder\').style.display = \'none\';
156  document.getElementById(\'tx-dbal-qrylimit\').style.display = \'none\';
157  break;
158  }
159 }
160 /*]]>*/
161  </script>
162  <table>
163  <tr class="tableheader bgColor5"><th colspan="2">Easy SQL check</th></tr>
164  <tr><td colspan="2">
165  <select name="tx_dbal[QUERY]"size="1" onchange="updateQryForm(this.options[this.selectedIndex].value)">
166  <option value="SELECT" ' . ($input['QUERY'] === 'SELECT' ? 'selected="selected"' : '') . '>SELECT</option>
167  <option value="INSERT" ' . ($input['QUERY'] === 'INSERT' ? 'selected="selected"' : '') . '>INSERT</option>
168  <option value="UPDATE" ' . ($input['QUERY'] === 'UPDATE' ? 'selected="selected"' : '') . '>UPDATE</option>
169  <option value="DELETE" ' . ($input['QUERY'] === 'DELETE' ? 'selected="selected"' : '') . '>DELETE</option>
170  </select>
171  </td></tr>
172  <tr id="tx-dbal-qryupdate" style="display:none;"><td></td><td><input name="tx_dbal[UPDATE]" value="' . $input['UPDATE'] . '" type="text" size="30" maxsize="100" /></td></tr>
173  <tr id="tx-dbal-qryfields"><td></td><td><input name="tx_dbal[FIELDS]" value="' . $input['FIELDS'] . '" type="text" size="30" maxsize="100" /></td></tr>
174  <tr id="tx-dbal-qryinsertvalues" style="display:none;"><td></td><td><textarea name="tx_dbal[INSERTVALUES]" cols="30" rows="4">' . $input['INSERTVALUES'] . '</textarea></td></tr>
175  <tr id="tx-dbal-qryupdatevalues" style="display:none;"><th>SET</th><td><textarea name="tx_dbal[UPDATEVALUES]" cols="30" rows="4">' . $input['UPDATEVALUES'] . '</textarea></td></tr>
176  <tr id="tx-dbal-qryfrom"><th>FROM</th><td><input name="tx_dbal[FROM]" value="' . $input['FROM'] . '" type="text" size="30" maxsize="100" /></td></tr>
177  <tr id="tx-dbal-qryinto" style="display:none;"><th>INTO</th><td><input name="tx_dbal[INTO]" value="' . $input['INTO'] . '" type="text" size="30" maxsize="100" /></td></tr>
178  <tr id="tx-dbal-qrywhere"><th>WHERE</th><td><input name="tx_dbal[WHERE]" value="' . $input['WHERE'] . '" type="text" size="30" maxsize="100" /></td></tr>
179  <tr id="tx-dbal-qrygroup"><th>GROUP BY</th><td><input name="tx_dbal[GROUP]" value="' . $input['GROUP'] . '" type="text" size="30" maxsize="100" /></td></tr>
180  <tr id="tx-dbal-qryorder"><th>ORDER BY</th><td><input name="tx_dbal[ORDER]" value="' . $input['ORDER'] . '" type="text" size="30" maxsize="100" /></td></tr>
181  <tr id="tx-dbal-qrylimit"><th>LIMIT</th><td><input name="tx_dbal[LIMIT]" value="' . $input['LIMIT'] . '" type="text" size="30" maxsize="100" /></td></tr>
182  <tr><td></td><td style="text-align:right;"><input type="submit" value="CHECK" /></td></tr>
183  <script type="text/javascript">
184 /*<![CDATA[*/
185 updateQryForm(\'' . $input['QUERY'] . '\');
186 /*]]>*/
187  </script>
188  ';
189  $out .= '<tr id="tx-dbal-result" class="bgColor4"><th>Result:</th><td>';
190  switch ($input['QUERY']) {
191  case 'SELECT':
192  $qry = $GLOBALS['TYPO3_DB']->SELECTquery($input['FIELDS'], $input['FROM'], $input['WHERE'], $input['GROUP'], $input['ORDER'], $input['LIMIT']);
193  break;
194  case 'INSERT':
195  $qry = $GLOBALS['TYPO3_DB']->INSERTquery($input['INTO'], $this->createFieldsValuesArray($input['INSERTVALUES']));
196  break;
197  case 'UPDATE':
198  $qry = $GLOBALS['TYPO3_DB']->UPDATEquery($input['UPDATE'], $input['WHERE'], $this->createFieldsValuesArray($input['UPDATEVALUES']));
199  break;
200  case 'DELETE':
201  $qry = $GLOBALS['TYPO3_DB']->DELETEquery($input['FROM'], $input['WHERE']);
202  break;
203  }
204  $out .= '<pre>' . htmlspecialchars($qry) . '</pre></td></tr>';
205  $out .= '
206  <tr class="tableheader bgColor5"><th colspan="2">RAW SQL check</th></tr>
207  <tr><td colspan="2" style="text-align:right;"><textarea name="tx_dbal[RAWSQL]" cols="60" rows="5">' . $input['RAWSQL'] . '</textarea><br /><input type="submit" value="CHECK" /></td></tr>';
208  if (!empty($input['RAWSQL'])) {
209  $out .= '<tr class="bgColor4">';
210  $parseResult = $GLOBALS['TYPO3_DB']->SQLparser->parseSQL($input['RAWSQL']);
211  if (is_array($parseResult)) {
212  $newQuery = $GLOBALS['TYPO3_DB']->SQLparser->compileSQL($parseResult);
213  $testResult = $GLOBALS['TYPO3_DB']->SQLparser->debug_parseSQLpartCompare($input['RAWSQL'], $newQuery);
214  if (!is_array($testResult)) {
215  $out .= '<td colspan="2">' . $newQuery;
216  } else {
217  $out .= '<td colspan="2">' . htmlspecialchars($testResult[0]) . '</td></tr>
218  <tr><th>Error:</th><td style="border:2px solid #f00;">Input query did not match the parsed and recompiled query exactly (not observing whitespace):<br />' . htmlspecialchars($testResult[1]);
219  }
220  } else {
221  $out .= '<th>Result:</th><td style="border:2px solid #f00;">' . $parseResult;
222  }
223  $out .= '</td></tr>';
224  }
225  $out .= '</table></form>';
226  return $out;
227  }
228 
238  protected function createFieldsValuesArray($in) {
239  $ret = array();
240  $in = explode(chr(10), $in);
241  foreach ($in as $v) {
242  $fv = explode('=', $v);
243  $ret[$fv[0]] = $fv[1];
244  }
245  return $ret;
246  }
247 
257  protected function printCachedInfo() {
258  // Get cmd:
259  if ((string) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cmd') === 'clear') {
260  $GLOBALS['TYPO3_DB']->clearCachedFieldInfo();
261  $GLOBALS['TYPO3_DB']->cacheFieldInfo();
262  }
263  $out = '<a name="autoincrement"></a><h2>auto_increment</h2>';
264  $out .= '<table border="1" cellspacing="0"><tbody><tr><th>Table</th><th>Field</th></tr>';
265  ksort($GLOBALS['TYPO3_DB']->cache_autoIncFields);
266  foreach ($GLOBALS['TYPO3_DB']->cache_autoIncFields as $table => $field) {
267  $out .= '<tr>';
268  $out .= '<td>' . $table . '</td>';
269  $out .= '<td>' . $field . '</td>';
270  $out .= '</tr>';
271  }
272  $out .= '</tbody></table>';
273  $out .= $this->doc->spacer(5);
274  $out .= '<a name="primarykeys"></a><h2>Primary keys</h2>';
275  $out .= '<table border="1" cellspacing="0"><tbody><tr><th>Table</th><th>Field(s)</th></tr>';
276  ksort($GLOBALS['TYPO3_DB']->cache_primaryKeys);
277  foreach ($GLOBALS['TYPO3_DB']->cache_primaryKeys as $table => $field) {
278  $out .= '<tr>';
279  $out .= '<td>' . $table . '</td>';
280  $out .= '<td>' . $field . '</td>';
281  $out .= '</tr>';
282  }
283  $out .= '</tbody></table>';
284  $out .= $this->doc->spacer(5);
285  $out .= '<a name="fieldtypes"></a><h2>Field types</h2>';
286  $out .= '<table border="1" cellspacing="0"><tbody><tr><th colspan="5">Table</th></tr><tr><th>Field</th><th>Type</th><th><a href="#metatypes">Metatype</a></th><th>NOT NULL</th><th>Default</th></th></tr>';
287  ksort($GLOBALS['TYPO3_DB']->cache_fieldType);
288  foreach ($GLOBALS['TYPO3_DB']->cache_fieldType as $table => $fields) {
289  $out .= '<th colspan="5">' . $table . '</th>';
290  foreach ($fields as $field => $data) {
291  $out .= '<tr>';
292  $out .= '<td>' . $field . '</td>';
293  $out .= '<td>' . $data['type'] . '</td>';
294  $out .= '<td>' . $data['metaType'] . '</td>';
295  $out .= '<td>' . ($data['notnull'] ? 'NOT NULL' : '') . '</td>';
296  $out .= '<td>' . $data['default'] . '</td>';
297  $out .= '</tr>';
298  }
299  }
300  $out .= '</tbody></table>';
301  $out .= $this->doc->spacer(5);
302  $out .= '<a name="metatypes"></a><h2>Metatype explanation</h2>';
303  $out .= '<pre>
304  C: Varchar, capped to 255 characters.
305  X: Larger varchar, capped to 4000 characters (to be compatible with Oracle).
306  XL: For Oracle, returns CLOB, otherwise the largest varchar size.
307 
308  C2: Multibyte varchar
309  X2: Multibyte varchar (largest size)
310 
311  B: BLOB (binary large object)
312 
313  D: Date (some databases do not support this, and we return a datetime type)
314  T: Datetime or Timestamp
315  L: Integer field suitable for storing booleans (0 or 1)
316  I: Integer (mapped to I4)
317  I1: 1-byte integer
318  I2: 2-byte integer
319  I4: 4-byte integer
320  I8: 8-byte integer
321  F: Floating point number
322  N: Numeric or decimal number</pre>';
323  $menu = '<a href="' . $this->thisScript . '&amp;cmd=clear">CLEAR DATA</a><hr />';
324  $menu .= '<a href="#autoincrement">auto_increment</a> | <a href="#primarykeys">Primary keys</a> | <a href="#fieldtypes">Field types</a> | <a href="#metatypes">Metatype explanation</a><hr />';
325  return $menu . $out;
326  }
327 
335  protected function printLogMgm() {
336  // Disable debugging in any case...
337  $GLOBALS['TYPO3_DB']->debug = FALSE;
338  // Get cmd:
339  $cmd = (string) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cmd');
340  switch ($cmd) {
341  case 'flush':
342  $res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog');
343  $res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog_where');
344  $outStr = 'Log FLUSHED!';
345  break;
346  case 'joins':
347  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('table_join,exec_time,query,script', 'tx_dbal_debuglog', 'table_join!=\'\'', 'table_join,script,exec_time,query');
348  // Init vars in which to pick up the query result:
349  $tableIndex = array();
350  $tRows = array();
351  $tRows[] = '
352  <tr>
353  <td>Execution time</td>
354  <td>Table joins</td>
355  <td>Script</td>
356  <td>Query</td>
357  </tr>';
358  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
359  $tableArray = $GLOBALS['TYPO3_DB']->SQLparser->parseFromTables($row['table_join']);
360  // Create table name index:
361  foreach ($tableArray as $a) {
362  foreach ($tableArray as $b) {
363  if ($b['table'] != $a['table']) {
364  $tableIndex[$a['table']][$b['table']] = 1;
365  }
366  }
367  }
368  // Create output row
369  $tRows[] = '
370  <tr>
371  <td>' . htmlspecialchars($row['exec_time']) . '</td>
372  <td>' . htmlspecialchars($row['table_join']) . '</td>
373  <td>' . htmlspecialchars($row['script']) . '</td>
374  <td>' . htmlspecialchars($row['query']) . '</td>
375  </tr>';
376  }
377  // Printing direct joins:
378  $outStr .= '<h4>Direct joins:</h4>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($tableIndex);
379  // Printing total dependencies:
380  foreach ($tableIndex as $priTable => $a) {
381  foreach ($tableIndex as $tableN => $v) {
382  foreach ($v as $tableP => $vv) {
383  if ($tableP == $priTable) {
384  $tableIndex[$priTable] = array_merge($v, $a);
385  }
386  }
387  }
388  }
389  $outStr .= '<h4>Total dependencies:</h4>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($tableIndex);
390  // Printing data rows:
391  $outStr .= '
392  <table border="1" cellspacing="0">' . implode('', $tRows) . '
393  </table>';
394  break;
395  case 'errors':
396  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('serdata,exec_time,query,script', 'tx_dbal_debuglog', 'errorFlag>0', '', 'tstamp DESC');
397  // Init vars in which to pick up the query result:
398  $tRows = array();
399  $tRows[] = '
400  <tr>
401  <td>Execution time</td>
402  <td>Error data</td>
403  <td>Script</td>
404  <td>Query</td>
405  </tr>';
406  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
407  // Create output row
408  $tRows[] = '
409  <tr>
410  <td>' . htmlspecialchars($row['exec_time']) . '</td>
411  <td>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray(unserialize($row['serdata'])) . '</td>
412  <td>' . htmlspecialchars($row['script']) . '</td>
413  <td>' . htmlspecialchars($row['query']) . '</td>
414  </tr>';
415  }
416  // Printing data rows:
417  $outStr .= '
418  <table border="1" cellspacing="0">' . implode('', $tRows) . '
419  </table>';
420  break;
421  case 'parsing':
422  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('query,serdata', 'tx_dbal_debuglog', 'errorFlag&2=2');
423  $tRows = array();
424  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
425  // Create output row
426  $tRows[] = '
427  <tr>
428  <td>' . htmlspecialchars($row['query']) . '</td>
429  </tr>';
430  }
431  // Printing data rows:
432  $outStr .= '
433  <table border="1" cellspacing="0">' . implode('', $tRows) . '
434  </table>';
435  break;
436  case 'where':
437  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp,script,tablename,whereclause', 'tx_dbal_debuglog_where', '', '', 'tstamp DESC');
438  $tRows = array();
439  $tRows[] = '
440  <tr>
441  <td>Time</td>
442  <td>Script</td>
443  <td>Table</td>
444  <td>WHERE clause</td>
445  </tr>';
446  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
447  $tRows[] = '
448  <tr>
449  <td>' . BackendUtility::datetime($row['tstamp']) . '</td>
450  <td>' . htmlspecialchars($row['script']) . '</td>
451  <td>' . htmlspecialchars($row['tablename']) . '</td>
452  <td>' . str_replace(array('\'\'', '""', 'IS NULL', 'IS NOT NULL'), array('<span style="background-color:#ff0000;color:#ffffff;padding:2px;font-weight:bold;">\'\'</span>', '<span style="background-color:#ff0000;color:#ffffff;padding:2px;font-weight:bold;">""</span>', '<span style="background-color:#00ff00;color:#ffffff;padding:2px;font-weight:bold;">IS NULL</span>', '<span style="background-color:#00ff00;color:#ffffff;padding:2px;font-weight:bold;">IS NOT NULL</span>'), htmlspecialchars($row['whereclause'])) . '</td>
453  </tr>';
454  }
455  $outStr = '
456  <table border="1" cellspacing="0">' . implode('', $tRows) . '
457  </table>';
458  break;
459  default:
460  // Look for request to view specific script exec:
461  $specTime = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('specTime');
462  if ($specTime) {
463  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('exec_time,errorFlag,table_join,serdata,query', 'tx_dbal_debuglog', 'tstamp=' . (int)$specTime);
464  $tRows = array();
465  $tRows[] = '
466  <tr>
467  <td>Execution time</td>
468  <td>Error</td>
469  <td>Table joins</td>
470  <td>Data</td>
471  <td>Query</td>
472  </tr>';
473  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
474  $tRows[] = '
475  <tr>
476  <td>' . htmlspecialchars($row['exec_time']) . '</td>
477  <td>' . ($row['errorFlag'] ? 1 : 0) . '</td>
478  <td>' . htmlspecialchars($row['table_join']) . '</td>
479  <td>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray(unserialize($row['serdata'])) . '</td>
480  <td>' . str_replace(array('\'\'', '""', 'IS NULL', 'IS NOT NULL'), array('<span style="background-color:#ff0000;color:#ffffff;padding:2px;font-weight:bold;">\'\'</span>', '<span style="background-color:#ff0000;color:#ffffff;padding:2px;font-weight:bold;">""</span>', '<span style="background-color:#00ff00;color:#ffffff;padding:2px;font-weight:bold;">IS NULL</span>', '<span style="background-color:#00ff00;color:#ffffff;padding:2px;font-weight:bold;">IS NOT NULL</span>'), htmlspecialchars($row['query'])) . '</td>
481  </tr>';
482  }
483  } else {
484  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp,script, SUM(exec_time) as calc_sum, count(*) AS qrycount, MAX(errorFlag) as error', 'tx_dbal_debuglog', '', 'tstamp,script', 'tstamp DESC');
485  $tRows = array();
486  $tRows[] = '
487  <tr>
488  <td>Time</td>
489  <td># of queries</td>
490  <td>Error</td>
491  <td>Time (ms)</td>
492  <td>Script</td>
493  </tr>';
494  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
495  $tRows[] = '
496  <tr>
497  <td>' . BackendUtility::datetime($row['tstamp']) . '</td>
498  <td>' . htmlspecialchars($row['qrycount']) . '</td>
499  <td>' . ($row['error'] ? '<strong style="color:#f00">ERR</strong>' : '') . '</td>
500  <td>' . htmlspecialchars($row['calc_sum']) . '</td>
501  <td><a href="' . $this->thisScript . '&amp;specTime=' . (int)$row['tstamp'] . '">' . htmlspecialchars($row['script']) . '</a></td>
502  </tr>';
503  }
504  }
505  $outStr = '
506  <table border="1" cellspacing="0">' . implode('', $tRows) . '
507  </table>';
508  }
509  $menu = '
510  <a href="' . $this->thisScript . '&amp;cmd=flush">FLUSH LOG</a> -
511  <a href="' . $this->thisScript . '&amp;cmd=joins">JOINS</a> -
512  <a href="' . $this->thisScript . '&amp;cmd=errors">ERRORS</a> -
513  <a href="' . $this->thisScript . '&amp;cmd=parsing">PARSING</a> -
514  <a href="' . $this->thisScript . '">LOG</a> -
515  <a href="' . $this->thisScript . '&amp;cmd=where">WHERE</a> -
516 
517  <a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript()) . '" target="tx_debuglog">[New window]</a>
518  <hr />
519  ';
520  return $menu . $outStr;
521  }
522 
523 }
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
static getModuleData($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='')
static getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script='', $addparams='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]