These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | class ezSQL_pdo_YOURLS extends ezSQL_pdo { |
||
4 | |||
5 | /** |
||
6 | * Constructor - Overwrite original to use MySQL and handle custom port |
||
7 | * |
||
8 | * @since 1.7 |
||
9 | */ |
||
10 | function __construct( $dbuser='', $dbpassword='', $dbname='', $dbhost='localhost', $encoding='' ) { |
||
11 | $this->show_errors = defined( 'YOURLS_DEBUG' ) && YOURLS_DEBUG; // comply to YOURLS debug mode |
||
12 | $this->dbuser = $dbuser; |
||
13 | $this->dbpassword = $dbpassword; |
||
0 ignored issues
–
show
|
|||
14 | $this->dbname = $dbname; |
||
15 | // Get custom port if any |
||
16 | if ( false !== strpos( $dbhost, ':' ) ) { |
||
17 | list( $dbhost, $dbport ) = explode( ':', $dbhost ); |
||
18 | $dbhost = sprintf( '%1$s;port=%2$d', $dbhost, $dbport ); |
||
19 | } |
||
20 | $this->dbhost = $dbhost; |
||
21 | $this->encoding = $encoding; |
||
22 | $dsn = 'mysql:host=' . $dbhost . ';dbname=' . $dbname ; |
||
23 | $this->dsn = $dsn; |
||
24 | |||
25 | // Turn on track errors |
||
26 | ini_set('track_errors',1); |
||
27 | |||
28 | $this->connect( $dsn, $dbuser, $dbpassword ); |
||
29 | |||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Return MySQL server version |
||
34 | * |
||
35 | * @since 1.7 |
||
36 | */ |
||
37 | function mysql_version() { |
||
38 | return ( $this->dbh->getAttribute(PDO::ATTR_SERVER_VERSION) ); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Perform mySQL query |
||
43 | * |
||
44 | * Added to the original function: logging of all queries |
||
45 | * |
||
46 | * @since 1.7 |
||
47 | */ |
||
48 | function query( $query ) { |
||
49 | |||
50 | // Keep history of all queries |
||
51 | $this->debug_log[] = $query; |
||
52 | |||
53 | // Original function |
||
54 | return parent::query( $query ); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Disconnect |
||
59 | * |
||
60 | * Actually not needed for PDO it seems, the function is there only for consistency with |
||
61 | * other classes |
||
62 | * |
||
63 | * @since 1.7 |
||
64 | */ |
||
65 | function disconnect() { |
||
66 | // bleh |
||
67 | } |
||
68 | |||
69 | |||
70 | } |
||
71 | |||
72 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.