aboutsummaryrefslogtreecommitdiff
path: root/templates/debug
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /templates/debug
current code from svn, revision 62608
Diffstat (limited to 'templates/debug')
-rw-r--r--templates/debug/db-log.php55
-rw-r--r--templates/debug/trace-row.php13
2 files changed, 68 insertions, 0 deletions
diff --git a/templates/debug/db-log.php b/templates/debug/db-log.php
new file mode 100644
index 0000000..141570e
--- /dev/null
+++ b/templates/debug/db-log.php
@@ -0,0 +1,55 @@
+<? if ($GLOBALS['DEBUG_ALL_DB_QUERIES']) : ?>
+ <style>
+ #all_db_queries td:first-child {
+ border-left: 4px solid transparent;
+ border-right: 4px solid red;
+ }
+ #all_db_queries .sorm td:first-child {
+ border-left-color: blue;
+ }
+ #all_db_queries .prepared td:first-child {
+ border-right-color: green;
+ }
+ #all_db_queries .query {
+ white-space: pre-wrap;
+ }
+ #all_db_queries ul {
+ counter-reset: queries -1;
+ }
+ #all_db_queries li:hover {
+ text-decoration: underline;
+ }
+ #all_db_queries li::before {
+ content: "#" counter(queries);
+ counter-increment: queries;
+ }
+ #all_db_queries li::before,
+ #all_db_queries span {
+ font-weight: lighter;
+ }
+ </style>
+ <div style="display: none;" id="all_db_queries">
+ <table class="default">
+ <tbody>
+ <? foreach ((array) DBManager::get()->queries as $query) : ?>
+ <tr class="<?= $query['classes'] ?>">
+ <td>
+ <code class="query"><?= htmlReady($query['query']) ?></code>
+ </td>
+ <? if ($GLOBALS['DEBUG_ALL_DB_QUERIES_WITH_TRACE']) : ?>
+ <td>
+ <ul class="list-unstyled">
+ <? foreach ($query['trace'] as $i => $row): ?>
+ <li>
+ <?= $this->render_partial('debug/trace-row.php', $row) ?>
+ </li>
+ <? endforeach; ?>
+ </ul>
+ </td>
+ <? endif ?>
+ </tr>
+ <? endforeach ?>
+ </tbody>
+ </table>
+ </div>
+<? endif ?>
diff --git a/templates/debug/trace-row.php b/templates/debug/trace-row.php
new file mode 100644
index 0000000..f3d29be
--- /dev/null
+++ b/templates/debug/trace-row.php
@@ -0,0 +1,13 @@
+<?php
+$file = ltrim(str_replace($GLOBALS['STUDIP_BASE_PATH'], '', $file), '/');
+$trac = htmlReady("https://develop.studip.de/trac/browser/trunk/{$file}#L{$line}");
+?>
+<code>
+ <?= htmlReady(sprintf(
+ '%s(%s)',
+ isset($class) ? "{$class}{$type}{$function}" : $function,
+ implode(', ', array_map(function ($arg) { return is_object($arg) ? get_class($arg) : (string) $arg; }, $args))
+ )) ?>
+</code>
+<span>called at</span>
+<a href="<?= $trac ?>" target="_blank"><?= htmlReady("{$file}:{$line}") ?></a>