Autoloader updates, read env to class, DB IO update

Move autolaoder loading from config.master.php to config.php and before
we read config.master.php
The read env function has moved into a class and is launched after the
auto loader has been loaded

DB IO class update with better error reporting with last error set and
error history of all errors in order.
TODO: per query or per action error grouping
This commit is contained in:
Clemens Schwaighofer
2022-02-24 19:59:47 +09:00
parent 0dc57564c5
commit 51a0276268
14 changed files with 621 additions and 219 deletions

View File

@@ -0,0 +1,50 @@
<?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';
// set session name
if (!defined('SET_SESSION_NAME')) {
define('SET_SESSION_NAME', EDIT_SESSION_NAME);
}
// define log file id
$LOG_FILE_ID = 'classTest-readEnvFile';
ob_end_flush();
$log = new CoreLibs\Debug\Logging([
'log_folder' => 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,
]);
$ref_class = 'CoreLibs\Get\ReadEnvFile';
print "<html><head><title>TEST CLASS: READ ENV FILE</title><head>";
print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>';
print "ALREADY from config.php: " . \CoreLibs\Debug\Support::printAr($_ENV) . "<br>";
// test .env in local
// error message
print $log->printErrorMsg();
print "</body></html>";
// __END__