v1.1.2 (#270)
* fixed #194 PHP 5.6 error * - closed #102 added "set waypoint/destination" context menu to route finder module - update "Select2" 4.0.0 -> 4.0.3 - update "Font Awesome" 4.6.1 -> 4.6.3 * - added *.js files for develop branch * - closed #195 fixed "BASE" dir for subDir installations - fixed "Home" menu link * - #195 improved js load path * - added "clear cache" function for manually cache clearing to /setup #200 #105 #158 - added cache size information to /setup - added current pathfinder "VERSION" to /setup - updated "requireJs" 2.1.20 ->2.2.0 - removed unnecessary page cache timings from static templates (page cache) * - added "document_root", "port", "protocol" and "PHP framework version" to /setup page - added new "shattered" wormhole types to "signature table", closed #182, #179 * - added new "delete old signatures" option to "signature reader" dialog, closed #95 * - added new housekeeping cronjob für cached files, closed #200 - added new cache size information to /setup page * - fixed signature groupId/typeId "overwriting" for already known signatures. closed #207 - improved system search dialog. Added trim(); before "api/signatures-> search" request * updated README.me * fixed PHP error "default object from empty value", closed #209 * reduced image file size * - added local storage (IndexedDB) - added local storage for map scroll position. closed #69 * - added "notice" panel for upcoming release information - improved layout for "release dialog" (GitHub API) - improved pagespeed (removed render blocking javascripts) - improved map scrollbar configuration - improved Chrome browser custom scrollbar layout - removed "sign up" buttons from "map panels", closed #214 * - fixed some session and cookie bugs * - added new requirement check for `max_input_vars` to /setup URL, closed #224 * - fixed isWormhole(); bug * -v1.1.1 added js build files * - removed IGB support #206 - removed location tracking by IGB * - added build files for upcoming version 1.1.2 - improved ajax authentication check and "logout" notification | closed #198 - improved logging, added missing log file configuration to pathfinder.ini - added logging for "unauthorized" requests | closed #198 - updated js "jQuery" 1.11.3 -> 3.0.0 | #206 - updated js "datatables" plugin 1.10.7 -> 1.10.12 | #206 - updated js "mCustomScrollbar" 3.1.14 -> 3.1.4 | #206 * - fixed some minor bugs in signature table module * - fixed type "Cataclysmic", closed #241 * - added new setup DB indexing for "system_neighbour" table to /setup route, #125 - fixed system "TrueSec" rounding in "routes module", closed #109 * - fixed system "TrueSec" rounding in "routes module", closed #109 * - added new wormhole statics for "Thera", closed #240 * - fixed missing statics for constellation "21000062" , closed #232 * - added "static" wormholes for "shattered" systems , closed #180 - added im/export function for "index" tables (*.csv import), as an alternative to the *.sql import, closed #125 * - added new system tooltip for "region name", closed #236 - updated "Bootstrap" JS-library 3.3.0 -> 3.3.5 * - removed console.log(),,, * minor bugfixes in /setup page * - added basic support for Russian signatures, closed #256 - added warning notification for invalid signature stings * - added basic support for Russian signatures, closed #256 * - added requirement check for "PDO", "PDO_MYSQL" to "/setup" route - imrpved DB PDO connection (added "TIMEOUT", forced "ERRMODE") - fixed broken "system alias" renaming dialog * - fixed "system graph" module rendering if there was no data available - improved "image gallery" initialization on landing page - added navigation to /setup page - updated "blueImpGallery" (fixed some bugs after jQuery 3.0 upgrade) 1.15.2 -> 2.21.3 - updated "blueImpGalleryBootstrap" (fixed some bugs after jQuery 3.0 upgrade) 3.1.1 -> 3.4.2 * - JS build files vor 1.1.2 * Updated pathfinder.css
This commit is contained in:
@@ -81,6 +81,7 @@ class Setup extends Controller {
|
||||
|
||||
'Model\SystemModel',
|
||||
'Model\SystemWormholeModel',
|
||||
'Model\ConstellationWormholeModel',
|
||||
|
||||
'Model\ConnectionModel',
|
||||
'Model\SystemSignatureModel',
|
||||
@@ -108,6 +109,12 @@ class Setup extends Controller {
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* database error
|
||||
* @var bool
|
||||
*/
|
||||
protected $databaseCheck = true;
|
||||
|
||||
/**
|
||||
* event handler for all "views"
|
||||
* some global template variables are set in here
|
||||
@@ -157,6 +164,12 @@ class Setup extends Controller {
|
||||
return;
|
||||
}elseif( !empty($params['fixCols']) ){
|
||||
$fixColumns = true;
|
||||
}elseif( !empty($params['buildIndex']) ){
|
||||
$this->setupSystemJumpTable();
|
||||
}elseif( !empty($params['importTable']) ){
|
||||
$this->importTable($params['importTable']);
|
||||
}elseif( !empty($params['exportTable']) ){
|
||||
$this->exportTable($params['exportTable']);
|
||||
}elseif( !empty($params['clearCache']) ){
|
||||
$this->clearCache($f3);
|
||||
}
|
||||
@@ -174,10 +187,105 @@ class Setup extends Controller {
|
||||
// set database connection information
|
||||
$f3->set('checkDatabase', $this->checkDatabase($f3, $fixColumns));
|
||||
|
||||
// set index information
|
||||
$f3->set('indexInformation', $this->getIndexData());
|
||||
|
||||
// set cache size
|
||||
$f3->set('cacheSize', $this->getCacheData($f3));
|
||||
}
|
||||
|
||||
/**
|
||||
* IMPORTANT: This function is not required for setup. It just imports *.json -> DB
|
||||
*
|
||||
* imports wormhole static data for "shattered" systems
|
||||
* into table "system_wormhole"
|
||||
* -> a *.csv dump of this *.json file can e found under /export/csv
|
||||
* @param \Base $f3
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function importSystemWormholesFromJson(\Base $f3){
|
||||
$path = $f3->get('EXPORT') .'json/statics.json';
|
||||
$pfDB = $this->getDB('PF');
|
||||
$ccpDB = $this->getDB('CCP');
|
||||
|
||||
$content = file_get_contents($path);
|
||||
|
||||
$jsonIterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveArrayIterator(json_decode($content, TRUE)),
|
||||
\RecursiveIteratorIterator::SELF_FIRST);
|
||||
|
||||
$staticNames = [];
|
||||
|
||||
$data = [];
|
||||
$tmpVal = (object) [];
|
||||
foreach ($jsonIterator as $key => $val) {
|
||||
if(is_array($val)) {
|
||||
if(isset($tmpVal->name)){
|
||||
$data[] = $tmpVal;
|
||||
}
|
||||
$tmpVal = (object) [];
|
||||
$tmpVal->name = $key;
|
||||
} else {
|
||||
$tmpVal->wh = isset($tmpVal->wh) ? array_merge($tmpVal->wh, [$val]) : [$val];
|
||||
$staticNames[] = $val;
|
||||
}
|
||||
}
|
||||
$data[] = $tmpVal;
|
||||
|
||||
// get static IDs by name ------------------------------
|
||||
$staticNames = array_unique($staticNames);
|
||||
$staticNames = array_flip($staticNames);
|
||||
foreach($staticNames as $name => $index){
|
||||
$result = $pfDB->exec("
|
||||
SELECT
|
||||
id
|
||||
FROM " . $pfDB->quotekey(Model\BasicModel::getNew('WormholeModel')->getTable()) . "
|
||||
WHERE " . $pfDB->quotekey('name') . " = :name",
|
||||
[':name' => $name]
|
||||
);
|
||||
$id = (int)$result[0]['id'];
|
||||
if($id){
|
||||
$staticNames[$name] = (int)$result[0]['id'];
|
||||
}else{
|
||||
$f3->error(500, 'Wormhole data missing in table "wormhole" for "name" = "' . $name . '"');
|
||||
}
|
||||
}
|
||||
|
||||
// import data -----------------------------------------
|
||||
$systemWormhole = Model\BasicModel::getNew('SystemWormholeModel');
|
||||
foreach($data as $staticData){
|
||||
$result = $ccpDB->exec("
|
||||
SELECT
|
||||
solarSystemID
|
||||
FROM " . $ccpDB->quotekey('mapSolarSystems') . "
|
||||
WHERE
|
||||
" . $ccpDB->quotekey('solarSystemName') . " = :systemName",
|
||||
[':systemName' => $staticData->name]
|
||||
);
|
||||
|
||||
$solarSystemID = (int)$result[0]['solarSystemID'];
|
||||
if($solarSystemID){
|
||||
foreach($staticData->wh as $wh){
|
||||
$staticId = (int)$staticNames[$wh];
|
||||
if($staticId){
|
||||
// check if entry already exists
|
||||
$systemWormhole->load(['systemId=? AND wormholeId=?', $solarSystemID, $staticId]);
|
||||
if( $systemWormhole->dry() ){
|
||||
$systemWormhole->systemId = $solarSystemID;
|
||||
$systemWormhole->wormholeId = $staticId;
|
||||
$systemWormhole->save();
|
||||
$systemWormhole->reset();
|
||||
}
|
||||
}else{
|
||||
$f3->error(500, 'Wormhole data missing for "name" = "' . $wh . '"');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$f3->error(500, 'System "' . $staticData->name . '" not found on CCP´s [SDE] database');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set environment information
|
||||
* @param \Base $f3
|
||||
@@ -234,23 +342,23 @@ class Setup extends Controller {
|
||||
],
|
||||
'os' => [
|
||||
'label' => 'OS',
|
||||
'value' => php_uname('s')
|
||||
'value' => function_exists('php_uname') ? php_uname('s') : 'unknown'
|
||||
],
|
||||
'name' => [
|
||||
'label' => 'Host name',
|
||||
'value' => php_uname('n')
|
||||
'value' => function_exists('php_uname') ? php_uname('n') : 'unknown'
|
||||
],
|
||||
'release' => [
|
||||
'label' => 'Release name',
|
||||
'value' => php_uname('r')
|
||||
'value' => function_exists('php_uname') ? php_uname('r') : 'unknown'
|
||||
],
|
||||
'version' => [
|
||||
'label' => 'Version info',
|
||||
'value' => php_uname('v')
|
||||
'value' => function_exists('php_uname') ? php_uname('v') : 'unknown'
|
||||
],
|
||||
'machine' => [
|
||||
'label' => 'Machine type',
|
||||
'value' => php_uname('m')
|
||||
'value' => function_exists('php_uname') ? php_uname('m') : 'unknown'
|
||||
],
|
||||
'root' => [
|
||||
'label' => 'Document root',
|
||||
@@ -262,7 +370,7 @@ class Setup extends Controller {
|
||||
],
|
||||
'protocol' => [
|
||||
'label' => 'Protocol',
|
||||
'value' => $f3->get('SCHEME')
|
||||
'value' => strtoupper( $f3->get('SCHEME') )
|
||||
]
|
||||
];
|
||||
|
||||
@@ -311,6 +419,18 @@ class Setup extends Controller {
|
||||
'version' => strstr(PCRE_VERSION, ' ', true),
|
||||
'check' => version_compare( strstr(PCRE_VERSION, ' ', true), $f3->get('REQUIREMENTS.PHP.PCRE_VERSION'), '>=')
|
||||
],
|
||||
'pdo' => [
|
||||
'label' => 'PDO',
|
||||
'required' => 'installed',
|
||||
'version' => extension_loaded('pdo') ? 'installed' : 'not installed',
|
||||
'check' => extension_loaded('pdo')
|
||||
],
|
||||
'pdoMysql' => [
|
||||
'label' => 'PDO_MYSQL',
|
||||
'required' => 'installed',
|
||||
'version' => extension_loaded('pdo_mysql') ? 'installed' : 'not installed',
|
||||
'check' => extension_loaded('pdo_mysql')
|
||||
],
|
||||
'gd' => [
|
||||
'label' => 'GD Library (for Image plugin)',
|
||||
'required' => 'installed',
|
||||
@@ -661,6 +781,13 @@ class Setup extends Controller {
|
||||
$f3->reroute('@setup');
|
||||
}
|
||||
|
||||
if($dbStatusCheckCount !== 0){
|
||||
$this->databaseCheck = false;
|
||||
}
|
||||
|
||||
// sort tables for better readability
|
||||
ksort($requiredTables);
|
||||
|
||||
$this->databases[$dbKey]['info'] = [
|
||||
'db' => $db,
|
||||
'label' => $dbLabel,
|
||||
@@ -758,6 +885,181 @@ class Setup extends Controller {
|
||||
return $checkTables;
|
||||
}
|
||||
|
||||
/** get indexed (cache) data information
|
||||
* @return array
|
||||
*/
|
||||
protected function getIndexData(){
|
||||
|
||||
// active DB and tables are required for obtain index data
|
||||
if( $this->databaseCheck ){
|
||||
$indexInfo = [
|
||||
'SystemNeighbourModel' => [
|
||||
'action' => [
|
||||
[
|
||||
'task' => 'buildIndex',
|
||||
'label' => 'build',
|
||||
'icon' => 'fa-refresh',
|
||||
'btn' => 'btn-primary'
|
||||
]
|
||||
],
|
||||
'table' => Model\BasicModel::getNew('SystemNeighbourModel')->getTable(),
|
||||
'count' => DB\Database::instance()->getRowCount( Model\BasicModel::getNew('SystemNeighbourModel')->getTable() )
|
||||
],
|
||||
'WormholeModel' => [
|
||||
'action' => [
|
||||
[
|
||||
'task' => 'exportTable',
|
||||
'label' => 'export',
|
||||
'icon' => 'fa-download',
|
||||
'btn' => 'btn-default'
|
||||
],[
|
||||
'task' => 'importTable',
|
||||
'label' => 'import',
|
||||
'icon' => 'fa-upload',
|
||||
'btn' => 'btn-primary'
|
||||
]
|
||||
],
|
||||
'table' => Model\BasicModel::getNew('WormholeModel')->getTable(),
|
||||
'count' => DB\Database::instance()->getRowCount( Model\BasicModel::getNew('WormholeModel')->getTable() )
|
||||
],
|
||||
'SystemWormholeModel' => [
|
||||
'action' => [
|
||||
[
|
||||
'task' => 'exportTable',
|
||||
'label' => 'export',
|
||||
'icon' => 'fa-download',
|
||||
'btn' => 'btn-default'
|
||||
],[
|
||||
'task' => 'importTable',
|
||||
'label' => 'import',
|
||||
'icon' => 'fa-upload',
|
||||
'btn' => 'btn-primary'
|
||||
]
|
||||
],
|
||||
'table' => Model\BasicModel::getNew('SystemWormholeModel')->getTable(),
|
||||
'count' => DB\Database::instance()->getRowCount( Model\BasicModel::getNew('SystemWormholeModel')->getTable() )
|
||||
],
|
||||
'ConstellationWormholeModel' => [
|
||||
'action' => [
|
||||
[
|
||||
'task' => 'exportTable',
|
||||
'label' => 'export',
|
||||
'icon' => 'fa-download',
|
||||
'btn' => 'btn-default'
|
||||
],[
|
||||
'task' => 'importTable',
|
||||
'label' => 'import',
|
||||
'icon' => 'fa-upload',
|
||||
'btn' => 'btn-primary'
|
||||
]
|
||||
],
|
||||
'table' => Model\BasicModel::getNew('ConstellationWormholeModel')->getTable(),
|
||||
'count' => DB\Database::instance()->getRowCount( Model\BasicModel::getNew('ConstellationWormholeModel')->getTable() )
|
||||
]
|
||||
];
|
||||
}else{
|
||||
$indexInfo = [
|
||||
'SystemNeighbourModel' => [
|
||||
'action' => [],
|
||||
'table' => 'Fix database errors first!'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
return $indexInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is just for setting up the cache table 'system_neighbour' which is used
|
||||
* for system jump calculation. Call this function manually when CCP adds Systems/Stargates
|
||||
*/
|
||||
protected function setupSystemJumpTable(){
|
||||
$pfDB = $this->getDB('PF');
|
||||
$ccpDB = $this->getDB('CCP');
|
||||
|
||||
$query = "SELECT
|
||||
map_sys.solarSystemID system_id,
|
||||
map_sys.regionID region_id,
|
||||
map_sys.constellationID constellation_id,
|
||||
map_sys.solarSystemName system_name,
|
||||
ROUND( map_sys.security, 4) system_security,
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT( NULLIF(map_sys_inner.solarSystemName, NULL) SEPARATOR ':')
|
||||
FROM
|
||||
mapSolarSystemJumps map_jump INNER JOIN
|
||||
mapSolarSystems map_sys_inner ON
|
||||
map_sys_inner.solarSystemID = map_jump.toSolarSystemID
|
||||
WHERE
|
||||
map_jump.fromSolarSystemID = map_sys.solarSystemID
|
||||
) system_neighbours
|
||||
FROM
|
||||
mapSolarSystems map_sys
|
||||
HAVING
|
||||
-- skip systems without neighbors (e.g. WHs)
|
||||
system_neighbours IS NOT NULL
|
||||
";
|
||||
|
||||
$rows = $ccpDB->exec($query);
|
||||
|
||||
if(count($rows) > 0){
|
||||
// switch DB back to pathfinder DB
|
||||
|
||||
// clear cache table
|
||||
$pfDB->exec("TRUNCATE system_neighbour");
|
||||
|
||||
foreach($rows as $row){
|
||||
$pfDB->exec("
|
||||
INSERT INTO
|
||||
system_neighbour(
|
||||
regionId,
|
||||
constellationId,
|
||||
systemName,
|
||||
systemId,
|
||||
jumpNodes,
|
||||
trueSec
|
||||
)
|
||||
VALUES(
|
||||
:regionId,
|
||||
:constellationId,
|
||||
:systemName,
|
||||
:systemId,
|
||||
:jumpNodes,
|
||||
:trueSec
|
||||
)",
|
||||
[
|
||||
':regionId' => $row['region_id'],
|
||||
':constellationId' => $row['constellation_id'],
|
||||
':systemName' => $row['system_name'],
|
||||
':systemId' => $row['system_id'],
|
||||
':jumpNodes' => $row['system_neighbours'],
|
||||
':trueSec' => $row['system_security']
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* import table data from existing dump file (e.g *.csv)
|
||||
* @param $modelClass
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function importTable($modelClass){
|
||||
$this->getDB('PF');
|
||||
return Model\BasicModel::getNew($modelClass)->importData();
|
||||
}
|
||||
|
||||
/**
|
||||
* export table data
|
||||
* @param $modelClass
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function exportTable($modelClass){
|
||||
$this->getDB('PF');
|
||||
Model\BasicModel::getNew($modelClass)->exportData();
|
||||
}
|
||||
|
||||
/**
|
||||
* get cache folder size as string
|
||||
* @param \Base $f3
|
||||
|
||||
Reference in New Issue
Block a user