Compare commits

..

1 Commits

Author SHA1 Message Date
Clemens Schwaighofer
0607cdc3be Add logger $log public entry in Form class
We need that for sub calls to debugger from TableArray loads
2023-01-10 18:19:20 +09:00

View File

@@ -294,6 +294,9 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// language // language
/** @var \CoreLibs\Language\L10n */ /** @var \CoreLibs\Language\L10n */
public $l; public $l;
// log
/** @var \CoreLibs\Debug\Logging */
public $log;
// now some default error msgs (english) // now some default error msgs (english)
/** @var array<mixed> */ /** @var array<mixed> */
@@ -319,13 +322,10 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
?array $locale = null, ?array $locale = null,
?array $table_arrays = null, ?array $table_arrays = null,
) { ) {
// init logger if not set
$this->log = $log ?? new \CoreLibs\Debug\Logging();
// don't log per class // don't log per class
if ($log !== null) { $this->log->setLogPer('class', false);
$log->setLogPer('class', false);
}
// replace any non valid variable names
// TODO extract only alphanumeric and _ after . to _ replacement
$this->my_page_name = str_replace(['.'], '_', System::getPageName(System::NO_EXTENSION));
// if pass on locale is null // if pass on locale is null
if ($locale === null) { if ($locale === null) {
$locale = \CoreLibs\Language\GetLocale::setLocale(); $locale = \CoreLibs\Language\GetLocale::setLocale();
@@ -350,6 +350,13 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
$this->base_acl_level = (int)$_SESSION['BASE_ACL_LEVEL']; $this->base_acl_level = (int)$_SESSION['BASE_ACL_LEVEL'];
$this->acl_admin = (int)$_SESSION['ADMIN']; $this->acl_admin = (int)$_SESSION['ADMIN'];
// replace any non valid variable names and set my page name
$this->my_page_name = str_replace(
['.'],
'_',
System::getPageName(System::NO_EXTENSION)
);
// first check if we have a in page override as $table_arrays[page name] // first check if we have a in page override as $table_arrays[page name]
if ( if (
isset($table_arrays[System::getPageName(System::NO_EXTENSION)]) && isset($table_arrays[System::getPageName(System::NO_EXTENSION)]) &&
@@ -374,7 +381,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
$db_config, $db_config,
$config_array['table_array'], $config_array['table_array'],
$config_array['table_name'], $config_array['table_name'],
$log ?? new \CoreLibs\Debug\Logging(), $this->log,
// set the ACL // set the ACL
$this->base_acl_level, $this->base_acl_level,
$this->acl_admin $this->acl_admin