Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 7eb98c6

Browse files
Pavel Vyskočilvyskocilpavel
authored andcommitted
Remove duplicate code from 'DatabaseConnector.php'
1 parent 79a1b60 commit 7eb98c6

File tree

2 files changed

+9
-35
lines changed

2 files changed

+9
-35
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.
1616
- All JS code was moved to 'index.js'
1717
- Using 'fetch_all' instead of 'fetch_asoc' to get data from DB
1818
- Set default values for some option in 'DatabaseConnector.php'
19+
- Remove duplicate code from 'DatabaseConnector.php'
1920

2021
#### Fixed
2122
- Fixed the syntax of CHANGELOG

lib/Auth/Process/DatabaseConnector.php

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -72,42 +72,15 @@ public function getConnection()
7272
$this->sslCAPath,
7373
null
7474
);
75-
if ($this->port === null) {
76-
mysqli_real_connect(
77-
$conn,
78-
$this->serverName,
79-
$this->username,
80-
$this->password,
81-
$this->databaseName
82-
);
83-
} else {
84-
mysqli_real_connect(
85-
$conn,
86-
$this->serverName,
87-
$this->username,
88-
$this->password,
89-
$this->databaseName,
90-
$this->port
91-
);
92-
}
93-
} elseif ($this->port === null) {
94-
mysqli_real_connect(
95-
$conn,
96-
$this->serverName,
97-
$this->username,
98-
$this->password,
99-
$this->databaseName
100-
);
101-
} else {
102-
mysqli_real_connect(
103-
$conn,
104-
$this->serverName,
105-
$this->username,
106-
$this->password,
107-
$this->databaseName,
108-
$this->port
109-
);
11075
}
76+
mysqli_real_connect(
77+
$conn,
78+
$this->serverName,
79+
$this->username,
80+
$this->password,
81+
$this->databaseName,
82+
$this->port
83+
);
11184
mysqli_set_charset($conn, "utf8");
11285
return $conn;
11386
}

0 commit comments

Comments
 (0)