mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
impl. todos or move to Project.md
This commit is contained in:
parent
9ae2cd45ed
commit
86029bc54f
|
|
@ -189,7 +189,6 @@ final class BasicOcr
|
|||
{
|
||||
$predictedLabels = [];
|
||||
foreach ($Xtest as $sample) {
|
||||
// @todo: consider to path the k-limit to the getDistances function for earlier filtering
|
||||
$distances = $this->getDistances($Xtrain, $sample);
|
||||
\asort($distances);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,13 +148,7 @@ final class Kmeans
|
|||
|
||||
foreach ($clusterCenters as $center) {
|
||||
for ($i = 0; $i < $coordinates; ++$i) {
|
||||
/**
|
||||
* @todo Orange-Management/phpOMS#229
|
||||
* Invalid center coodinate value
|
||||
* In some cases the center point of a cluster belongs to the group 0 in this case the coordinate value is not working correctly.
|
||||
* As a quick fix the value is set to `1` in such a case but probably has multiple side effects.
|
||||
* Maybe it makes sense to just use `$center->group + 1` or set the value to `0`.
|
||||
*/
|
||||
// @todo Invalid center coodinate value in like 5 % of the runs
|
||||
$center->setCoordinate($i, $center->getCoordinate($i) / ($center->group === 0 ? 1 : $center->group));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,10 +104,6 @@ final class Weighted
|
|||
*
|
||||
* @return JobInterface[]
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#244
|
||||
* [JobScheduling] Implement test for Jobs with same value.
|
||||
* There is no test case for the else clause in the `solve` function. Implement it.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function solve(array $jobs) : array
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@ final class ApplicationManager
|
|||
private ApplicationAbstract $app;
|
||||
|
||||
/**
|
||||
* Applications
|
||||
* Installed modules.
|
||||
*
|
||||
* @var ApplicationInfo[]
|
||||
* @var array<string, ApplicationInfo>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $applications = [];
|
||||
private array $installed = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
@ -107,8 +107,8 @@ final class ApplicationManager
|
|||
}
|
||||
|
||||
try {
|
||||
$info = $this->loadInfo($source . '/info.json');
|
||||
$this->applications[$info->getInternalName()] = $info;
|
||||
$info = $this->loadInfo($source . '/info.json');
|
||||
$this->installed[$info->getInternalName()] = $info;
|
||||
|
||||
$this->installFiles($source, $destination);
|
||||
$this->replacePlaceholder($destination);
|
||||
|
|
@ -122,6 +122,55 @@ final class ApplicationManager
|
|||
}
|
||||
}
|
||||
|
||||
public function getProvidingForModule(string $module) : array
|
||||
{
|
||||
$providing = [];
|
||||
$installed = $this->getInstalledApplications();
|
||||
|
||||
foreach ($installed as $app => $info) {
|
||||
if (!isset($providing[$app])) {
|
||||
$providing[$app] = [];
|
||||
}
|
||||
|
||||
$appProviding = $info->getProviding();
|
||||
foreach ($appProviding as $for => $version) {
|
||||
if ($for !== $module) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$providing[$app][] = $for;
|
||||
}
|
||||
}
|
||||
|
||||
return $providing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all installed modules.
|
||||
*
|
||||
* @param bool $useCache Use Cache
|
||||
*
|
||||
* @return array<string, ModuleInfo>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getInstalledApplications(bool $useCache = true) : array
|
||||
{
|
||||
if (empty($this->installed) || !$useCache) {
|
||||
$apps = \scandir(__DIR__ . '/../../Web');
|
||||
|
||||
foreach ($apps as $app) {
|
||||
if ($app === '.' || $app === '..' || !\is_file(__DIR__ . '/../../Web/' . $app . '/info.json')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->installed[$app] = $this->loadInfo(__DIR__ . '/../../Web/' . $app . '/info.json');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the files to the destination
|
||||
*
|
||||
|
|
|
|||
|
|
@ -139,14 +139,13 @@ final class Autoloader
|
|||
/**
|
||||
* Invalidate a already loaded file
|
||||
*
|
||||
* IMPORTANT: This does not reload an already loaded file
|
||||
* IMPORTANT: This does not reload an already loaded file, this is not possible.
|
||||
*
|
||||
* @param string $class Class to invalidate
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @todo Find a way to re-load aready loaded files. This can be important for changed scripts
|
||||
*/
|
||||
public static function invalidate(string $class) : bool
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace phpOMS\DataStorage\Database\Connection;
|
|||
|
||||
use phpOMS\DataStorage\Database\DatabaseStatus;
|
||||
use phpOMS\DataStorage\Database\DatabaseType;
|
||||
use phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException;
|
||||
use phpOMS\DataStorage\Database\Query\Grammar\MysqlGrammar;
|
||||
use phpOMS\DataStorage\Database\Schema\Grammar\MysqlGrammar as MysqlSchemaGrammar;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,52 +32,17 @@ use phpOMS\Utils\ArrayUtils;
|
|||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#122
|
||||
* Split/Refactor.
|
||||
* Child extends parent. Parent creates GetMapper, CreateMapper etc.
|
||||
* Example:
|
||||
* ```User::get(...)```
|
||||
* The get() function (defined in an abstract class) creates internally an instance of GetMapper.
|
||||
* The GetMapper receives all information such as primaryField, columns etc internally from the get().
|
||||
* This transfer of knowledge to the GetMapper could be done in the abstract class as a setup() function.
|
||||
* Now all mappers are split. The overhead is one additional function call and the setup() function.
|
||||
* Alternatively, think about using traits in the beginning.
|
||||
*
|
||||
* @todo Orange-Management/Modules#99
|
||||
* Use binds
|
||||
* Currently databinds are not used. Currently injections are possible.
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#241
|
||||
* [DataMapper] Consider global conditionals
|
||||
* In some cases conditionals in the mapper are typed again and again
|
||||
* e.g. language conditional for localization purposes
|
||||
* This is very annoying and maybe could be defined once in a `$conditionalsGlobal = [];` array.
|
||||
* This array then populates the `$conditionals` array in the mapper.
|
||||
* Overwriting the global conditionals could be possible by defining a conditional as `null`.
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#242
|
||||
* [DataMapper] Conditional queries bugs/problems
|
||||
* Corrupted conditional relations are not shown and therefor cannot be fixed by the user e.g.
|
||||
* * Tag is created
|
||||
* * No l11n is created
|
||||
* -> The tags without l11n are not shown in the list and therefor the user doesn't know about them and cannot fix them.
|
||||
* -> The tags without l11n are not shown in the list and therefor the user doesn't know about them and cannot fix them. (wrong join type?)
|
||||
* If the defined conditional doesn't exist (e.g. language) the element is not shown at all.
|
||||
* This can be a problem if the user wants the conditional as preferred result
|
||||
* but also accepts alternatives if nothing exists for this conditional but for other conditionals. E.g.
|
||||
* * News article doesn't exist in the defined l11n
|
||||
* * However if the article exists in english language it should at least show in that language.
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#???
|
||||
* Use more column/field names instead of model variable names
|
||||
* Consider to replace the model member variable name in the `column` definition of hasMany etc. definitions with the actual column name. This could be faster.
|
||||
* This could make it faster since we don't need to do a reverse look up.
|
||||
* Maybe this will require us to do a different lookup however which costs a similar amount of time?
|
||||
*
|
||||
* @todo Orange-Management/phpOMS#???
|
||||
* Concise usage of runtime evaluations vs hard-coded definitions
|
||||
* Most of the time we are using Mapper::class etc. but there are still places where we use 'table' => 'table_name' instead of Mapper::$table.
|
||||
* The Mapper::$table approach is probably better for future code changes but makes it probably also slower.
|
||||
* We really need to decide to follow one path and implement this everywhere.
|
||||
*/
|
||||
class DataMapperAbstract implements DataMapperInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,6 +67,16 @@ class Builder extends QueryBuilder
|
|||
*/
|
||||
public array $selectTables = ['*'];
|
||||
|
||||
/**
|
||||
* Always calls compileCreateTableSettings in the Grammar
|
||||
*
|
||||
* This is important to set the correct table settings (e.g. utf8mb4 instead of utf8)
|
||||
*
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public bool $createTableSettings = true;
|
||||
|
||||
/**
|
||||
* Select fields.
|
||||
*
|
||||
|
|
@ -75,14 +85,6 @@ class Builder extends QueryBuilder
|
|||
*/
|
||||
public string $selectFields = '';
|
||||
|
||||
/**
|
||||
* @todo: ?????.
|
||||
*
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public bool $createTableSettings = true;
|
||||
|
||||
/**
|
||||
* Table to alter.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -95,6 +95,29 @@ final class L11nManager
|
|||
: $translation[$from] + $this->language[$language][$from];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load language file which contains multiple languages.
|
||||
*
|
||||
* @param string $from Module name
|
||||
* @param string $file File to import language from
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function loadLanguageFile(string $from, string $file) : void
|
||||
{
|
||||
if (!\is_file($file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
$lang = include $file;
|
||||
|
||||
foreach ($lang as $code => $translation)
|
||||
$this->loadLanguage($code, $from, $translation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load language from file.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -89,16 +89,7 @@ final class Rest
|
|||
$boundary = '----' . \uniqid();
|
||||
$data = self::createMultipartData($boundary, $request->getData());
|
||||
|
||||
/**
|
||||
* @todo:
|
||||
* there is a very weird bug where boundary= fails to create the correct request
|
||||
* while removing the = or putting it at a different location works (e.g. bound=ary).
|
||||
* Maybe boundary= is a reserved keyword?
|
||||
*
|
||||
* according to the verbose output of curl the request is correct. this means the server must have a problem with it
|
||||
*
|
||||
* the php webserver and apache2 both seem to be unable to populate the php://input correctly -> not a server issue but a php issue?
|
||||
*/
|
||||
// @todo: replace boundary/ with the correct boundary= in the future. Currently this cannot be done due to a bug. If we do it now the server cannot correclty populate php://input
|
||||
$headers['content-type'] = 'Content-Type: multipart/form-data; boundary/' . $boundary;
|
||||
$headers['content-length'] = 'Content-Length: ' . \strlen($data);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,36 +44,9 @@ abstract class InstallerAbstract
|
|||
public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
||||
{
|
||||
self::createTables($dbPool, $info);
|
||||
self::installSettings($dbPool, $info, $cfgHandler);
|
||||
self::activate($dbPool, $info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install module settings.
|
||||
*
|
||||
* @param DatabasePool $dbPool Database instance
|
||||
* @param ModuleInfo $info Module info
|
||||
* @param SettingsInterface $cfgHandler Settings/Configuration handler
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @todo move to admin module as providing option (like media providing `Admin.install.php` instead of Settings.install.php)
|
||||
*/
|
||||
public static function installSettings(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
||||
{
|
||||
$path = \dirname($info->getPath()) . '/Admin/Install/Settings.install.php';
|
||||
if (!\is_file($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = include $path;
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
$cfgHandler->create($setting);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create tables for module.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ For more detailed information please checkout the [Installation Guide](https://o
|
|||
|
||||
#### Developer
|
||||
|
||||
https://github.com/Orange-Management/Developer-Guide/blob/master/setup/installation.md
|
||||
https://github.com/Orange-Management/Developer-Guide/blob/develop/general/setup.md
|
||||
|
||||
## Philosophy
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class ApplicationManagerTest extends \PHPUnit\Framework\TestCase
|
|||
public function get(
|
||||
mixed $ids = null,
|
||||
string | array $names = null,
|
||||
int $app = null,
|
||||
string $module = null,
|
||||
int $group = null,
|
||||
int $account = null
|
||||
|
|
@ -69,7 +70,7 @@ class ApplicationManagerTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$app->moduleManager = new ModuleManager($app, __DIR__ . '/../../../Modules/');
|
||||
|
||||
$this->appManager = new ApplicationManager();
|
||||
$this->appManager = new ApplicationManager($app);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user