@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * @var CallbackDriver|null |
| 17 | 17 | */ |
| 18 | - protected CallbackDriver|null $driver = null; |
|
| 18 | + protected CallbackDriver | null $driver = null; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var Admin |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * @var int|null |
| 61 | 61 | */ |
| 62 | - private int|null $ownerId = null; |
|
| 62 | + private int | null $ownerId = null; |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * @var ConnectionInterface |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | $this->connection = $driver->createConnection($database); |
| 82 | 82 | $this->connection->open($database['name'], $database['schema'] ?? ''); |
| 83 | - $this->enduserEnabled = (bool)($options['enduser']['enabled'] ?? false); |
|
| 84 | - $this->historyEnabled = (bool)($options['history']['enabled'] ?? false); |
|
| 85 | - $this->historyDistinct = (bool)($options['history']['distinct'] ?? false); |
|
| 86 | - $this->historyLimit = (int)($options['history']['limit'] ?? 15); |
|
| 83 | + $this->enduserEnabled = (bool) ($options['enduser']['enabled'] ?? false); |
|
| 84 | + $this->historyEnabled = (bool) ($options['history']['enabled'] ?? false); |
|
| 85 | + $this->historyDistinct = (bool) ($options['history']['distinct'] ?? false); |
|
| 86 | + $this->historyLimit = (int) ($options['history']['limit'] ?? 15); |
|
| 87 | 87 | $this->category = self::CAT_ENDUSER; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $statement = "select id from dbadmin_owners where username='$username' limit 1"; |
| 106 | 106 | $ownerId = $this->connection->result($statement); |
| 107 | - return $this->ownerId = !$ownerId ? 0 : (int)$ownerId; |
|
| 107 | + return $this->ownerId = !$ownerId ? 0 : (int) $ownerId; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -132,9 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private function getOwnerId(): int |
| 134 | 134 | { |
| 135 | - return $this->ownerId !== null ? $this->ownerId : |
|
| 136 | - ($this->readOwnerId($this->auth->user()) ?: |
|
| 137 | - $this->newOwnerId($this->auth->user())); |
|
| 135 | + return $this->ownerId !== null ? $this->ownerId : ($this->readOwnerId($this->auth->user()) ?: $this->newOwnerId($this->auth->user())); |
|
| 138 | 136 | } |
| 139 | 137 | |
| 140 | 138 | /** |
@@ -221,8 +219,7 @@ discard block |
||
| 221 | 219 | $statement = $this->historyDistinct ? |
| 222 | 220 | "select max(id) as id,query from dbadmin_runned_commands c " . |
| 223 | 221 | "where c.owner_id=$ownerId and c.category=$category " . |
| 224 | - "group by query order by c.last_update desc limit {$this->historyLimit}" : |
|
| 225 | - "select id,query from dbadmin_runned_commands c " . |
|
| 222 | + "group by query order by c.last_update desc limit {$this->historyLimit}" : "select id,query from dbadmin_runned_commands c " . |
|
| 226 | 223 | "where c.owner_id=$ownerId and c.category=$category " . |
| 227 | 224 | "order by c.last_update desc limit {$this->historyLimit}"; |
| 228 | 225 | $statement = $this->connection->query($statement); |