fix: dang, type hinting is only for PHP7... bleee :P

This commit is contained in:
Martin Ambrus
2017-10-26 11:43:08 +02:00
parent 743a6a3f90
commit 91736e6209
4 changed files with 15 additions and 13 deletions
+7 -7
View File
@@ -108,7 +108,7 @@ class MYSQLi_DB implements IDbConnection {
* @param int $port [Optional] server port to connect to. Default: 3306
* @return void This method doesn't have a return value.
*/
public function __construct(string $hostname, string $username, string $password, string $dbname, int $port = 3306) {
public function __construct($hostname, $username, $password, $dbname, $port = 3306) {
$this->hostname = $hostname;
$this->port = $port;
$this->username = $username;
@@ -128,7 +128,7 @@ class MYSQLi_DB implements IDbConnection {
* {@inheritDoc}
* @see \App\Database\IDbConnection::connect()
*/
public function connect(): bool {
public function connect() {
// try to connect
$this->dblink = mysqli_connect($this->hostname, $this->username, $this->password);
@@ -153,7 +153,7 @@ class MYSQLi_DB implements IDbConnection {
* {@inheritDoc}
* @see \App\Database\IDbConnection::disconnect()
*/
public function disconnect(): bool {
public function disconnect() {
if ($this->dblink) {
if (!$this->dblink->close()) {
return false;
@@ -169,16 +169,16 @@ class MYSQLi_DB implements IDbConnection {
* {@inheritDoc}
* @see \App\Database\IDbConnection::reconnect()
*/
public function reconnect(): bool {
public function reconnect() {
$this->disconnect();
return $this->connect();
}
/**
* {@inheritDoc}
* @see \App\Database\IDbConnection::query()
* @see \App\Database\IDbConnection::query_new()
*/
public function query_new(string $statement, ...$params) {
public function query_new($statement, ...$params) {
// check for SELECT
preg_match('/[^AZ-az]*(\()?[^AZ-az]*SELECT/i', $statement, $matches);
@@ -229,7 +229,7 @@ class MYSQLi_DB implements IDbConnection {
* {@inheritDoc}
* @see \App\Database\IDbConnection::is_connected()
*/
public function is_connected(): bool {
public function is_connected() {
return ($this->dblink ? true : false);
}
+5 -5
View File
@@ -27,14 +27,14 @@ interface IDbConnection {
*
* @return bool Returns true if the connection was made and the chosen database exists, false otherwise.
*/
public function connect(): bool;
public function connect();
/**
* Method used to disconnect from the database.
*
* @return bool Returns true if the disconnect was successful, false otherwise.
*/
public function disconnect(): bool;
public function disconnect();
/**
* Method used to reconnect to the database
@@ -42,7 +42,7 @@ interface IDbConnection {
*
* @return bool Returns true if the reconnect was successful, false otherwise.
*/
public function reconnect(): bool;
public function reconnect();
/**
* Method to check whether or not we are connected
@@ -50,7 +50,7 @@ interface IDbConnection {
*
* @return bool Returns true if a connection exists, false otherwise.
*/
public function is_connected(): bool;
public function is_connected();
/**
* Prepares and executes a MySQL query and returns the result.
@@ -69,6 +69,6 @@ interface IDbConnection {
* @return mixed Returns either a mysqli_result or a number. If number is returned, it will be last insert ID
* for INSERTs or number of affected rows for anything else.
*/
public function query_new(string $statement, ...$params);
public function query_new($statement, ...$params);
}
+1 -1
View File
@@ -89,7 +89,7 @@ class User {
* @return boolean Returns true if the value exists in database,
* false otherwise.
*/
public static function exists(IDbConnection $db, string $value) {
public static function exists(IDbConnection $db, $value) {
$sql = '(
SELECT
Count(*) AS in_users
+2
View File
@@ -5,6 +5,8 @@
- show number of set vs. number of available units for raids in the farmlist
- when not enough units are available in farmlist, show error when start raid is clicked
- we really need un/subscription in forums (for sending notifications of new posts into messages) rather than subscribing by posting something in a topic
- create admin user with a real village during installation if admin data are set
- add mysql port setting into installation script
- normalize forum tables - varchar is used for numeric values and is joined with int field
- finish parts in Admin that are unfinished (mostly delete -X- buttons and Alliance settings)
- add batching logic to mehods which get called too frequently and multiple times (example - Message::sendMessage() now that is sends messages for each forum post)