Feature #23328 » 15319.diff
res/Templates/mod1_default.html (revision 0) | ||
---|---|---|
<!-- ###FULLDOC### begin -->
|
||
<div class="typo3-fullDoc">
|
||
<!-- Page header with buttons, path details and csh -->
|
||
<div id="typo3-docheader">
|
||
<div id="typo3-docheader-row1">
|
||
<div class="buttonsleft">###BUTTONLIST_LEFT###</div>
|
||
<div class="buttonsright">###BUTTONLIST_RIGHT###</div>
|
||
</div>
|
||
<div id="typo3-docheader-row2">
|
||
<div class="docheader-row2-left"><div class="docheader-funcmenu">###FUNC_MENU###</div></div>
|
||
<div class="docheader-row2-right"></div>
|
||
</div>
|
||
</div>
|
||
<!-- Content of module, for instance listing, info or editing -->
|
||
<div id="typo3-docbody">
|
||
<div id="typo3-inner-docbody">
|
||
###CONTENT###
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- ###FULLDOC### end -->
|
||
<!-- Grouping the icons on top -->
|
||
<!-- ###BUTTON_GROUP_WRAP### -->
|
||
<div class="buttongroup">###BUTTONS###</div>
|
||
<!-- ###BUTTON_GROUP_WRAP### -->
|
||
<!-- ###BUTTON_GROUPS_LEFT### -->
|
||
<!-- ###BUTTON_GROUP1### --><div class="docheader-csh">###CSH###</div><!-- ###BUTTON_GROUP1### -->
|
||
<!-- ###BUTTON_GROUPS_LEFT### -->
|
||
<!-- ###BUTTON_GROUPS_RIGHT### -->
|
||
<!-- ###BUTTON_GROUP1### -->###NEW_WINDOW### ###SHORTCUT###<!-- ###BUTTON_GROUP1### -->
|
||
<!-- ###BUTTON_GROUPS_RIGHT### -->
|
mod1/locallang.xml (working copy) | ||
---|---|---|
<languageKey index="default" type="array">
|
||
<label index="title">DBAL Analysis Module</label>
|
||
<label index="Debug_log">Debug log</label>
|
||
<label index="Cached_info">Cached info</label>
|
||
<label index="Cached_info">Cached information</label>
|
||
<label index="SQL_check">SQL Check</label>
|
||
<label index="tab.0.joins">Joins</label>
|
||
<label index="tab.0.errors">Errors</label>
|
||
<label index="tab.0.parsing">Parsing</label>
|
||
<label index="tab.0.log">Log</label>
|
||
<label index="tab.0.where">Where</label>
|
||
<label index="tab.info.autoIncrement">Auto Increment</label>
|
||
<label index="tab.info.primaryKeys">Primary Keys</label>
|
||
<label index="tab.info.fieldTypes">Field Types</label>
|
||
<label index="tab.info.metatypeExplanation">Metatype explanation</label>
|
||
</languageKey>
|
||
</data>
|
||
</T3locallang>
|
mod1/index.php (working copy) | ||
---|---|---|
// Clean up settings:
|
||
$this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
|
||
// Draw the header
|
||
$this->doc = t3lib_div::makeInstance('noDoc');
|
||
$this->doc = t3lib_div::makeInstance('template');
|
||
$this->doc->docType= 'xhtml_trans';
|
||
$this->doc->backPath = $GLOBALS['BACK_PATH'];
|
||
$this->doc->form = '<form action="" method="post">';
|
||
$this->doc->setModuleTemplate('EXT:dbal/res/Templates/mod1_default.html');
|
||
$this->doc->bodyTagId = 'typo3-mod-php';
|
||
$this->doc->divClass = '';
|
||
$this->doc->form = '<form action="" method="post" autocomplete="off">';
|
||
// JavaScript
|
||
// Adding classic jumpToUrl function, needed for the function menu.
|
||
// Also, the id in the parent frameset is configured.
|
||
$this->doc->JScode = $this->doc->wrapScriptTags('
|
||
script_ended = 0;
|
||
function jumpToUrl(URL) { //
|
||
window.location.href = URL;
|
||
function jumpToUrl(URL) { //
|
||
document.location = URL;
|
||
return false;
|
||
}
|
||
');
|
||
function setHighlight(id) { //
|
||
if (top.fsMod) {
|
||
top.fsMod.recentIds["web"]=id;
|
||
top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting
|
||
// DBAL page title:
|
||
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
|
||
top.content.nav_frame.refresh_nav();
|
||
}
|
||
}
|
||
}
|
||
') . $this->doc->getDynTabMenuJScode();
|
||
$this->renderModuleContent();
|
||
$docHeaderButtons = $this->getDocHeaderButtons();
|
||
$markers = array(
|
||
'CSH' => $docHeaderButtons['csh'],
|
||
'FUNC_MENU' => t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
|
||
'CONTENT' => $this->content
|
||
);
|
||
// Place content inside template
|
||
$content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
|
||
$content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
|
||
$content .= $this->doc->endPage();
|
||
// Replace content with templated content
|
||
$this->content = $content;
|
||
}
|
||
/**
|
||
* Prints out the module HTML.
|
||
*
|
||
* @return string HTML output
|
||
*/
|
||
public function printContent() {
|
||
$this->content .= $this->doc->middle();
|
||
$this->content .= $this->doc->endPage();
|
||
echo $this->content;
|
||
}
|
||
/**
|
||
* Gets the buttons that shall be rendered in the docHeader.
|
||
*
|
||
* @return array Available buttons for the docHeader
|
||
*/
|
||
protected function getDocHeaderButtons() {
|
||
$buttons = array(
|
||
'csh' => t3lib_BEfunc::cshItem('_MOD_tools_txdbalM1', '', $this->backPath),
|
||
'shortcut' => $this->getShortcutButton(),
|
||
'new_window' => '<a href="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" target="tx_debuglog" title="New window"><img src="../typo3conf/ext/dbal/res/Icons/new-window.png" alt="New Window" /></a>',
|
||
);
|
||
return $buttons;
|
||
}
|
||
/**
|
||
* Gets the button to set a new shortcut in the backend (if current user is allowed to).
|
||
*
|
||
* @return string HTML representiation of the shortcut button
|
||
*/
|
||
protected function getShortcutButton() {
|
||
$result = '';
|
||
if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
|
||
$result = $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
|
||
}
|
||
return $result;
|
||
}
|
||
/**
|
||
* Renders module content.
|
||
*
|
||
* @return void
|
||
*/
|
||
protected function renderModuleContent() {
|
||
$this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
|
||
$this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
|
||
$this->content .= $this->doc->spacer(5);
|
||
$this->content .= $this->doc->section('', $this->doc->funcMenu('', t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'])));
|
||
// Debug log:
|
||
switch ($this->MOD_SETTINGS['function']) {
|
||
case 'info':
|
||
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Cached_info'), $this->printCachedInfo());
|
||
$clearCmd = $this->printCachedInfo();
|
||
$this->content .= $this->doc->section(
|
||
$GLOBALS['LANG']->getLL('Cached_info'),
|
||
$this->generateCachedInformation()
|
||
);
|
||
$this->content .= $clearCmd;
|
||
break;
|
||
case 'sqlcheck':
|
||
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('SQL_check'), $this->printSqlCheck());
|
||
break;
|
||
case 0:
|
||
$this->content .= $this->doc->section(
|
||
$GLOBALS['LANG']->getLL('Debug_log'),
|
||
$this->generateDebugLog()
|
||
);
|
||
$this->content.= $this->doc->section($GLOBALS['LANG']->getLL('Debug_log'), $this->printLogMgm());
|
||
break;
|
||
}
|
||
// ShortCut
|
||
if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
|
||
$this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']));
|
||
}
|
||
$this->content .= $this->doc->spacer(10);
|
||
}
|
||
/**
|
||
* Prints out the module HTML
|
||
*
|
||
* @return string HTML output
|
||
*/
|
||
public function printContent() {
|
||
$this->content .= $this->doc->middle();
|
||
$this->content .= $this->doc->endPage();
|
||
echo $this->content;
|
||
}
|
||
/**
|
||
* Displays a form to check DBAL SQL methods and parse raw SQL.
|
||
*
|
||
* @return string HTML output
|
||
... | ... | |
if ((string)t3lib_div::_GP('cmd') === 'clear') {
|
||
$GLOBALS['TYPO3_DB']->clearCachedFieldInfo();
|
||
$GLOBALS['TYPO3_DB']->cacheFieldInfo();
|
||
$this->notify('Cached information has been cleared');
|
||
}
|
||
$out = '<a name="autoincrement"></a><h2>auto_increment</h2>';
|
||
$out .= '<table border="1" cellspacing="0"><tbody><tr><th>Table</th><th>Field</th></tr>';
|
||
$menu = '<a href="' . $this->thisScript . '&cmd=clear">CLEAR DATA</a><hr />';
|
||
return $menu;
|
||
}
|
||
/**
|
||
* Generates the Debug Log content.
|
||
*
|
||
* @return string
|
||
*/
|
||
protected function generateDebugLog() {
|
||
// Disable debugging in any case...
|
||
$GLOBALS['TYPO3_DB']->debug = FALSE;
|
||
$parts = array();
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.0.joins', 1),
|
||
'content' => $this->getJoins(),
|
||
);
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.0.errors', 1),
|
||
'content' => $this->getErrors(),
|
||
);
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.0.parsing', 1),
|
||
'content' => $this->getParsing(),
|
||
);
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.0.log', 1),
|
||
'content' => 'Log go here',
|
||
);
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.0.where', 1),
|
||
'content' => $this->getWhere(),
|
||
);
|
||
return $this->doc->getDynTabMenu($parts, 'DBAL:templateOverviewModule:' . $this->id, 0, 0, 300);
|
||
}
|
||
/**
|
||
* Generates the Cached Information about the database.
|
||
*
|
||
* The DBAL caches a lot of information, e.g. about auto increment fields,
|
||
* field types and primary keys. This method formats all this into a HTML
|
||
* table to display in the BE.
|
||
*
|
||
* @return string
|
||
*/
|
||
protected function generateCachedInformation() {
|
||
$parts = array();
|
||
$out = '<table border="1" cellspacing="0"><tbody><tr><th>Table</th><th>Field</th></tr>';
|
||
ksort($GLOBALS['TYPO3_DB']->cache_autoIncFields);
|
||
foreach ($GLOBALS['TYPO3_DB']->cache_autoIncFields as $table => $field) {
|
||
$out .= '<tr>';
|
||
... | ... | |
}
|
||
$out .= '</tbody></table>';
|
||
$out .= $this->doc->spacer(5);
|
||
$out .= '<a name="primarykeys"></a><h2>Primary keys</h2>';
|
||
$out .= '<table border="1" cellspacing="0"><tbody><tr><th>Table</th><th>Field(s)</th></tr>';
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.info.autoIncrement', 1),
|
||
'content' => $out,
|
||
);
|
||
$out = '<table border="1" cellspacing="0"><tbody><tr><th>Table</th><th>Field(s)</th></tr>';
|
||
ksort($GLOBALS['TYPO3_DB']->cache_primaryKeys);
|
||
foreach ($GLOBALS['TYPO3_DB']->cache_primaryKeys as $table => $field) {
|
||
$out .= '<tr>';
|
||
... | ... | |
}
|
||
$out .= '</tbody></table>';
|
||
$out .= $this->doc->spacer(5);
|
||
$out .= '<a name="fieldtypes"></a><h2>Field types</h2>';
|
||
$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>';
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.info.primaryKeys', 1),
|
||
'content' => $out,
|
||
);
|
||
$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>';
|
||
ksort($GLOBALS['TYPO3_DB']->cache_fieldType);
|
||
foreach ($GLOBALS['TYPO3_DB']->cache_fieldType as $table => $fields) {
|
||
$out .= '<th colspan="5">' . $table . '</th>';
|
||
... | ... | |
}
|
||
$out .= '</tbody></table>';
|
||
$out .= $this->doc->spacer(5);
|
||
$out .= '<a name="metatypes"></a><h2>Metatype explanation</h2>';
|
||
$out .= '<pre>
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.info.fieldTypes', 1),
|
||
'content' => $out,
|
||
);
|
||
$out = '<pre>
|
||
C: Varchar, capped to 255 characters.
|
||
X: Larger varchar, capped to 4000 characters (to be compatible with Oracle).
|
||
XL: For Oracle, returns CLOB, otherwise the largest varchar size.
|
||
... | ... | |
F: Floating point number
|
||
N: Numeric or decimal number</pre>';
|
||
$menu = '<a href="' . $this->thisScript . '&cmd=clear">CLEAR DATA</a><hr />';
|
||
$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 />';
|
||
$parts[] = array(
|
||
'label' => $GLOBALS['LANG']->getLL('tab.info.metatypeExplanation', 1),
|
||
'content' => $out,
|
||
);
|
||
return $menu . $out;
|
||
return $this->doc->getDynTabMenu($parts, 'DBAL:templateOverviewModule:' . $this->id, 0, 0, 300);
|
||
}
|
||
/**
|
||
* Returns the JOINS debugging information.
|
||
*
|
||
* @return string
|
||
*/
|
||
protected function getJoins() {
|
||
$content = '';
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
||
'table_join,exec_time,query,script',
|
||
'tx_dbal_debuglog',
|
||
'table_join!=\'\'',
|
||
'table_join,script,exec_time,query'
|
||
);
|
||
// Init vars in which to pick up the query result:
|
||
$tableIndex = array();
|
||
$tRows = array();
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>Execution time</td>
|
||
<td>Table joins</td>
|
||
<td>Script</td>
|
||
<td>Query</td>
|
||
</tr>';
|
||
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$tableArray = $GLOBALS['TYPO3_DB']->SQLparser->parseFromTables($row['table_join']);
|
||
// Create table name index:
|
||
foreach ($tableArray as $a) {
|
||
foreach ($tableArray as $b) {
|
||
if ($b['table'] != $a['table']) {
|
||
$tableIndex[$a['table']][$b['table']] = 1;
|
||
}
|
||
}
|
||
}
|
||
// Create output row
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>' . htmlspecialchars($row['exec_time']) . '</td>
|
||
<td>' . htmlspecialchars($row['table_join']) . '</td>
|
||
<td>' . htmlspecialchars($row['script']) . '</td>
|
||
<td>' . htmlspecialchars($row['query']) . '</td>
|
||
</tr>';
|
||
}
|
||
// Printing direct joins:
|
||
$content .= '<h4>Direct joins:</h4>' . t3lib_div::view_array($tableIndex);
|
||
// Printing total dependencies:
|
||
foreach ($tableIndex as $priTable => $a) {
|
||
foreach ($tableIndex as $tableN => $v) {
|
||
foreach ($v as $tableP => $vv) {
|
||
if ($tableP == $priTable) {
|
||
$tableIndex[$priTable] = array_merge($v, $a);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
$content .= '<h4>Total dependencies:</h4>' . t3lib_div::view_array($tableIndex);
|
||
// Printing data rows:
|
||
$content .= '
|
||
<table border="1" cellspacing="0">' . implode('', $tRows) . '
|
||
</table>';
|
||
return $content;
|
||
}
|
||
/**
|
||
* Returns the ERRORS debugging information.
|
||
*
|
||
* @return string
|
||
*/
|
||
protected function getErrors() {
|
||
$content = '';
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('serdata,exec_time,query,script', 'tx_dbal_debuglog', 'errorFlag>0', '', 'tstamp DESC');
|
||
// Init vars in which to pick up the query result:
|
||
$tRows = array();
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>Execution time</td>
|
||
<td>Error data</td>
|
||
<td>Script</td>
|
||
<td>Query</td>
|
||
</tr>';
|
||
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
// Create output row
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>' . htmlspecialchars($row['exec_time']) . '</td>
|
||
<td>' . t3lib_div::view_array(unserialize($row['serdata'])) . '</td>
|
||
<td>' . htmlspecialchars($row['script']) . '</td>
|
||
<td>' . htmlspecialchars($row['query']) . '</td>
|
||
</tr>';
|
||
}
|
||
// Printing data rows:
|
||
$content .= '
|
||
<table border="1" cellspacing="0">' . implode('', $tRows) . '
|
||
</table>';
|
||
return $content;
|
||
}
|
||
/**
|
||
* Returns the PARSING debugging information.
|
||
*
|
||
* @return string
|
||
*/
|
||
protected function getParsing() {
|
||
$content = '';
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('query,serdata', 'tx_dbal_debuglog', 'errorFlag&2=2');
|
||
$tRows = array();
|
||
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
// Create output row
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>' . htmlspecialchars($row['query']) . '</td>
|
||
</tr>';
|
||
}
|
||
// Printing data rows:
|
||
$content .= '
|
||
<table border="1" cellspacing="0">' . implode('', $tRows) . '
|
||
</table>';
|
||
return $content;
|
||
}
|
||
/**
|
||
* Returns the WHERE debugging information.
|
||
*
|
||
* @return string
|
||
*/
|
||
protected function getWhere() {
|
||
$content = '';
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp,script,tablename,whereclause', 'tx_dbal_debuglog_where', '', '', 'tstamp DESC');
|
||
$tRows = array();
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>Time</td>
|
||
<td>Script</td>
|
||
<td>Table</td>
|
||
<td>WHERE clause</td>
|
||
</tr>';
|
||
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>' . t3lib_BEfunc::datetime($row['tstamp']) . '</td>
|
||
<td>' . htmlspecialchars($row['script']) . '</td>
|
||
<td>' . htmlspecialchars($row['tablename']) . '</td>
|
||
<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>
|
||
</tr>';
|
||
}
|
||
$content .= '
|
||
<table border="1" cellspacing="0">' . implode('', $tRows) . '
|
||
</table>';
|
||
return $content;
|
||
}
|
||
/**
|
||
* Printing the debug-log from the DBAL extension
|
||
*
|
||
* To enabled debugging, you will have to enabled it in the configuration!
|
||
... | ... | |
case 'flush':
|
||
$res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog');
|
||
$res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog_where');
|
||
$outStr = 'Log FLUSHED!';
|
||
$this->notify('Log FLUSHED!');
|
||
break;
|
||
case 'joins':
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('table_join,exec_time,query,script', 'tx_dbal_debuglog', 'table_join!=\'\'', 'table_join,script,exec_time,query');
|
||
// Init vars in which to pick up the query result:
|
||
$tableIndex = array();
|
||
$tRows = array();
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>Execution time</td>
|
||
<td>Table joins</td>
|
||
<td>Script</td>
|
||
<td>Query</td>
|
||
</tr>';
|
||
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$tableArray = $GLOBALS['TYPO3_DB']->SQLparser->parseFromTables($row['table_join']);
|
||
// Create table name index:
|
||
foreach ($tableArray as $a) {
|
||
foreach ($tableArray as $b) {
|
||
if ($b['table'] != $a['table']) {
|
||
$tableIndex[$a['table']][$b['table']] = 1;
|
||
}
|
||
}
|
||
}
|
||
// Create output row
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>' . htmlspecialchars($row['exec_time']) . '</td>
|
||
<td>' . htmlspecialchars($row['table_join']) . '</td>
|
||
<td>' . htmlspecialchars($row['script']) . '</td>
|
||
<td>' . htmlspecialchars($row['query']) . '</td>
|
||
</tr>';
|
||
}
|
||
// Printing direct joins:
|
||
$outStr .= '<h4>Direct joins:</h4>' . t3lib_div::view_array($tableIndex);
|
||
// Printing total dependencies:
|
||
foreach ($tableIndex as $priTable => $a) {
|
||
foreach ($tableIndex as $tableN => $v) {
|
||
foreach ($v as $tableP => $vv) {
|
||
if ($tableP == $priTable) {
|
||
$tableIndex[$priTable] = array_merge($v, $a);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
$outStr .= '<h4>Total dependencies:</h4>' . t3lib_div::view_array($tableIndex);
|
||
// Printing data rows:
|
||
$outStr .= '
|
||
<table border="1" cellspacing="0">' . implode('', $tRows) . '
|
||
</table>';
|
||
$outStr .= $this->getJoins();
|
||
break;
|
||
case 'errors':
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('serdata,exec_time,query,script', 'tx_dbal_debuglog', 'errorFlag>0', '', 'tstamp DESC');
|
||
// Init vars in which to pick up the query result:
|
||
$tRows = array();
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>Execution time</td>
|
||
<td>Error data</td>
|
||
<td>Script</td>
|
||
<td>Query</td>
|
||
</tr>';
|
||
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
// Create output row
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>' . htmlspecialchars($row['exec_time']) . '</td>
|
||
<td>' . t3lib_div::view_array(unserialize($row['serdata'])) . '</td>
|
||
<td>' . htmlspecialchars($row['script']) . '</td>
|
||
<td>' . htmlspecialchars($row['query']) . '</td>
|
||
</tr>';
|
||
}
|
||
// Printing data rows:
|
||
$outStr .= '
|
||
<table border="1" cellspacing="0">' . implode('', $tRows) . '
|
||
</table>';
|
||
$outStr .= $this->getErrors();
|
||
break;
|
||
case 'parsing':
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('query,serdata', 'tx_dbal_debuglog', 'errorFlag&2=2');
|
||
$tRows = array();
|
||
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
// Create output row
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>' . htmlspecialchars($row['query']) . '</td>
|
||
</tr>';
|
||
}
|
||
// Printing data rows:
|
||
$outStr .= '
|
||
<table border="1" cellspacing="0">' . implode('', $tRows) . '
|
||
</table>';
|
||
$outStr .= $this->getParsing();
|
||
break;
|
||
case 'where':
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp,script,tablename,whereclause', 'tx_dbal_debuglog_where', '', '', 'tstamp DESC');
|
||
$tRows = array();
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>Time</td>
|
||
<td>Script</td>
|
||
<td>Table</td>
|
||
<td>WHERE clause</td>
|
||
</tr>';
|
||
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$tRows[] = '
|
||
<tr>
|
||
<td>' . t3lib_BEfunc::datetime($row['tstamp']) . '</td>
|
||
<td>' . htmlspecialchars($row['script']) . '</td>
|
||
<td>' . htmlspecialchars($row['tablename']) . '</td>
|
||
<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>
|
||
</tr>';
|
||
}
|
||
$outStr = '
|
||
<table border="1" cellspacing="0">' . implode('', $tRows) . '
|
||
</table>';
|
||
$outStr .= $this->getWhere();
|
||
break;
|
||
default:
|
||
... | ... | |
<a href="' . $this->thisScript . '&cmd=errors">ERRORS</a> -
|
||
<a href="' . $this->thisScript . '&cmd=parsing">PARSING</a> -
|
||
<a href="' . $this->thisScript . '">LOG</a> -
|
||
<a href="' . $this->thisScript . '&cmd=where">WHERE</a> -
|
||
<a href="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" target="tx_debuglog">[New window]</a>
|
||
<a href="' . $this->thisScript . '&cmd=where">WHERE</a>
|
||
<hr />
|
||
';
|
||
return $menu . $outStr;
|
||
}
|
||
/**
|
||
* Notifies the user using a Flash message.
|
||
*
|
||
* @param string $message The message
|
||
* @param integer $severity Optional severity, must be either of t3lib_FlashMessage::INFO, t3lib_FlashMessage::OK,
|
||
* t3lib_FlashMessage::WARNING or t3lib_FlashMessage::ERROR. Default is t3lib_FlashMessage::OK.
|
||
* @return void
|
||
*/
|
||
protected function notify($message, $severity = t3lib_FlashMessage::OK) {
|
||
$flashMessage = t3lib_div::makeInstance(
|
||
't3lib_FlashMessage',
|
||
$message,
|
||
'',
|
||
$severity,
|
||
TRUE
|
||
);
|
||
t3lib_FlashMessageQueue::addMessage($flashMessage);
|
||
}
|
||
}
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/mod1/index.php']) {
|
- « Previous
- 1
- 2
- Next »