* #84 test data dump from CREST login

* updated "credits" dialog (Google+ link)
fixed login form layout

* updated Cortex Data-Mapper

* - #84 CREST Login (WIP)
- New CREST controller
- Database restructuring
- improved type-casting for some controller functions
- New login process
- Fixed some bugs during the setup process (/setup root)
- Added CREST request caching by response headers

* pathfinder-84 [Feature Request] CREST Pilot Tracking, many smaller Bugfixes

* pathfinder-84 [Feature Request] added develop JS files

* closed #121 fixed wormhole signature type caching

* closed #120 removed map-loading animation for larger maps (same behaviour as IGB)

* closed #119 fixed wormhole signature id count

* closed #114 Added check for already existing system when adding a new one. (fixed PDO 'duplicate entry' error)

* closed #112 fixed DataTables error for missing "status" data (signature table)

* closed #111 fixed convertDataToUTC(); client side date transformation

* closed #109 fixed system TrueSec rounding

* closed #103 fixed system updated timestamp in getData()

* fixed CSS class for secStatus in Routes module

* closed #121 fixed wormhole signature type caching

* changed dateTime format from German to US format
fixed some minor bugs in signatureTable module

* closed #81 fixed "signature type" overwriting by "signature reader" update

* closed #106 added new signature_types form C5/6 wormholes (gas/ore)

* closed #129 fixed parameter hinting

* closed #131 new "route search" algorithm, added current map systems to live search, added refresh/update functionality for each found route, added bulk route refresh function, added "meta map" route search (search on multiple maps), added route "filters" (restrict search on "stargates", "wormholes", "jumpbridges"), added route "filter" for wormholes (reduced/critical wormholes)
closed #89 fixed "loop connections" on same system
#84 added error messages for "invalid" CREST "Client ID"
added "bootboxjs" (customized styled checkboxes/radio buttons) CSS only
"Font Awesome" version upgrade 4.4.0 -> 4.61
"Bootbox.js" version upgrade 4.3.0 -> 4.4.0
fixed "system dialog" (added responsive layout)

* closed #134  fixed db column type DT_INT (8 bytes) to DT_BIGINT

* closed #138 added new cookie based login

* closed #137 fixed javascript errors on trying to establish an "invalid" connection

* - #84, #138 improved "character selection" on login page (expired cookies are deleted, character panel layout improvements)
- added new "Server info panel" to the login page
- added new cronjob to delete expired cookie authentication data

* #138 enables character switching between characters which have same user

* - PHP Framework upgrade 3.5.0 -> 3.5.1 (fixes some issues with CREST cURL caching, and SESSION management)
- #138 added "cookie logout" to "logout" menu entry

* - updated "feature page" with new feature descriptions and label
- added some new images to the "feature gallery"
- removed "beta" status from "magnetizing" feature on map menu
- hide "server status" panel on "mobile" breakpoint

* - #138 clear character authentication data on sold characters

* closed #142 added custom "onsuspect()" session handler

* #142 do not log suspect if no file is defined in pathfinder.ini

* #142 added NullSec Data/Relic sites to C1/2/3 wormholes as signature option

* #144 fixed "Character not found" warning

* #144 fixed "Character not found" warning

* closed #144 fixed broken routes panel in IGB

* updated README.md for upcoming release

* #147 response header validation

* #149 changed comment for 'BASE' framework var

* fixed map  import

* - added minimal SDE dump (EVE Online: Citadel)
- #147 improved CREST API error logging (WIP)
- improved SSO controller (removed access_token from public endpoints)

* closed #154 added alliance maps to CREST API

* - updated Gulp build dependencies
- increased CREST timeout from 3s -> 4s
- added "Accept" Headers for some CREST endpoints

* cloased #147

* - closed #153 added character verification check for getAll(); Signatures Ajax endpoint

* - updated README.md (added Slack developer chat information)

* Bugfix frig holes (#159)

* added missing frigate wormholes and fixed Q003 destination in shattered wormholes

* changed C7 to 0.0 for Q003

* - fixed broken "graph" data for system

* added a  "failover" system  for bad crest requests (HTTP status 5xx,.. )

* Red Gaint => Red Giant (#161)

* closed #163 added CREST endpoint support for "waypoints"

* fixed typo

* closed #160 fixed tooltip container

* - added new features to login page

* closes #154 added alliance map support

* fixed XML path for cronjobs

* fixed a bug with inactive "private" maps

* closes #175 added alternative environment configuration

* - v1.0.0  build
This commit is contained in:
Mark Friedrich
2016-06-03 23:05:34 +02:00
parent 0c0cd84730
commit ecd505a202
192 changed files with 7965 additions and 5751 deletions

View File

@@ -11,11 +11,46 @@ namespace Controller;
use DB;
use DB\SQL;
use DB\SQL\MySQL as MySQL;
use lib\Config;
use Model;
class Setup extends Controller {
/**
* required environment variables
* @var array
*/
protected $environmentVars = [
'TYPE',
'BASE',
'URL',
'DEBUG',
'DB_DNS',
'DB_NAME',
'DB_USER',
'DB_PASS',
'DB_CCP_DNS',
'DB_CCP_NAME',
'DB_CCP_USER',
'DB_CCP_PASS',
'CCP_CREST_URL',
'SSO_CCP_URL',
'SSO_CCP_CLIENT_ID',
'SSO_CCP_SECRET_KEY',
'CCP_XML',
'SMTP_HOST',
'SMTP_PORT',
'SMTP_SCHEME',
'SMTP_USER',
'SMTP_PASS',
'SMTP_FROM',
'SMTP_ERROR'
];
/**
* required database setup
* @var array
*/
protected $databases = [
'PF' => [
'info' => [],
@@ -30,18 +65,17 @@ class Setup extends Controller {
'Model\SystemStatusModel',
'Model\SystemNeighbourModel',
'Model\WormholeModel',
'Model\RegistrationKeyModel',
'Model\CharacterStatusModel',
'Model\ConnectionScopeModel',
'Model\UserMapModel',
'Model\CharacterMapModel',
'Model\AllianceMapModel',
'Model\CorporationMapModel',
'Model\UserApiModel',
'Model\UserCharacterModel',
'Model\CharacterModel',
'Model\CharacterAuthenticationModel',
'Model\CharacterLogModel',
'Model\SystemModel',
@@ -76,9 +110,9 @@ class Setup extends Controller {
/**
* event handler for all "views"
* some global template variables are set in here
* @param $f3
* @param \Base $f3
*/
function beforeroute($f3) {
function beforeroute(\Base $f3) {
// page title
$f3->set('pageTitle', 'Setup');
@@ -92,7 +126,7 @@ class Setup extends Controller {
$f3->set('pathJs', 'public/js/' . $f3->get('PATHFINDER.VERSION') );
}
public function afterroute($f3) {
public function afterroute(\Base $f3) {
// js view (file)
$f3->set('jsView', 'setup');
@@ -103,9 +137,9 @@ class Setup extends Controller {
/**
* main setup route handler
* works as dispatcher for setup functions
* @param $f3
* @param \Base $f3
*/
public function init($f3){
public function init(\Base $f3){
$params = $f3->get('GET');
// enables automatic column fix
@@ -129,22 +163,69 @@ class Setup extends Controller {
$fixColumns = true;
}
// set server information for page render
// set template data ----------------------------------------------------------------
// set environment information
$f3->set('environmentInformation', $this->getEnvironmentInformation($f3));
// set server information
$f3->set('serverInformation', $this->getServerInformation($f3));
// set requirement check information for page render
// set requirement check information
$f3->set('checkRequirements', $this->checkRequirements($f3));
// set database connection information for page render
// set database connection information
$f3->set('checkDatabase', $this->checkDatabase($f3, $fixColumns));
}
/**
* get server information
* @param $f3
* set environment information
* @param \Base $f3
* @return array
*/
protected function getServerInformation($f3){
protected function getEnvironmentInformation(\Base $f3){
$environmentData = [];
// exclude some sensitive data (e.g. database, passwords)
$excludeVars = ['DB_DNS', 'DB_NAME', 'DB_USER',
'DB_PASS', 'DB_CCP_DNS', 'DB_CCP_NAME',
'DB_CCP_USER', 'DB_CCP_PASS'
];
// obscure some values
$obscureVars = ['SSO_CCP_CLIENT_ID', 'SSO_CCP_SECRET_KEY', 'SMTP_PASS'];
foreach($this->environmentVars as $var){
if( !in_array($var, $excludeVars) ){
$value = Config::getEnvironmentData($var);
$check = true;
if(is_null($value)){
// variable missing
$check = false;
$value = '[missing]';
}elseif( in_array($var, $obscureVars)){
$length = strlen($value);
$hideChars = ($length < 10) ? $length : 10;
$value = substr_replace($value, str_repeat('.', 3), -$hideChars);
$value .= ' [' . $length . ']';
}
$environmentData[$var] = [
'label' => $var,
'value' => ((empty($value) && !is_int($value)) ? '&nbsp;' : $value),
'check' => $check
];
}
}
return $environmentData;
}
/**
* get server information
* @param \Base $f3
* @return array
*/
protected function getServerInformation(\Base $f3){
$serverInfo = [
'time' => [
'label' => 'Time',
@@ -178,10 +259,10 @@ class Setup extends Controller {
/**
* check all required backend requirements
* (Fat Free Framework)
* @param $f3
* @param \Base $f3
* @return array
*/
protected function checkRequirements($f3){
protected function checkRequirements(\Base $f3){
// server type ------------------------------------------------------------------
@@ -288,11 +369,11 @@ class Setup extends Controller {
/**
* get database connection information
* @param $f3
* @param \Base $f3
* @param bool|false $exec
* @return array
*/
protected function checkDatabase($f3, $exec = false){
protected function checkDatabase(\Base $f3, $exec = false){
foreach($this->databases as $dbKey => $dbData){
@@ -413,6 +494,7 @@ class Setup extends Controller {
$changedType = false;
$changedUnique = false;
$changedIndex = false;
$addConstraints = [];
// set (new) column information -------------------------------------------------------
$requiredTables[$requiredTableName]['fieldConf'][$columnName]['exists'] = true;
@@ -427,17 +509,22 @@ class Setup extends Controller {
$constraint = $col->newConstraint($constraintData);
$foreignKeyExists = $col->constraintExists($constraint);
// constraint information -> show in template
$requiredTables[$requiredTableName]['foreignKeys'][] = [
'exists' => $foreignKeyExists,
'keyName' => $constraint->getConstraintName()
];
$col->addConstraint($constraint);
if(!$foreignKeyExists){
if($foreignKeyExists){
// drop constraint and re-add again at the and, in case something has changed
$col->dropConstraint($constraint);
}else{
$tableStatusCheckCount++;
$foreignKeyStatusCheck = false;
}
$addConstraints[] = $constraint;
}
}
@@ -452,11 +539,21 @@ class Setup extends Controller {
$tableStatusCheckCount++;
}
// check if column unique changed -----------------------------------------------------
// check if column index changed ------------------------------------------------------
$indexUpdate = false;
$indexKey = (bool)$hasIndex;
$indexUnique = (bool)$hasUnique;
if($currentColIndex != $fieldConf['index']){
$changedIndex = true;
$columnStatusCheck = false;
$tableStatusCheckCount++;
$indexUpdate = true;
$indexKey = (bool) $fieldConf['index'];
}
// check if column unique changed -----------------------------------------------------
if($currentColIndexData['unique'] != $fieldConf['unique']){
$changedUnique = true;
$columnStatusCheck = false;
@@ -466,15 +563,6 @@ class Setup extends Controller {
$indexUnique =(bool)$fieldConf['unique'];
}
// check if column index changed ------------------------------------------------------
if($currentColIndex != $fieldConf['index']){
$changedIndex = true;
$columnStatusCheck = false;
$tableStatusCheckCount++;
$indexUpdate = true;
$indexKey = (bool) $fieldConf['index'];
}
// build table with changed columns ---------------------------------------------------
if(!$columnStatusCheck || !$foreignKeyStatusCheck){
@@ -495,6 +583,12 @@ class Setup extends Controller {
$tableModifier->updateColumn($columnName, $col);
}
// (re-)add constraints !after! index update is done
// otherwise index update will fail if there are existing constraints
foreach($addConstraints as $constraint){
$col->addConstraint($constraint);
}
$buildStatus = $tableModifier->build($exec);
if(
@@ -559,11 +653,11 @@ class Setup extends Controller {
}
/** check MySQL params
* @param $f3
* @param \Base $f3
* @param $db
* @return array
*/
protected function checkDBConfig($f3, $db){
protected function checkDBConfig(\Base $f3, $db){
// some db like "Maria DB" have some strange version strings....
$dbVersionString = $db->version();