Add Upgrade to V6 readme file, other minor fixes

typos in config file
deprecate read env file function, use class instead
add read/write menu_flag in Class\Backend, further updates in later
versions
This commit is contained in:
Clemens Schwaighofer
2022-03-18 19:49:26 +09:00
parent 35a7229158
commit 023ab6811d
5 changed files with 159 additions and 5 deletions

View File

@@ -245,9 +245,9 @@ if (
}
// define the db config set name, the db config and the db schema
define('DB_CONFIG_NAME', $SITE_CONFIG[HOST_NAME]['db_host']);
define('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ?? []);
define('DB_CONFIG', $DB_CONFIG[DB_CONFIG_NAME] ?? []);
// because we can't change constant, but we want to for db debug flag
$GLOBALS['DB_CONIFG'] = DB_CONFIG;
$GLOBALS['DB_CONFIG'] = DB_CONFIG;
// define('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']);
// define('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']);
// override for login and global schemas

View File

@@ -25,9 +25,15 @@ declare(strict_types=1);
* 1 for file loadable, but no data inside
* 2 for file not readable
* 3 for file not found
* @deprecated V6 Use \CoreLibs\Get\ReadEnvFile::readEnvFile()
*/
function readEnvFile(string $path = __DIR__, string $env_file = '.env'): int
{
trigger_error(
'Method readEnvFile() is deprecated, use '
. '\CoreLibs\Get\ReadEnvFile::readEnvFile()',
E_USER_DEPRECATED
);
// default -1;
$status = -1;
$env_file_target = $path . DIRECTORY_SEPARATOR . $env_file;

View File

@@ -112,8 +112,8 @@ class Backend
// CONSTRUCTOR / DECONSTRUCTOR |====================================>
/**
* main class constructor
* @param \CoreLibs\DB\IO $db Database connection class
* @param \CoreLibs\Debug\Logging $log Logging class, default set if not set
* @param \CoreLibs\DB\IO $db Database connection class
* @param \CoreLibs\Debug\Logging $log Logging class
* @param \CoreLibs\Language\L10n|null $l10n l10n language class
* if null, auto set
*/
@@ -276,6 +276,27 @@ class Backend
$this->db->dbExec($q, 'NULL');
}
/**
* Set the menu show flag
* @param string|int $menu_show_flag
* @return string|int
*/
public function adbSetMenuShowFlag($menu_show_flag)
{
// must be string or int
$this->menu_show_flag = $menu_show_flag;
return $this->menu_show_flag;
}
/**
* Return the menu show flag
* @return string|int
*/
public function adbGetMenuShowFlag()
{
return $this->menu_show_flag;
}
/**
* menu creater (from login menu session pages)
* @param int $flag visible flag trigger

View File

@@ -54,7 +54,7 @@ class ReadEnvFile
$var = $matches[1];
$value = $matches[2];
$quotes = $matches[3];
// wirte only if env is not set yet, and write only the first time
// write only if env is not set yet, and write only the first time
if (empty($_ENV[$var])) {
if (!empty($quotes)) {
// match greedy for first to last so we move any " if there are