Skip to content
Snippets Groups Projects
Commit 3151b338 authored by Stein Magne Bjorklund's avatar Stein Magne Bjorklund Committed by Thijs Kinkhorst
Browse files

Micro optimisation and lower memory footprint

parent 34438cd9
Branches
Tags
No related merge requests found
......@@ -110,14 +110,11 @@ class Database
$config->getOptionalArray('database.slaves', [])
);
foreach ($secondaries as $secondary) {
array_push(
$this->dbSecondaries,
$this->connect(
$secondary['dsn'],
$secondary['username'],
$secondary['password'],
$driverOptions
)
$this->dbSecondaries[] = $this->connect(
$secondary['dsn'],
$secondary['username'],
$secondary['password'],
$driverOptions
);
}
$this->tablePrefix = $config->getOptionalString('database.prefix', '');
......
......@@ -530,7 +530,7 @@ class Logger
if ($statsLog) {
$stat = 'STAT ';
}
array_push($replacements, $stat);
$replacements[] = $stat;
if (self::$trackid === self::NO_TRACKID && !self::$shuttingDown) {
// we have a log without track ID and we are not still shutting down, so defer logging
......
......@@ -129,8 +129,8 @@ class FileLoggingHandler implements LoggingHandlerInterface
$format = $matches[1];
}
array_push($formats, $matches[0]);
array_push($replacements, date($format));
$formats[] = $matches[0];
$replacements[] = date($format);
}
if (preg_match('/^php:\/\//', $this->logFile)) {
......
......@@ -113,11 +113,11 @@ class HTTP
$current = 'localhost';
}
if (strstr($current, ":")) {
if (str_contains($current, ":")) {
$decomposed = explode(":", $current);
$port = array_pop($decomposed);
if (!is_numeric($port)) {
array_push($decomposed, $port);
$decomposed[] = $port;
}
$current = implode(":", $decomposed);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment