v1.1.1 (#233)
* 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
This commit is contained in:
@@ -36,7 +36,7 @@ UI = public/
|
||||
AUTOLOAD = app/main/
|
||||
|
||||
; path to favicons folder
|
||||
FAVICON = /favicon
|
||||
FAVICON = favicon/
|
||||
|
||||
; load additional config files
|
||||
; DO NOT load environment.ini, it is loaded automatically
|
||||
|
||||
@@ -7,7 +7,7 @@ web = TRUE
|
||||
; run every minute
|
||||
instant = * * * * *
|
||||
|
||||
; run in downtime 11:00 GMT/UTC
|
||||
; run on EVE downtime 11:00 GMT/UTC
|
||||
downtime = 0 11 * * *
|
||||
|
||||
[CRON.jobs]
|
||||
@@ -24,4 +24,7 @@ deleteLogData = Cron\CharacterUpdate->deleteLogData, @hourly
|
||||
deleteMapData = Cron\MapUpdate->deleteMapData, @downtime
|
||||
|
||||
; delete expired character cookie authentication data
|
||||
deleteAuthenticationData = Cron\CharacterUpdate->deleteAuthenticationData, @downtime
|
||||
deleteAuthenticationData = Cron\CharacterUpdate->deleteAuthenticationData, @downtime
|
||||
|
||||
; delete expired cache files
|
||||
deleteExpiredCacheData = Cron\Cache->deleteExpiredData, @weekly
|
||||
@@ -8,7 +8,7 @@ SERVER = DEVELOP
|
||||
|
||||
[ENVIRONMENT.DEVELOP]
|
||||
; path to index.php (Default: leave blank == "auto-detect")
|
||||
; -> e.g. set /pathfinder if your URL looks like https://www.[YOUR_DOMAIN]/pathfinder (subfolder)
|
||||
; -> e.g. set pathfinder/ if your URL looks like https://www.[YOUR_DOMAIN]/pathfinder (subfolder)
|
||||
BASE =
|
||||
; deployment URL (e.g. http://localhost)
|
||||
URL = http://pathfinder.local
|
||||
@@ -47,7 +47,7 @@ SMTP_ERROR = pathfinder@localhost.com
|
||||
|
||||
[ENVIRONMENT.PRODUCTION]
|
||||
; path to index.php (Default: leave blank == "auto-detect")
|
||||
; -> e.g. set /pathfinder if your URL looks like https://www.[YOUR_DOMAIN]/pathfinder (subfolder)
|
||||
; -> e.g. set pathfinder/ if your URL looks like https://www.[YOUR_DOMAIN]/pathfinder (subfolder)
|
||||
BASE =
|
||||
; deployment URL (e.g. https://www.pathfinder-w.space)
|
||||
URL = https://www.pathfinder-w.space
|
||||
|
||||
@@ -40,7 +40,7 @@ class GitHub extends Controller\Controller {
|
||||
public function releases($f3){
|
||||
$cacheKey = 'CACHE_GITHUB_RELEASES';
|
||||
$ttl = 60 * 30; // 30min
|
||||
$releaseCount = 3;
|
||||
$releaseCount = 4;
|
||||
|
||||
if( !$f3->exists($cacheKey) ){
|
||||
$apiPath = $this->getF3()->get('PATHFINDER.API.GIT_HUB') . '/repos/exodus4d/pathfinder/releases';
|
||||
|
||||
@@ -780,150 +780,155 @@ class Map extends Controller\AccessController {
|
||||
$sourceSystemId = (int)$this->getF3()->get(User::SESSION_KEY_CHARACTER_PREV_SYSTEM_ID);
|
||||
$targetSystemId = (int)$log->systemId;
|
||||
|
||||
$sourceSystem = null;
|
||||
$targetSystem = null;
|
||||
if($sourceSystemId){
|
||||
$sourceSystem = null;
|
||||
$targetSystem = null;
|
||||
|
||||
// check if source and target systems are equal
|
||||
// -> NO target system available
|
||||
if($sourceSystemId === $targetSystemId){
|
||||
// check if previous (solo) system is already on the map
|
||||
$sourceSystem = $map->getSystemByCCPId($sourceSystemId);
|
||||
$sameSystem = true;
|
||||
}else{
|
||||
// check if previous (source) system is already on the map
|
||||
$sourceSystem = $map->getSystemByCCPId($sourceSystemId);
|
||||
// check if source and target systems are equal
|
||||
// -> NO target system available
|
||||
if($sourceSystemId === $targetSystemId){
|
||||
// check if previous (solo) system is already on the map
|
||||
$sourceSystem = $map->getSystemByCCPId($sourceSystemId);
|
||||
$sameSystem = true;
|
||||
}else{
|
||||
// check if previous (source) system is already on the map
|
||||
$sourceSystem = $map->getSystemByCCPId($sourceSystemId);
|
||||
|
||||
// -> check if system is already on this map
|
||||
$targetSystem = $map->getSystemByCCPId( $targetSystemId );
|
||||
}
|
||||
// -> check if system is already on this map
|
||||
$targetSystem = $map->getSystemByCCPId( $targetSystemId );
|
||||
}
|
||||
|
||||
// if systems don´t already exists on map -> get "blank" systems
|
||||
// -> required for system type check (e.g. wormhole, k-space)
|
||||
if( !$sourceSystem ){
|
||||
$sourceExists = false;
|
||||
$sourceSystem = $map->getNewSystem($sourceSystemId);
|
||||
}else{
|
||||
// system exists -> add target to the "right"
|
||||
$systemPosX = $sourceSystem->posX + $systemOffsetX;
|
||||
$systemPosY = $sourceSystem->posY + $systemOffsetY;
|
||||
}
|
||||
// if systems don´t already exists on map -> get "blank" systems
|
||||
// -> required for system type check (e.g. wormhole, k-space)
|
||||
if(
|
||||
!$sourceSystem &&
|
||||
$sourceSystemId
|
||||
){
|
||||
$sourceExists = false;
|
||||
$sourceSystem = $map->getNewSystem($sourceSystemId);
|
||||
}else{
|
||||
// system exists -> add target to the "right"
|
||||
$systemPosX = $sourceSystem->posX + $systemOffsetX;
|
||||
$systemPosY = $sourceSystem->posY + $systemOffsetY;
|
||||
}
|
||||
|
||||
if(
|
||||
!$sameSystem &&
|
||||
!$targetSystem
|
||||
){
|
||||
$targetExists = false;
|
||||
$targetSystem = $map->getNewSystem( $targetSystemId );
|
||||
}
|
||||
if(
|
||||
!$sameSystem &&
|
||||
!$targetSystem
|
||||
){
|
||||
$targetExists = false;
|
||||
$targetSystem = $map->getNewSystem( $targetSystemId );
|
||||
}
|
||||
|
||||
$addSourceSystem = false;
|
||||
$addTargetSystem = false;
|
||||
$addConnection = false;
|
||||
$addSourceSystem = false;
|
||||
$addTargetSystem = false;
|
||||
$addConnection = false;
|
||||
|
||||
switch($mapScope->name){
|
||||
case 'all':
|
||||
if($sameSystem){
|
||||
$addSourceSystem = true;
|
||||
}else{
|
||||
$addSourceSystem = true;
|
||||
$addTargetSystem = true;
|
||||
$addConnection = true;
|
||||
}
|
||||
break;
|
||||
case 'k-space':
|
||||
if($sameSystem){
|
||||
if( !$sourceSystem->isWormhole() ){
|
||||
switch($mapScope->name){
|
||||
case 'all':
|
||||
if($sameSystem){
|
||||
$addSourceSystem = true;
|
||||
}
|
||||
}elseif(
|
||||
!$sourceSystem->isWormhole() ||
|
||||
!$targetSystem->isWormhole()
|
||||
){
|
||||
$addSourceSystem = true;
|
||||
$addTargetSystem = true;
|
||||
$addConnection = true;
|
||||
}
|
||||
break;
|
||||
case 'wh':
|
||||
default:
|
||||
if($sameSystem){
|
||||
if( $sourceSystem->isWormhole() ){
|
||||
$addSourceSystem = true;
|
||||
}
|
||||
}elseif(
|
||||
$sourceSystem->isWormhole() ||
|
||||
$targetSystem->isWormhole()
|
||||
){
|
||||
$addSourceSystem = true;
|
||||
$addTargetSystem = true;
|
||||
$addConnection = true;
|
||||
}elseif(
|
||||
!$sourceSystem->isWormhole() &&
|
||||
!$targetSystem->isWormhole()
|
||||
){
|
||||
// check distance between systems (in jumps)
|
||||
// -> if > 1 it is !very likely! a wormhole
|
||||
$routeController = new Route();
|
||||
$routeController->initJumpData();
|
||||
$route = $routeController->findRoute($sourceSystem->name, $targetSystem->name, 1);
|
||||
|
||||
if( !$route['routePossible'] ){
|
||||
}else{
|
||||
$addSourceSystem = true;
|
||||
$addTargetSystem = true;
|
||||
$addConnection = true;
|
||||
}
|
||||
break;
|
||||
case 'k-space':
|
||||
if($sameSystem){
|
||||
if( !$sourceSystem->isWormhole() ){
|
||||
$addSourceSystem = true;
|
||||
}
|
||||
}elseif(
|
||||
!$sourceSystem->isWormhole() ||
|
||||
!$targetSystem->isWormhole()
|
||||
){
|
||||
$addSourceSystem = true;
|
||||
$addTargetSystem = true;
|
||||
$addConnection = true;
|
||||
}
|
||||
break;
|
||||
case 'wh':
|
||||
default:
|
||||
if($sameSystem){
|
||||
if( $sourceSystem->isWormhole() ){
|
||||
$addSourceSystem = true;
|
||||
}
|
||||
}elseif(
|
||||
$sourceSystem->isWormhole() ||
|
||||
$targetSystem->isWormhole()
|
||||
){
|
||||
$addSourceSystem = true;
|
||||
$addTargetSystem = true;
|
||||
$addConnection = true;
|
||||
}elseif(
|
||||
!$sourceSystem->isWormhole() &&
|
||||
!$targetSystem->isWormhole()
|
||||
){
|
||||
// check distance between systems (in jumps)
|
||||
// -> if > 1 it is !very likely! a wormhole
|
||||
$routeController = new Route();
|
||||
$routeController->initJumpData();
|
||||
$route = $routeController->findRoute($sourceSystem->name, $targetSystem->name, 1);
|
||||
|
||||
if( !$route['routePossible'] ){
|
||||
$addSourceSystem = true;
|
||||
$addTargetSystem = true;
|
||||
$addConnection = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// save source system -------------------------------------------------------------------------------------
|
||||
if(
|
||||
$addSourceSystem &&
|
||||
$sourceSystem &&
|
||||
!$sourceExists
|
||||
){
|
||||
$sourceSystem = $map->saveSystem($sourceSystem, $systemPosX, $systemPosY, $character);
|
||||
// get updated maps object
|
||||
if($sourceSystem){
|
||||
$map = $sourceSystem->mapId;
|
||||
$sourceExists = true;
|
||||
$clearMapDataCache = true;
|
||||
// increase system position (prevent overlapping)
|
||||
$systemPosX = $sourceSystem->posX + $systemOffsetX;
|
||||
$systemPosY = $sourceSystem->posY + $systemOffsetY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// save source system -------------------------------------------------------------------------------------
|
||||
if(
|
||||
$addSourceSystem &&
|
||||
$sourceSystem &&
|
||||
!$sourceExists
|
||||
){
|
||||
$sourceSystem = $map->saveSystem($sourceSystem, $systemPosX, $systemPosY, $character);
|
||||
// get updated maps object
|
||||
if($sourceSystem){
|
||||
$map = $sourceSystem->mapId;
|
||||
$sourceExists = true;
|
||||
$clearMapDataCache = true;
|
||||
// increase system position (prevent overlapping)
|
||||
$systemPosX = $sourceSystem->posX + $systemOffsetX;
|
||||
$systemPosY = $sourceSystem->posY + $systemOffsetY;
|
||||
}
|
||||
}
|
||||
|
||||
// save target system -------------------------------------------------------------------------------------
|
||||
if(
|
||||
$addTargetSystem &&
|
||||
$targetSystem &&
|
||||
!$targetExists
|
||||
){
|
||||
$targetSystem = $map->saveSystem($targetSystem, $systemPosX, $systemPosY, $character);
|
||||
// get updated maps object
|
||||
if($targetSystem){
|
||||
$map = $targetSystem->mapId;
|
||||
$clearMapDataCache = true;
|
||||
$targetExists = true;
|
||||
// save target system -------------------------------------------------------------------------------------
|
||||
if(
|
||||
$addTargetSystem &&
|
||||
$targetSystem &&
|
||||
!$targetExists
|
||||
){
|
||||
$targetSystem = $map->saveSystem($targetSystem, $systemPosX, $systemPosY, $character);
|
||||
// get updated maps object
|
||||
if($targetSystem){
|
||||
$map = $targetSystem->mapId;
|
||||
$clearMapDataCache = true;
|
||||
$targetExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// save connection ----------------------------------------------------------------------------------------
|
||||
if(
|
||||
$addConnection &&
|
||||
$sourceExists &&
|
||||
$targetExists &&
|
||||
$sourceSystem &&
|
||||
$targetSystem &&
|
||||
!$map->searchConnection( $sourceSystem, $targetSystem )
|
||||
){
|
||||
$connection = $map->getNewConnection($sourceSystem, $targetSystem);
|
||||
$connection = $map->saveConnection($connection);
|
||||
// get updated maps object
|
||||
if($connection){
|
||||
$map = $connection->mapId;
|
||||
$clearMapDataCache = true;
|
||||
// save connection ----------------------------------------------------------------------------------------
|
||||
if(
|
||||
$addConnection &&
|
||||
$sourceExists &&
|
||||
$targetExists &&
|
||||
$sourceSystem &&
|
||||
$targetSystem &&
|
||||
!$map->searchConnection( $sourceSystem, $targetSystem )
|
||||
){
|
||||
$connection = $map->getNewConnection($sourceSystem, $targetSystem);
|
||||
$connection = $map->saveConnection($connection);
|
||||
// get updated maps object
|
||||
if($connection){
|
||||
$map = $connection->mapId;
|
||||
$clearMapDataCache = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,8 +589,8 @@ class Route extends \Controller\AccessController {
|
||||
];
|
||||
|
||||
$returnRoutData = [
|
||||
'systemFrom' => $routeData['systemFrom'],
|
||||
'systemTo' => $routeData['systemTo'],
|
||||
'systemFromData' => $routeData['systemFromData'],
|
||||
'systemToData' => $routeData['systemToData'],
|
||||
'maps' => $mapData,
|
||||
'mapIds' => $mapIds
|
||||
];
|
||||
@@ -599,10 +599,14 @@ class Route extends \Controller\AccessController {
|
||||
$returnRoutData += $filterData;
|
||||
|
||||
if(count($mapIds) > 0){
|
||||
$systemFrom = $routeData['systemFromData']['name'];
|
||||
$systemTo = $routeData['systemToData']['name'];
|
||||
|
||||
|
||||
$cacheKey = $this->getRouteCacheKey(
|
||||
$mapIds,
|
||||
$routeData['systemFrom'],
|
||||
$routeData['systemTo'],
|
||||
$systemFrom,
|
||||
$systemTo,
|
||||
$filterData
|
||||
);
|
||||
|
||||
@@ -614,7 +618,7 @@ class Route extends \Controller\AccessController {
|
||||
$this->initJumpData($mapIds, $filterData);
|
||||
|
||||
// no cached route data found
|
||||
$foundRoutData = $this->findRoute($routeData['systemFrom'], $routeData['systemTo']);
|
||||
$foundRoutData = $this->findRoute($systemFrom, $systemTo);
|
||||
$returnRoutData = array_merge($returnRoutData, $foundRoutData);
|
||||
|
||||
// cache if route was found
|
||||
|
||||
@@ -28,7 +28,7 @@ class Signature extends Controller\AccessController{
|
||||
* -> return value of this is limited to a "SINGLE" system
|
||||
* @param \Base $f3
|
||||
*/
|
||||
public function getAll($f3){
|
||||
public function getAll(\Base $f3){
|
||||
$signatureData = [];
|
||||
$systemIds = (array)$f3->get('POST.systemIds');
|
||||
|
||||
@@ -60,12 +60,16 @@ class Signature extends Controller\AccessController{
|
||||
/**
|
||||
* save or update a full signature data set
|
||||
* or save/update just single or multiple signature data
|
||||
* @param $f3
|
||||
* @param \Base $f3
|
||||
*/
|
||||
public function save($f3){
|
||||
public function save(\Base $f3){
|
||||
$requestData = $f3->get('POST');
|
||||
|
||||
$signatureData = null;
|
||||
$systemId = (int)$requestData['systemId'];
|
||||
// delete all signatures that are not available in this request
|
||||
$deleteOldSignatures = (bool)$requestData['deleteOld'];
|
||||
|
||||
|
||||
$return = (object) [];
|
||||
$return->error = [];
|
||||
@@ -83,6 +87,8 @@ class Signature extends Controller\AccessController{
|
||||
$activeCharacter = $this->getCharacter();
|
||||
|
||||
if($activeCharacter){
|
||||
// signature ids that were updated/created
|
||||
$updatedSignatureIds = [];
|
||||
|
||||
/**
|
||||
* @var Model\SystemModel $system
|
||||
@@ -96,7 +102,7 @@ class Signature extends Controller\AccessController{
|
||||
|
||||
$system->getById( (int)$data['systemId']);
|
||||
|
||||
if(!$system->dry()){
|
||||
if( !$system->dry() ){
|
||||
// update/save signature
|
||||
|
||||
/**
|
||||
@@ -156,6 +162,14 @@ class Signature extends Controller\AccessController{
|
||||
unset( $data['typeId'] );
|
||||
}
|
||||
|
||||
// "sig reader" should not overwrite signature group information
|
||||
if(
|
||||
$data['groupId'] == 0 &&
|
||||
$signature->groupId > 0
|
||||
){
|
||||
unset($data['groupId']);
|
||||
}
|
||||
|
||||
$newData = $data;
|
||||
}
|
||||
|
||||
@@ -167,6 +181,7 @@ class Signature extends Controller\AccessController{
|
||||
}
|
||||
|
||||
$signature->save();
|
||||
$updatedSignatureIds[] = $signature->id;
|
||||
|
||||
// get a fresh signature object with the new data. This is a bad work around!
|
||||
// but i could not figure out what the problem was when using the signature model, saved above :(
|
||||
@@ -184,6 +199,28 @@ class Signature extends Controller\AccessController{
|
||||
|
||||
$system->reset();
|
||||
}
|
||||
|
||||
// delete "old" signatures ------------------------------------------------------------------
|
||||
if(
|
||||
$deleteOldSignatures &&
|
||||
$systemId
|
||||
){
|
||||
$system->getById($systemId);
|
||||
if(
|
||||
!$system->dry() &&
|
||||
$system->hasAccess($activeCharacter)
|
||||
){
|
||||
$allSignatures = $system->getSignatures();
|
||||
foreach($allSignatures as $tempSignature){
|
||||
if( !in_array($tempSignature->id, $updatedSignatureIds)){
|
||||
$tempSignature->delete( $activeCharacter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +231,7 @@ class Signature extends Controller\AccessController{
|
||||
* delete signatures
|
||||
* @param \Base $f3
|
||||
*/
|
||||
public function delete($f3){
|
||||
public function delete(\Base $f3){
|
||||
$signatureIds = $f3->get('POST.signatureIds');
|
||||
$activeCharacter = $this->getCharacter();
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace Controller;
|
||||
|
||||
use data\filesystem\Search;
|
||||
use DB;
|
||||
use DB\SQL;
|
||||
use DB\SQL\MySQL as MySQL;
|
||||
@@ -137,6 +138,7 @@ class Setup extends Controller {
|
||||
/**
|
||||
* main setup route handler
|
||||
* works as dispatcher for setup functions
|
||||
* -> for security reasons all /setup "routes" are dispatched by GET params
|
||||
* @param \Base $f3
|
||||
*/
|
||||
public function init(\Base $f3){
|
||||
@@ -146,21 +148,17 @@ class Setup extends Controller {
|
||||
$fixColumns = false;
|
||||
|
||||
// bootstrap database from model class definition
|
||||
if(
|
||||
isset($params['db']) &&
|
||||
!empty($params['db'])
|
||||
){
|
||||
if( !empty($params['db']) ){
|
||||
$this->bootstrapDB($params['db']);
|
||||
|
||||
// reload page
|
||||
// -> remove GET param
|
||||
$f3->reroute('@setup');
|
||||
return;
|
||||
}elseif(
|
||||
isset($params['fixCols']) &&
|
||||
!empty($params['fixCols'])
|
||||
){
|
||||
}elseif( !empty($params['fixCols']) ){
|
||||
$fixColumns = true;
|
||||
}elseif( !empty($params['clearCache']) ){
|
||||
$this->clearCache($f3);
|
||||
}
|
||||
|
||||
// set template data ----------------------------------------------------------------
|
||||
@@ -175,6 +173,9 @@ class Setup extends Controller {
|
||||
|
||||
// set database connection information
|
||||
$f3->set('checkDatabase', $this->checkDatabase($f3, $fixColumns));
|
||||
|
||||
// set cache size
|
||||
$f3->set('cacheSize', $this->getCacheData($f3));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,7 +230,7 @@ class Setup extends Controller {
|
||||
$serverInfo = [
|
||||
'time' => [
|
||||
'label' => 'Time',
|
||||
'value' => date('Y/m/d H:i:s') . ' - (' . date_default_timezone_get() . ')'
|
||||
'value' => date('Y/m/d H:i:s') . ' - (' . $f3->get('TZ') . ')'
|
||||
],
|
||||
'os' => [
|
||||
'label' => 'OS',
|
||||
@@ -250,6 +251,18 @@ class Setup extends Controller {
|
||||
'machine' => [
|
||||
'label' => 'Machine type',
|
||||
'value' => php_uname('m')
|
||||
],
|
||||
'root' => [
|
||||
'label' => 'Document root',
|
||||
'value' => $f3->get('ROOT')
|
||||
],
|
||||
'port' => [
|
||||
'label' => 'Port',
|
||||
'value' => $f3->get('PORT')
|
||||
],
|
||||
'protocol' => [
|
||||
'label' => 'Protocol',
|
||||
'value' => $f3->get('SCHEME')
|
||||
]
|
||||
];
|
||||
|
||||
@@ -309,6 +322,20 @@ class Setup extends Controller {
|
||||
'required' => 'installed',
|
||||
'version' => (extension_loaded('curl') && function_exists('curl_version')) ? 'installed' : 'not installed',
|
||||
'check' => (extension_loaded('curl') && function_exists('curl_version'))
|
||||
],
|
||||
'maxInputVars' => [
|
||||
'label' => 'max_input_vars',
|
||||
'required' => $f3->get('REQUIREMENTS.PHP.MAX_INPUT_VARS'),
|
||||
'version' => ini_get('max_input_vars'),
|
||||
'check' => ini_get('max_input_vars') >= $f3->get('REQUIREMENTS.PHP.MAX_INPUT_VARS'),
|
||||
'tooltip' => 'PHP default = 1000. Increase it in order to import larger maps.'
|
||||
],
|
||||
'maxExecutionTime' => [
|
||||
'label' => 'max_execution_time',
|
||||
'required' => $f3->get('REQUIREMENTS.PHP.MAX_EXECUTION_TIME'),
|
||||
'version' => ini_get('max_execution_time'),
|
||||
'check' => ini_get('max_execution_time') >= $f3->get('REQUIREMENTS.PHP.MAX_EXECUTION_TIME'),
|
||||
'tooltip' => 'PHP default = 30. Max execution time for PHP scripts.'
|
||||
]
|
||||
];
|
||||
|
||||
@@ -730,4 +757,56 @@ class Setup extends Controller {
|
||||
}
|
||||
return $checkTables;
|
||||
}
|
||||
|
||||
/**
|
||||
* get cache folder size as string
|
||||
* @param \Base $f3
|
||||
* @return array
|
||||
*/
|
||||
protected function getCacheData(\Base $f3){
|
||||
|
||||
// get all cache -----------------------------------------------------------------------------------------
|
||||
$cacheFilesAll = Search::getFilesByMTime( $f3->get('TEMP') );
|
||||
$bytesAll = 0;
|
||||
foreach($cacheFilesAll as $filename => $file) {
|
||||
$bytesAll += $file->getSize();
|
||||
}
|
||||
|
||||
// get data cache -----------------------------------------------------------------------------------------
|
||||
$cacheFilesData = Search::getFilesByMTime( $f3->get('TEMP') . 'cache/' );
|
||||
$bytesData = 0;
|
||||
foreach($cacheFilesData as $filename => $file) {
|
||||
$bytesData += $file->getSize();
|
||||
}
|
||||
|
||||
return [
|
||||
'all' => $this->convertBytes($bytesAll),
|
||||
'data' => $this->convertBytes($bytesData),
|
||||
'template' => $this->convertBytes($bytesAll - $bytesData)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* clear all cached files
|
||||
* @param \Base $f3
|
||||
*/
|
||||
protected function clearCache(\Base $f3){
|
||||
$f3->clear('CACHE');
|
||||
}
|
||||
|
||||
/**
|
||||
* convert Bytes to string + suffix
|
||||
* @param int $bytes
|
||||
* @param int $precision
|
||||
* @return string
|
||||
*/
|
||||
protected function convertBytes($bytes, $precision = 2){
|
||||
$result = '0';
|
||||
if($bytes){
|
||||
$base = log($bytes, 1024);
|
||||
$suffixes = array('', 'KB', 'MB', 'GB', 'TB');
|
||||
$result = round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
60
app/main/cron/cache.php
Normal file
60
app/main/cron/cache.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Exodus
|
||||
* Date: 25.06.2016
|
||||
* Time: 14:59
|
||||
*/
|
||||
|
||||
namespace cron;
|
||||
|
||||
use data\filesystem\Search;
|
||||
use Controller;
|
||||
|
||||
class Cache {
|
||||
|
||||
const LOG_TEXT = '%s [%\'_10s] files, size [%\'_10s] byte, not writable [%\'_10s] files, errors [%\'_10s], exec (%.3Fs)';
|
||||
|
||||
/**
|
||||
* clear expired cached files
|
||||
* >> >php index.php "/cron/deleteExpiredCacheData"
|
||||
* @param \Base $f3
|
||||
*/
|
||||
function deleteExpiredData(\Base $f3){
|
||||
$time_start = microtime(true);
|
||||
|
||||
// cache dir (dir is recursively searched...)
|
||||
$cacheDir = $f3->get('TEMP');
|
||||
|
||||
$filterTime = (int)strtotime('-' . $f3->get('PATHFINDER.CACHE.EXPIRE_MAX') . ' seconds');
|
||||
$expiredFiles = Search::getFilesByMTime($cacheDir, $filterTime);
|
||||
|
||||
$deletedFiles = 0;
|
||||
$deletedSize = 0;
|
||||
$notWritableFiles = 0;
|
||||
$deleteErrors = 0;
|
||||
foreach($expiredFiles as $filename => $file) {
|
||||
/**
|
||||
* @var $file \SplFileInfo
|
||||
*/
|
||||
if( $file->isWritable() ){
|
||||
$tmpSize = $file->getSize();
|
||||
if( unlink($file->getRealPath()) ){
|
||||
$deletedSize += $tmpSize;
|
||||
$deletedFiles++;
|
||||
}else{
|
||||
$deleteErrors++;
|
||||
}
|
||||
}else{
|
||||
$notWritableFiles++;
|
||||
}
|
||||
}
|
||||
|
||||
$execTime = microtime(true) - $time_start;
|
||||
|
||||
// Log ------------------------
|
||||
$log = Controller\LogController::getLogger('cron_' . __FUNCTION__);
|
||||
$log->write( sprintf(self::LOG_TEXT, __FUNCTION__, $deletedFiles, $deletedSize, $notWritableFiles, $deleteErrors, $execTime) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class MapUpdate {
|
||||
* >> php index.php "/cron/deactivateMapData"
|
||||
* @param \Base $f3
|
||||
*/
|
||||
function deactivateMapData($f3){
|
||||
function deactivateMapData(\Base $f3){
|
||||
|
||||
$pfDB = DB\Database::instance()->getDB('PF');
|
||||
|
||||
@@ -48,7 +48,7 @@ class MapUpdate {
|
||||
* >> php index.php "/cron/deleteMapData"
|
||||
* @param \Base $f3
|
||||
*/
|
||||
function deleteMapData($f3){
|
||||
function deleteMapData(\Base $f3){
|
||||
|
||||
$pfDB = DB\Database::instance()->getDB('PF');
|
||||
|
||||
|
||||
58
app/main/data/filesystem/search.php
Normal file
58
app/main/data/filesystem/search.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Exodus
|
||||
* Date: 25.06.2016
|
||||
* Time: 16:58
|
||||
*/
|
||||
|
||||
namespace data\filesystem;
|
||||
|
||||
|
||||
class Search {
|
||||
|
||||
/**
|
||||
* timestamp (seconds) filter files by mTime()
|
||||
* -> default = "no filter"
|
||||
* @var int
|
||||
*/
|
||||
static $filterTime = 0;
|
||||
|
||||
/**
|
||||
* recursive file filter by mTime
|
||||
* @param string $dir
|
||||
* @param int $mTime
|
||||
* @return \RecursiveIteratorIterator
|
||||
*/
|
||||
static function getFilesByMTime($dir, $mTime = null){
|
||||
|
||||
if(is_null($mTime)){
|
||||
self::$filterTime = time();
|
||||
}else{
|
||||
self::$filterTime = (int)$mTime;
|
||||
}
|
||||
|
||||
|
||||
$directory = new \RecursiveDirectoryIterator( $dir, \FilesystemIterator::SKIP_DOTS );
|
||||
$files = new \RecursiveCallbackFilterIterator($directory, function ($current, $key, $iterator) {
|
||||
|
||||
// Check for last modification date
|
||||
/**
|
||||
* @var $current \RecursiveDirectoryIterator
|
||||
*/
|
||||
if (
|
||||
!$current->isFile() || // allow recursion
|
||||
(
|
||||
strpos($current->getFilename(), '.') !== 0 && // skip e.g. ".gitignore"
|
||||
$current->getMTime() < self::$filterTime // check last modification date
|
||||
)
|
||||
){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
return new \RecursiveIteratorIterator($files);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -216,8 +216,9 @@ class MapModel extends BasicModel {
|
||||
*/
|
||||
public function getNewSystem($systemId){
|
||||
$systemController = new System();
|
||||
$system = reset($systemController->getSystemModelByIds([$systemId]));
|
||||
$system->mapId = $this->id;
|
||||
$systems = $systemController->getSystemModelByIds([$systemId]);
|
||||
$system = reset($systems);
|
||||
$system->mapId = $this->_id;
|
||||
return $system;
|
||||
}
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ class SystemModel extends BasicModel {
|
||||
|
||||
/**
|
||||
* get all signatures of this system
|
||||
* @return array
|
||||
* @return SystemModel array
|
||||
*/
|
||||
public function getSignatures(){
|
||||
$this->filter('signatures', ['active = ?', 1], ['order' => 'name']);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[PATHFINDER]
|
||||
NAME = Pathfinder
|
||||
; installed version (used for CSS/JS cache busting)
|
||||
VERSION = v1.1.0
|
||||
VERSION = v1.1.1
|
||||
; contact information [optional]
|
||||
CONTACT = https://github.com/exodus4d
|
||||
; public contact email [optional]
|
||||
@@ -92,10 +92,12 @@ EXECUTION_LIMIT = 50
|
||||
|
||||
; CACHE ===========================================================================================
|
||||
[PATHFINDER.CACHE]
|
||||
; cache character log informations in seconds. This is ignored if ship/system switch was detected
|
||||
; expire time for character log data (seconds). (default: 300s)
|
||||
CHARACTER_LOG = 300
|
||||
; cache time for all system data within a constellation (this will never change) 30d
|
||||
; expire time for static system data (seconds) (default: 30d)
|
||||
CONSTELLATION_SYSTEMS = 2592000
|
||||
; max expire time. Expired cache files will be deleted by cronjob (seconds) (default: 60d)
|
||||
EXPIRE_MAX = 5184000
|
||||
|
||||
; LOGGING =========================================================================================
|
||||
[PATHFINDER.LOGFILES]
|
||||
|
||||
@@ -17,6 +17,15 @@ VERSION = 5.6
|
||||
; but needs to be additionally updated on CentOS or Red Hat systems
|
||||
PCRE_VERSION = 8.02
|
||||
|
||||
; max execution time for requests
|
||||
MAX_EXECUTION_TIME = 10
|
||||
|
||||
; max variable size for $_GET, $_POST and $_COOKIE
|
||||
; this is required for importing larger maps
|
||||
; http://php.net/manual/en/info.configuration.php
|
||||
; PHP default = 1000
|
||||
MAX_INPUT_VARS = 3000
|
||||
|
||||
[REQUIREMENTS.MYSQL]
|
||||
; min MySQL Version
|
||||
; newer "deviation" of MySQL like "MariaDB" > 10.1 are recommended
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
[routes]
|
||||
; DB setup setup
|
||||
; IMPORTANT: remove/comment this line after setup/update is finished!
|
||||
GET @setup: /setup [sync] = Controller\Setup->init, 0
|
||||
GET @setup: /setup [sync] = Controller\Setup->init
|
||||
; login (index) page
|
||||
GET @login: / [sync] = Controller\AppController->init, 0
|
||||
GET @login: / [sync] = Controller\AppController->init
|
||||
; CCP SSO redirect
|
||||
GET @sso: /sso/@action [sync] = Controller\Ccp\Sso->@action, 0
|
||||
GET @sso: /sso/@action [sync] = Controller\Ccp\Sso->@action
|
||||
; map page
|
||||
GET @map: /map [sync] = Controller\MapController->init, 0
|
||||
GET @map: /map [sync] = Controller\MapController->init
|
||||
|
||||
; ajax wildcard APIs (throttled)
|
||||
GET|POST /api/@controller/@action [ajax] = Controller\Api\@controller->@action, 0, 512
|
||||
GET|POST /api/@controller/@action/@arg1 [ajax] = Controller\Api\@controller->@action, 0, 512
|
||||
GET|POST /api/@controller/@action/@arg1/@arg2 [ajax] = Controller\Api\@controller->@action, 0, 512
|
||||
GET|POST /api/@controller/@action [ajax] = Controller\Api\@controller->@action, , 512
|
||||
GET|POST /api/@controller/@action/@arg1 [ajax] = Controller\Api\@controller->@action, , 512
|
||||
GET|POST /api/@controller/@action/@arg1/@arg2 [ajax] = Controller\Api\@controller->@action, , 512
|
||||
|
||||
Reference in New Issue
Block a user