Merge branch 'development'
This commit is contained in:
@@ -96,9 +96,9 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
public function testErrorMessageLevelOk(string $level, string $str, string $expected): void
|
public function testErrorMessageLevelOk(string $level, string $str, string $expected): void
|
||||||
{
|
{
|
||||||
$log = new \CoreLibs\Logging\Logging([
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
'log_file_id' => 'testErrorMessages',
|
'log_file_id' => 'testErrorMessagesLevelOk',
|
||||||
'log_folder' => self::LOG_FOLDER,
|
'log_folder' => self::LOG_FOLDER,
|
||||||
'log_level' => Level::Debug,
|
'log_level' => Level::Error,
|
||||||
]);
|
]);
|
||||||
$em = new \CoreLibs\Logging\ErrorMessage($log);
|
$em = new \CoreLibs\Logging\ErrorMessage($log);
|
||||||
$em->setMessage(
|
$em->setMessage(
|
||||||
@@ -128,9 +128,9 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
public function testErrorMessageOk(): void
|
public function testErrorMessageOk(): void
|
||||||
{
|
{
|
||||||
$log = new \CoreLibs\Logging\Logging([
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
'log_file_id' => 'testErrorMessages',
|
'log_file_id' => 'testErrorMessagesOk',
|
||||||
'log_folder' => self::LOG_FOLDER,
|
'log_folder' => self::LOG_FOLDER,
|
||||||
'log_level' => Level::Debug
|
'log_level' => Level::Error
|
||||||
]);
|
]);
|
||||||
$em = new \CoreLibs\Logging\ErrorMessage($log);
|
$em = new \CoreLibs\Logging\ErrorMessage($log);
|
||||||
$em->setErrorMsg(
|
$em->setErrorMsg(
|
||||||
@@ -314,7 +314,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
* @dataProvider providerErrorMessageLog
|
* @dataProvider providerErrorMessageLog
|
||||||
* @testdox Test Log writing [$_dataName]
|
* @testdox Test Log writing with log level Error [$_dataName]
|
||||||
*
|
*
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* @param string $level
|
* @param string $level
|
||||||
@@ -324,7 +324,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
* @param string $expected
|
* @param string $expected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testErrorMessageLog(
|
public function testErrorMessageLogErrorLevel(
|
||||||
string $id,
|
string $id,
|
||||||
string $level,
|
string $level,
|
||||||
string $str,
|
string $str,
|
||||||
@@ -333,7 +333,63 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
string $expected
|
string $expected
|
||||||
): void {
|
): void {
|
||||||
$log = new \CoreLibs\Logging\Logging([
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
'log_file_id' => 'testErrorMessages',
|
'log_file_id' => 'testErrorMessagesLogError',
|
||||||
|
'log_folder' => self::LOG_FOLDER,
|
||||||
|
'log_level' => Level::Notice,
|
||||||
|
'log_per_run' => true
|
||||||
|
]);
|
||||||
|
$em = new \CoreLibs\Logging\ErrorMessage($log);
|
||||||
|
$em->setErrorMsg(
|
||||||
|
$id,
|
||||||
|
$level,
|
||||||
|
$str,
|
||||||
|
message: $message,
|
||||||
|
log_error: $log_error
|
||||||
|
);
|
||||||
|
$file_content = '';
|
||||||
|
if (is_file($log->getLogFolder() . $log->getLogFile())) {
|
||||||
|
$file_content = file_get_contents(
|
||||||
|
$log->getLogFolder() . $log->getLogFile()
|
||||||
|
) ?: '';
|
||||||
|
}
|
||||||
|
// if error, if null or false, it will not be logged
|
||||||
|
if ($level == 'error' && ($log_error === null || $log_error === false)) {
|
||||||
|
$this->assertStringNotContainsString(
|
||||||
|
$expected,
|
||||||
|
$file_content
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->assertStringContainsString(
|
||||||
|
$expected,
|
||||||
|
$file_content
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @dataProvider providerErrorMessageLog
|
||||||
|
* @testdox Test Log writing with log Level Debug [$_dataName]
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
* @param string $level
|
||||||
|
* @param string $str
|
||||||
|
* @param string|null $message
|
||||||
|
* @param bool|null $log_error
|
||||||
|
* @param string $expected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testErrorMessageLogErrorDebug(
|
||||||
|
string $id,
|
||||||
|
string $level,
|
||||||
|
string $str,
|
||||||
|
?string $message,
|
||||||
|
?bool $log_error,
|
||||||
|
string $expected
|
||||||
|
): void {
|
||||||
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
|
'log_file_id' => 'testErrorMessagesLogDebug',
|
||||||
'log_folder' => self::LOG_FOLDER,
|
'log_folder' => self::LOG_FOLDER,
|
||||||
'log_level' => Level::Debug,
|
'log_level' => Level::Debug,
|
||||||
'log_per_run' => true
|
'log_per_run' => true
|
||||||
@@ -352,8 +408,8 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
|
|||||||
$log->getLogFolder() . $log->getLogFile()
|
$log->getLogFolder() . $log->getLogFile()
|
||||||
) ?: '';
|
) ?: '';
|
||||||
}
|
}
|
||||||
// if n
|
// if error, and log is debug level, only explicit false are not logged
|
||||||
if ($level == 'error' && ($log_error === null || $log_error === false)) {
|
if ($level == 'error' && $log_error === false) {
|
||||||
$this->assertStringNotContainsString(
|
$this->assertStringNotContainsString(
|
||||||
$expected,
|
$expected,
|
||||||
$file_content
|
$file_content
|
||||||
|
|||||||
34
composer.lock
generated
34
composer.lock
generated
@@ -481,16 +481,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/deprecations",
|
"name": "doctrine/deprecations",
|
||||||
"version": "v1.1.1",
|
"version": "1.1.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/deprecations.git",
|
"url": "https://github.com/doctrine/deprecations.git",
|
||||||
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3"
|
"reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3",
|
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
|
||||||
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3",
|
"reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -522,9 +522,9 @@
|
|||||||
"homepage": "https://www.doctrine-project.org/",
|
"homepage": "https://www.doctrine-project.org/",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/deprecations/issues",
|
"issues": "https://github.com/doctrine/deprecations/issues",
|
||||||
"source": "https://github.com/doctrine/deprecations/tree/v1.1.1"
|
"source": "https://github.com/doctrine/deprecations/tree/1.1.2"
|
||||||
},
|
},
|
||||||
"time": "2023-06-03T09:27:29+00:00"
|
"time": "2023-09-27T20:04:15+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "felixfbecker/advanced-json-rpc",
|
"name": "felixfbecker/advanced-json-rpc",
|
||||||
@@ -1180,16 +1180,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "1.10.35",
|
"version": "1.10.36",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3"
|
"reference": "ffa3089511121a672e62969404e4fddc753f9b15"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15",
|
||||||
"reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3",
|
"reference": "ffa3089511121a672e62969404e4fddc753f9b15",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1238,7 +1238,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-09-19T15:27:56+00:00"
|
"time": "2023-09-29T14:07:45+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan-deprecation-rules",
|
"name": "phpstan/phpstan-deprecation-rules",
|
||||||
@@ -2254,16 +2254,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/string",
|
"name": "symfony/string",
|
||||||
"version": "v6.3.2",
|
"version": "v6.3.5",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/string.git",
|
"url": "https://github.com/symfony/string.git",
|
||||||
"reference": "53d1a83225002635bca3482fcbf963001313fb68"
|
"reference": "13d76d0fb049051ed12a04bef4f9de8715bea339"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68",
|
"url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339",
|
||||||
"reference": "53d1a83225002635bca3482fcbf963001313fb68",
|
"reference": "13d76d0fb049051ed12a04bef4f9de8715bea339",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2320,7 +2320,7 @@
|
|||||||
"utf8"
|
"utf8"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/string/tree/v6.3.2"
|
"source": "https://github.com/symfony/string/tree/v6.3.5"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -2336,7 +2336,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-07-05T08:41:27+00:00"
|
"time": "2023-09-18T10:38:32+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tysonandre/var_representation_polyfill",
|
"name": "tysonandre/var_representation_polyfill",
|
||||||
|
|||||||
40
vendor/composer/installed.json
vendored
40
vendor/composer/installed.json
vendored
@@ -441,17 +441,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/deprecations",
|
"name": "doctrine/deprecations",
|
||||||
"version": "v1.1.1",
|
"version": "1.1.2",
|
||||||
"version_normalized": "1.1.1.0",
|
"version_normalized": "1.1.2.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/deprecations.git",
|
"url": "https://github.com/doctrine/deprecations.git",
|
||||||
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3"
|
"reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3",
|
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
|
||||||
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3",
|
"reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -469,7 +469,7 @@
|
|||||||
"suggest": {
|
"suggest": {
|
||||||
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
|
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
|
||||||
},
|
},
|
||||||
"time": "2023-06-03T09:27:29+00:00",
|
"time": "2023-09-27T20:04:15+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -485,7 +485,7 @@
|
|||||||
"homepage": "https://www.doctrine-project.org/",
|
"homepage": "https://www.doctrine-project.org/",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/deprecations/issues",
|
"issues": "https://github.com/doctrine/deprecations/issues",
|
||||||
"source": "https://github.com/doctrine/deprecations/tree/v1.1.1"
|
"source": "https://github.com/doctrine/deprecations/tree/1.1.2"
|
||||||
},
|
},
|
||||||
"install-path": "../doctrine/deprecations"
|
"install-path": "../doctrine/deprecations"
|
||||||
},
|
},
|
||||||
@@ -1179,17 +1179,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "1.10.35",
|
"version": "1.10.36",
|
||||||
"version_normalized": "1.10.35.0",
|
"version_normalized": "1.10.36.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3"
|
"reference": "ffa3089511121a672e62969404e4fddc753f9b15"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15",
|
||||||
"reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3",
|
"reference": "ffa3089511121a672e62969404e4fddc753f9b15",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1198,7 +1198,7 @@
|
|||||||
"conflict": {
|
"conflict": {
|
||||||
"phpstan/phpstan-shim": "*"
|
"phpstan/phpstan-shim": "*"
|
||||||
},
|
},
|
||||||
"time": "2023-09-19T15:27:56+00:00",
|
"time": "2023-09-29T14:07:45+00:00",
|
||||||
"bin": [
|
"bin": [
|
||||||
"phpstan",
|
"phpstan",
|
||||||
"phpstan.phar"
|
"phpstan.phar"
|
||||||
@@ -2351,17 +2351,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/string",
|
"name": "symfony/string",
|
||||||
"version": "v6.3.2",
|
"version": "v6.3.5",
|
||||||
"version_normalized": "6.3.2.0",
|
"version_normalized": "6.3.5.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/string.git",
|
"url": "https://github.com/symfony/string.git",
|
||||||
"reference": "53d1a83225002635bca3482fcbf963001313fb68"
|
"reference": "13d76d0fb049051ed12a04bef4f9de8715bea339"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68",
|
"url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339",
|
||||||
"reference": "53d1a83225002635bca3482fcbf963001313fb68",
|
"reference": "13d76d0fb049051ed12a04bef4f9de8715bea339",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2381,7 +2381,7 @@
|
|||||||
"symfony/translation-contracts": "^2.5|^3.0",
|
"symfony/translation-contracts": "^2.5|^3.0",
|
||||||
"symfony/var-exporter": "^5.4|^6.0"
|
"symfony/var-exporter": "^5.4|^6.0"
|
||||||
},
|
},
|
||||||
"time": "2023-07-05T08:41:27+00:00",
|
"time": "2023-09-18T10:38:32+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -2420,7 +2420,7 @@
|
|||||||
"utf8"
|
"utf8"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/string/tree/v6.3.2"
|
"source": "https://github.com/symfony/string/tree/v6.3.5"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|||||||
18
vendor/composer/installed.php
vendored
18
vendor/composer/installed.php
vendored
@@ -65,9 +65,9 @@
|
|||||||
'dev_requirement' => true,
|
'dev_requirement' => true,
|
||||||
),
|
),
|
||||||
'doctrine/deprecations' => array(
|
'doctrine/deprecations' => array(
|
||||||
'pretty_version' => 'v1.1.1',
|
'pretty_version' => '1.1.2',
|
||||||
'version' => '1.1.1.0',
|
'version' => '1.1.2.0',
|
||||||
'reference' => '612a3ee5ab0d5dd97b7cf3874a6efe24325efac3',
|
'reference' => '4f2d4f2836e7ec4e7a8625e75c6aa916004db931',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'install_path' => __DIR__ . '/../doctrine/deprecations',
|
'install_path' => __DIR__ . '/../doctrine/deprecations',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
@@ -191,9 +191,9 @@
|
|||||||
'dev_requirement' => true,
|
'dev_requirement' => true,
|
||||||
),
|
),
|
||||||
'phpstan/phpstan' => array(
|
'phpstan/phpstan' => array(
|
||||||
'pretty_version' => '1.10.35',
|
'pretty_version' => '1.10.36',
|
||||||
'version' => '1.10.35.0',
|
'version' => '1.10.36.0',
|
||||||
'reference' => 'e730e5facb75ffe09dfb229795e8c01a459f26c3',
|
'reference' => 'ffa3089511121a672e62969404e4fddc753f9b15',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'install_path' => __DIR__ . '/../phpstan/phpstan',
|
'install_path' => __DIR__ . '/../phpstan/phpstan',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
@@ -347,9 +347,9 @@
|
|||||||
'dev_requirement' => true,
|
'dev_requirement' => true,
|
||||||
),
|
),
|
||||||
'symfony/string' => array(
|
'symfony/string' => array(
|
||||||
'pretty_version' => 'v6.3.2',
|
'pretty_version' => 'v6.3.5',
|
||||||
'version' => '6.3.2.0',
|
'version' => '6.3.5.0',
|
||||||
'reference' => '53d1a83225002635bca3482fcbf963001313fb68',
|
'reference' => '13d76d0fb049051ed12a04bef4f9de8715bea339',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'install_path' => __DIR__ . '/../symfony/string',
|
'install_path' => __DIR__ . '/../symfony/string',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use function array_reduce;
|
|||||||
use function assert;
|
use function assert;
|
||||||
use function debug_backtrace;
|
use function debug_backtrace;
|
||||||
use function sprintf;
|
use function sprintf;
|
||||||
|
use function str_replace;
|
||||||
use function strpos;
|
use function strpos;
|
||||||
use function strrpos;
|
use function strrpos;
|
||||||
use function substr;
|
use function substr;
|
||||||
@@ -138,7 +139,7 @@ class Deprecation
|
|||||||
|
|
||||||
// first check that the caller is not from a tests folder, in which case we always let deprecations pass
|
// first check that the caller is not from a tests folder, in which case we always let deprecations pass
|
||||||
if (isset($backtrace[1]['file'], $backtrace[0]['file']) && strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) {
|
if (isset($backtrace[1]['file'], $backtrace[0]['file']) && strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) {
|
||||||
$path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR;
|
$path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $package) . DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
if (strpos($backtrace[0]['file'], $path) === false) {
|
if (strpos($backtrace[0]['file'], $path) === false) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
22
vendor/doctrine/deprecations/phpcs.xml
vendored
22
vendor/doctrine/deprecations/phpcs.xml
vendored
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset>
|
|
||||||
<arg name="basepath" value="."/>
|
|
||||||
<arg name="extensions" value="php"/>
|
|
||||||
<arg name="parallel" value="80"/>
|
|
||||||
<arg name="cache" value=".phpcs-cache"/>
|
|
||||||
<arg name="colors"/>
|
|
||||||
|
|
||||||
<!-- Ignore warnings, show progress of the run and show sniff names -->
|
|
||||||
<arg value="nps"/>
|
|
||||||
|
|
||||||
<config name="php_version" value="70100"/>
|
|
||||||
|
|
||||||
<!-- Directories to be checked -->
|
|
||||||
<file>lib</file>
|
|
||||||
<file>tests</file>
|
|
||||||
|
|
||||||
<!-- Include full Doctrine Coding Standard -->
|
|
||||||
<rule ref="Doctrine">
|
|
||||||
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint" />
|
|
||||||
</rule>
|
|
||||||
</ruleset>
|
|
||||||
9
vendor/doctrine/deprecations/phpstan.neon
vendored
9
vendor/doctrine/deprecations/phpstan.neon
vendored
@@ -1,9 +0,0 @@
|
|||||||
parameters:
|
|
||||||
level: 6
|
|
||||||
paths:
|
|
||||||
- lib
|
|
||||||
- tests
|
|
||||||
|
|
||||||
includes:
|
|
||||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
|
||||||
- vendor/phpstan/phpstan-phpunit/rules.neon
|
|
||||||
30
vendor/doctrine/deprecations/psalm.xml
vendored
30
vendor/doctrine/deprecations/psalm.xml
vendored
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<psalm
|
|
||||||
errorLevel="1"
|
|
||||||
resolveFromConfigFile="true"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns="https://getpsalm.org/schema/config"
|
|
||||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
|
||||||
findUnusedBaselineEntry="true"
|
|
||||||
findUnusedCode="false"
|
|
||||||
>
|
|
||||||
<projectFiles>
|
|
||||||
<directory name="lib/Doctrine/Deprecations" />
|
|
||||||
<directory name="tests/Doctrine/Deprecations" />
|
|
||||||
<ignoreFiles>
|
|
||||||
<directory name="vendor" />
|
|
||||||
</ignoreFiles>
|
|
||||||
</projectFiles>
|
|
||||||
<plugins>
|
|
||||||
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
|
|
||||||
</plugins>
|
|
||||||
<issueHandlers>
|
|
||||||
<DeprecatedMethod>
|
|
||||||
<errorLevel type="suppress">
|
|
||||||
<!-- Remove when dropping support for PHPUnit 9.6 -->
|
|
||||||
<referencedMethod name="PHPUnit\Framework\TestCase::expectDeprecation"/>
|
|
||||||
<referencedMethod name="PHPUnit\Framework\TestCase::expectDeprecationMessage"/>
|
|
||||||
</errorLevel>
|
|
||||||
</DeprecatedMethod>
|
|
||||||
</issueHandlers>
|
|
||||||
</psalm>
|
|
||||||
BIN
vendor/phpstan/phpstan/phpstan.phar
vendored
BIN
vendor/phpstan/phpstan/phpstan.phar
vendored
Binary file not shown.
26
vendor/phpstan/phpstan/phpstan.phar.asc
vendored
26
vendor/phpstan/phpstan/phpstan.phar.asc
vendored
@@ -1,16 +1,16 @@
|
|||||||
-----BEGIN PGP SIGNATURE-----
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmUJveMACgkQUcZzBf/C
|
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmUW2hQACgkQUcZzBf/C
|
||||||
5cDJpw/9HY+cS4w3C3NI/NIuIDkMOwID2fyF3jGp89+HylnvRgdnM6DNWiF1smRX
|
5cAX+g/8DLEpwgjbRjXNPaPoL9y2lbhYuOAkFuTLElmFTNRvmUgOrqI3pGdfWves
|
||||||
NuQUI55L6q6x9gamVOG+8VVaPdJO8fBbHx1uHqW4Kx+q8XShjCdGm0HiMkDceEZP
|
tFCRVdzefPnbi8PX7Y0u14bKY/YieSgeXEwqaZfllPdan7TJ7gdu8ZvOxZeiOvT5
|
||||||
GQFp06iPY/O+Nqz9ofNfJMR++SkaVQnrgDLws18+fhp29mkkGxAW3M2hcCz6kC/X
|
Ns7Bnn7F+TyK7Z9gFn9pSt4bopLXgoGM3Xw4yg//HWQIb2gYzP/OEUwzF6vj1N88
|
||||||
yAjw12VsJErpCvtlYdXu3geBYiqfS095mTyjj9xmyYojzVDwiNI2nYhWvw1gzsM6
|
x7GyXKhuNClh8DOYLPdw/Mp5C+Z4wEqUpxFFZ6nMZN239gOC4kxz2IfbMj1Lb1jR
|
||||||
PMb1k8HhkMThRsqxG+7kkZe1klWJ3KHQXsHyB4mQqUHzL0SYbSFtWOx4IsEZ90eb
|
5diFq+lAB9IfmqlRqJnlkRDmM3jt6G6+i4YNIdk8iRN3ppMJWT0Ck9cSiRSPhImB
|
||||||
/Bm5GHfYso1pE5NzWcYzfyNKxRkcV8jPWu5YzzdkX6ncMR6sZ78CEFrhkYG9zhIy
|
n/fo4AA+fhomI6aXBECmYRud78ul0nm411KVM+a/cCnVD9nYrab6eC3K6KBeuWOw
|
||||||
rfaU9Bccuy9jAmec8WHtpaHo+b23tzn/vpfnY4VboggpEsJWyiCKQnBLK/qlesbw
|
2SNTdKSY+Al5y6mwjwzLCwrOLR7WxCTMkdO8pcbCj62IuKKyxWtS4xI/oxZE+z1S
|
||||||
UN41jPlXvzrWZZJNFZnDzFn/0rAma0qqiM3tz5BKwLtGZuHugwJ4RJ40MlrqYHN8
|
2o4arkHhv103JQiF9NkbRWnUQakt2IhjWDjZmz051jMjijHfSW3j4WpZ8sjwk5mY
|
||||||
CeazXTcEqeVywh1y6gRKTPoFf9WdFi46COwcU71av5V/9VewNzz6rzik51ryS/2m
|
GKO/jQMgJ0M/4h46q+pFawMljBgK+7ECHF1nEAuoF2e+5v8VJ+XRJ+VC6rdvjQWC
|
||||||
6sIlRWVYi31OTUkLyRmu6drYJSNjkrN/WOB935SyvFDVHpNH8OQbSP/HqOniCz/S
|
StcsiFDznyRJgosaOePn39mLt6E0wOBc6Ko8OIoBrSDP7l5Wh+H6yIzpCiPLCm9C
|
||||||
h0eAWSJUbrDslJSc87rbdm/WA3jftbwI0w5ymKit7wqm/Dn5Q20=
|
8sx9U+LB0Jt+BHpWYReQcHrdbek5H7Iu4h8s/F8YYZFEeI0O9tc=
|
||||||
=rQp6
|
=Y8DE
|
||||||
-----END PGP SIGNATURE-----
|
-----END PGP SIGNATURE-----
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file has been auto-generated by the Symfony String Component for internal use.
|
* This file has been auto-generated by the Symfony String Component for internal use.
|
||||||
*
|
*
|
||||||
* Unicode version: 15.0.0
|
* Unicode version: 15.1.0
|
||||||
* Date: 2022-10-05T17:16:36+02:00
|
* Date: 2023-09-13T11:47:12+00:00
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -166,7 +166,7 @@ return [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
12272,
|
12272,
|
||||||
12283,
|
12287,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
12288,
|
12288,
|
||||||
@@ -396,6 +396,10 @@ return [
|
|||||||
12736,
|
12736,
|
||||||
12771,
|
12771,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
12783,
|
||||||
|
12783,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
12784,
|
12784,
|
||||||
12799,
|
12799,
|
||||||
@@ -1110,6 +1114,14 @@ return [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
191457,
|
191457,
|
||||||
|
191471,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
191472,
|
||||||
|
192093,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
192094,
|
||||||
194559,
|
194559,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file has been auto-generated by the Symfony String Component for internal use.
|
* This file has been auto-generated by the Symfony String Component for internal use.
|
||||||
*
|
*
|
||||||
* Unicode version: 15.0.0
|
* Unicode version: 15.1.0
|
||||||
* Date: 2022-10-05T17:16:37+02:00
|
* Date: 2023-09-13T11:47:13+00:00
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -35,13 +35,16 @@ print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
|||||||
|
|
||||||
$em = new \CoreLibs\Logging\ErrorMessage($log);
|
$em = new \CoreLibs\Logging\ErrorMessage($log);
|
||||||
|
|
||||||
|
print "Log ERROR: " . $log->prAr($em->getFlagLogError()) . "<br>";
|
||||||
|
|
||||||
print "FN: " . ml::fromName('Affe')->name . "<br>";
|
print "FN: " . ml::fromName('Affe')->name . "<br>";
|
||||||
print "NU: " . ml::fromValue(100)->name . "<br>";
|
print "NU: " . ml::fromValue(100)->name . "<br>";
|
||||||
print "NU: " . ml::fromValue(1000)->name . "<br>";
|
print "NU: " . ml::fromValue(1000)->name . "<br>";
|
||||||
|
|
||||||
$em->setErrorMsg('123', 'error', 'msg this is bad, not logged');
|
$em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug');
|
||||||
$em->setErrorMsg('123', 'error', 'msg this is bad, not logged', 'target-id', 'other-style');
|
$em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug', 'target-id', 'other-style');
|
||||||
$em->setErrorMsg('123', 'error', 'msg this is bad, logged', log_error:true);
|
$em->setErrorMsg('123', 'error', 'msg this is bad, logged always', log_error:true);
|
||||||
|
$em->setErrorMsg('123', 'error', 'msg this is bad, never logged', log_error:false);
|
||||||
$em->setErrorMsg('1000', 'info', 'This is good');
|
$em->setErrorMsg('1000', 'info', 'This is good');
|
||||||
$em->setErrorMsg('9999', 'abort', 'BAD: This is critical (abort)');
|
$em->setErrorMsg('9999', 'abort', 'BAD: This is critical (abort)');
|
||||||
$em->setErrorMsg('10-1000', 'wrong', 'Wrong level: This is emergency');
|
$em->setErrorMsg('10-1000', 'wrong', 'Wrong level: This is emergency');
|
||||||
@@ -51,4 +54,6 @@ print "Errors: <pre>" . $log->prAr($em->getErrorMsg()) . "</pre>";
|
|||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
|
$log->debug('[END]', '==========================================>');
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
<textarea name="{$element.data.name}"{if $element.data.rows} rows="{$element.data.rows}"{/if}{if $element.data.cols} cols="{$element.data.cols}"{/if}>{$element.data.value}</textarea>
|
<textarea name="{$element.data.name}"{if $element.data.rows} rows="{$element.data.rows}"{/if}{if $element.data.cols} cols="{$element.data.cols}"{/if}>{$element.data.value}</textarea>
|
||||||
{/if}
|
{/if}
|
||||||
{if $element.type == 'drop_down'}
|
{if $element.type == 'drop_down'}
|
||||||
|
{* {$element.data.selected} *}
|
||||||
{html_options name=$element.data.name values=$element.data.value output=$element.data.output selected=$element.data.selected}
|
{html_options name=$element.data.name values=$element.data.value output=$element.data.output selected=$element.data.selected}
|
||||||
{if $drop_down_input}
|
{if $drop_down_input}
|
||||||
<input type="text" name="{$element.data.input_name}" value="{$element.data.input_value}"{if $element.data.input_size} size="{$element.data.input_size}"{/if}{if $element.data.input_length} maxlength="{$element.data.input_length}"{/if}>
|
<input type="text" name="{$element.data.input_name}" value="{$element.data.input_value}"{if $element.data.input_size} size="{$element.data.input_size}"{/if}{if $element.data.input_length} maxlength="{$element.data.input_length}"{/if}>
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class EditBase
|
|||||||
$q = "UPDATE " . $table_name
|
$q = "UPDATE " . $table_name
|
||||||
. " SET order_number = " . $row_data_order[$i]
|
. " SET order_number = " . $row_data_order[$i]
|
||||||
. " WHERE " . $table_name . "_id = " . $row_data_id[$i];
|
. " WHERE " . $table_name . "_id = " . $row_data_id[$i];
|
||||||
$q = $this->form->dbExec($q);
|
$q = $this->form->dba->dbExec($q);
|
||||||
}
|
}
|
||||||
} // for all article ids ...
|
} // for all article ids ...
|
||||||
} // if write
|
} // if write
|
||||||
@@ -173,7 +173,7 @@ class EditBase
|
|||||||
$options_name = [];
|
$options_name = [];
|
||||||
$options_selected = [];
|
$options_selected = [];
|
||||||
// DB read data for menu
|
// DB read data for menu
|
||||||
while (is_array($res = $this->form->dbReturn($q))) {
|
while (is_array($res = $this->form->dba->dbReturn($q))) {
|
||||||
$row_data[] = [
|
$row_data[] = [
|
||||||
"id" => $res[$table_name . "_id"],
|
"id" => $res[$table_name . "_id"],
|
||||||
"name" => $res["name"],
|
"name" => $res["name"],
|
||||||
@@ -431,9 +431,9 @@ class EditBase
|
|||||||
$elements[] = $this->form->formCreateElement('template');
|
$elements[] = $this->form->formCreateElement('template');
|
||||||
break;
|
break;
|
||||||
case 'edit_pages':
|
case 'edit_pages':
|
||||||
if (!isset($this->form->table_array['edit_page_id']['value'])) {
|
if (!isset($this->form->dba->getTableArray()['edit_page_id']['value'])) {
|
||||||
$q = "DELETE FROM temp_files";
|
$q = "DELETE FROM temp_files";
|
||||||
$this->form->dbExec($q);
|
$this->form->dba->dbExec($q);
|
||||||
// gets all files in the current dir and dirs given ending with .php
|
// gets all files in the current dir and dirs given ending with .php
|
||||||
$folders = ['../admin/', '../frontend/'];
|
$folders = ['../admin/', '../frontend/'];
|
||||||
$files = ['*.php'];
|
$files = ['*.php'];
|
||||||
@@ -461,16 +461,16 @@ class EditBase
|
|||||||
if ($t_q) {
|
if ($t_q) {
|
||||||
$t_q .= ', ';
|
$t_q .= ', ';
|
||||||
}
|
}
|
||||||
$t_q .= "('" . $this->form->dbEscapeString($pathinfo['dirname']) . "', '"
|
$t_q .= "('" . $this->form->dba->dbEscapeString($pathinfo['dirname']) . "', '"
|
||||||
. $this->form->dbEscapeString($pathinfo['basename']) . "')";
|
. $this->form->dba->dbEscapeString($pathinfo['basename']) . "')";
|
||||||
}
|
}
|
||||||
$this->form->dbExec($q . $t_q, 'NULL');
|
$this->form->dba->dbExec($q . $t_q, 'NULL');
|
||||||
$elements[] = $this->form->formCreateElement('filename');
|
$elements[] = $this->form->formCreateElement('filename');
|
||||||
} else {
|
} else {
|
||||||
// show file menu
|
// show file menu
|
||||||
// just show name of file ...
|
// just show name of file ...
|
||||||
$this->DATA['filename_exist'] = 1;
|
$this->DATA['filename_exist'] = 1;
|
||||||
$this->DATA['filename'] = $this->form->table_array['filename']['value'];
|
$this->DATA['filename'] = $this->form->dba->getTableArray()['filename']['value'];
|
||||||
} // File Name View IF
|
} // File Name View IF
|
||||||
$elements[] = $this->form->formCreateElement('hostname');
|
$elements[] = $this->form->formCreateElement('hostname');
|
||||||
$elements[] = $this->form->formCreateElement('name');
|
$elements[] = $this->form->formCreateElement('name');
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
{
|
{
|
||||||
// main calss variables
|
// main calss variables
|
||||||
/** @var array<mixed> */
|
/** @var array<mixed> */
|
||||||
public array $table_array; // the array from the table to work on
|
private array $table_array; // the array from the table to work on
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $table_name; // the table_name
|
private string $table_name; // the table_name
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $pk_name = ''; // the primary key from this table
|
private string $pk_name = ''; // the primary key from this table
|
||||||
/** @var int|string|null */
|
/** @var int|string|null */
|
||||||
public int|string|null $pk_id; // the PK id
|
private int|string|null $pk_id; // the PK id
|
||||||
// security values
|
// security values
|
||||||
/** @var int base acl for current page */
|
/** @var int base acl for current page */
|
||||||
private int $base_acl_level = 0;
|
private int $base_acl_level = 0;
|
||||||
@@ -74,24 +74,21 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
// instance db_io class
|
// instance db_io class
|
||||||
parent::__construct($db_config, $log);
|
parent::__construct($db_config, $log);
|
||||||
// more error vars for this class
|
// more error vars for this class
|
||||||
$this->error_string['1999'] = 'No table array or table name set';
|
$this->error_string['1998'] = 'No table name set';
|
||||||
|
$this->error_string['1999'] = 'No table array set';
|
||||||
$this->error_string['1021'] = 'No Primary Key given';
|
$this->error_string['1021'] = 'No Primary Key given';
|
||||||
$this->error_string['1022'] = 'Could not run Array Query';
|
$this->error_string['1022'] = 'Could not run Array Query';
|
||||||
|
|
||||||
$this->table_array = $table_array;
|
$this->setTableArray($table_array);
|
||||||
$this->table_name = $table_name;
|
$this->setTableName($table_name);
|
||||||
|
|
||||||
// error abort if no table array or no table name
|
|
||||||
if (empty($table_array) || empty($table_name)) {
|
|
||||||
$this->__dbError(1999, false, 'MAJOR ERROR: Core settings missing');
|
|
||||||
throw new \RuntimeException('MAJOR ERROR: Core settings missing', 1999);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set primary key for given table_array
|
// set primary key for given table_array
|
||||||
foreach ($this->table_array as $key => $value) {
|
foreach ($this->table_array as $key => $value) {
|
||||||
if (!empty($value['pk'])) {
|
if (empty($value['pk'])) {
|
||||||
$this->pk_name = $key;
|
continue;
|
||||||
}
|
}
|
||||||
|
$this->setPkName($key);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$this->dbArrayIOSetAcl($base_acl_level, $acl_admin);
|
$this->dbArrayIOSetAcl($base_acl_level, $acl_admin);
|
||||||
}
|
}
|
||||||
@@ -104,6 +101,144 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
parent::__destruct();
|
parent::__destruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the overall table array
|
||||||
|
*
|
||||||
|
* @param array<mixed> $table_array
|
||||||
|
* @return void
|
||||||
|
* @throws \RuntimeException 1999 for empty table array
|
||||||
|
*/
|
||||||
|
public function setTableArray(array $table_array): void
|
||||||
|
{
|
||||||
|
$this->table_array = $table_array;
|
||||||
|
if (empty($this->table_array)) {
|
||||||
|
$this->__dbError(1999, false, 'MAJOR ERROR: Core settings missing: table_arrry');
|
||||||
|
throw new \RuntimeException('MAJOR ERROR: Core settings missing: table_array', 1999);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return full table array, or [] if empty
|
||||||
|
* of reset is set to true, will reset array first
|
||||||
|
*
|
||||||
|
* @param bool $reset [=false] run a reset before returning
|
||||||
|
* @return array<mixed>
|
||||||
|
*/
|
||||||
|
public function getTableArray(bool $reset = false): array
|
||||||
|
{
|
||||||
|
if (!$reset) {
|
||||||
|
return $this->table_array ?? [];
|
||||||
|
}
|
||||||
|
$table_array = $this->table_array ?? [];
|
||||||
|
reset($table_array);
|
||||||
|
return $table_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a table array entry under the key with element pos
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param string $pos
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getTableArrayEntry(string $key, string $pos): mixed
|
||||||
|
{
|
||||||
|
return $this->table_array[$key][$pos] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set a new value at key with pos
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @param string $key
|
||||||
|
* @param string $pos
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setTableArrayEntry(mixed $value, string $key, string $pos): void
|
||||||
|
{
|
||||||
|
$this->table_array[$key][$pos] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* unset entry at key with pos
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param string $pos
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unsetTableArrayEntry(string $key, string $pos): void
|
||||||
|
{
|
||||||
|
unset($this->table_array[$key][$pos]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set table name
|
||||||
|
*
|
||||||
|
* @param string $table_name
|
||||||
|
* @return void
|
||||||
|
* @throws \RuntimeException 1998 for empty table name
|
||||||
|
*/
|
||||||
|
public function setTableName(string $table_name): void
|
||||||
|
{
|
||||||
|
$this->table_name = $table_name;
|
||||||
|
if (empty($this->table_name)) {
|
||||||
|
$this->__dbError(1998, false, 'MAJOR ERROR: Core settings missing: table_name');
|
||||||
|
throw new \RuntimeException('MAJOR ERROR: Core settings missing: table_name', 1998);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return table name or empty string if not net
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTableName(): string
|
||||||
|
{
|
||||||
|
return $this->table_name ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set primary key name
|
||||||
|
*
|
||||||
|
* @param string $pk_name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setPkName(string $pk_name): void
|
||||||
|
{
|
||||||
|
$this->pk_name = $pk_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get primary key name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPkName(): string
|
||||||
|
{
|
||||||
|
return $this->pk_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set primary key id, can be null for not yet set
|
||||||
|
*
|
||||||
|
* @param int|string|null $pk_id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setPkId(int|string|null $pk_id): void
|
||||||
|
{
|
||||||
|
$this->pk_id = $pk_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return primary key id, or null if not set
|
||||||
|
*
|
||||||
|
* @return int|string|null
|
||||||
|
*/
|
||||||
|
public function getPkId(): int|string|null
|
||||||
|
{
|
||||||
|
return $this->pk_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the base acl level and admin acl flag
|
* set the base acl level and admin acl flag
|
||||||
* This is needed for table array ACL checks
|
* This is needed for table array ACL checks
|
||||||
@@ -198,8 +333,8 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
public function dbCheckPkSet(): bool
|
public function dbCheckPkSet(): bool
|
||||||
{
|
{
|
||||||
// if pk_id is set, overrule ...
|
// if pk_id is set, overrule ...
|
||||||
if (!empty($this->pk_id)) {
|
if (!empty($this->getPkId())) {
|
||||||
$this->table_array[$this->pk_name]['value'] = $this->pk_id;
|
$this->table_array[$this->pk_name]['value'] = $this->getPkId();
|
||||||
}
|
}
|
||||||
// if not set ... produce error
|
// if not set ... produce error
|
||||||
if (!$this->table_array[$this->pk_name]['value']) {
|
if (!$this->table_array[$this->pk_name]['value']) {
|
||||||
@@ -287,7 +422,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
$q .= ' AND ' . $q_where;
|
$q .= ' AND ' . $q_where;
|
||||||
}
|
}
|
||||||
// if 0, error
|
// if 0, error
|
||||||
$this->pk_id = null;
|
$this->setPkId(null);
|
||||||
if (!$this->dbExec($q)) {
|
if (!$this->dbExec($q)) {
|
||||||
$this->__dbError(1022);
|
$this->__dbError(1022);
|
||||||
}
|
}
|
||||||
@@ -374,7 +509,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// possible dbFetchArray errors ...
|
// possible dbFetchArray errors ...
|
||||||
$this->pk_id = $this->table_array[$this->pk_name]['value'];
|
$this->setPkId($this->table_array[$this->pk_name]['value']);
|
||||||
} else {
|
} else {
|
||||||
$this->__dbError(1022);
|
$this->__dbError(1022);
|
||||||
}
|
}
|
||||||
@@ -397,10 +532,6 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
if (count($table_array)) {
|
if (count($table_array)) {
|
||||||
$this->table_array = $table_array;
|
$this->table_array = $table_array;
|
||||||
}
|
}
|
||||||
// PK ID check
|
|
||||||
// if ($this->pk_id && !$this->table_array[$this->pk_name]["value"]) {
|
|
||||||
// $this->table_array[$this->pk_name]["value"]=$this->pk_id;
|
|
||||||
// }
|
|
||||||
// checken ob PKs gesetzt, wenn alle -> update, wenn keiner -> insert, wenn ein paar -> ERROR!
|
// checken ob PKs gesetzt, wenn alle -> update, wenn keiner -> insert, wenn ein paar -> ERROR!
|
||||||
if (!$this->table_array[$this->pk_name]['value']) {
|
if (!$this->table_array[$this->pk_name]['value']) {
|
||||||
$insert = 1;
|
$insert = 1;
|
||||||
@@ -624,16 +755,11 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
$q .= ' AND ' . $q_where;
|
$q .= ' AND ' . $q_where;
|
||||||
}
|
}
|
||||||
// set pk_id ... if it has changed or so
|
// set pk_id ... if it has changed or so
|
||||||
$this->pk_id = $this->table_array[$this->pk_name]['value'];
|
$this->setPkId($this->table_array[$this->pk_name]['value']);
|
||||||
} else {
|
} else {
|
||||||
$q = 'INSERT INTO ' . $this->table_name . ' ';
|
$q = 'INSERT INTO ' . $this->table_name . ' ';
|
||||||
$q .= '(' . $q_vars . ') ';
|
$q .= '(' . $q_vars . ') ';
|
||||||
$q .= 'VALUES (' . $q_data . ')';
|
$q .= 'VALUES (' . $q_data . ')';
|
||||||
// write primary key too
|
|
||||||
// if ($q_data)
|
|
||||||
// $q .= ", ";
|
|
||||||
// $q .= $this->pk_name." = ".$this->table_array[$this->pk_name]['value']." ";
|
|
||||||
// $this->pk_id = $this->table_array[$this->pk_name]['value'];
|
|
||||||
}
|
}
|
||||||
// return success or not
|
// return success or not
|
||||||
if (!$this->dbExec($q)) {
|
if (!$this->dbExec($q)) {
|
||||||
@@ -646,7 +772,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
$insert_id = 0;
|
$insert_id = 0;
|
||||||
}
|
}
|
||||||
$this->table_array[$this->pk_name]['value'] = $insert_id;
|
$this->table_array[$this->pk_name]['value'] = $insert_id;
|
||||||
$this->pk_id = $insert_id;
|
$this->setPkId($insert_id);
|
||||||
}
|
}
|
||||||
// return the table if needed
|
// return the table if needed
|
||||||
return $this->table_array;
|
return $this->table_array;
|
||||||
|
|||||||
@@ -27,13 +27,19 @@ class ErrorMessage
|
|||||||
* init ErrorMessage
|
* init ErrorMessage
|
||||||
*
|
*
|
||||||
* @param \CoreLibs\Logging\Logging $log
|
* @param \CoreLibs\Logging\Logging $log
|
||||||
* @param bool $log_error [=false]
|
* @param null|bool $log_error [=null], defaults to false if log is not level debug
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
\CoreLibs\Logging\Logging $log,
|
\CoreLibs\Logging\Logging $log,
|
||||||
bool $log_error = false
|
?bool $log_error = null
|
||||||
) {
|
) {
|
||||||
$this->log = $log;
|
$this->log = $log;
|
||||||
|
// if log default logging is debug then log_error is default set to true
|
||||||
|
if ($this->log->loggingLevelIsDebug() && $log_error === null) {
|
||||||
|
$log_error = true;
|
||||||
|
} else {
|
||||||
|
$log_error = $log_error ?? false;
|
||||||
|
}
|
||||||
$this->log_error = $log_error;
|
$this->log_error = $log_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user