mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-03 22:53:58 +02:00
Backup of current cakephp version
This commit is contained in:
parent
b8f82da6f8
commit
5a580df460
925 changed files with 238041 additions and 1 deletions
75
lib/Cake/View/Elements/exception_stack_trace.ctp
Normal file
75
lib/Cake/View/Elements/exception_stack_trace.ctp
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* Prints a stack trace for an exception
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.View.Elements
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
App::uses('Debugger', 'Utility');
|
||||
?>
|
||||
<h3>Stack Trace</h3>
|
||||
<ul class="cake-stack-trace">
|
||||
<?php foreach ($error->getTrace() as $i => $stack): ?>
|
||||
<li><?php
|
||||
$excerpt = $arguments = '';
|
||||
$params = array();
|
||||
|
||||
if (isset($stack['file']) && isset($stack['line'])):
|
||||
printf(
|
||||
'<a href="#" onclick="traceToggle(event, \'file-excerpt-%s\')">%s line %s</a>',
|
||||
$i,
|
||||
Debugger::trimPath($stack['file']),
|
||||
$stack['line']
|
||||
);
|
||||
$excerpt = sprintf('<div id="file-excerpt-%s" class="cake-code-dump" style="display:none;"><pre>', $i);
|
||||
$excerpt .= implode("\n", Debugger::excerpt($stack['file'], $stack['line'] - 1, 2));
|
||||
$excerpt .= '</pre></div> ';
|
||||
else:
|
||||
echo '<a href="#">[internal function]</a>';
|
||||
endif;
|
||||
echo ' → ';
|
||||
if ($stack['function']):
|
||||
$args = array();
|
||||
if (!empty($stack['args'])):
|
||||
foreach ((array)$stack['args'] as $arg):
|
||||
$args[] = Debugger::getType($arg);
|
||||
$params[] = Debugger::exportVar($arg, 2);
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
$called = isset($stack['class']) ? $stack['class'] . $stack['type'] . $stack['function'] : $stack['function'];
|
||||
|
||||
printf(
|
||||
'<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s(%s)</a> ',
|
||||
$i,
|
||||
$called,
|
||||
implode(', ', $args)
|
||||
);
|
||||
$arguments = sprintf('<div id="trace-args-%s" class="cake-code-dump" style="display: none;"><pre>', $i);
|
||||
$arguments .= implode("\n", $params);
|
||||
$arguments .= '</pre></div>';
|
||||
endif;
|
||||
echo $excerpt;
|
||||
echo $arguments;
|
||||
?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<script type="text/javascript">
|
||||
function traceToggle(event, id) {
|
||||
var el = document.getElementById(id);
|
||||
el.style.display = (el.style.display == 'block') ? 'none' : 'block';
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
</script>
|
74
lib/Cake/View/Elements/sql_dump.ctp
Normal file
74
lib/Cake/View/Elements/sql_dump.ctp
Normal file
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* SQL Dump element. Dumps out SQL log information
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.View.Elements
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
if (!class_exists('ConnectionManager') || Configure::read('debug') < 2) {
|
||||
return false;
|
||||
}
|
||||
$noLogs = !isset($logs);
|
||||
if ($noLogs):
|
||||
$sources = ConnectionManager::sourceList();
|
||||
|
||||
$logs = array();
|
||||
foreach ($sources as $source):
|
||||
$db = ConnectionManager::getDataSource($source);
|
||||
if (!method_exists($db, 'getLog')):
|
||||
continue;
|
||||
endif;
|
||||
$logs[$source] = $db->getLog();
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
if ($noLogs || isset($_forced_from_dbo_)):
|
||||
foreach ($logs as $source => $logInfo):
|
||||
$text = $logInfo['count'] > 1 ? 'queries' : 'query';
|
||||
printf(
|
||||
'<table class="cake-sql-log" id="cakeSqlLog_%s" summary="Cake SQL Log" cellspacing="0">',
|
||||
preg_replace('/[^A-Za-z0-9_]/', '_', uniqid(time(), true))
|
||||
);
|
||||
printf('<caption>(%s) %s %s took %s ms</caption>', $source, $logInfo['count'], $text, $logInfo['time']);
|
||||
?>
|
||||
<thead>
|
||||
<tr><th>Nr</th><th>Query</th><th>Error</th><th>Affected</th><th>Num. rows</th><th>Took (ms)</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($logInfo['log'] as $k => $i) :
|
||||
$i += array('error' => '');
|
||||
if (!empty($i['params']) && is_array($i['params'])) {
|
||||
$bindParam = $bindType = null;
|
||||
if (preg_match('/.+ :.+/', $i['query'])) {
|
||||
$bindType = true;
|
||||
}
|
||||
foreach ($i['params'] as $bindKey => $bindVal) {
|
||||
if ($bindType === true) {
|
||||
$bindParam .= h($bindKey) ." => " . h($bindVal) . ", ";
|
||||
} else {
|
||||
$bindParam .= h($bindVal) . ", ";
|
||||
}
|
||||
}
|
||||
$i['query'] .= " , params[ " . rtrim($bindParam, ', ') . " ]";
|
||||
}
|
||||
echo "<tr><td>" . ($k + 1) . "</td><td>" . h($i['query']) . "</td><td>{$i['error']}</td><td style = \"text-align: right\">{$i['affected']}</td><td style = \"text-align: right\">{$i['numRows']}</td><td style = \"text-align: right\">{$i['took']}</td></tr>\n";
|
||||
endforeach;
|
||||
?>
|
||||
</tbody></table>
|
||||
<?php
|
||||
endforeach;
|
||||
else:
|
||||
echo '<p>Encountered unexpected $logs cannot generate SQL log</p>';
|
||||
endif;
|
Loading…
Add table
Add a link
Reference in a new issue