diff --git a/app/main/controller/ccp/sso.php b/app/main/controller/ccp/sso.php index d55ff30b..21d2690c 100644 --- a/app/main/controller/ccp/sso.php +++ b/app/main/controller/ccp/sso.php @@ -499,7 +499,7 @@ class Sso extends Api\User{ protected function updateCharacter(\stdClass $characterData) : ?Pathfinder\CharacterModel { $character = null; - if( !empty($characterData->character) ){ + if(!empty($characterData->character)){ /** * @var $character Pathfinder\CharacterModel */ @@ -511,7 +511,7 @@ class Sso extends Api\User{ $character->corporationId = $characterData->corporation; $character->allianceId = $characterData->alliance; - $character = $character->save(); + $character->save(); } return $character; diff --git a/app/main/controller/setup.php b/app/main/controller/setup.php index 6b1b610b..fdd543c2 100644 --- a/app/main/controller/setup.php +++ b/app/main/controller/setup.php @@ -1410,6 +1410,7 @@ class Setup extends Controller { * @return array */ protected function checkDBConfig(\Base $f3, \lib\db\SQL $db) : array { + $checkAll = true; // some db like "Maria DB" have some strange version strings.... $dbVersionString = $db->version(); $dbVersionParts = explode('-', $dbVersionString); @@ -1423,11 +1424,13 @@ class Setup extends Controller { } $dbConfig = [ - 'version' => [ - 'label' => 'DB version', - 'required' => $f3->get('REQUIREMENTS.MYSQL.VERSION'), - 'version' => $dbVersion, - 'check' => version_compare($dbVersion, $f3->get('REQUIREMENTS.MYSQL.VERSION'), '>=' ) + 'data' => [ + 'version' => [ + 'label' => 'DB version', + 'required' => $f3->get('REQUIREMENTS.MYSQL.VERSION'), + 'version' => $dbVersion, + 'check' => version_compare($dbVersion, $f3->get('REQUIREMENTS.MYSQL.VERSION'), '>=' ) ? : $checkAll = false + ] ] ]; @@ -1443,16 +1446,32 @@ class Setup extends Controller { return !empty($match) ? end(reset($match)) : 'unknown'; }; + $checkValue = function($requiredValue, $value) : bool { + $check = true; + if(!empty($requiredValue)){ + if(is_int($requiredValue)){ + $check = $requiredValue <= $value; + }else{ + $check = $requiredValue == $value; + } + } + return $check; + }; + foreach($mySQLConfig as $param => $requiredValue){ $value = $getValue($param); - $dbConfig[] = [ + $dbConfig['data'][] = [ 'label' => $param, 'required' => $requiredValue, 'version' => $value, - 'check' => !empty($requiredValue) ? ($requiredValue == $value) : true + 'check' => $checkValue($requiredValue, $value) ? : $checkAll = false ]; } + $dbConfig['meta'] = [ + 'check' => $checkAll + ]; + return $dbConfig; } diff --git a/app/main/lib/api/AbstractClient.php b/app/main/lib/api/AbstractClient.php index 9e592a29..9e87aa8d 100644 --- a/app/main/lib/api/AbstractClient.php +++ b/app/main/lib/api/AbstractClient.php @@ -131,6 +131,12 @@ abstract class AbstractClient extends \Prefab { Config::REDIS_OPT_READ_TIMEOUT ) ){ + + if(isset($poolConfig['tag'])){ + $name = 'pathfinder|php|tag:' . strtolower($poolConfig['tag']) . '|pid:' . getmypid(); + $client->client('setname', $name); + } + if(isset($poolConfig['db'])){ $client->select($poolConfig['db']); } @@ -179,7 +185,8 @@ abstract class AbstractClient extends \Prefab { * @return array */ protected function getCachePoolConfig(\Base $f3) : array { - $dsn = (string)$f3->get('API_CACHE'); + $tag = 'API_CACHE'; + $dsn = (string)$f3->get($tag); // fallback $conf = ['type' => 'array']; @@ -195,6 +202,10 @@ abstract class AbstractClient extends \Prefab { // redis or filesystem -> overwrites $conf Config::parseDSN($dsn, $conf); + // tag name is used as alias name e.g. for debugging + // -> e.g. for Redis https://redis.io/commands/client-setname + $conf['tag'] = $tag; + return $conf; } diff --git a/app/main/lib/config.php b/app/main/lib/config.php index c45e193f..d1a7698a 100644 --- a/app/main/lib/config.php +++ b/app/main/lib/config.php @@ -234,7 +234,6 @@ class Config extends \Prefab { $f3->set(self::HIVE_KEY_ENVIRONMENT, $environmentData); } - return $environmentData; } diff --git a/app/main/model/pathfinder/abstractpathfindermodel.php b/app/main/model/pathfinder/abstractpathfindermodel.php index 36a0ac01..bbd7532f 100644 --- a/app/main/model/pathfinder/abstractpathfindermodel.php +++ b/app/main/model/pathfinder/abstractpathfindermodel.php @@ -108,6 +108,6 @@ abstract class AbstractPathfinderModel extends AbstractModel { // parent::save() resets the schema and old values get replaced with new values $this->fieldChanges = $this->getFieldChanges(); - parent::save(); + return parent::save(); } } \ No newline at end of file diff --git a/app/requirements.ini b/app/requirements.ini index 77b7683e..81afcba7 100644 --- a/app/requirements.ini +++ b/app/requirements.ini @@ -70,6 +70,8 @@ COLLATION_DATABASE = utf8_general_ci COLLATION_CONNECTION = utf8_general_ci FOREIGN_KEY_CHECKS = ON INNODB_FILE_PER_TABLE = ON +WAIT_TIMEOUT = 28800 +INTERACTIVE_TIMEOUT = {{ @REQUIREMENTS.MYSQL.VARS.WAIT_TIMEOUT }} [REQUIREMENTS.REDIS] VERSION = 3.0 diff --git a/public/templates/view/setup.html b/public/templates/view/setup.html index eff2eabb..c195690d 100644 --- a/public/templates/view/setup.html +++ b/public/templates/view/setup.html @@ -476,7 +476,7 @@ - connected (persistent) + connected (persistent) @@ -505,20 +505,22 @@ - - required - installed - + + + + required + installed + - - - {{ @setting.label }} - + + + {{ @setting.label }} + {{ @setting.required }} - + {{ @setting.version }} @@ -528,7 +530,7 @@ - +