public function deletePOST($trace)
 {
     $db = Registry::getInstance()->getDb();
     $db->delete('traceview_values', 'trace_id=' . (int) $trace);
     $db->delete('traceview_nodes', 'trace_id=' . (int) $trace);
     $db->delete('traceview_traces', 'id=' . (int) $trace);
     return new RedirectResponse('/');
 }
 public function importPOST($trace)
 {
     if (!TRACEVIEW_MYSQL) {
         throw new Exception('Enable database support to use import');
     }
     $db = Registry::getInstance()->getDb();
     if ($db->selectValue('SELECT id FROM traceview_traces WHERE file_name="' . $db->escape($trace) . '"')) {
         throw new Exception("Trace {$trace} already imported");
     }
     $traceInfo = $this->tl->getTraceInfo($trace);
     $parsedTrace = $this->tl->getTrace($trace);
     $db->insert('traceview_traces', array('name' => $trace, 'file_name' => $trace, 'm_time' => $traceInfo->mTime, 'size' => $traceInfo->size));
     $traceId = $db->insertId();
     $parsedTrace->traverse(function (Node $node) use($db, $traceId) {
         foreach ($node->parameters as $k => $value) {
             $db->insert('traceview_values', array('trace_id' => $traceId, 'call_id' => $node->callId, 'order_id' => $k, 'type' => $node->getType($value), 'value' => $value));
         }
         $db->insert('traceview_values', array('trace_id' => $traceId, 'call_id' => $node->callId, 'order_id' => -1, 'type' => $node->getType($node->returnValue), 'value' => $node->returnValue));
         $db->insert('traceview_nodes', array('trace_id' => $traceId, 'call_id' => $node->callId, 'parent_id' => $node->parent ? $node->parent->callId : 0, 'level' => $node->level, 'time_start' => $node->timeStart, 'time_end' => $node->timeEnd, 'function' => $node->function, 'include_file' => $node->includeFile, 'file' => $node->file, 'line' => $node->line));
     });
     return new RedirectResponse('/');
 }
예제 #3
0
<?php

define('TRACEVIEW_MYSQL', true);
\Vtk13\TraceView\Registry::getInstance()->setDb(new Vtk13\LibSql\Mysql\Mysql('localhost', 'root', '', 'traceview'));
예제 #4
0
        echo date('Y-m-d H:i:s', $traceInfo->mTime), ',  ', number_format($traceInfo->size);
        ?>
 bytes
                        </div>
                    <?php 
    }
    ?>
                </div>
            </div>
        </div>
        <div class="col-md-5">
            <div class="panel panel-default">
                <div class="panel-heading">Traces from database:</div>
                <div class="list-group">
                    <?php 
    $dbTraces = new DbTraceList(Registry::getInstance()->getDb());
    $tracesInfo = $dbTraces->listTracesInfo();
    if ($tracesInfo) {
        foreach ($tracesInfo as $traceInfo) {
            ?>
                            <div class="list-group-item">
                                <form method="post" action="/db-trace/delete/<?php 
            echo urlencode($traceInfo->id);
            ?>
" class="pull-right" onsubmit="return confirm('Delete trace?');">
                                    <button type="submit" title="Remove trace"><span class="glyphicon glyphicon-remove"></span></button>
                                </form>
                                <a href="/db-trace/view/<?php 
            echo urlencode($traceInfo->id);
            ?>
"><?php