Composer git pull update

This commit is contained in:
Clemens Schwaighofer
2024-11-06 10:47:54 +09:00
parent 86a9ad8789
commit 1386afb552
15 changed files with 711 additions and 140 deletions

88
composer.lock generated
View File

@@ -553,16 +553,16 @@
},
{
"name": "nikic/php-parser",
"version": "v5.2.0",
"version": "v5.3.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb"
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b",
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b",
"shasum": ""
},
"require": {
@@ -605,9 +605,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1"
},
"time": "2024-09-15T16:40:33+00:00"
"time": "2024-10-08T18:51:32+00:00"
},
{
"name": "phan/phan",
@@ -862,16 +862,16 @@
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "5.4.1",
"version": "5.5.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c"
"reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c",
"reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/54e10d44fc1a84e2598d26f70d4f6f1f233e228a",
"reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a",
"shasum": ""
},
"require": {
@@ -884,13 +884,13 @@
"webmozart/assert": "^1.9.1"
},
"require-dev": {
"mockery/mockery": "~1.3.5",
"mockery/mockery": "~1.3.5 || ~1.6.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^5.13"
"psalm/phar": "^5.26"
},
"type": "library",
"extra": {
@@ -920,29 +920,29 @@
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1"
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.5.0"
},
"time": "2024-05-21T05:55:05+00:00"
"time": "2024-11-04T21:26:31+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.8.2",
"version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "153ae662783729388a584b4361f2545e4d841e3c"
"reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c",
"reference": "153ae662783729388a584b4361f2545e4d841e3c",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1fb5ba8d045f5dd984ebded5b1cc66f29459422d",
"reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d",
"shasum": ""
},
"require": {
"doctrine/deprecations": "^1.0",
"php": "^7.3 || ^8.0",
"phpdocumentor/reflection-common": "^2.0",
"phpstan/phpdoc-parser": "^1.13"
"phpstan/phpdoc-parser": "^1.18"
},
"require-dev": {
"ext-tokenizer": "*",
@@ -978,22 +978,22 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2"
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.9.0"
},
"time": "2024-02-23T11:10:43+00:00"
"time": "2024-11-03T20:11:34+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.30.1",
"version": "1.33.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "51b95ec8670af41009e2b2b56873bad96682413e"
"reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e",
"reference": "51b95ec8670af41009e2b2b56873bad96682413e",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140",
"reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140",
"shasum": ""
},
"require": {
@@ -1025,22 +1025,22 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1"
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0"
},
"time": "2024-09-07T20:13:05+00:00"
"time": "2024-10-13T11:25:22+00:00"
},
{
"name": "phpstan/phpstan",
"version": "1.12.4",
"version": "1.12.7",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd"
"reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa517cb918591b93acc9b95c0bebdcd0e4538bd",
"reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0",
"reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0",
"shasum": ""
},
"require": {
@@ -1085,7 +1085,7 @@
"type": "github"
}
],
"time": "2024-09-19T07:58:01+00:00"
"time": "2024-10-18T11:12:07+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -2643,16 +2643,16 @@
},
{
"name": "symfony/console",
"version": "v7.1.4",
"version": "v7.1.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111"
"reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/1eed7af6961d763e7832e874d7f9b21c3ea9c111",
"reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111",
"url": "https://api.github.com/repos/symfony/console/zipball/bb5192af6edc797cbab5c8e8ecfea2fe5f421e57",
"reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57",
"shasum": ""
},
"require": {
@@ -2716,7 +2716,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.1.4"
"source": "https://github.com/symfony/console/tree/v7.1.6"
},
"funding": [
{
@@ -2732,7 +2732,7 @@
"type": "tidelift"
}
],
"time": "2024-08-15T22:48:53+00:00"
"time": "2024-10-09T08:46:59+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -3284,16 +3284,16 @@
},
{
"name": "symfony/string",
"version": "v7.1.4",
"version": "v7.1.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b"
"reference": "61b72d66bf96c360a727ae6232df5ac83c71f626"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b",
"reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b",
"url": "https://api.github.com/repos/symfony/string/zipball/61b72d66bf96c360a727ae6232df5ac83c71f626",
"reference": "61b72d66bf96c360a727ae6232df5ac83c71f626",
"shasum": ""
},
"require": {
@@ -3351,7 +3351,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v7.1.4"
"source": "https://github.com/symfony/string/tree/v7.1.6"
},
"funding": [
{
@@ -3367,7 +3367,7 @@
"type": "tidelift"
}
],
"time": "2024-08-12T09:59:40+00:00"
"time": "2024-09-25T14:20:29+00:00"
},
{
"name": "theseer/tokenizer",

View File

@@ -56,8 +56,9 @@ print "SETACL[]: <br>";
$backend->setACL(['EMPTY' => 'EMPTY']);
print "ADBEDITLOG: <br>";
$backend->adbEditLog('CLASSTEST-ADMIN-BINARY', 'Some info string', 'BINARY');
$backend->adbEditLog('CLASSTEST-ADMIN-ZLIB', 'Some info string', 'ZLIB');
$backend->adbEditLog('CLASSTEST-ADMIN-SERIAL', 'Some info string', 'SERIAL');
$backend->adbEditLog('CLASSTEST-ADMIN-JSON', 'Some info string', 'JSON');
$backend->adbEditLog('CLASSTEST-ADMIN-INVALID', 'Some info string', 'INVALID');
// test with various
$backend->action = 'TEST ACTION';
$backend->action_id = 'TEST ACTION ID';

View File

@@ -204,6 +204,20 @@ WHERE string_a = $1
SQL, []);
print "PL: " . Support::PrAr($db->dbGetPlaceholderConverted()) . "<br>";
echo "dbReturn read LIKE: <br>";
while (
is_array($res = $db->dbReturnParams(
<<<SQL
SELECT test, string_a, number_a
FROM test_foo
WHERE string_a LIKE ?
SQL,
['%A-1%']
))
) {
print "RES: " . Support::prAr($res) . "<br>";
}
print "</body></html>";
$db->log->debug('DEBUGEND', '==================================== [END]');

View File

@@ -117,6 +117,7 @@ $test_files = [
'class_test.config.direct.php' => 'Class Test: CONFIG DIRECT',
'class_test.class-calls.php' => 'Class Test: CLASS CALLS',
'class_test.error_msg.php' => 'Class Test: ERROR MSG',
'class_test.url-requests.curl.php' => 'Class Test: URL REQUESTS: CURL',
'subfolder/class_test.config.direct.php' => 'Class Test: CONFIG DIRECT SUB',
];

View File

@@ -0,0 +1,295 @@
<?php // phpcs:ignore warning
/**
* @phan-file-suppress PhanTypeSuspiciousStringExpression
*/
declare(strict_types=1);
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
ob_start();
// basic class test file
define('USE_DATABASE', false);
// sample config
require 'config.php';
// define log file id
$LOG_FILE_ID = 'classTest-urlrequests';
ob_end_flush();
use CoreLibs\UrlRequests\Curl;
$log = new CoreLibs\Logging\Logging([
'log_folder' => BASE . LOG,
'log_file_id' => $LOG_FILE_ID,
'log_per_date' => true,
]);
$PAGE_NAME = 'TEST CLASS: URL REQUESTS CURL';
print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
$client = new Curl();
print "<hr>";
$data = $client->get(
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=get_a',
[
'headers' => $client->prepareHeaders([
'test-header: ABC',
'info-request-type: _GET',
'Funk-pop' => 'Semlly god'
]),
'query' => ['foo' => 'BAR']
]
);
print "_GET RESPONSE: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
$data = $client->request(
'get',
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=get_a',
);
print "_GET RESPONSE, nothing set: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
try {
$data = $client->request(
'get',
'soba54.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=get_a',
);
print "_GET RESPONSE, nothing set, invalid URL: <pre>" . print_r($data, true) . "</pre>";
} catch (Exception $e) {
print "Exception: <pre>" . print_r($e, true) . "</pre><br>";
}
print "<hr>";
$data = $client->request(
"get",
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/'
. 'trunk/www/admin/UrlRequests.target.php'
. '?other=get_a',
[
"headers" => $client->prepareHeaders([
'test-header: ABC',
'info-request-type: _GET',
'Funk-pop' => 'Semlly god'
]),
"query" => ['foo' => 'BAR'],
],
);
print "[request] _GET RESPONSE: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
$data = $client->post(
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=post_a',
[
'body' => ['payload' => 'data post'],
'headers' => $client->prepareHeaders([
'Content-Type: application/json',
'Accept: application/json',
'test-header: ABC',
'info-request-type: _POST'
]),
'query' => ['foo' => 'BAR post'],
]
);
print "_POST RESPONSE: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
$data = $client->request(
"post",
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=post_a',
[
"body" => ['payload' => 'data post', 'request' => 'I am the request body'],
"headers" => $client->prepareHeaders([
'Content-Type: application/json',
'Accept: application/json',
'test-header: ABC',
'info-request-type: _POST'
]),
"query" => ['foo' => 'BAR post'],
]
);
print "[request] _POST RESPONSE: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
$data = $client->put(
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=put_a',
[
"body" => ['payload' => 'data put'],
"headers" => $client->prepareHeaders([
'Content-Type: application/json',
'Accept: application/json',
'test-header: ABC',
'info-request-type: _PUT'
]),
'query' => ['foo' => 'BAR put'],
]
);
print "_PUT RESPONSE: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
$data = $client->patch(
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=patch_a',
[
"body" => ['payload' => 'data patch'],
"headers" => $client->prepareHeaders([
'Content-Type: application/json',
'Accept: application/json',
'test-header: ABC',
'info-request-type: _PATCH'
]),
'query' => ['foo' => 'BAR patch'],
]
);
print "_PATCH RESPONSE: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
$data = $client->delete(
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=delete_no_body_a',
[
"body" => null,
"headers" => $client->prepareHeaders([
'Content-Type: application/json',
'Accept: application/json',
'test-header: ABC',
'info-request-type: _DELETE'
]),
"query" => ['foo' => 'BAR delete'],
]
);
print "_DELETE RESPONSE: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
$data = $client->delete(
'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/UrlRequests.target.php'
. '?other=delete_body_a',
[
"body" => ['payload' => 'data delete'],
"headers" => $client->prepareHeaders([
'Content-Type: application/json',
'Accept: application/json',
'test-header: ABC',
'info-request-type: _DELETE'
]),
"query" => ['foo' => 'BAR delete'],
]
);
print "_DELETE RESPONSE BODY: <pre>" . print_r($data, true) . "</pre>";
print "<hr>";
try {
$uc = new Curl([
"base_uri" => 'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/foo',
"headers" => [
'DEFAULT-master' => 'master-header',
'default-header' => 'uc-get',
'default-remove' => 'will be removed',
'default-remove-array' => ['a', 'b'],
'default-remove-array-part' => ['c', 'd'],
'default-remove-array-part-alt' => ['c', 'd', 'e'],
'default-overwrite' => 'will be overwritten',
'default-add' => 'will be added',
],
'query' => [
'global-p' => 'glob'
]
]);
print "CONFIG: <pre>" . print_r($uc->getConfig(), true) . "</pre>";
$uc->removeHeaders(['default-remove' => '']);
$uc->removeHeaders(['default-remove-array' => ['a', 'b']]);
$uc->removeHeaders(['default-remove-array-part' => 'c']);
$uc->removeHeaders(['default-remove-array-part-alt' => ['c', 'd']]);
$uc->setHeaders(['default-new' => 'Something new']);
$uc->setHeaders(['default-overwrite' => 'Something Overwritten']);
$uc->setHeaders(['default-add' => 'Something Added'], true);
print "CONFIG: <pre>" . print_r($uc->getConfig(), true) . "</pre>";
$data = $uc->request(
'get',
'UrlRequests.target.php',
[
'headers' => [
'call-header' => 'call-get',
'default-header' => 'overwrite-uc-get',
'X-Foo' => ['bar', 'baz'],
],
'query' => [
'other' => 'get_a',
],
]
);
print "[uc] _GET RESPONSE, nothing set: <pre>" . print_r($data, true) . "</pre>";
print "[uc] SENT URL: " . $uc->getUrlSent() . "<br>";
print "[uc] SENT URL PARSED: <pre>" . print_r($uc->getUrlParsedSent(), true) . "</pre>";
print "[uc] SENT HEADERS: <pre>" . print_r($uc->getHeadersSent(), true) . "</pre>";
} catch (Exception $e) {
print "Exception: <pre>" . print_r(json_decode($e->getMessage(), true), true) . "</pre><br>";
}
print "<hr>";
try {
$uc = new Curl([
"base_uri" => 'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/',
"exception_on_not_authorized" => false,
"headers" => [
"Authorization" => "schmalztiegel",
"RunAuthTest" => "yes",
]
]);
$response = $uc->get('UrlRequests.target.php');
print "AUTH REQUEST: <pre>" . print_r($response, true) . "</pre>";
print "[uc] SENT URL: " . $uc->getUrlSent() . "<br>";
print "[uc] SENT URL PARSED: <pre>" . print_r($uc->getUrlParsedSent(), true) . "</pre>";
print "[uc] SENT HEADERS: <pre>" . print_r($uc->getHeadersSent(), true) . "</pre>";
} catch (Exception $e) {
print "Exception: <pre>" . print_r(json_decode($e->getMessage(), true), true) . "</pre><br>";
}
print "AUTH REQUEST WITH EXCEPTION:<br>";
try {
$uc = new Curl([
"base_uri" => 'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/',
"exception_on_not_authorized" => true,
"headers" => [
"Authorization" => "schmalztiegel",
"RunAuthTest" => "yes",
]
]);
$response = $uc->get('UrlRequests.target.php');
print "AUTH REQUEST: <pre>" . print_r($response, true) . "</pre>";
print "[uc] SENT URL: " . $uc->getUrlSent() . "<br>";
print "[uc] SENT URL PARSED: <pre>" . print_r($uc->getUrlParsedSent(), true) . "</pre>";
print "[uc] SENT HEADERS: <pre>" . print_r($uc->getHeadersSent(), true) . "</pre>";
} catch (Exception $e) {
print "Exception: <pre>" . print_r(json_decode($e->getMessage(), true), true) . "</pre><br>";
}
print "<hr>";
$uc = new Curl([
"base_uri" => 'https://soba.egplusww.jp/developers/clemens/core_data/php_libraries/trunk/www/admin/',
"headers" => [
"header-one" => "one"
]
]);
$response = $uc->get('UrlRequests.target.php', ["headers" => null, "query" => ["test" => "one-test"]]);
print "AUTH REQUEST: <pre>" . print_r($response, true) . "</pre>";
print "[uc] SENT URL: " . $uc->getUrlSent() . "<br>";
print "[uc] SENT URL PARSED: <pre>" . print_r($uc->getUrlParsedSent(), true) . "</pre>";
print "[uc] SENT HEADERS: <pre>" . print_r($uc->getHeadersSent(), true) . "</pre>";
print "</body></html>";
// __END__

4
www/composer.lock generated
View File

@@ -8,11 +8,11 @@
"packages": [
{
"name": "egrajp/corelibs-composer-all",
"version": "dev-development",
"version": "dev-master",
"dist": {
"type": "path",
"url": "/storage/var/www/html/developers/clemens/core_data/composer-packages/CoreLibs-Composer-All",
"reference": "e7fe4655d1c9e8ae444ff07f1d8d71c205260e72"
"reference": "5e6ba856391c357426b687cfacdb402e3e74fa0b"
},
"require": {
"php": ">=8.2",

View File

@@ -2,12 +2,12 @@
"packages": [
{
"name": "egrajp/corelibs-composer-all",
"version": "dev-development",
"version_normalized": "dev-development",
"version": "dev-master",
"version_normalized": "dev-master",
"dist": {
"type": "path",
"url": "/storage/var/www/html/developers/clemens/core_data/composer-packages/CoreLibs-Composer-All",
"reference": "e7fe4655d1c9e8ae444ff07f1d8d71c205260e72"
"reference": "5e6ba856391c357426b687cfacdb402e3e74fa0b"
},
"require": {
"php": ">=8.2",

View File

@@ -11,9 +11,9 @@
),
'versions' => array(
'egrajp/corelibs-composer-all' => array(
'pretty_version' => 'dev-development',
'version' => 'dev-development',
'reference' => 'e7fe4655d1c9e8ae444ff07f1d8d71c205260e72',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '5e6ba856391c357426b687cfacdb402e3e74fa0b',
'type' => 'library',
'install_path' => __DIR__ . '/../egrajp/corelibs-composer-all',
'aliases' => array(),

View File

@@ -1 +1 @@
9.15.0
9.17.6.1

View File

@@ -31,6 +31,8 @@ declare(strict_types=1);
namespace CoreLibs\Admin;
use CoreLibs\Convert\Json;
class Backend
{
// page name
@@ -42,7 +44,7 @@ class Backend
/** @var array<string> */
public array $action_list = [
'action', 'action_id', 'action_sub_id', 'action_yes', 'action_flag',
'action_menu', 'action_value', 'action_error', 'action_loaded'
'action_menu', 'action_value', 'action_type', 'action_error', 'action_loaded'
];
/** @var string */
public string $action;
@@ -61,20 +63,31 @@ class Backend
/** @var string */
public string $action_value;
/** @var string */
public string $action_type;
/** @var string */
public string $action_error;
// ACL array variable if we want to set acl data from outisde
/** @var array<mixed> */
public array $acl = [];
/** @var int */
public int $default_acl;
// queue key
/** @var string */
public string $queue_key;
/** @var array<string> list of allowed types for edit log write */
private const WRITE_TYPES = ['BINARY', 'BZIP2', 'LZIP', 'STRING', 'SERIAL', 'JSON'];
/** @var array<string> list of available write types for log */
private array $write_types_available = [];
// the current active edit access id
/** @var int|null */
public int|null $edit_access_id;
/** @var string */
public string $page_name;
// error/warning/info messages
/** @var array<mixed> */
public array $messages = [];
@@ -84,6 +97,7 @@ class Backend
public bool $warning = false;
/** @var bool */
public bool $info = false;
// internal lang & encoding vars
/** @var string */
public string $lang_dir = '';
@@ -95,6 +109,7 @@ class Backend
public string $domain;
/** @var string */
public string $encoding;
/** @var \CoreLibs\Logging\Logging logger */
public \CoreLibs\Logging\Logging $log;
/** @var \CoreLibs\DB\IO database */
@@ -103,6 +118,7 @@ class Backend
public \CoreLibs\Language\L10n $l;
/** @var \CoreLibs\Create\Session session class */
public \CoreLibs\Create\Session $session;
// smarty publics [end processing in smarty class]
/** @var array<mixed> */
public array $DATA = [];
@@ -121,14 +137,16 @@ class Backend
* @param \CoreLibs\Logging\Logging $log Logging class
* @param \CoreLibs\Create\Session $session Session interface class
* @param \CoreLibs\Language\L10n $l10n l10n language class
* @param int|null $set_default_acl_level Default ACL level
* @param int|null $set_default_acl_level [default=null] Default ACL level
* @param bool $init_action_vars [default=true] If the action vars should be set
*/
public function __construct(
\CoreLibs\DB\IO $db,
\CoreLibs\Logging\Logging $log,
\CoreLibs\Create\Session $session,
\CoreLibs\Language\L10n $l10n,
?int $set_default_acl_level = null
?int $set_default_acl_level = null,
bool $init_action_vars = true
) {
// attach db class
$this->db = $db;
@@ -151,9 +169,9 @@ class Backend
// set the page name
$this->page_name = \CoreLibs\Get\System::getPageName();
// set the action ids
foreach ($this->action_list as $_action) {
$this->$_action = $_POST[$_action] ?? '';
// NOTE: if any of the "action" vars are used somewhere, it is recommended to NOT set them here
if ($init_action_vars) {
$this->adbSetActionVars();
}
if ($set_default_acl_level === null) {
@@ -170,9 +188,12 @@ class Backend
}
// queue key
if (preg_match("/^(add|save|delete|remove|move|up|down|push_live)$/", $this->action)) {
if (preg_match("/^(add|save|delete|remove|move|up|down|push_live)$/", $this->action ?? '')) {
$this->queue_key = \CoreLibs\Create\RandomKey::randomKeyGen(3);
}
// check what edit log data write types are allowed
$this->adbSetEditLogWriteTypeAvailable();
}
/**
@@ -183,7 +204,26 @@ class Backend
// NO OP
}
// PUBLIC METHODS |=================================================>
// MARK: PRIVATE METHODS
/**
* set the write types that are allowed
*
* @return void
*/
private function adbSetEditLogWriteTypeAvailable()
{
// check what edit log data write types are allowed
$this->write_types_available = self::WRITE_TYPES;
if (!function_exists('bzcompress')) {
$this->write_types_available = array_diff($this->write_types_available, ['BINARY', 'BZIP']);
}
if (!function_exists('gzcompress')) {
$this->write_types_available = array_diff($this->write_types_available, ['LZIP']);
}
}
// MARK: PUBLIC METHODS |=================================================>
/**
* set internal ACL from login ACL
@@ -195,30 +235,95 @@ class Backend
$this->acl = $acl;
}
/**
* Return current set ACL
*
* @return array<mixed>
*/
public function adbGetAcl(): array
{
return $this->acl;
}
/**
* Set _POST action vars if needed
*
* @return void
*/
public function adbSetActionVars()
{
// set the action ids
foreach ($this->action_list as $_action) {
$this->$_action = $_POST[$_action] ?? '';
}
}
/**
* writes all action vars plus other info into edit_log table
*
* @param string $event any kind of event description,
* @param string|array<mixed> $data any kind of data related to that event
* @param string $write_type write type can bei STRING or BINARY
* @param string|null $db_schema override target schema
* @param string $event [default=''] any kind of event description,
* @param string|array<mixed> $data [default=''] any kind of data related to that event
* @param string $write_type [default=JSON] write type can be
* JSON, STRING/SERIEAL, BINARY/BZIP or ZLIB
* @param string|null $db_schema [default=null] override target schema
* @return void
*/
public function adbEditLog(
string $event = '',
string|array $data = '',
string $write_type = 'STRING',
string $write_type = 'JSON',
?string $db_schema = null
): void {
$data_binary = '';
$data_write = '';
if ($write_type == 'BINARY') {
$data_binary = $this->db->dbEscapeBytea((string)bzcompress(serialize($data)));
$data_write = 'see bzip compressed data_binary field';
// check if write type is valid, if not fallback to JSON
if (!in_array($write_type, $this->write_types_available)) {
$this->log->warning('Write type not in allowed array, fallback to JSON', context:[
"write_type" => $write_type,
"write_list" => $this->write_types_available,
]);
$write_type = 'JSON';
}
if ($write_type == 'STRING') {
$data_binary = '';
$data_write = $this->db->dbEscapeString(serialize($data));
switch ($write_type) {
case 'BINARY':
case 'BZIP':
$data_binary = $this->db->dbEscapeBytea((string)bzcompress(serialize($data)));
$data_write = Json::jsonConvertArrayTo([
'type' => 'BZIP',
'message' => 'see bzip compressed data_binary field'
]);
break;
case 'ZLIB':
$data_binary = $this->db->dbEscapeBytea((string)gzcompress(serialize($data)));
$data_write = Json::jsonConvertArrayTo([
'type' => 'ZLIB',
'message' => 'see zlib compressed data_binary field'
]);
break;
case 'STRING':
case 'SERIAL':
$data_binary = $this->db->dbEscapeBytea(Json::jsonConvertArrayTo([
'type' => 'SERIAL',
'message' => 'see serial string data field'
]));
$data_write = serialize($data);
break;
case 'JSON':
$data_binary = $this->db->dbEscapeBytea(Json::jsonConvertArrayTo([
'type' => 'JSON',
'message' => 'see json string data field'
]));
// must be converted to array
if (!is_array($data)) {
$data = ["data" => $data];
}
$data_write = Json::jsonConvertArrayTo($data);
break;
default:
$this->log->alert('Invalid type for data compression was set', context:[
"write_type" => $write_type
]);
break;
}
/** @var string $DB_SCHEMA check schema */
@@ -228,44 +333,62 @@ class Backend
} elseif (!empty($this->db->dbGetSchema())) {
$DB_SCHEMA = $this->db->dbGetSchema();
}
$q = "INSERT INTO " . $DB_SCHEMA . ".edit_log "
. "(euid, event_date, event, data, data_binary, page, "
. "ip, user_agent, referer, script_name, query_string, server_name, http_host, "
. "http_accept, http_accept_charset, http_accept_encoding, session_id, "
. "action, action_id, action_yes, action_flag, action_menu, action_loaded, action_value, action_error) "
. "VALUES "
. "(" . $this->db->dbEscapeString(isset($_SESSION['EUID']) && is_numeric($_SESSION['EUID']) ?
$_SESSION['EUID'] :
'NULL')
. ", "
. "NOW(), "
. "'" . $this->db->dbEscapeString((string)$event) . "', "
. "'" . $data_write . "', "
. "'" . $data_binary . "', "
. "'" . $this->db->dbEscapeString((string)$this->page_name) . "', "
. "'" . ($_SERVER["REMOTE_ADDR"] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['HTTP_USER_AGENT'] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['HTTP_REFERER'] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['SCRIPT_FILENAME'] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['QUERY_STRING'] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['SERVER_NAME'] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['HTTP_HOST'] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['HTTP_ACCEPT'] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['HTTP_ACCEPT_CHARSET'] ?? '') . "', "
. "'" . $this->db->dbEscapeString($_SERVER['HTTP_ACCEPT_ENCODING'] ?? '') . "', "
. ($this->session->getSessionId() === false ?
"NULL" :
"'" . $this->session->getSessionId() . "'")
. ", "
. "'" . $this->db->dbEscapeString($this->action) . "', "
. "'" . $this->db->dbEscapeString($this->action_id) . "', "
. "'" . $this->db->dbEscapeString($this->action_yes) . "', "
. "'" . $this->db->dbEscapeString($this->action_flag) . "', "
. "'" . $this->db->dbEscapeString($this->action_menu) . "', "
. "'" . $this->db->dbEscapeString($this->action_loaded) . "', "
. "'" . $this->db->dbEscapeString($this->action_value) . "', "
. "'" . $this->db->dbEscapeString($this->action_error) . "')";
$this->db->dbExec($q, 'NULL');
$q = <<<SQL
INSERT INTO {DB_SCHEMA}.edit_log (
euid, event_date, event, data, data_binary, page,
ip, user_agent, referer, script_name, query_string, server_name, http_host,
http_accept, http_accept_charset, http_accept_encoding, session_id,
action, action_id, action_yes, action_flag, action_menu, action_loaded,
action_value, action_type, action_error
) VALUES (
$1, NOW(), $2, $3, $4, $5,
$6, $7, $8, $9, $10, $11, $12,
$13, $14, $15, $16,
$17, $18, $19, $20, $21, $22,
$23, $24, $25
)
SQL;
$this->db->dbExecParams(
str_replace(
['{DB_SCHEMA}'],
[$DB_SCHEMA],
$q
),
[
// row 1
isset($_SESSION['EUID']) && is_numeric($_SESSION['EUID']) ?
$_SESSION['EUID'] : null,
(string)$event,
$data_write,
$data_binary,
(string)$this->page_name,
// row 2
$_SERVER["REMOTE_ADDR"] ?? '',
$_SERVER['HTTP_USER_AGENT'] ?? '',
$_SERVER['HTTP_REFERER'] ?? '',
$_SERVER['SCRIPT_FILENAME'] ?? '',
$_SERVER['QUERY_STRING'] ?? '',
$_SERVER['SERVER_NAME'] ?? '',
$_SERVER['HTTP_HOST'] ?? '',
// row 3
$_SERVER['HTTP_ACCEPT'] ?? '',
$_SERVER['HTTP_ACCEPT_CHARSET'] ?? '',
$_SERVER['HTTP_ACCEPT_ENCODING'] ?? '',
$this->session->getSessionId() !== false ?
$this->session->getSessionId() : null,
// row 4
$this->action ?? '',
$this->action_id ?? '',
$this->action_yes ?? '',
$this->action_flag ?? '',
$this->action_menu ?? '',
$this->action_loaded ?? '',
$this->action_value ?? '',
$this->action_type ?? '',
$this->action_error ?? '',
],
'NULL'
);
}
/**
@@ -515,16 +638,30 @@ class Backend
} elseif (!empty($this->db->dbGetSchema())) {
$DB_SCHEMA = $this->db->dbGetSchema();
}
$q = "INSERT INTO " . $DB_SCHEMA . ".live_queue ("
. "queue_key, key_value, key_name, type, target, data, group_key, action, associate, file"
. ") VALUES ("
. "'" . $this->db->dbEscapeString($queue_key) . "', '" . $this->db->dbEscapeString($key_value) . "', "
. "'" . $this->db->dbEscapeString($key_name) . "', '" . $this->db->dbEscapeString($type) . "', "
. "'" . $this->db->dbEscapeString($target) . "', '" . $this->db->dbEscapeString($data) . "', "
. "'" . $this->queue_key . "', '" . $this->action . "', "
. "'" . $this->db->dbEscapeString((string)$associate) . "', "
. "'" . $this->db->dbEscapeString((string)$file) . "')";
$this->db->dbExec($q);
$q = <<<SQL
INSERT INTO {DB_SCHEMA}.live_queue (
queue_key, key_value, key_name, type,
target, data, group_key, action, associate, file
) VALUES (
$1, $2, $3, $4,
$5, $6, $7, $8, $9, $10
)
SQL;
// $this->db->dbExec($q);
$this->db->dbExecParams(
str_replace(
['{DB_SCHEMA}'],
[$DB_SCHEMA],
$q
),
[
$queue_key, $key_value,
$key_name, $type,
$target, $data,
$this->queue_key, $this->action,
(string)$associate, (string)$file
]
);
}
/**

View File

@@ -509,6 +509,22 @@ class ArrayHandler
}
return $array;
}
/**
* Remove entries from a simple array, will not keep key order
*
* any array content is allowed
*
* https://stackoverflow.com/a/369608
*
* @param array<mixed> $array Array where elements are located
* @param array<mixed> $remove Elements to remove
* @return array<mixed> Array with $remove elements removed
*/
public static function arrayRemoveEntry(array $array, array $remove): array
{
return array_diff($array, $remove);
}
}
// __END__

View File

@@ -823,6 +823,10 @@ class IO
);
break;
default:
// no context on DB_INFO
if ($id == 'DB_INFO') {
$context = [];
}
// used named arguments so we can easy change the order of debug
$this->log->debug(
group_id: $debug_id,
@@ -1814,14 +1818,13 @@ class IO
$html_tags = ['{b}', '{/b}', '{br}'];
$replace_html = ['<b>', '</b>', '<br>'];
$replace_text = ['', '', ' **** '];
$string = '';
$string .= '{b}-DB-info->{/b} Connected to db {b}\'' . $this->db_name . '\'{/b} ';
$string .= 'with schema {b}\'' . $this->db_schema . '\'{/b} ';
$string .= 'as user {b}\'' . $this->db_user . '\'{/b} ';
$string .= 'at host {b}\'' . $this->db_host . '\'{/b} ';
$string .= 'on port {b}\'' . $this->db_port . '\'{/b} ';
$string .= 'with ssl mode {b}\'' . $this->db_ssl . '\'{/b}{br}';
$string .= '{b}-DB-info->{/b} DB IO Class debug output: {b}'
$string = '{b}-DB-info->{/b} Connected to db {b}\'' . $this->db_name . '\'{/b} '
. 'with schema {b}\'' . $this->db_schema . '\'{/b} '
. 'as user {b}\'' . $this->db_user . '\'{/b} '
. 'at host {b}\'' . $this->db_host . '\'{/b} '
. 'on port {b}\'' . $this->db_port . '\'{/b} '
. 'with ssl mode {b}\'' . $this->db_ssl . '\'{/b}{br}'
. '{b}-DB-info->{/b} DB IO Class debug output: {b}'
. ($this->dbGetDebug() ? 'Yes' : 'No') . '{/b}';
if ($log === true) {
// if debug, remove / change b
@@ -1829,7 +1832,7 @@ class IO
$html_tags,
$replace_text,
$string
), 'dbInfo');
), 'DB_INFO');
} else {
$string = $string . '{br}';
}
@@ -1985,7 +1988,7 @@ class IO
if (is_array($array)) {
$this->nbsp = '';
$string .= $this->__printArray($array);
$this->__dbDebugMessage('db', $string, 'dbDumpData');
$this->__dbDebugMessage('db', $string, 'DB_INFO');
}
return $string;
}

View File

@@ -24,16 +24,20 @@ class ErrorMessage
/** @var bool $log_error global flag to log error level message */
private bool $log_error = false;
/** @var bool $log_warning global flat to log warning level messages */
private bool $log_warning = false;
/**
* init ErrorMessage
*
* @param \CoreLibs\Logging\Logging $log
* @param null|bool $log_error [=null], defaults to false if log is not level debug
* @param null|bool $log_warning [=null], defaults to false if log is not level debug
*/
public function __construct(
\CoreLibs\Logging\Logging $log,
?bool $log_error = null
?bool $log_error = null,
?bool $log_warning = null
) {
$this->log = $log;
// if log default logging is debug then log_error is default set to true
@@ -43,6 +47,13 @@ class ErrorMessage
$log_error = $log_error ?? false;
}
$this->log_error = $log_error;
// if log default logging is debug then log_warning is default set to true
if ($this->log->loggingLevelIsDebug() && $log_warning === null) {
$log_warning = true;
} else {
$log_warning = $log_warning ?? false;
}
$this->log_warning = $log_warning;
}
/**
@@ -81,6 +92,8 @@ class ErrorMessage
* @param array<mixed> $context Additionl info for abort/crash messages
* @param bool|null $log_error [=null] log level 'error' to error, if null use global,
* else set for this call only
* @param bool|null $log_warning [=null] log level 'warning' to warning, if null use global,
* else set for this call only
*/
public function setErrorMsg(
string $error_id,
@@ -93,10 +106,14 @@ class ErrorMessage
?string $message = null,
array $context = [],
?bool $log_error = null,
?bool $log_warning = null,
): void {
if ($log_error === null) {
$log_error = $this->log_error;
}
if ($log_warning === null) {
$log_warning = $this->log_warning;
}
$original_level = $level;
$level = MessageLevel::fromName($level)->name;
// if not string set, write message string if set, else level/error id
@@ -121,6 +138,14 @@ class ErrorMessage
'level' => $original_level,
], $context));
break;
case 'warn':
if ($log_warning) {
$this->log->warning($message ?? $str, array_merge([
'id' => $error_id,
'level' => $original_level,
], $context));
}
break;
case 'error':
if ($log_error) {
$this->log->error($message ?? $str, array_merge([
@@ -169,6 +194,8 @@ class ErrorMessage
* @param array<mixed> $context Additionl info for abort/crash messages
* @param bool|null $log_error [=null] log level 'error' to error, if null use global,
* else set for this call only
* @param bool|null $log_warning [=null] log level 'warning' to warning, if null use global,
* else set for this call only
*/
public function setMessage(
string $level,
@@ -181,6 +208,7 @@ class ErrorMessage
?string $message = null,
array $context = [],
?bool $log_error = null,
?bool $log_warning = null,
): void {
$this->setErrorMsg(
$error_id ?? '',
@@ -192,7 +220,8 @@ class ErrorMessage
$jump_target,
$message,
$context,
$log_error
$log_error,
$log_warning
);
}
@@ -314,6 +343,27 @@ class ErrorMessage
{
return $this->log_error;
}
/**
* Set the log warning flag
*
* @param bool $flag True to log level warning too, False for do not (Default)
* @return void
*/
public function setFlagLogWarning(bool $flag): void
{
$this->log_warning = $flag;
}
/**
* Get the current log error flag
*
* @return bool
*/
public function getFlagLogWarning(): bool
{
return $this->log_warning;
}
}
// __END__

View File

@@ -14,7 +14,7 @@ namespace CoreLibs\Logging\Logger;
enum MessageLevel: int
{
case ok = 100;
case success = 110; // special for file uploads
case success = 150; // special for file uploads
case info = 200;
case notice = 250;
case warn = 300;

View File

@@ -230,6 +230,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ERROR MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => null,
'expected' => '<ERROR> ERROR MESSAGE',
],
'error, logged' => [
@@ -238,6 +239,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ERROR MESSAGE',
'message' => null,
'log_error' => true,
'log_warning' => null,
'expected' => '<ERROR> ERROR MESSAGE',
],
'error, logged, message' => [
@@ -246,14 +248,43 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ERROR MESSAGE',
'message' => 'OTHER ERROR MESSAGE',
'log_error' => true,
'log_warning' => null,
'expected' => '<ERROR> OTHER ERROR MESSAGE',
],
'warn, not logged' => [
'id' => '300',
'level' => 'warn',
'str' => 'WARNING MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => null,
'expected' => '<WARNING> WARNING MESSAGE',
],
'warn, logged' => [
'id' => '300',
'level' => 'warn',
'str' => 'WARNING MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => true,
'expected' => '<WARNING> WARNING MESSAGE',
],
'warn, logged, message' => [
'id' => '300',
'level' => 'warn',
'str' => 'WARNING MESSAGE',
'message' => 'OTHER WARNING MESSAGE',
'log_error' => null,
'log_warning' => true,
'expected' => '<WARNING> OTHER WARNING MESSAGE',
],
'notice' => [
'id' => '100',
'level' => 'notice',
'str' => 'NOTICE MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => null,
'expected' => '<NOTICE> NOTICE MESSAGE',
],
'notice, message' => [
@@ -262,6 +293,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'NOTICE MESSAGE',
'message' => 'OTHER NOTICE MESSAGE',
'log_error' => null,
'log_warning' => null,
'expected' => '<NOTICE> OTHER NOTICE MESSAGE',
],
'crash' => [
@@ -270,6 +302,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'CRASH MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => null,
'expected' => '<ALERT> CRASH MESSAGE',
],
'crash, message' => [
@@ -278,6 +311,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'CRASH MESSAGE',
'message' => 'OTHER CRASH MESSAGE',
'log_error' => null,
'log_warning' => null,
'expected' => '<ALERT> OTHER CRASH MESSAGE',
],
'abort' => [
@@ -286,6 +320,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ABORT MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => null,
'expected' => '<CRITICAL> ABORT MESSAGE',
],
'abort, message' => [
@@ -294,6 +329,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ABORT MESSAGE',
'message' => 'OTHER ABORT MESSAGE',
'log_error' => null,
'log_warning' => null,
'expected' => '<CRITICAL> OTHER ABORT MESSAGE',
],
'unknown' => [
@@ -302,6 +338,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'WRONG LEVEL MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => null,
'expected' => '<EMERGENCY> WRONG LEVEL MESSAGE',
],
'unknown, message' => [
@@ -310,6 +347,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'WRONG LEVEL MESSAGE',
'message' => 'OTHER WRONG LEVEL MESSAGE',
'log_error' => null,
'log_warning' => null,
'expected' => '<EMERGENCY> OTHER WRONG LEVEL MESSAGE',
],
];
@@ -326,6 +364,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
* @param string $str
* @param string|null $message
* @param bool|null $log_error
* @param bool|null $log_warning
* @param string $expected
* @return void
*/
@@ -335,6 +374,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
string $str,
?string $message,
?bool $log_error,
?bool $log_warning,
string $expected
): void {
$log = new \CoreLibs\Logging\Logging([
@@ -349,7 +389,8 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$level,
$str,
message: $message,
log_error: $log_error
log_error: $log_error,
log_warning: $log_warning
);
$file_content = '';
if (is_file($log->getLogFolder() . $log->getLogFile())) {
@@ -363,6 +404,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$expected,
$file_content
);
} elseif ($level == 'warn' && ($log_warning === null || $log_warning === false)) {
$this->assertStringNotContainsString(
$expected,
$file_content
);
} else {
$this->assertStringContainsString(
$expected,
@@ -382,6 +428,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
* @param string $str
* @param string|null $message
* @param bool|null $log_error
* @param bool|null $log_warning
* @param string $expected
* @return void
*/
@@ -391,6 +438,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
string $str,
?string $message,
?bool $log_error,
?bool $log_warning,
string $expected
): void {
$log = new \CoreLibs\Logging\Logging([
@@ -405,7 +453,8 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$level,
$str,
message: $message,
log_error: $log_error
log_error: $log_error,
log_warning: $log_warning
);
$file_content = '';
if (is_file($log->getLogFolder() . $log->getLogFile())) {
@@ -419,6 +468,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$expected,
$file_content
);
} elseif ($level == 'warn' && $log_warning === false) {
$this->assertStringNotContainsString(
$expected,
$file_content
);
} else {
$this->assertStringContainsString(
$expected,