feat: Rewrite of the core: avoid globals where possible

Create services for: login, status, router, database, AnonymousStatistics
Drop gesior.backward_support
Drop compat/pages.php
Drop part of compat/classes.php
Move signature to routes
This commit is contained in:
slawkens
2025-03-09 14:41:41 +01:00
parent 3c1210fefa
commit 2c59c4d8f7
35 changed files with 1054 additions and 1174 deletions

View File

@@ -98,7 +98,7 @@ class OTS_DB_MySQL extends OTS_Base_DB
}
global $config;
$cache = Cache::getInstance();
$cache = app()->get('cache');
if($cache->enabled()) {
$tmp = null;
$need_revalidation = true;
@@ -150,7 +150,7 @@ class OTS_DB_MySQL extends OTS_Base_DB
{
global $config;
$cache = Cache::getInstance();
$cache = app()->get('cache');
if($cache->enabled()) {
if ($this->clearCacheAfter) {
$cache->delete('database_tables');

View File

@@ -33,7 +33,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable
*/
public function __construct($file = '')
{
global $db;
$db = app()->get('db');
if($db->hasTable('groups')) { // read groups from database
foreach($db->query('SELECT `id`, `name`, `access` FROM `groups`;') as $group)
{
@@ -47,10 +47,8 @@ class OTS_Groups_List implements IteratorAggregate, Countable
return;
}
if(!isset($file[0]))
{
global $config;
$file = $config['data_path'] . 'XML/groups.xml';
if(!isset($file[0])) {
$file = config('data_path') . 'XML/groups.xml';
}
if(!@file_exists($file)) {
@@ -59,7 +57,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable
return;
}
$cache = Cache::getInstance();
$cache = app()->get('cache');
$data = array();
if($cache->enabled())

View File

@@ -655,8 +655,7 @@ class OTS_Player extends OTS_Row_DAO
//if($path == '')
// $path = $config['data_path'].'XML/groups.xml';
if( !isset($this->data['group_id']) )
{
if(!isset($this->data['group_id'])) {
throw new E_OTS_NotLoaded();
}
@@ -665,8 +664,9 @@ class OTS_Player extends OTS_Row_DAO
global $groups;
$tmp = $groups->getGroup($this->data['group_id']);
if($tmp)
if($tmp) {
return $tmp;
}
return new OTS_Group();
// echo 'error while loading group..';