- BC Break: _PHP_ namespaces changed (PSR-4 standard). The _root_ namespace for all _PF_ related scripts is Exodus4D\Pathfinder

- BC Break: Project folder structure changed. Removed `app/main` dir.
- BC Break: Core _PHP_ framework + dependencies moved into `composer.json` and are no longer part of this repo
This commit is contained in:
Mark Friedrich
2019-12-15 22:27:17 +01:00
parent 9cb013e9ff
commit 647bd7db58
155 changed files with 3085 additions and 610 deletions

View File

@@ -1,18 +1,16 @@
# ![Pathfinder logo](favicon/favicon-32x32.png "Logo") *PATHFINDER*
Mapping tool for [*EVE ONLINE*](https://www.eveonline.com)
#### Mapping tool for [*EVE ONLINE*](https://www.eveonline.com)
- Project URL [https://www.pathfinder-w.space](https://www.pathfinder-w.space)
- Official forum post [https://forums.eveonline.com](https://forums.eveonline.com/default.aspx?g=posts&m=6021776#post6021776)
- Screenshots [imgur.com](http://imgur.com/a/k2aVa)
- Videos [youtube.com](https://www.youtube.com/channel/UC7HU7XEoMbqRwqxDTbMjSPg)
- Licence [MIT](http://opensource.org/licenses/MIT)
#### Development
- Test server
- URL: http://www.dev.pathfinder-w.space
- Test server: [https://www.dev.pathfinder-w.space](https://www.dev.pathfinder-w.space)
- Running current `develop` branch
- _SISI_ _ESI_ (make sure to use your test-server client)
- Available for public testing (e.g. new feature,.. )
- Available for public testing (e.g. new feature, )
- Database will be cleared from time to time
- Installation guide:
- [wiki](https://github.com/exodus4d/pathfinder/wiki)
@@ -29,49 +27,48 @@ Issues should be reported in the [Issue](https://github.com/exodus4d/pathfinder/
### Project structure
```
|-- [0755] app/ --> backend [*.php]
|-- app/ --> "Fat Free Framework" extensions
|-- lib/ --> "Fat Free Framework"
|-- main/ --> "PATHFINDER" root
|-- config.ini --> config "f3" framework
|-- cron.ini --> config - cronjobs
|-- environment.ini --> config - system environment
|-- pathfinder.ini --> config - pathfinder
|-- requirements.ini --> config - system requirements
|-- routes.ini --> config - routes
|-- [0755] export/ --> static data
|-- csv/ --> *.csv used by /setup page
|-- sql/ --> DB dump for import (eve_universe.sql.zip)
|-- [0755] favicon/ --> Favicons
|-- [0777] history/ --> log files (map history logs) [optional]
|-- [0755] js/ --> JS source files
|-- app/ --> "PASTHFINDER" core files (not used for production)
|-- lib/ --> 3rd partie extension/library (not used for production)
|-- app.js --> require.js config (!required for production!)
|-- [0777] logs/ --> log files
|-- ...
|-- node_modules/ --> node.js modules (not used for production)
|-- ...
|-- [0755] public/ --> frontend source
|-- css/ --> CSS dist/build folder (minified)
|-- fonts/ --> (icon)-Fonts
|-- img/ --> images
|-- js/ --> JS dist/build folder and source maps (minified, uglified)
|-- templates/ --> templates
|-- sass/ --> SCSS source (not used for production)
|-- [0777] tmp/ --> cache folder
|-- [0755] .htaccess --> reroute/caching rules ("Apache" only!)
|-- [0755] index.php
─╮
├─ app/ [0755] → "PATHFINDER" root
├─ config.ini → config "f3" framework
│ ├─ cron.ini → config - cronjobs
├─ environment.ini config - system environment
├─ pathfinder.ini config - pathfinder
├─ requirements.ini config - system requirements
└─ routes.ini → config - routes
├─ export/ [0755] → static data
├─ csv/ → *.csv used by /setup page
│ └─ sql/ → DB dump for import (eve_universe.sql.zip)
├─ favicon/ [0755] → favicons
├─ history/ [0777] → log files (map history logs) [optional]
├─ js/ [0755] → JS source files (not used for production)
│ ├─ app/ → "PATHFINDER" core files
│ ├─ lib/ → 3rd party libs
└─ app.js → require.js config
├─ logs/ [0777] → log files
│ └─ …
├─ node_modules/ → node.js modules (not used for production)
│ └─ …
├─ public/ [0755] → static resources
│ ├─ css/ → CSS dist/build folder (minified)
│ ├─ fonts/ → icon-/fonts
├─ img/ → images
├─ js/ → JS dist/build folder and source maps (minified, uglified)
│ └─ templates/ → templates
├─ sass/ → SCSS sources (not used for production)
├─ tmp/ [0777] → cache folder (PHP templates)
│ └─ cache/ [0777] → cache folder (PHP cache)
├─ .htaccess [0755] → reroute/caching rules ("Apache" only!)
└─ index.php [0755]
--------------------------
━━━━━━━━━━━━━━━━━━━━━━━━━━
CI/CD config files:
--------------------------
|-- .jshintrc --> "JSHint" config (not used for production)
|-- composer.json --> Composer package definition
|-- config.rb --> "Compass" config (not used for production)
|-- gulpfile.js --> "Gulp" task config (not used for production )
|-- package.json --> "Node.js" dependency config (not used for production)
|-- README.md --> This file :) (not used for production)
├─ .jshintrc "JSHint" config (not used for production)
├─ composer.json → "Composer" package definition
├─ config.rb "Compass" config (not used for production)
├─ gulpfile.js "Gulp" task config (not used for production)
├─ package.json "Node.js" dependency config (not used for production)
└─ README.md This file :) (not used for production)
```
***

View File

@@ -6,10 +6,10 @@
* Time: 23:30
*/
namespace Controller;
namespace Exodus4D\Pathfinder\Controller;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
class AccessController extends Controller {

View File

@@ -6,15 +6,15 @@
* Time: 20:30
*/
namespace Controller;
namespace Exodus4D\Pathfinder\Controller;
use Controller\Ccp\Sso;
use lib\Config;
use Model\Pathfinder\CharacterModel;
use Model\Pathfinder\CorporationModel;
use Model\Pathfinder\MapModel;
use Model\Pathfinder\RoleModel;
use Exodus4D\Pathfinder\Controller\Ccp\Sso;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel;
use Exodus4D\Pathfinder\Model\Pathfinder\CorporationModel;
use Exodus4D\Pathfinder\Model\Pathfinder\MapModel;
use Exodus4D\Pathfinder\Model\Pathfinder\RoleModel;
class Admin extends Controller{

View File

@@ -6,10 +6,10 @@
* Time: 17:42
*/
namespace Controller\Api;
namespace Exodus4D\Pathfinder\Controller\Api;
use Controller;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Model\Pathfinder;
class Access extends Controller\AccessController {

View File

@@ -7,12 +7,11 @@
* Time: 03:34
*/
namespace Controller\Api;
namespace Exodus4D\Pathfinder\Controller\Api;
use lib\Config;
use Controller;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Controller;
/**
* Github controller

View File

@@ -6,15 +6,15 @@
* Time: 20:23
*/
namespace Controller\Api;
namespace Exodus4D\Pathfinder\Controller\Api;
use Controller;
use data\file\FileHandler;
use lib\Config;
use Model\AbstractModel;
use Model\Pathfinder;
use Model\Universe;
use Exception;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Data\File\FileHandler;
use Exodus4D\Pathfinder\Model\AbstractModel;
use Exodus4D\Pathfinder\Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Universe;
use Exodus4D\Pathfinder\Exception;
/**
* Map controller
@@ -49,7 +49,7 @@ class Map extends Controller\AccessController {
/**
* Get all required static config data for program initialization
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function initData(\Base $f3){
$validInitData = true;
@@ -272,7 +272,7 @@ class Map extends Controller\AccessController {
/**
* import new map data
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function import(\Base $f3){
$importData = (array)$f3->get('POST');
@@ -433,7 +433,7 @@ class Map extends Controller\AccessController {
/**
* save a new map or update an existing map
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function save(\Base $f3){
$formData = (array)$f3->get('POST.formData');
@@ -619,7 +619,7 @@ class Map extends Controller\AccessController {
/**
* delete a map and all dependencies
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function delete(\Base $f3){
$mapData = (array)$f3->get('POST.mapData');
@@ -653,7 +653,7 @@ class Map extends Controller\AccessController {
* broadcast characters with map access rights to WebSocket server
* -> if characters with map access found -> broadcast mapData to them
* @param Pathfinder\MapModel $map
* @throws Exception
* @throws \Exception
*/
protected function broadcastMapAccess(Pathfinder\MapModel $map){
$mapAccess = [
@@ -682,7 +682,7 @@ class Map extends Controller\AccessController {
* get map access tokens for current character
* -> send access tokens via TCP Socket for WebSocket auth
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function getAccessData(\Base $f3){
$return = (object) [];
@@ -827,7 +827,7 @@ class Map extends Controller\AccessController {
* update map data
* -> function is called continuously (trigger) by any active client
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function updateData(\Base $f3){
$postData = (array)$f3->get('POST');
@@ -851,7 +851,7 @@ class Map extends Controller\AccessController {
* onUnload map sync
* @see https://developer.mozilla.org/docs/Web/API/Navigator/sendBeacon
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function updateUnloadData(\Base $f3){
$postData = (array)$f3->get('POST');
@@ -870,7 +870,7 @@ class Map extends Controller\AccessController {
* update map data api
* -> function is called continuously by any active client
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function updateUserData(\Base $f3){
$postData = (array)$f3->get('POST');
@@ -941,7 +941,7 @@ class Map extends Controller\AccessController {
* @param Pathfinder\CharacterModel $character
* @param array $newSystemPositions
* @return Pathfinder\MapModel
* @throws Exception
* @throws \Exception
*/
protected function updateMapByCharacter(Pathfinder\MapModel $map, Pathfinder\CharacterModel $character, array $newSystemPositions = []) : Pathfinder\MapModel {
// map changed. update cache (system/connection) changed
@@ -1207,7 +1207,7 @@ class Map extends Controller\AccessController {
/**
* get connectionData
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function getConnectionData(\Base $f3){
$postData = (array)$f3->get('POST');
@@ -1258,7 +1258,7 @@ class Map extends Controller\AccessController {
/**
* get map log data
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function getLogData(\Base $f3){
$postData = (array)$f3->get('POST');

View File

@@ -6,9 +6,9 @@
* Time: 16:14
*/
namespace Controller\Api\Rest;
namespace Exodus4D\Pathfinder\Controller\Api\Rest;
use Controller;
use Exodus4D\Pathfinder\Controller;
abstract class AbstractRestController extends Controller\AccessController {

View File

@@ -6,9 +6,10 @@
* Time: 12:10
*/
namespace Controller\Api\Rest;
namespace Exodus4D\Pathfinder\Controller\Api\Rest;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
class Connection extends AbstractRestController {

View File

@@ -6,9 +6,10 @@
* Time: 15:28
*/
namespace Controller\Api\Rest;
namespace Exodus4D\Pathfinder\Controller\Api\Rest;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
class Log extends AbstractRestController {

View File

@@ -6,10 +6,10 @@
* Time: 16:20
*/
namespace Controller\Api\Rest;
namespace Exodus4D\Pathfinder\Controller\Api\Rest;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
class Signature extends AbstractRestController {

View File

@@ -6,11 +6,11 @@
* Time: 16:44
*/
namespace Controller\Api\Rest;
namespace Exodus4D\Pathfinder\Controller\Api\Rest;
use Model\Pathfinder;
use lib\Config;
use Exodus4D\Pathfinder\Model\Pathfinder;
use Exodus4D\Pathfinder\Lib\Config;
class SignatureHistory extends AbstractRestController {

View File

@@ -6,10 +6,10 @@
* Time: 23:29
*/
namespace Controller\Api\Rest;
namespace Exodus4D\Pathfinder\Controller\Api\Rest;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
class Structure extends AbstractRestController {

View File

@@ -6,10 +6,10 @@
* Time: 12:34
*/
namespace Controller\Api\Rest;
namespace Exodus4D\Pathfinder\Controller\Api\Rest;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
class System extends AbstractRestController {

View File

@@ -6,12 +6,12 @@
* Time: 03:34
*/
namespace Controller\Api;
namespace Exodus4D\Pathfinder\Controller\Api;
use Controller;
use Controller\Ccp\Universe;
use lib\Config;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Controller\Ccp\Universe;
use Exodus4D\Pathfinder\Model\Pathfinder;
/**
* Routes controller
@@ -731,9 +731,7 @@ class Route extends Controller\AccessController {
];
$keyParts += $filterData;
$key = 'route_' . hash('md5', implode('_', $keyParts));
return $key;
return 'route_' . hash('md5', implode('_', $keyParts));
}
/**

View File

@@ -6,12 +6,12 @@
* Time: 14:17
*/
namespace Controller\Api;
namespace Exodus4D\Pathfinder\Controller\Api;
use Controller;
use lib\Config;
use lib\Cron;
use Model;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Lib\Cron;
use Exodus4D\Pathfinder\Model;
class Setup extends Controller\Controller {

View File

@@ -6,11 +6,11 @@
* Time: 00:29
*/
namespace controller\api;
namespace Exodus4D\Pathfinder\Controller\Api;
use Controller;
use lib\Config;
use Model\Pathfinder\CharacterModel;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel;
class Statistic extends Controller\AccessController {

View File

@@ -6,11 +6,11 @@
* Time: 20:23
*/
namespace Controller\Api;
namespace Exodus4D\Pathfinder\Controller\Api;
use Controller;
use lib\Config;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Model\Pathfinder;
class System extends Controller\AccessController {

View File

@@ -6,11 +6,11 @@
* Time: 15:49
*/
namespace Controller\Api;
namespace Exodus4D\Pathfinder\Controller\Api;
use Controller;
use Controller\Ccp as Ccp;
use Model;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Controller\Ccp as Ccp;
use Exodus4D\Pathfinder\Model;
class Universe extends Controller\AccessController {

View File

@@ -6,13 +6,13 @@
* Time: 20:50
*/
namespace Controller\Api;
namespace Exodus4D\Pathfinder\Controller\Api;
use Controller;
use lib\Config;
use Model\Pathfinder;
use Exception;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Model\Pathfinder;
use Exodus4D\Pathfinder\Exception;
class User extends Controller\Controller{
@@ -46,7 +46,7 @@ class User extends Controller\Controller{
* login a valid character
* @param Pathfinder\CharacterModel $character
* @return bool
* @throws Exception
* @throws \Exception
*/
protected function loginByCharacter(Pathfinder\CharacterModel &$character) : bool {
$login = false;
@@ -113,7 +113,7 @@ class User extends Controller\Controller{
* validate cookie character information
* -> return character data (if valid)
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function getCookieCharacter(\Base $f3){
$data = $f3->get('POST');
@@ -194,7 +194,7 @@ class User extends Controller\Controller{
/**
* log the current user out + clear character system log data
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function logout(\Base $f3){
$this->logoutCharacter($f3, false, true, true, true);
@@ -204,7 +204,7 @@ class User extends Controller\Controller{
* remote open ingame information window (character, corporation or alliance) Id
* -> the type is auto-recognized by CCP
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function openIngameWindow(\Base $f3){
$data = $f3->get('POST');
@@ -235,7 +235,7 @@ class User extends Controller\Controller{
* -> a fresh user automatically generated on first login with a new character
* -> see SSO login
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function saveAccount(\Base $f3){
$data = $f3->get('POST');
@@ -348,7 +348,7 @@ class User extends Controller\Controller{
/**
* delete current user account from DB
* @param \Base $f3
* @throws Exception
* @throws \Exception
*/
public function deleteAccount(\Base $f3){
$data = $f3->get('POST.formData');

View File

@@ -6,11 +6,12 @@
* Time: 21:27
*/
namespace Controller;
namespace Exodus4D\Pathfinder\Controller;
use Controller\Ccp as Ccp;
use lib\Config;
use lib\Resource;
use Exodus4D\Pathfinder\Controller\Ccp as Ccp;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Lib\Resource;
class AppController extends Controller {

View File

@@ -11,12 +11,12 @@
* - Check "PATHFINDER.API" in "pathfinder.ini" for correct API URLs
*/
namespace Controller\Ccp;
namespace Exodus4D\Pathfinder\Controller\Ccp;
use Controller;
use Controller\Api as Api;
use Model\Pathfinder;
use Lib;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Controller\Api as Api;
use Exodus4D\Pathfinder\Model\Pathfinder;
use Exodus4D\Pathfinder\Lib;
class Sso extends Api\User{

View File

@@ -6,13 +6,13 @@
* Time: 11:31
*/
namespace Controller\Ccp;
namespace Exodus4D\Pathfinder\Controller\Ccp;
use Controller\Controller;
use lib\Util;
use Model;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Lib\Util;
use Exodus4D\Pathfinder\Model;
class Universe extends Controller {
class Universe extends Controller\Controller {
const SESSION_KEY_SYSTEM_IDS = 'SESSION.SETUP.SYSTEM_IDS';

File diff suppressed because it is too large Load Diff

View File

@@ -6,12 +6,12 @@
* Time: 15:24
*/
namespace controller;
namespace Exodus4D\Pathfinder\Controller;
use lib\Config;
use lib\logging\MapLog;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Lib\Logging\MapLog;
use Exodus4D\Pathfinder\Model\Pathfinder;
class LogController extends \Prefab {

View File

@@ -6,11 +6,11 @@
* Time: 21:18
*/
namespace Controller;
namespace Exodus4D\Pathfinder\Controller;
use lib\Config;
use lib\Resource;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Lib\Resource;
class MapController extends AccessController {

View File

@@ -6,17 +6,19 @@
* Time: 10:59
*/
namespace Controller;
namespace Exodus4D\Pathfinder\Controller;
use Controller\Ccp\Universe as UniverseController;
use data\filesystem\Search;
use DB\SQL\Schema;
use DB\SQL\MySQL as MySQL;
use lib\Config;
use lib\Cron;
use lib\Util;
use Model\Pathfinder;
use Model\Universe;
use Exodus4D\Pathfinder\Db\Sql\Mysql;
use Exodus4D\Pathfinder\Lib\Db\Sql;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Lib\Cron;
use Exodus4D\Pathfinder\Lib\Util;
use Exodus4D\Pathfinder\Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Universe;
use Exodus4D\Pathfinder\Controller\Ccp\Universe as UniverseController;
use Exodus4D\Pathfinder\Data\Filesystem\Search;
class Setup extends Controller {
@@ -275,7 +277,7 @@ class Setup extends Controller {
* @return array
*/
protected function getNavigationConfig() : array {
$config = [
return [
'server' => [
'icon' => 'fa-home'
],
@@ -301,8 +303,6 @@ class Setup extends Controller {
'icon' => 'fa-wrench'
]
];
return $config;
}
/**
@@ -351,7 +351,7 @@ class Setup extends Controller {
* @return array
*/
protected function getServerInformation(\Base $f3) : array {
$serverInfo = [
return [
'time' => [
'label' => 'Time',
'value' => date('Y/m/d H:i:s') . ' - (' . $f3->get('TZ') . ')'
@@ -389,8 +389,6 @@ class Setup extends Controller {
'value' => $f3->get('SERVER.SERVER_PROTOCOL') . ' - ' . $f3->get('SCHEME')
]
];
return $serverInfo;
}
/**
@@ -399,7 +397,7 @@ class Setup extends Controller {
* @return array
*/
protected function getDirectoryConfig(\Base $f3) : array {
$directoryData = [
return [
'TEMP' => [
'label' => 'TEMP',
'value' => $f3->get('TEMP'),
@@ -465,8 +463,6 @@ class Setup extends Controller {
'tooltip' => 'Folder for custom *.ini files. (e.g. when overwriting of default values in app/*.ini)'
]
];
return $directoryData;
}
/**
@@ -639,7 +635,7 @@ class Setup extends Controller {
$maxExecutionTime = (int)ini_get('max_execution_time'); // 0 == infinite
$htmlErrors = (int)ini_get('html_errors');
$phpConfig = [
return [
'exec' => [
'label' => 'exec()',
'required' => $f3->get('REQUIREMENTS.PHP.EXEC'),
@@ -697,8 +693,6 @@ class Setup extends Controller {
'tooltip' => 'PHP Session name.'
]
];
return $phpConfig;
}
/**
@@ -724,7 +718,7 @@ class Setup extends Controller {
* @return array
*/
$getClientInfo = function(\Redis $client, array $conf) : array {
$redisInfo = [
return [
'dsn' => [
'label' => 'DSN',
'value' => $conf['host'] . ':' . $conf['port']
@@ -734,8 +728,6 @@ class Setup extends Controller {
'value' => $client->isConnected()
]
];
return $redisInfo;
};
/**
@@ -1110,7 +1102,7 @@ class Setup extends Controller {
// collection for errors
$dbErrors = [];
/**
* @var $db \lib\db\SQL
* @var $db Sql
*/
$db = $f3->DB->getDB($dbAlias);
@@ -1172,7 +1164,7 @@ class Setup extends Controller {
// Table exists
$tableExists = true;
// get existing table columns and column related constraints (if exists)
$tableModifierTemp = new MySQL\TableModifier($requiredTableName, $schema);
$tableModifierTemp = new Mysql\TableModifier($requiredTableName, $schema);
$currentColumns = $tableModifierTemp->getCols(true);
// get row count
$tableRows = $db->getRowCount($requiredTableName);
@@ -1220,10 +1212,10 @@ class Setup extends Controller {
// column exists
// get tableModifier -> possible column update
$tableModifier = new MySQL\TableModifier($requiredTableName, $schema);
$tableModifier = new Mysql\TableModifier($requiredTableName, $schema);
// get new column and copy Schema from existing column
$col = new MySQL\Column($columnName, $tableModifier);
$col = new Mysql\Column($columnName, $tableModifier);
$col->copyfrom($currentColumns[$columnName]);
$currentColType = $currentColumns[$columnName]['type'];
@@ -1441,10 +1433,10 @@ class Setup extends Controller {
/**
* check MySQL params
* @param \Base $f3
* @param \lib\db\SQL $db
* @param Sql $db
* @return array
*/
protected function checkDBConfig(\Base $f3, \lib\db\SQL $db) : array {
protected function checkDBConfig(\Base $f3, Sql $db) : array {
$checkAll = true;
// some db like "Maria DB" have some strange version strings....
$dbVersionString = $db->version();
@@ -1624,7 +1616,7 @@ class Setup extends Controller {
$setStats((array)$payload['stats']);
});
$socketInformation = [
return [
'tcpSocket' => [
'label' => 'TCP-Socket (intern)',
'icon' => 'fa-exchange-alt',
@@ -1669,8 +1661,6 @@ class Setup extends Controller {
]
]
];
return $socketInformation;
}
/**
@@ -1710,13 +1700,11 @@ class Setup extends Controller {
]
];
$config = [
return [
'checkCronConfig' => $cronConf,
'settings' => $f3->constants($cron, 'DEFAULT_'),
'jobs' => $cron->getJobsConfig()
];
return $config;
}
/**

View File

@@ -6,9 +6,9 @@
* Time: 12:13
*/
namespace cron;
namespace Exodus4D\Pathfinder\Cron;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
abstract class AbstractCron {
@@ -90,7 +90,7 @@ abstract class AbstractCron {
protected function logStart(string $job, bool $logging = true){
$this->setMaxExecutionTime();
$cron = \lib\Cron::instance();
$cron = \Exodus4D\Pathfinder\Lib\Cron::instance();
if(isset($cron->jobs[$job])){
// set "start" date for current cronjob
$jobConf = $cron->getJobDataFromConf($cron->jobs[$job]);

View File

@@ -6,9 +6,9 @@
* Time: 14:59
*/
namespace cron;
namespace Exodus4D\Pathfinder\Cron;
use data\filesystem\Search;
use Exodus4D\Pathfinder\Data\Filesystem\Search;
class Cache extends AbstractCron {

View File

@@ -6,8 +6,10 @@
* Time: 21:31
*/
namespace Cron;
use lib\db\SQL;
namespace Exodus4D\Pathfinder\Cron;
use Exodus4D\Pathfinder\Lib\Db\Sql;
class CcpSystemsUpdate extends AbstractCron {
@@ -29,11 +31,11 @@ class CcpSystemsUpdate extends AbstractCron {
/**
* checks if a table exists in DB or not
* @param SQL$db
* @param Sql $db
* @param string $table
* @return bool
*/
protected function tableExists (SQL $db, string $table) : bool {
protected function tableExists (Sql $db, string $table) : bool {
return !empty($db->exec('SHOW TABLES LIKE :table', [':table' => $table]));
}
@@ -111,7 +113,7 @@ class CcpSystemsUpdate extends AbstractCron {
// switch DB for data import..
/**
* @var $pfDB SQL
* @var $pfDB Sql
*/
$pfDB = $f3->DB->getDB('PF');

View File

@@ -6,10 +6,10 @@
* Time: 19:35
*/
namespace Cron;
namespace Exodus4D\Pathfinder\Cron;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
class CharacterUpdate extends AbstractCron {

View File

@@ -6,11 +6,11 @@
* Time: 15:48
*/
namespace Cron;
namespace Exodus4D\Pathfinder\Cron;
use data\mapper\SortingIterator;
use data\file\FileHandler;
use data\filesystem\Search;
use Exodus4D\Pathfinder\Data\Mapper\SortingIterator;
use Exodus4D\Pathfinder\Data\File\FileHandler;
use Exodus4D\Pathfinder\Data\Filesystem\Search;
class MapHistory extends AbstractCron {

View File

@@ -6,11 +6,11 @@
* Time: 17:54
*/
namespace cron;
namespace Exodus4D\Pathfinder\Cron;
use lib\Config;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Model\Pathfinder;
class MapUpdate extends AbstractCron {

View File

@@ -6,7 +6,7 @@
* Time: 21:31
*/
namespace cron;
namespace Exodus4D\Pathfinder\Cron;
class StatisticsUpdate extends AbstractCron {

View File

@@ -6,9 +6,10 @@
* Time: 03:46
*/
namespace Cron;
namespace Exodus4D\Pathfinder\Cron;
use Model;
use Exodus4D\Pathfinder\Model;
class Universe extends AbstractCron {

View File

@@ -6,7 +6,7 @@
* Time: 18:47
*/
namespace data\file;
namespace Exodus4D\Pathfinder\Data\File;
class FileHandler extends \Prefab {

View File

@@ -6,7 +6,7 @@
* Time: 18:42
*/
namespace data\file;
namespace Exodus4D\Pathfinder\Data\File;
class ReverseSplFileObject extends \SplFileObject{

View File

@@ -6,7 +6,7 @@
* Time: 16:58
*/
namespace data\filesystem;
namespace Exodus4D\Pathfinder\Data\Filesystem;
class Search {

View File

@@ -6,9 +6,9 @@
* Time: 04:06
*/
namespace data\mapper;
namespace Exodus4D\Pathfinder\Data\Mapper;
use lib\Util;
use Exodus4D\Pathfinder\Lib\Util;
class AbstractIterator extends \RecursiveArrayIterator {
@@ -26,7 +26,10 @@ class AbstractIterator extends \RecursiveArrayIterator {
*/
protected static $removeUnmapped = true;
/**
* AbstractIterator constructor.
* @param $data
*/
function __construct($data){
parent::__construct($data, \RecursiveIteratorIterator::SELF_FIRST);
}
@@ -52,10 +55,10 @@ class AbstractIterator extends \RecursiveArrayIterator {
/**
* recursive iterator function called on every node
* @param $iterator
* @return mixed
* @param AbstractIterator $iterator
* @return AbstractIterator
*/
static function recursiveIterator($iterator){
static function recursiveIterator(AbstractIterator $iterator){
$keyWhitelist = array_keys(static::$map);

View File

@@ -6,7 +6,7 @@
* Time: 00:55
*/
namespace data\mapper;
namespace Exodus4D\Pathfinder\Data\Mapper;
class SortingIterator extends \ArrayIterator {

View File

@@ -6,12 +6,19 @@
* Time: 15:40
*/
namespace DB\SQL\MySQL;
namespace Exodus4D\Pathfinder\Db\Sql\Mysql;
class Session extends \DB\SQL\Session {
/**
* Session constructor.
* @param \DB\SQL $db
* @param string $table
* @param bool $force
* @param callback $onsuspect
* @param string $key
*/
function __construct(\DB\SQL $db, string $table = 'sessions', bool $force = true, $onsuspect = null, $key = null){
if($force){
// create sessions table

View File

@@ -12,7 +12,9 @@
* - FOREIGN KEY CONSTRAINTS (single column key)
*/
namespace DB\SQL\MySQL;
namespace Exodus4D\Pathfinder\Db\Sql\Mysql;
use DB\SQL;
class TableModifier extends SQL\TableModifier {
@@ -23,7 +25,7 @@ class TableModifier extends SQL\TableModifier {
/**
* return table foreign key constraints as assoc array
* -> if §constraint is passed, constraints are limited to that column
* @param null| SQL\MySQL\Constraint $constraint
* @param null| Constraint $constraint
* @return Constraint[]
*/
public function listConstraint($constraint = null){
@@ -65,7 +67,7 @@ class TableModifier extends SQL\TableModifier {
/**
* checks whether a constraint name exists or not
* -> does not check constraint params
* @param SQL\MySQL\Constraint $constraint
* @param Constraint $constraint
* @return bool
*/
public function constraintExists($constraint){
@@ -75,7 +77,7 @@ class TableModifier extends SQL\TableModifier {
/**
* drop foreign key constraint
* @param SQL\MySQL\Constraint $constraint
* @param Constraint $constraint
*/
public function dropConstraint($constraint){
if($constraint->isValid()){
@@ -88,7 +90,7 @@ class TableModifier extends SQL\TableModifier {
/**
* Add/Update foreign key constraint
* @param SQL\MySQL\Constraint $constraint
* @param Constraint $constraint
*/
public function addConstraint($constraint){
@@ -131,7 +133,6 @@ class Column extends SQL\Column {
}
/**
* @see \DB\SQL\MySQL\TableModifier->constraintExists();
* @param Constraint $constraint
* @return mixed
*/
@@ -147,7 +148,7 @@ class Column extends SQL\Column {
* $constraintData['on-update'] => ON UPDATE action (optional) default: see \DB\SQL\MySQL\Constraint const
*
* @param array $constraintData
* @return SQL\MySQL\Constraint
* @return Constraint
*/
public function newConstraint($constraintData){

View File

@@ -6,11 +6,14 @@
* Time: 18:53
*/
namespace Exception;
namespace Exodus4D\Pathfinder\Exception;
class ConfigException extends PathfinderException {
/**
* @var array
*/
protected $codes = [
1000 => 500
];

View File

@@ -6,14 +6,22 @@
* Time: 20:31
*/
namespace Exception;
namespace Exodus4D\Pathfinder\Exception;
class DatabaseException extends PathfinderException {
/**
* @var array
*/
protected $codes = [
1500 => 500
];
/**
* DatabaseException constructor.
* @param string $message
*/
public function __construct(string $message){
parent::__construct($message, 1500);
}

View File

@@ -6,10 +6,14 @@
* Time: 18:12
*/
namespace Exception;
namespace Exodus4D\Pathfinder\Exception;
class DateException extends PathfinderException {
/**
* @var array
*/
protected $codes = [
3000 => 500 // invalid DateRange
];

View File

@@ -6,9 +6,10 @@
* Time: 00:41
*/
namespace Exception;
namespace Exodus4D\Pathfinder\Exception;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
class PathfinderException extends \Exception {
@@ -26,6 +27,11 @@ class PathfinderException extends \Exception {
0 => self::DEFAULT_RESPONSECODE
];
/**
* PathfinderException constructor.
* @param string $message
* @param int $code
*/
public function __construct(string $message, int $code = 0){
if( !array_key_exists($code, $this->codes) ){
// exception code not specified by child class

View File

@@ -6,11 +6,14 @@
* Time: 21:21
*/
namespace Exception;
namespace Exodus4D\Pathfinder\Exception;
class RegistrationException extends PathfinderException{
/**
* @var array
*/
protected $codes = [
2000 => 403
];
@@ -21,6 +24,11 @@ class RegistrationException extends PathfinderException{
*/
private $field;
/**
* RegistrationException constructor.
* @param string $message
* @param string $field
*/
public function __construct(string $message, string $field = ''){
parent::__construct($message, 2000);
$this->field = $field;

View File

@@ -6,11 +6,14 @@
* Time: 00:12
*/
namespace Exception;
namespace Exodus4D\Pathfinder\Exception;
class ValidationException extends PathfinderException {
/**
* @var array
*/
protected $codes = [
2000 => 422
];
@@ -21,6 +24,11 @@ class ValidationException extends PathfinderException {
*/
private $field;
/**
* ValidationException constructor.
* @param string $message
* @param string $field
*/
public function __construct(string $message, string $field = ''){
parent::__construct($message, 2000);
$this->field = $field;

View File

@@ -6,7 +6,7 @@
* Time: 17:41
*/
namespace lib\api;
namespace Exodus4D\Pathfinder\Lib\Api;
use Cache\Adapter\Filesystem\FilesystemCachePool;
use Cache\Adapter\PHPArray\ArrayCachePool;
@@ -14,10 +14,10 @@ use Cache\Adapter\Redis\RedisCachePool;
use Cache\Namespaced\NamespacedCachePool;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use lib\Config;
use lib\Util;
use lib\logging;
use controller\LogController;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Lib\Util;
use Exodus4D\Pathfinder\Lib\Logging;
use Exodus4D\Pathfinder\Controller\LogController;
use Exodus4D\ESI\Client\ApiInterface;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Http\Message\RequestInterface;
@@ -89,8 +89,8 @@ abstract class AbstractClient extends \Prefab {
* @return \Closure
*/
protected function newLog() : \Closure {
return function(string $action, string $level = 'warning') : logging\LogInterface {
$log = new logging\ApiLog($action, $level);
return function(string $action, string $level = 'warning') : Logging\LogInterface {
$log = new Logging\ApiLog($action, $level);
$log->addHandler('stream', 'json', $this->getStreamConfig($action));
return $log;
};

View File

@@ -6,9 +6,9 @@
* Time: 17:43
*/
namespace lib\api;
namespace Exodus4D\Pathfinder\Lib\Api;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\ESI\Client\ApiInterface;
use Exodus4D\ESI\Client\Ccp\Esi\Esi as Client;
use Exodus4D\ESI\Client\Ccp\Esi\EsiInterface as ClientInterface;

View File

@@ -1,9 +1,9 @@
<?php
namespace lib\api;
namespace Exodus4D\Pathfinder\Lib\Api;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\ESI\Client\ApiInterface;
use Exodus4D\ESI\Client\EveScout\EveScout as Client;
use Exodus4D\ESI\Client\EveScout\EveScoutInterface as ClientInterface;

View File

@@ -6,9 +6,9 @@
* Time: 22:23
*/
namespace lib\api;
namespace Exodus4D\Pathfinder\Lib\Api;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\ESI\Client\ApiInterface;
use Exodus4D\ESI\Client\GitHub\GitHub as Client;
use Exodus4D\ESI\Client\GitHub\GitHubInterface as ClientInterface;

View File

@@ -6,9 +6,9 @@
* Time: 17:39
*/
namespace lib\api;
namespace Exodus4D\Pathfinder\Lib\Api;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\ESI\Client\ApiInterface;
use Exodus4D\ESI\Client\Ccp\Sso\Sso as Client;

View File

@@ -6,17 +6,16 @@
* Time: 16:05
*/
namespace lib;
namespace Exodus4D\Pathfinder\Lib;
use lib\db\Pool;
use lib\api\CcpClient;
use lib\api\GitHubClient;
use lib\api\SsoClient;
use lib\api\EveScoutClient;
use lib\socket\AbstractSocket;
use lib\socket\SocketInterface;
use lib\socket\TcpSocket;
use Exodus4D\Pathfinder\Lib\Db\Pool;
use Exodus4D\Pathfinder\Lib\Api\CcpClient;
use Exodus4D\Pathfinder\Lib\Api\GitHubClient;
use Exodus4D\Pathfinder\Lib\Api\SsoClient;
use Exodus4D\Pathfinder\Lib\Api\EveScoutClient;
use Exodus4D\Pathfinder\Lib\Socket\AbstractSocket;
use Exodus4D\Pathfinder\Lib\Socket\SocketInterface;
use Exodus4D\Pathfinder\Lib\Socket\TcpSocket;
class Config extends \Prefab {

View File

@@ -1,9 +1,9 @@
<?php
namespace lib;
namespace Exodus4D\Pathfinder\Lib;
use Model\Pathfinder;
use Exodus4D\Pathfinder\Model\Pathfinder;
/**
* Class Cron

View File

@@ -6,9 +6,9 @@
* Time: 18:06
*/
namespace lib;
namespace Exodus4D\Pathfinder\Lib;
use Exception\DateException;
use Exodus4D\Pathfinder\Exception\DateException;
class DateRange {

View File

@@ -1,12 +1,12 @@
<?php
namespace lib\db;
namespace Exodus4D\Pathfinder\Lib\Db;
use DB\SQL\Schema;
use controller\LogController;
use Exception\ConfigException;
use Exodus4D\Pathfinder\Controller\LogController;
use Exodus4D\Pathfinder\Exception\ConfigException;
class Pool extends \Prefab {
@@ -22,7 +22,7 @@ class Pool extends \Prefab {
const ERROR_SCHEME = 'DB Scheme "%s" is not supported for DB alias "%s"';
/**
* @var SQL[]
* @var Sql[]
*/
private $connectionStore = [];
@@ -83,9 +83,9 @@ class Pool extends \Prefab {
* connect to the DB server itself -> NO database is used
* -> can be used to check if a certain DB exists without connecting to it directly
* @param string $alias
* @return SQL|null
* @return Sql|null
*/
public function connectToServer(string $alias) : ?SQL {
public function connectToServer(string $alias) : ?Sql {
$config = ($this->getConfig)($alias);
$config['NAME'] = '';
return $this->newDB($config);
@@ -95,9 +95,9 @@ class Pool extends \Prefab {
* tries to create a database if not exists
* -> DB user needs rights to create a DB
* @param string $alias
* @return SQL|null
* @return Sql|null
*/
public function createDB(string $alias) : ?SQL {
public function createDB(string $alias) : ?Sql {
$db = null;
$config = ($this->getConfig)($alias);
// remove database from $dsn (we want to crate it)
@@ -135,9 +135,9 @@ class Pool extends \Prefab {
/**
* get active connection from store or init new connection
* @param string $alias
* @return SQL|null
* @return Sql|null
*/
public function getDB(string $alias) : ?SQL {
public function getDB(string $alias) : ?Sql {
if(!isset($this->connectionStore[$alias])){
$db = $this->newDB(($this->getConfig)($alias));
if(!is_null($db)){
@@ -175,14 +175,14 @@ class Pool extends \Prefab {
/**
* @param array $config
* @return SQL|null
* @return Sql|null
*/
protected function newDB(array $config) : ?SQL {
protected function newDB(array $config) : ?Sql {
$db = null;
if($config['SCHEME'] == 'mysql'){
try{
$db = new SQL($this->buildDnsFromConfig($config), $config['USER'], $config['PASS'], $config['OPTIONS']);
$db = new Sql($this->buildDnsFromConfig($config), $config['USER'], $config['PASS'], $config['OPTIONS']);
}catch(\PDOException $e){
$this->pushError($config['ALIAS'], $e);

View File

@@ -1,12 +1,12 @@
<?php
namespace lib\db;
namespace Exodus4D\Pathfinder\Lib\Db;
use DB\SQL\Schema;
class SQL extends \DB\SQL {
class Sql extends \DB\SQL {
/**
* SQL constructor.

View File

@@ -1,10 +1,10 @@
<?php
namespace lib\format;
namespace Exodus4D\Pathfinder\Lib\Format;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
class Image extends \Prefab {

View File

@@ -6,7 +6,7 @@
* Time: 22:13
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
abstract class AbstractChannelLog extends AbstractLog {

View File

@@ -6,10 +6,10 @@
* Time: 19:05
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
use lib\Config;
use Model\Pathfinder\CharacterModel;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel;
abstract class AbstractCharacterLog extends AbstractChannelLog {

View File

@@ -6,10 +6,10 @@
* Time: 22:13
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
use lib\Monolog;
use Exodus4D\Pathfinder\Lib\Monolog;
use Monolog\Logger;
abstract class AbstractLog implements LogInterface {

View File

@@ -6,7 +6,7 @@
* Time: 16:42
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
class ApiLog extends AbstractLog {
@@ -20,8 +20,17 @@ class ApiLog extends AbstractLog {
//'stream' => 'json'
];
/**
* @var string
*/
protected $channelType = 'api';
/**
* ApiLog constructor.
* @param string $action
* @param string $level
* @throws \Exception
*/
public function __construct(string $action, string $level){
parent::__construct($action);

View File

@@ -6,7 +6,7 @@
* Time: 22:08
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
class DefaultLog extends AbstractLog {

View File

@@ -6,13 +6,17 @@
* Time: 14:49
*/
namespace lib\logging\formatter;
namespace Exodus4D\Pathfinder\Lib\Logging\Formatter;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
use Monolog\Formatter;
class MailFormatter implements Formatter\FormatterInterface {
/**
* @param array $record
* @return mixed|string
*/
public function format(array $record){
$tplDefaultData = [
@@ -34,6 +38,10 @@ class MailFormatter implements Formatter\FormatterInterface {
return \Template::instance()->render('templates/mail/basic_inline.html', 'text/html', $tplData);
}
/**
* @param array $records
* @return mixed|string
*/
public function formatBatch(array $records){
$message = '';
foreach ($records as $key => $record) {

View File

@@ -6,9 +6,9 @@
* Time: 10:18
*/
namespace lib\logging\handler;
namespace Exodus4D\Pathfinder\Lib\Logging\Handler;
use lib\Util;
use Exodus4D\Pathfinder\Lib\Util;
abstract class AbstractMapWebhookHandler extends AbstractWebhookHandler {

View File

@@ -6,10 +6,10 @@
* Time: 10:09
*/
namespace lib\logging\handler;
namespace Exodus4D\Pathfinder\Lib\Logging\Handler;
use League\HTMLToMarkdown\HtmlConverter;
use lib\Util;
use Exodus4D\Pathfinder\Lib\Util;
abstract class AbstractRallyWebhookHandler extends AbstractWebhookHandler {
@@ -150,7 +150,6 @@ abstract class AbstractRallyWebhookHandler extends AbstractWebhookHandler {
protected function htmlToMarkdown($html){
$converter = new HtmlConverter();
$converter->getConfig()->setOption('strip_tags', true);
$markdown = $converter->convert($html);
return $markdown;
return $converter->convert($html);
}
}

View File

@@ -6,9 +6,9 @@
* Time: 20:08
*/
namespace lib\logging\handler;
namespace Exodus4D\Pathfinder\Lib\Logging\Handler;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
use Monolog\Handler;
use Monolog\Logger;

View File

@@ -6,7 +6,7 @@
* Time: 10:23
*/
namespace lib\logging\handler;
namespace Exodus4D\Pathfinder\Lib\Logging\Handler;
class DiscordMapWebhookHandler extends AbstractMapWebhookHandler {

View File

@@ -6,11 +6,15 @@
* Time: 10:13
*/
namespace lib\logging\handler;
namespace Exodus4D\Pathfinder\Lib\Logging\Handler;
class DiscordRallyWebhookHandler extends AbstractRallyWebhookHandler {
/**
* @param $html
* @return string
*/
protected function htmlToMarkdown($html){
$markdown = parent::htmlToMarkdown($html);
// Discord supports syntax highlighting for MarkDown

View File

@@ -6,9 +6,9 @@
* Time: 20:52
*/
namespace lib\logging\handler;
namespace Exodus4D\Pathfinder\Lib\Logging\Handler;
class SlackMapWebhookHandler extends AbstractMapWebhookHandler {
}

View File

@@ -6,12 +6,9 @@
* Time: 17:32
*/
namespace lib\logging\handler;
namespace Exodus4D\Pathfinder\Lib\Logging\Handler;
class SlackRallyWebhookHandler extends AbstractRallyWebhookHandler {
}

View File

@@ -6,7 +6,7 @@
* Time: 19:11
*/
namespace lib\logging\handler;
namespace Exodus4D\Pathfinder\Lib\Logging\Handler;
use Monolog\Logger;
@@ -19,6 +19,13 @@ class SocketHandler extends \Monolog\Handler\SocketHandler {
*/
protected $metaData = [];
/**
* SocketHandler constructor.
* @param $connectionString
* @param int $level
* @param bool $bubble
* @param array $metaData
*/
public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true, $metaData = []){
$this->metaData = $metaData;

View File

@@ -6,7 +6,7 @@
* Time: 11:23
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
class LogCollection extends AbstractLog {
@@ -32,6 +32,10 @@ class LogCollection extends AbstractLog {
*/
private $collection = null;
/**
* LogCollection constructor.
* @param string $action
*/
public function __construct(string $action){
parent::__construct($action);

View File

@@ -6,7 +6,7 @@
* Time: 14:10
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
interface LogInterface {

View File

@@ -6,10 +6,10 @@
* Time: 22:08
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
use controller\LogController;
use Exodus4D\Pathfinder\Controller\LogController;
class MapLog extends AbstractCharacterLog {
@@ -34,7 +34,12 @@ class MapLog extends AbstractCharacterLog {
*/
protected $logActivity = false;
/**
* MapLog constructor.
* @param string $action
* @param array $objectData
* @throws \Exception
*/
public function __construct(string $action, array $objectData){
parent::__construct($action, $objectData);

View File

@@ -6,9 +6,10 @@
* Time: 16:50
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
class RallyLog extends AbstractCharacterLog {
@@ -27,7 +28,12 @@ class RallyLog extends AbstractCharacterLog {
*/
protected $channelType = 'rally';
/**
* RallyLog constructor.
* @param string $action
* @param array $objectData
* @throws \Exception
*/
public function __construct(string $action, array $objectData){
parent::__construct($action, $objectData);

View File

@@ -6,7 +6,7 @@
* Time: 14:15
*/
namespace lib\logging;
namespace Exodus4D\Pathfinder\Lib\Logging;
class UserLog extends AbstractChannelLog {
@@ -25,6 +25,12 @@ class UserLog extends AbstractChannelLog {
*/
protected $channelType = 'user';
/**
* UserLog constructor.
* @param string $action
* @param array $objectData
* @throws \Exception
*/
public function __construct(string $action, array $objectData){
parent::__construct($action, $objectData);

View File

@@ -6,11 +6,11 @@
* Time: 20:17
*/
namespace lib;
namespace Exodus4D\Pathfinder\Lib;
use controller\LogController;
use lib\logging;
use Exodus4D\Pathfinder\Controller\LogController;
use Exodus4D\Pathfinder\Lib\Logging;
use Monolog\Registry;
use Monolog\Processor\ProcessorInterface;
use Monolog\Formatter\FormatterInterface;
@@ -43,7 +43,7 @@ class Monolog extends \Prefab {
'line' => 'Monolog\Formatter\LineFormatter',
'json' => 'Monolog\Formatter\JsonFormatter',
'html' => 'Monolog\Formatter\HtmlFormatter',
'mail' => 'lib\logging\formatter\MailFormatter'
'mail' => 'Exodus4D\Pathfinder\Lib\Logging\Formatter\MailFormatter'
];
/**
@@ -52,11 +52,11 @@ class Monolog extends \Prefab {
const HANDLER = [
'stream' => 'Monolog\Handler\StreamHandler',
'mail' => 'Monolog\Handler\SwiftMailerHandler',
'socket' => 'lib\logging\handler\SocketHandler',
'slackMap' => 'lib\logging\handler\SlackMapWebhookHandler',
'slackRally' => 'lib\logging\handler\SlackRallyWebhookHandler',
'discordMap' => 'lib\logging\handler\DiscordMapWebhookHandler',
'discordRally' => 'lib\logging\handler\DiscordRallyWebhookHandler'
'socket' => 'Exodus4D\Pathfinder\Lib\Logging\Handler\SocketHandler',
'slackMap' => 'Exodus4D\Pathfinder\Lib\Logging\Handler\SlackMapWebhookHandler',
'slackRally' => 'Exodus4D\Pathfinder\Lib\Logging\Handler\SlackRallyWebhookHandler',
'discordMap' => 'Exodus4D\Pathfinder\Lib\Logging\Handler\DiscordMapWebhookHandler',
'discordRally' => 'Exodus4D\Pathfinder\Lib\Logging\Handler\DiscordRallyWebhookHandler'
];
/**

View File

@@ -1,7 +1,7 @@
<?php
namespace lib;
namespace Exodus4D\Pathfinder\Lib;
class PriorityCacheStore {

View File

@@ -6,7 +6,7 @@
* Time: 10:58
*/
namespace lib;
namespace Exodus4D\Pathfinder\Lib;
class Resource extends \Prefab {

View File

@@ -6,7 +6,7 @@
* Time: 19:13
*/
namespace lib\socket;
namespace Exodus4D\Pathfinder\Lib\Socket;
use React\EventLoop;
@@ -237,12 +237,10 @@ abstract class AbstractSocket implements SocketInterface {
* @return array
*/
protected function newPayload(string $task, $load = null) : array {
$payload = [
return [
'task' => $task,
'load' => $load
];
return $payload;
}
/**

View File

@@ -6,7 +6,7 @@
* Time: 23:22
*/
namespace lib\socket;
namespace Exodus4D\Pathfinder\Lib\Socket;
use React\Socket;

View File

@@ -6,10 +6,9 @@
* Time: 11:26
*/
namespace lib\socket;
namespace Exodus4D\Pathfinder\Lib\Socket;
use React\EventLoop;
use React\Promise;
interface SocketInterface {

View File

@@ -6,7 +6,7 @@
* Time: 10:04
*/
namespace lib\socket;
namespace Exodus4D\Pathfinder\Lib\Socket;
use React\Socket;

View File

@@ -6,7 +6,8 @@
* Time: 17:32
*/
namespace lib;
namespace Exodus4D\Pathfinder\Lib;
class Util {

1156
app/Model/AbstractModel.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -6,9 +6,10 @@
* Time: 18:45
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
use Exodus4D\Pathfinder\Exception;
abstract class AbstractMapTrackingModel extends AbstractPathfinderModel implements LogModelInterface {
@@ -19,7 +20,7 @@ abstract class AbstractMapTrackingModel extends AbstractPathfinderModel implemen
'createdCharacterId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\CharacterModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel',
'constraint' => [
[
'table' => 'character',
@@ -31,7 +32,7 @@ abstract class AbstractMapTrackingModel extends AbstractPathfinderModel implemen
'updatedCharacterId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\CharacterModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel',
'constraint' => [
[
'table' => 'character',
@@ -70,7 +71,7 @@ abstract class AbstractMapTrackingModel extends AbstractPathfinderModel implemen
/**
* validates all required columns of this class
* @return bool
* @throws \Exception\DatabaseException
* @throws Exception\DatabaseException
*/
public function isValid(): bool {
if($valid = parent::isValid()){

View File

@@ -0,0 +1,112 @@
<?php
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use Exodus4D\Pathfinder\Model\AbstractModel;
abstract class AbstractPathfinderModel extends AbstractModel {
/**
* alias name for database connection
*/
const DB_ALIAS = 'PF';
/**
* enables check for $fieldChanges on update/insert
* -> fields that should be checked need an "activity-log" flag
* in $fieldConf config
* @var bool
*/
protected $enableActivityLogging = true;
/**
* changed fields (columns) on update/insert
* -> e.g. for character "activity logging"
* @var array
*/
protected $fieldChanges = [];
/**
* change default "activity logging" status
* -> enable/disable
* @param $status
*/
public function setActivityLogging(bool $status){
$this->enableActivityLogging = $status;
}
/**
* @param bool $mapper
* @return NULL|void
*/
public function reset($mapper = true){
$this->fieldChanges = [];
parent::reset($mapper);
}
/**
* function should be overwritten in child classes with access restriction
* @param CharacterModel $characterModel
* @return bool
*/
public function hasAccess(CharacterModel $characterModel) : bool {
return true;
}
/**
* set "updated" field to current timestamp
* this is useful to mark a row as "changed"
*/
protected function setUpdated(){
if($this->_id > 0){
$this->db->exec(
["UPDATE " . $this->table . " SET updated=NOW() WHERE id=:id"],
[
[':id' => $this->_id]
]
);
}
}
/**
* get old and new value from field, in case field is configured with 'activity-log'
* @return array
*/
protected function getFieldChanges() : array {
$changes = [];
if($this->enableActivityLogging){
// filter fields, where "activity" (changes) should be logged
$fieldConf = array_filter($this->fieldConf, function($fieldConf, $key){
return isset($fieldConf['activity-log']) ? (bool)$fieldConf['activity-log'] : false;
}, ARRAY_FILTER_USE_BOTH);
if($fieldKeys = array_keys($fieldConf)){
// model has fields where changes should be logged
$schema = $this->getMapper()->schema();
foreach($fieldKeys as $key){
if($this->changed($key)){
$changes[$key] = [
'old' => $schema[$key]['initial'],
'new' => $schema[$key]['value']
];
}
}
}
}
return $changes;
}
/**
* @return mixed|void
*/
public function save(){
// save changed field value BEFORE ->save() it called!
// parent::save() resets the schema and old values get replaced with new values
$this->fieldChanges = $this->getFieldChanges();
return parent::save();
}
}

View File

@@ -6,7 +6,7 @@
* Time: 22:11
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;

View File

@@ -6,14 +6,20 @@
* Time: 15:11
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
class ActivityLogModel extends AbstractPathfinderModel {
/**
* @var string
*/
protected $table = 'activity_log';
/**
* @var array
*/
protected $fieldConf = [
'active' => [
'type' => Schema::DT_BOOL,
@@ -24,7 +30,7 @@ class ActivityLogModel extends AbstractPathfinderModel {
'characterId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\CharacterModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel',
'constraint' => [
[
'table' => 'character',
@@ -35,7 +41,7 @@ class ActivityLogModel extends AbstractPathfinderModel {
'mapId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\MapModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\MapModel',
'constraint' => [
[
'table' => 'map',
@@ -129,6 +135,13 @@ class ActivityLogModel extends AbstractPathfinderModel {
],
];
/**
* ActivityLogModel constructor.
* @param null $db
* @param null $table
* @param null $fluid
* @param int $ttl
*/
public function __construct($db = NULL, $table = NULL, $fluid = NULL, $ttl = 0){
$this->addStaticDateFieldConfig();

View File

@@ -6,7 +6,7 @@
* Time: 20:14
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
@@ -30,7 +30,7 @@ class AllianceMapModel extends AbstractPathfinderModel {
'allianceId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\AllianceModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\AllianceModel',
'constraint' => [
[
'table' => 'alliance',
@@ -41,7 +41,7 @@ class AllianceMapModel extends AbstractPathfinderModel {
'mapId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\MapModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\MapModel',
'constraint' => [
[
'table' => 'map',

View File

@@ -6,10 +6,10 @@
* Time: 20:43
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
use lib\Config;
use Exodus4D\Pathfinder\Lib\Config;
class AllianceModel extends AbstractPathfinderModel {
@@ -44,10 +44,10 @@ class AllianceModel extends AbstractPathfinderModel {
'default' => 0
],
'allianceCharacters' => [
'has-many' => ['Model\Pathfinder\CharacterModel', 'allianceId']
'has-many' => ['Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel', 'allianceId']
],
'mapAlliances' => [
'has-many' => ['Model\Pathfinder\AllianceMapModel', 'allianceId']
'has-many' => ['Exodus4D\Pathfinder\Model\Pathfinder\AllianceMapModel', 'allianceId']
]
];

View File

@@ -6,15 +6,21 @@
* Time: 19:33
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
use Controller;
use Exodus4D\Pathfinder\Controller;
class CharacterAuthenticationModel extends AbstractPathfinderModel{
/**
* @var string
*/
protected $table = 'character_authentication';
/**
* @var array
*/
protected $fieldConf = [
'active' => [
'type' => Schema::DT_BOOL,
@@ -25,7 +31,7 @@ class CharacterAuthenticationModel extends AbstractPathfinderModel{
'characterId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\CharacterModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel',
'constraint' => [
[
'table' => 'character',

View File

@@ -6,7 +6,7 @@
* Time: 00:04
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
@@ -37,7 +37,7 @@ class CharacterLogModel extends AbstractPathfinderModel {
'type' => Schema::DT_INT,
'index' => true,
'unique' => true,
'belongs-to-one' => 'Model\Pathfinder\CharacterModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel',
'constraint' => [
[
'table' => 'character',

View File

@@ -6,14 +6,20 @@
* Time: 12:31
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
class CharacterMapModel extends AbstractPathfinderModel {
/**
* @var string
*/
protected $table = 'character_map';
/**
* @var array
*/
protected $fieldConf = [
'active' => [
'type' => Schema::DT_BOOL,
@@ -24,7 +30,7 @@ class CharacterMapModel extends AbstractPathfinderModel {
'characterId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\CharacterModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CharacterModel',
'constraint' => [
[
'table' => 'character',
@@ -35,7 +41,7 @@ class CharacterMapModel extends AbstractPathfinderModel {
'mapId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\MapModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\MapModel',
'constraint' => [
[
'table' => 'map',

View File

@@ -6,13 +6,13 @@
* Time: 15:20
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use Controller\Ccp\Sso as Sso;
use Controller\Api\User as User;
use Exodus4D\Pathfinder\Controller\Ccp\Sso as Sso;
use Exodus4D\Pathfinder\Controller\Api\User as User;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Model\Universe;
use DB\SQL\Schema;
use lib\Config;
use Model\Universe;
class CharacterModel extends AbstractPathfinderModel {
@@ -116,7 +116,7 @@ class CharacterModel extends AbstractPathfinderModel {
'corporationId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\CorporationModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CorporationModel',
'constraint' => [
[
'table' => 'corporation',
@@ -127,7 +127,7 @@ class CharacterModel extends AbstractPathfinderModel {
'allianceId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\AllianceModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\AllianceModel',
'constraint' => [
[
'table' => 'alliance',
@@ -140,7 +140,7 @@ class CharacterModel extends AbstractPathfinderModel {
'nullable' => false,
'default' => 1,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\RoleModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\RoleModel',
'constraint' => [
[
'table' => 'role',
@@ -187,16 +187,16 @@ class CharacterModel extends AbstractPathfinderModel {
'default' => 0
],
'userCharacter' => [
'has-one' => ['Model\Pathfinder\UserCharacterModel', 'characterId']
'has-one' => ['Exodus4D\Pathfinder\Model\Pathfinder\UserCharacterModel', 'characterId']
],
'characterLog' => [
'has-one' => ['Model\Pathfinder\CharacterLogModel', 'characterId']
'has-one' => ['Exodus4D\Pathfinder\Model\Pathfinder\CharacterLogModel', 'characterId']
],
'characterMaps' => [
'has-many' => ['Model\Pathfinder\CharacterMapModel', 'characterId']
'has-many' => ['Exodus4D\Pathfinder\Model\Pathfinder\CharacterMapModel', 'characterId']
],
'characterAuthentications' => [
'has-many' => ['Model\Pathfinder\CharacterAuthenticationModel', 'characterId']
'has-many' => ['Exodus4D\Pathfinder\Model\Pathfinder\CharacterAuthenticationModel', 'characterId']
]
];

View File

@@ -6,14 +6,20 @@
* Time: 21:12
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
class CharacterStatusModel extends AbstractPathfinderModel {
/**
* @var string
*/
protected $table = 'character_status';
/**
* @var array
*/
protected $fieldConf = [
'active' => [
'type' => Schema::DT_BOOL,
@@ -33,6 +39,9 @@ class CharacterStatusModel extends AbstractPathfinderModel {
]
];
/**
* @var array
*/
protected static $tableData = [
[
'id' => 1,

View File

@@ -6,14 +6,20 @@
* Time: 17:51
*/
namespace Model\Pathfinder;
namespace Exodus4D\Pathfinder\Model\Pathfinder;
use DB\SQL\Schema;
class ConnectionLogModel extends AbstractPathfinderModel {
/**
* @var string
*/
protected $table = 'connection_log';
/**
* @var array
*/
protected $fieldConf = [
'active' => [
'type' => Schema::DT_BOOL,
@@ -24,7 +30,7 @@ class ConnectionLogModel extends AbstractPathfinderModel {
'connectionId' => [
'type' => Schema::DT_INT,
'index' => true,
'belongs-to-one' => 'Model\Pathfinder\ConnectionModel',
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\ConnectionModel',
'constraint' => [
[
'table' => 'connection',

Some files were not shown because too many files have changed in this diff Show More