Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
MysqlProfilerStorage.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\HttpKernel\Profiler;
13
14 /**
15 * A ProfilerStorage for Mysql
16 *
17 * @author Jan Schumann <js@schumann-it.com>
18 */
19 class MysqlProfilerStorage extends PdoProfilerStorage
20 {
21 /**
22 * {@inheritdoc}
23 */
24 protected function initDb()
25 {
26 if (null === $this->db) {
27 if (0 !== strpos($this->dsn, 'mysql')) {
28 throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Mysql with an invalid dsn "%s". The expected format is "mysql:dbname=database_name;host=host_name".', $this->dsn));
29 }
30
31 if (!class_exists('PDO') || !in_array('mysql', \PDO::getAvailableDrivers(), true)) {
32 throw new \RuntimeException('You need to enable PDO_Mysql extension for the profiler to run properly.');
33 }
34
35 $db = new \PDO($this->dsn, $this->username, $this->password);
36 $db->exec('CREATE TABLE IF NOT EXISTS sf_profiler_data (token VARCHAR(255) PRIMARY KEY, data LONGTEXT, ip VARCHAR(64), method VARCHAR(6), url VARCHAR(255), time INTEGER UNSIGNED, parent VARCHAR(255), created_at INTEGER UNSIGNED, KEY (created_at), KEY (ip), KEY (method), KEY (url), KEY (parent))');
37
38 $this->db = $db;
39 }
40
41 return $this->db;
42 }
43
44 /**
45 * {@inheritdoc}
46 */
47 protected function buildCriteria($ip, $url, $start, $end, $limit, $method)
48 {
49 $criteria = array();
50 $args = array();
51
52 if ($ip = preg_replace('/[^\d\.]/', '', $ip)) {
53 $criteria[] = 'ip LIKE :ip';
54 $args[':ip'] = '%'.$ip.'%';
55 }
56
57 if ($url) {
58 $criteria[] = 'url LIKE :url';
59 $args[':url'] = '%'.addcslashes($url, '%_\\').'%';
60 }
61
62 if ($method) {
63 $criteria[] = 'method = :method';
64 $args[':method'] = $method;
65 }
66
67 if (!empty($start)) {
68 $criteria[] = 'time >= :start';
69 $args[':start'] = $start;
70 }
71
72 if (!empty($end)) {
73 $criteria[] = 'time <= :end';
74 $args[':end'] = $end;
75 }
76
77 return array($criteria, $args);
78 }
79 }
80