@@ -149,7 +149,7 @@ |
||
149 | 149 | */ |
150 | 150 | public function insertItem(string $table, array $queryOptions): array |
151 | 151 | { |
152 | - [$fields, ,] = $this->getFields($table, $queryOptions); |
|
152 | + [$fields,,] = $this->getFields($table, $queryOptions); |
|
153 | 153 | |
154 | 154 | // From edit.inc.php |
155 | 155 | $values = []; |
@@ -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 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param LoggingService|null $logging |
47 | 47 | */ |
48 | 48 | public function __construct(AbstractFacade $dbFacade, |
49 | - protected TimerService $timer, protected LoggingService|null $logging) |
|
49 | + protected TimerService $timer, protected LoggingService | null $logging) |
|
50 | 50 | { |
51 | 51 | parent::__construct($dbFacade); |
52 | 52 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | ini_set('memory_limit', max($this->admin->iniBytes('memory_limit'), |
227 | 227 | 2 * strlen($queries) + memory_get_usage() + 8e6)); |
228 | 228 | } |
229 | - catch(\Exception $e) { |
|
229 | + catch (\Exception $e) { |
|
230 | 230 | // Do nothing if the option is not modified. |
231 | 231 | } |
232 | 232 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | if ($commands === 0) { |
254 | 254 | $messages[] = $this->utils->trans->lang('No commands to execute.'); |
255 | 255 | } elseif ($onlyErrors) { |
256 | - $messages[] = $this->utils->trans->lang('%d query(s) executed OK.', $commands - $errors); |
|
256 | + $messages[] = $this->utils->trans->lang('%d query(s) executed OK.', $commands - $errors); |
|
257 | 257 | } |
258 | 258 | return [ |
259 | 259 | 'results' => $this->results, |
@@ -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); |