diff --git a/4dev/checking/phpunit.sh b/4dev/checking/phpunit.sh
index ec852f14..bbd562be 100755
--- a/4dev/checking/phpunit.sh
+++ b/4dev/checking/phpunit.sh
@@ -10,14 +10,16 @@ if [ "${1}" = "t" ] || [ "${2}" = "t" ]; then
opt_testdox="--testdox";
fi;
php_bin="";
-case "${1}" in
- # "7.3") php_bin="/usr/bin/php7.3 "; ;;
- "7.4") php_bin="/usr/bin/php7.4 "; ;;
- "8.0") php_bin="/usr/bin/php8.0 "; ;;
- "8.1") php_bin="/usr/bin/php8.1 "; ;;
- *) echo "Not support PHP: ${1}"; exit; ;;
-esac;
-if [ -z "${php_bin}" ]; then
+if [ ! -z "${1}" ]; then
+ case "${1}" in
+ # "7.3") php_bin="/usr/bin/php7.3 "; ;;
+ "7.4") php_bin="/usr/bin/php7.4 "; ;;
+ "8.0") php_bin="/usr/bin/php8.0 "; ;;
+ "8.1") php_bin="/usr/bin/php8.1 "; ;;
+ *) echo "Not support PHP: ${1}"; exit; ;;
+ esac;
+fi;
+if [ ! -z "${2}" ] && [ -z "${php_bin}" ]; then
case "${2}" in
# "7.3") php_bin="/usr/bin/php7.3 "; ;;
"7.4") php_bin="/usr/bin/php7.4 "; ;;
diff --git a/www/admin/class_test.config.direct.php b/www/admin/class_test.config.direct.php
new file mode 100644
index 00000000..ffccb171
--- /dev/null
+++ b/www/admin/class_test.config.direct.php
@@ -0,0 +1,58 @@
+ BASE . LOG,
+ 'file_id' => $LOG_FILE_ID,
+ // add file date
+ 'print_file_date' => true,
+ // set debug and print flags
+ 'debug_all' => $DEBUG_ALL ?? false,
+ 'echo_all' => $ECHO_ALL ?? false,
+ 'print_all' => $PRINT_ALL ?? false,
+]);
+
+print "";
+print "
TEST CLASS: CONFIG DIRECT";
+print "";
+print '';
+print 'CONFIG DIRECT
';
+
+print "DIR: " . DIR . "
";
+print "BASE: " . BASE . "
";
+print "ROOT: " . ROOT . "
";
+print "BASE NAME: " . BASE_NAME . "
";
+echo "Config path prefix: " . $CONFIG_PATH_PREFIX . "
";
+print "DB Name: " . DB_CONFIG_NAME . "
";
+print "DB Config: " . \CoreLibs\Debug\Support::printAr(DB_CONFIG) . "
";
+
+// error message
+print $log->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.config.link.php b/www/admin/class_test.config.link.php
new file mode 100644
index 00000000..cbbec124
--- /dev/null
+++ b/www/admin/class_test.config.link.php
@@ -0,0 +1,58 @@
+ BASE . LOG,
+ 'file_id' => $LOG_FILE_ID,
+ // add file date
+ 'print_file_date' => true,
+ // set debug and print flags
+ 'debug_all' => $DEBUG_ALL ?? false,
+ 'echo_all' => $ECHO_ALL ?? false,
+ 'print_all' => $PRINT_ALL ?? false,
+]);
+
+print "";
+print "TEST CLASS: CONFIG LINK";
+print "";
+print '';
+print 'CONFIG LINK
';
+
+print "DIR: " . DIR . "
";
+print "BASE: " . BASE . "
";
+print "ROOT: " . ROOT . "
";
+print "BASE NAME: " . BASE_NAME . "
";
+echo "Config path prefix: " . $CONFIG_PATH_PREFIX . "
";
+print "DB Name: " . DB_CONFIG_NAME . "
";
+print "DB Config: " . \CoreLibs\Debug\Support::printAr(DB_CONFIG) . "
";
+
+// error message
+print $log->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/admin/class_test.php b/www/admin/class_test.php
index 206921c6..ca90c81a 100644
--- a/www/admin/class_test.php
+++ b/www/admin/class_test.php
@@ -83,6 +83,9 @@ print 'Class Test: BACKEND ADMIN CLA
print '';
print '';
print '';
+print '';
+print '';
+print '';
print "
";
print "L: " . CoreLibs\Debug\Support::printAr($locale) . "
";
diff --git a/www/admin/subfolder/class_test.config.direct.php b/www/admin/subfolder/class_test.config.direct.php
new file mode 100644
index 00000000..07bad318
--- /dev/null
+++ b/www/admin/subfolder/class_test.config.direct.php
@@ -0,0 +1,58 @@
+ BASE . LOG,
+ 'file_id' => $LOG_FILE_ID,
+ // add file date
+ 'print_file_date' => true,
+ // set debug and print flags
+ 'debug_all' => $DEBUG_ALL ?? false,
+ 'echo_all' => $ECHO_ALL ?? false,
+ 'print_all' => $PRINT_ALL ?? false,
+]);
+
+print "";
+print "TEST CLASS: CONFIG DIRECT SUB";
+print "";
+print '';
+print 'CONFIG DIRECT SUB
';
+
+print "DIR: " . DIR . "
";
+print "BASE: " . BASE . "
";
+print "ROOT: " . ROOT . "
";
+print "BASE NAME: " . BASE_NAME . "
";
+echo "Config path prefix: " . $CONFIG_PATH_PREFIX . "
";
+print "DB Name: " . DB_CONFIG_NAME . "
";
+print "DB Config: " . \CoreLibs\Debug\Support::printAr(DB_CONFIG) . "
";
+
+// error message
+print $log->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/configs/config.php b/www/configs/config.php
index f9353fd0..c0e08ed6 100644
--- a/www/configs/config.php
+++ b/www/configs/config.php
@@ -11,44 +11,56 @@
declare(strict_types=1);
define('CONFIG_PATH', 'configs' . DIRECTORY_SEPARATOR);
-// config path prefix search, start with 0, got down each level __DIR__ has, if nothing found -> bail
+// config path prefix search, start with 0, got down each level __DIR__ has,
+// if nothing found -> bail
$CONFIG_PATH_PREFIX = '';
+// base path for loads
+$__DIR__PATH = __DIR__ . DIRECTORY_SEPARATOR;
+// don't load autoloader twice
$end_autoload = false;
-for ($dir_pos = 0, $dir_max = count(explode(DIRECTORY_SEPARATOR, __DIR__)); $dir_pos <= $dir_max; $dir_pos++) {
+for (
+ $dir_pos = 0, $dir_max = count(explode(DIRECTORY_SEPARATOR, __DIR__));
+ $dir_pos <= $dir_max;
+ $dir_pos++
+) {
$CONFIG_PATH_PREFIX .= '..' . DIRECTORY_SEPARATOR;
if ($end_autoload === false) {
/************* AUTO LOADER *******************/
- // read auto loader for lib only
- // It is recommended to setup basic composer and use just one auto loader
- // if (is_file($CONFIG_PATH_PREFIX . 'lib' . DIRECTORY_SEPARATOR . 'autoloader.php')) {
- // require $CONFIG_PATH_PREFIX . 'lib' . DIRECTORY_SEPARATOR . 'autoloader.php';
- // $end_autoload = true;
- // }
- // composer auto loader, IF composer.json file includes classmap for lib/:
+ // composer auto loader, in composer.json file add classmap for lib/:
// "autoload": {
// "classmap": [
// "lib/"
// ]
// },
- // NOTE: MUST RUN composer dump-autoload if file/class names are changed or added
- // load auto loader
- if (is_file($CONFIG_PATH_PREFIX . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) {
- require $CONFIG_PATH_PREFIX . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
+ // NOTE: MUST RUN composer dump-autoload if file/class names are
+ // changed or new ones are added
+ if (
+ is_file(
+ $__DIR__PATH . $CONFIG_PATH_PREFIX
+ . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'
+ )
+ ) {
+ require $__DIR__PATH . $CONFIG_PATH_PREFIX
+ . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
$end_autoload = true;
}
- // load enviorment file if it exists
- \CoreLibs\Get\ReadEnvFile::readEnvFile($CONFIG_PATH_PREFIX . CONFIG_PATH);
}
/************* MASTER CONFIG *******************/
- if (is_file($CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php')) {
+ if (
+ is_file($__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php')
+ ) {
+ // load enviorment file if it exists
+ \CoreLibs\Get\ReadEnvFile::readEnvFile(
+ $__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH
+ );
// load master config file that loads all other config files
- require $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php';
+ require $__DIR__PATH . $CONFIG_PATH_PREFIX . CONFIG_PATH . 'config.master.php';
break;
}
}
// fail if no base DIR is not set
if (!defined('DIR')) {
- exit('Base config unloadable');
+ exit('Base config could not be loaded');
}
// find trigger name "admin/" or "frontend/" in the getcwd() folder
foreach (['admin', 'frontend'] as $folder) {
diff --git a/www/lib/CoreLibs/Basic.php b/www/lib/CoreLibs/Basic.php
index 1ff06b44..b2c22087 100644
--- a/www/lib/CoreLibs/Basic.php
+++ b/www/lib/CoreLibs/Basic.php
@@ -85,11 +85,13 @@ class Basic
* main Basic constructor to init and check base settings
* @param \CoreLibs\Debug\Logging|null $log Logging class
* @param string|null $session_name Set session name
+ * @deprecated DO NOT USE Class\Basic anymore. Use dedicated logger and sub classes
*/
public function __construct(
\CoreLibs\Debug\Logging $log = null,
?string $session_name = null
) {
+ trigger_error('Class \CoreLibs\Basic is deprected', E_USER_DEPRECATED);
// TODO make check dynamic for entries we MUST have depending on load type
// before we start any work, we should check that all MUST constants are defined
$abort = false;