Merge pull request #38 from exodus4d/develop

v0.0.11
This commit is contained in:
Exodus 4D
2015-09-29 21:21:25 +02:00
40 changed files with 92 additions and 46 deletions

View File

@@ -3,6 +3,7 @@ RewriteEngine On
# HTTP to HTTPS ----------------------------------------------------------------
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$
RewriteCond %{HTTP_HOST} !=localhost
# First rewrite to HTTPS:
@@ -13,6 +14,7 @@ RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{HTTP_HOST} !^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

View File

@@ -444,7 +444,9 @@ class Map extends \Controller\AccessController {
// format map Data for return
$return->mapData = self::getFormattedMapData($maps);
$f3->set($cacheKey, $return, $responseTTL);
if(count($return->mapData) > 0){
$f3->set($cacheKey, $return, $responseTTL);
}
}else{
// get from cache
$return = $f3->get($cacheKey);

View File

@@ -46,16 +46,18 @@ class AllianceModel extends BasicModel {
$this->filter('mapAlliances',
['active = ?', 1],
[
'limit' => $f3->get('PATHFINDER.MAX_MAPS_ALLIANCE'),
'order' => 'created'
]
['order' => 'created']
);
if($this->mapAlliances){
$mapCount = 0;
foreach($this->mapAlliances as $mapAlliance){
if($mapAlliance->mapId->isActive()){
if(
$mapAlliance->mapId->isActive() &&
$mapCount < $f3->get('PATHFINDER.MAX_MAPS_ALLIANCE')
){
$maps[] = $mapAlliance->mapId;
$mapCount++;
}
}
}

View File

@@ -14,7 +14,7 @@ class CorporationModel extends BasicModel {
protected $fieldConf = [
'corporationCharacters' => [
'has-many' => ['Model\CharacterModel', 'allianceId']
'has-many' => ['Model\CharacterModel', 'corporationId']
],
'mapCorporations' => [
'has-many' => ['Model\CorporationMapModel', 'corporationId']
@@ -32,7 +32,6 @@ class CorporationModel extends BasicModel {
$cooperationData->name = $this->name;
$cooperationData->sharing = $this->sharing;
return $cooperationData;
}
@@ -47,16 +46,18 @@ class CorporationModel extends BasicModel {
$this->filter('mapCorporations',
['active = ?', 1],
[
'limit' => $f3->get('PATHFINDER.MAX_MAPS_CORPORATION'),
'order' => 'created'
]
['order' => 'created']
);
if($this->mapCorporations){
$mapCount = 0;
foreach($this->mapCorporations as $mapCorporation){
if($mapCorporation->mapId->isActive()){
if(
$mapCorporation->mapId->isActive() &&
$mapCount < $f3->get('PATHFINDER.MAX_MAPS_CORPORATION')
){
$maps[] = $mapCorporation->mapId;
$mapCount++;
}
}
}

View File

@@ -420,14 +420,16 @@ class MapModel extends BasicModel {
if(is_null($charactersData)){
$charactersData = [];
$characters = $this->getCharacters();
foreach($characters as $character){
$charactersData[] = $character->getData(true);
}
$this->updateCacheData($charactersData, 'CHARACTERS', 10);
// cache active characters (if found)
if(!empty($charactersData)){
$this->updateCacheData($charactersData, 'CHARACTERS', 10);
}
}
return $charactersData;

View File

@@ -186,17 +186,19 @@ class UserModel extends BasicModel {
$this->filter(
'userMaps',
['active = ?', 1],
[
'limit' => $f3->get('PATHFINDER.MAX_MAPS_PRIVATE'),
'order' => 'created'
]
['order' => 'created']
);
$maps = [];
if($this->userMaps){
$mapCountPrivate = 0;
foreach($this->userMaps as $userMap){
if($userMap->mapId->isActive()){
if(
$userMap->mapId->isActive() &&
$mapCountPrivate < $f3->get('PATHFINDER.MAX_MAPS_PRIVATE')
){
$maps[] = $userMap->mapId;
$mapCountPrivate++;
}
}
}

View File

@@ -1,7 +1,7 @@
[PATHFINDER]
NAME = "PATHFINDER"
; installed version (used for CSS/JS cache busting)
VERSION = "v0.0.10"
VERSION = "v0.0.11"
; contact information (DO NOT CHANGE)
CONTACT = "https://github.com/exodus4d"
; source code (DO NOT CHANGE)

View File

@@ -197,7 +197,8 @@ define([], function() {
4: 'Ordinary Perimeter Reservoir', //*
5: 'Bountiful Frontier Reservoir', //*
6: 'Instrumental Core Reservoir', //*
7: 'Vital Core Reservoir' //*
7: 'Vital Core Reservoir', //*
8: 'Minor Perimeter Reservoir' //*
},
5: { // Wormhole
1: 'D792 - HS',

View File

@@ -75,7 +75,7 @@ define([
var activeInstances = {};
// active connections per map (cache object)
var activeConnections = {};
var connectionCache = {};
// characterID => systemIds are cached temporary where the active user character is in
// if a character switches/add system, establish connection with "previous" system
@@ -337,6 +337,7 @@ define([
if(show === 'destroy'){
system.tooltip( show );
system.removeAttr('data-original-title');
}else if(show === 'hide'){
system.tooltip( show );
} else if(show === 'toggle'){
@@ -371,6 +372,7 @@ define([
options.html = true;
options.animation = true;
options.template = template;
options.viewport = system.parent('.' + config.mapClass);
system.attr('title', options.title);
@@ -784,7 +786,30 @@ define([
};
/**
* get a connection object from "cache" (this requires the "activeConnections" cache to be actual!
* update local connection cache
* @param mapId
* @param connection
*/
var updateConnectionCache = function(mapId, connection){
if(
mapId > 0 &&
connection
){
var connectionId = parseInt( connection.getParameter('connectionId') );
if(connectionId > 0){
connectionCache[mapId][connectionId] = connection;
}else{
console.error('updateConnectionCache', 'connectionId missing');
}
}else{
console.error('updateConnectionCache', 'missing data');
}
};
/**
* get a connection object from "cache" (this requires the "connectionCache" cache to be actual!
* @param mapId
* @param connectionId
* @returns {*}
@@ -794,10 +819,10 @@ define([
var connection = null;
if(
activeConnections[mapId] &&
activeConnections[mapId][connectionId]
connectionCache[mapId] &&
connectionCache[mapId][connectionId]
){
connection = activeConnections[mapId][connectionId];
connection = connectionCache[mapId][connectionId];
}
return connection;
@@ -1253,11 +1278,18 @@ define([
url: Init.path.saveConnection,
data: requestData,
dataType: 'json',
context: connection
//context: connection
context: {
connection: connection,
mapId: mapId
}
}).done(function(newConnectionData){
// update connection data e.g. "scope" has auto detected
updateConnection(this, connectionData, newConnectionData);
connection = updateConnection(this.connection, connectionData, newConnectionData);
// new connection should be cached immediately!
updateConnectionCache(this.mapId, connection);
// connection scope
var scope = Util.getScopeInfoForConnection(newConnectionData.scope, 'label');
@@ -1349,6 +1381,7 @@ define([
* @param connection
* @param connectionData
* @param newConnectionData
* @returns {*}
*/
var updateConnection = function(connection, connectionData, newConnectionData){
@@ -1409,6 +1442,8 @@ define([
// set update date
connection.setParameter('updated', newConnectionData.updated);
return connection;
};
/**
@@ -2912,7 +2947,6 @@ define([
var mapElement = map.getContainer();
// get map tracking toggle value
// if "false" -> new systems/connections will not automatically added
var mapTracking = $('#' + config.headMapTrackingId).is(':checked');
@@ -3011,8 +3045,6 @@ define([
}
// cache current location
activeSystemCache = system;
}
@@ -3023,7 +3055,7 @@ define([
// current user was not found on any map system -> add new system to map where the user is in ----------------
// this is restricted to IGB-usage! CharacterLog data is always set through the IGB
// ->this prevent adding the same system multiple times, if a user if online with the IGB AND OOG
// ->this prevent adding the same system multiple times, if a user is online with IGB AND OOG
if(
CCP.isInGameBrowser() === true &&
currentUserOnMap === false &&
@@ -3032,7 +3064,6 @@ define([
){
// add new system to the map
var requestData = {
systemData: {
systemId: currentCharacterLog.system.id
@@ -3139,8 +3170,8 @@ define([
var connections = map.getAllConnections();
var connectionsFormatted = [];
// clear connections cache
activeConnections[mapConfig.id] = {};
// new connections cache
var updatedConnectionCache = {};
// format connections
for(var j = 0; j < connections.length; j++){
@@ -3157,14 +3188,17 @@ define([
var connectionData = getDataByConnection(tempConnection);
// add to cache
activeConnections[mapConfig.id][connectionData.id] = tempConnection;
if(addConnectionData){
connectionsFormatted.push( connectionData );
}
// add to cache
updatedConnectionCache[connectionData.id] = tempConnection;
}
// overwrite connection cache
connectionCache[mapConfig.id] = updatedConnectionCache;
data.connections = connectionsFormatted;
mapData.data = data;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long