Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e0af7a5f7 | ||
|
|
b022662dfc | ||
|
|
3039ebf913 | ||
|
|
e2e080c404 | ||
|
|
4671143d1c | ||
|
|
b492558cca | ||
|
|
64e76530d4 | ||
|
|
0b93f9f146 |
@@ -99,7 +99,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
private static $log;
|
private static $log;
|
||||||
private static bool $db_debug = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if pgsql module loaded
|
* Test if pgsql module loaded
|
||||||
@@ -123,7 +122,6 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
'log_file_id' => 'CoreLibs-DB-IO-Test',
|
'log_file_id' => 'CoreLibs-DB-IO-Test',
|
||||||
]);
|
]);
|
||||||
// will be true, default logging is true
|
// will be true, default logging is true
|
||||||
self::$db_debug = self::$log->getLoggingLevel()->includes(Level::Debug);
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config['valid'],
|
self::$db_config['valid'],
|
||||||
self::$log
|
self::$log
|
||||||
@@ -521,6 +519,9 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function debugSetProvider(): array
|
public function debugSetProvider(): array
|
||||||
{
|
{
|
||||||
|
// 0: db connecdtion
|
||||||
|
// 1: override log flag, null for default
|
||||||
|
// 2: set flag
|
||||||
return [
|
return [
|
||||||
'default debug set' => [
|
'default debug set' => [
|
||||||
// what base connection
|
// what base connection
|
||||||
@@ -538,95 +539,46 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* test set for toggleDEbug
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function debugToggleProvider(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'default debug set' => [
|
|
||||||
// what base connection
|
|
||||||
'valid',
|
|
||||||
// actions
|
|
||||||
null,
|
|
||||||
// toggle is inverse
|
|
||||||
self::$db_debug ? true : false,
|
|
||||||
],
|
|
||||||
'toggle debug to false' => [
|
|
||||||
'valid',
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test dbSetDbug, dbGetDebug
|
* Test dbSetDbug, dbGetDebug
|
||||||
*
|
*
|
||||||
* @covers ::dbGetDbug
|
* @covers ::dbGetDbug
|
||||||
* @covers ::dbSetDebug
|
* @covers ::dbSetDebug
|
||||||
* @dataProvider debugSetProvider
|
* @testdox Set and Get Debug flag
|
||||||
* @testdox Setting debug $set will be $expected [$_dataName]
|
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDbSetDebug(
|
public function testDbSetDebug(): void
|
||||||
string $connection,
|
{
|
||||||
?bool $set,
|
$connection = 'valid';
|
||||||
bool $expected
|
// default set, expect true
|
||||||
): void {
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config[$connection],
|
self::$db_config[$connection],
|
||||||
self::$log
|
self::$log
|
||||||
);
|
);
|
||||||
echo "Expected: " . self::$db_debug . "\n";
|
$this->assertTrue(
|
||||||
$this->assertEquals(
|
$db->dbGetDebug()
|
||||||
$expected,
|
|
||||||
$set === null ?
|
|
||||||
$db->dbSetDebug() :
|
|
||||||
$db->dbSetDebug($set)
|
|
||||||
);
|
);
|
||||||
// must always match
|
// switch off
|
||||||
$this->assertEquals(
|
$db->dbSetDebug(false);
|
||||||
$expected,
|
$this->assertFalse(
|
||||||
$db->dbGetDebug()
|
$db->dbGetDebug()
|
||||||
);
|
);
|
||||||
$db->dbClose();
|
$db->dbClose();
|
||||||
}
|
// second conenction with log set NOT debug
|
||||||
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
/**
|
// 'log_folder' => __DIR__ . DIRECTORY_SEPARATOR . 'log',
|
||||||
* Test dbToggleDebug, dbGetDebug
|
'log_folder' => DIRECTORY_SEPARATOR . 'tmp',
|
||||||
*
|
'log_file_id' => 'CoreLibs-DB-IO-Test',
|
||||||
* @covers ::dbGetDbug
|
'log_level' => \CoreLibs\Logging\Logger\Level::Notice,
|
||||||
* @covers ::dbSetDebug
|
]);
|
||||||
* @dataProvider debugToggleProvider
|
|
||||||
* @testdox Toggle debug $toggle will be $expected [$_dataName]
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testDbToggleDebug(
|
|
||||||
string $connection,
|
|
||||||
?bool $toggle,
|
|
||||||
bool $expected
|
|
||||||
): void {
|
|
||||||
$db = new \CoreLibs\DB\IO(
|
$db = new \CoreLibs\DB\IO(
|
||||||
self::$db_config[$connection],
|
self::$db_config[$connection],
|
||||||
self::$log
|
$log
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertFalse(
|
||||||
$expected,
|
|
||||||
$toggle === null ?
|
|
||||||
$db->dbToggleDebug() :
|
|
||||||
$db->dbToggleDebug($toggle)
|
|
||||||
);
|
|
||||||
// must always match
|
|
||||||
$this->assertEquals(
|
|
||||||
$expected,
|
|
||||||
$db->dbGetDebug()
|
$db->dbGetDebug()
|
||||||
);
|
);
|
||||||
$db->dbClose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - set max query call sets
|
// - set max query call sets
|
||||||
|
|||||||
@@ -460,16 +460,18 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
* @cover ::getCallerFileLine
|
* @cover ::getCallerFileLine
|
||||||
* @testWith ["/storage/var/www/html/developers/clemens/core_data/php_libraries/trunk/www/vendor/phpunit/phpunit/src/Framework/TestCase.php:1608"]
|
* @testWith ["vendor/phpunit/phpunit/src/Framework/TestCase.php:"]
|
||||||
* @testdox getCallerFileLine check if it returns $expected [$_dataName]
|
* @testdox getCallerFileLine check based on regex /[\w\-\/]/vendor/phpunit/phpunit/src/Framework/TestCase.php:\d+ [$_dataName]
|
||||||
*
|
*
|
||||||
* @param string $expected
|
* @param string $expected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testGetCallerFileLine(string $expected): void
|
public function testGetCallerFileLine(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
// regex prefix with path "/../" and then fixed vendor + \d+
|
||||||
$expected,
|
$regex = "/^\/[\w\-\/]+\/vendor\/phpunit\/phpunit\/src\/Framework\/TestCase.php:\d+$/";
|
||||||
|
$this->assertMatchesRegularExpression(
|
||||||
|
$regex,
|
||||||
Support::getCallerFileLine()
|
Support::getCallerFileLine()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -518,11 +520,17 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
// add one "run" before "runBare"
|
// add one "run" before "runBare"
|
||||||
|
// array_splice(
|
||||||
|
// $expected,
|
||||||
|
// 7,
|
||||||
|
// 0,
|
||||||
|
// ['run']
|
||||||
|
// );
|
||||||
array_splice(
|
array_splice(
|
||||||
$expected,
|
$expected,
|
||||||
7,
|
|
||||||
0,
|
0,
|
||||||
['run']
|
0,
|
||||||
|
['include']
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
|
|||||||
@@ -20,10 +20,15 @@ final class CoreLibsLoggingLoggingTest extends TestCase
|
|||||||
private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR;
|
private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR;
|
||||||
private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date
|
private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date
|
||||||
. "\[[\w\.]+(:\d+)?\]\s{1}" // host:port
|
. "\[[\w\.]+(:\d+)?\]\s{1}" // host:port
|
||||||
. "\[[\w+\.\/]+:\d+\]\s{1}" // folder/file
|
. "\[[\w\-\.\/]+:\d+\]\s{1}" // folder/file
|
||||||
. "\[\w+\]\s{1}" // run id
|
. "\[\w+\]\s{1}" // run id
|
||||||
. "{[\w\\\\]+(::\w+)?}\s{1}"; // class
|
. "{[\w\\\\]+(::\w+)?}\s{1}"; // class
|
||||||
|
|
||||||
|
public static function tearDownAfterClass(): void
|
||||||
|
{
|
||||||
|
array_map('unlink', glob(self::LOG_FOLDER . '*.log'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test set for options BASIC
|
* test set for options BASIC
|
||||||
*
|
*
|
||||||
@@ -217,14 +222,14 @@ final class CoreLibsLoggingLoggingTest extends TestCase
|
|||||||
|
|
||||||
// setLoggingLevel
|
// setLoggingLevel
|
||||||
// getLoggingLevel
|
// getLoggingLevel
|
||||||
// getJsDebug
|
// loggingLevelIsDebug
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
* @covers ::setLoggingLevel
|
* @covers ::setLoggingLevel
|
||||||
* @covers ::getLoggingLevel
|
* @covers ::getLoggingLevel
|
||||||
* @covers ::getJsDebug
|
* @covers ::loggingLevelIsDebug
|
||||||
* @testdox setLoggingLevel set/get checks
|
* @testdox setLoggingLevel set/get checks
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@@ -242,7 +247,7 @@ final class CoreLibsLoggingLoggingTest extends TestCase
|
|||||||
$log->getLoggingLevel()
|
$log->getLoggingLevel()
|
||||||
);
|
);
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$log->getJsDebug()
|
$log->loggingLevelIsDebug()
|
||||||
);
|
);
|
||||||
// not set, should be debug]
|
// not set, should be debug]
|
||||||
$log = new \CoreLibs\Logging\Logging([
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
@@ -254,7 +259,7 @@ final class CoreLibsLoggingLoggingTest extends TestCase
|
|||||||
$log->getLoggingLevel()
|
$log->getLoggingLevel()
|
||||||
);
|
);
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$log->getJsDebug()
|
$log->loggingLevelIsDebug()
|
||||||
);
|
);
|
||||||
// invalid, should be debug, will throw excpetion too
|
// invalid, should be debug, will throw excpetion too
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
@@ -269,7 +274,7 @@ final class CoreLibsLoggingLoggingTest extends TestCase
|
|||||||
$log->getLoggingLevel()
|
$log->getLoggingLevel()
|
||||||
);
|
);
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$log->getJsDebug()
|
$log->loggingLevelIsDebug()
|
||||||
);
|
);
|
||||||
// set valid, then change
|
// set valid, then change
|
||||||
$log = new \CoreLibs\Logging\Logging([
|
$log = new \CoreLibs\Logging\Logging([
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ ob_end_flush();
|
|||||||
$ECHO_ALL = true;
|
$ECHO_ALL = true;
|
||||||
|
|
||||||
// use CoreLibs\Debug\Support;
|
// use CoreLibs\Debug\Support;
|
||||||
|
|
||||||
|
use CoreLibs\Debug\Support;
|
||||||
use CoreLibs\Logging\Logger\Level;
|
use CoreLibs\Logging\Logger\Level;
|
||||||
use CoreLibs\Logging\Logger\Flag;
|
use CoreLibs\Logging\Logger\Flag;
|
||||||
// use CoreLibs\Debug\Support;
|
// use CoreLibs\Debug\Support;
|
||||||
@@ -51,7 +53,18 @@ print "Flag: per_run ->value: " . Flag::per_class->value . "<br>";
|
|||||||
$log->setLogUniqueId();
|
$log->setLogUniqueId();
|
||||||
print "LogUniqId: " . $log->getLogUniqueId() . "<br>";
|
print "LogUniqId: " . $log->getLogUniqueId() . "<br>";
|
||||||
|
|
||||||
print "DUMP: " . $log->dV(['something' => 'error']) . "<br>";
|
print "Is Debug (check): " . Support::printBool($log->getLoggingLevel()->includes(
|
||||||
|
Level::Debug
|
||||||
|
)) . "<br>";
|
||||||
|
print "Is Debug (fk): " . Support::printBool($log->loggingLevelIsDebug()) . "<br>";
|
||||||
|
$log->setLoggingLevel(Level::Notice);
|
||||||
|
print "Is Debug (check): " . Support::printBool($log->getLoggingLevel()->includes(
|
||||||
|
Level::Debug
|
||||||
|
)) . "<br>";
|
||||||
|
print "Is Debug (fk): " . Support::printBool($log->loggingLevelIsDebug()) . "<br>";
|
||||||
|
$log->setLoggingLevel(Level::Debug);
|
||||||
|
|
||||||
|
print "DUMP: <pre>" . $log->dV(['something' => 'error']) . "</pre><br>";
|
||||||
|
|
||||||
$log->debug('LEGACY', 'Some legacy shit here');
|
$log->debug('LEGACY', 'Some legacy shit here');
|
||||||
$log->debug('ARRAY', 'Dump some data: ' . $log->dV(['something' => 'error']));
|
$log->debug('ARRAY', 'Dump some data: ' . $log->dV(['something' => 'error']));
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ print "<body>";
|
|||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||||
|
|
||||||
$smarty->DATA['JS_DEBUG'] = $log->getJsDebug();
|
$smarty->DATA['JS_DEBUG'] = $log->loggingLevelIsDebug();
|
||||||
$smarty->MASTER_TEMPLATE_NAME = 'main_body.tpl';
|
$smarty->MASTER_TEMPLATE_NAME = 'main_body.tpl';
|
||||||
$smarty->TEMPLATE_NAME = 'smarty_test.tpl';
|
$smarty->TEMPLATE_NAME = 'smarty_test.tpl';
|
||||||
$smarty->CSS_SPECIAL_TEMPLATE_NAME = 'smart_test.css';
|
$smarty->CSS_SPECIAL_TEMPLATE_NAME = 'smart_test.css';
|
||||||
|
|||||||
@@ -121,6 +121,6 @@ if (!$login->loginActionRun()) {
|
|||||||
//------------------------------ logging end
|
//------------------------------ logging end
|
||||||
|
|
||||||
// pass on DEBUG flag to JS via smarty variable
|
// pass on DEBUG flag to JS via smarty variable
|
||||||
$smarty->DATA['JS_DEBUG'] = $log->getJsDebug();
|
$smarty->DATA['JS_DEBUG'] = $log->loggingLevelIsDebug();
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ class IO
|
|||||||
/** @var array<mixed> */
|
/** @var array<mixed> */
|
||||||
private array $pk_name_table = [];
|
private array $pk_name_table = [];
|
||||||
/** @var string internal primary key name, for cross calls in async */
|
/** @var string internal primary key name, for cross calls in async */
|
||||||
private string $pk_name;
|
private string $pk_name = '';
|
||||||
/** @var bool if we use RETURNING in the INSERT call */
|
/** @var bool if we use RETURNING in the INSERT call */
|
||||||
private bool $returning_id = false;
|
private bool $returning_id = false;
|
||||||
/** @var string if a sync is running holds the hash key of the query */
|
/** @var string if a sync is running holds the hash key of the query */
|
||||||
@@ -1267,7 +1267,7 @@ class IO
|
|||||||
// ONLY insert with set pk name
|
// ONLY insert with set pk name
|
||||||
($this->__checkQueryForInsert($this->query, true) && $this->pk_name != 'NULL') ||
|
($this->__checkQueryForInsert($this->query, true) && $this->pk_name != 'NULL') ||
|
||||||
// insert or update with returning add
|
// insert or update with returning add
|
||||||
($this->__checkQueryForInsert($this->query) && $this->returning_id)
|
($this->__checkQueryForInsert($this->query) && $this->returning_id)
|
||||||
) {
|
) {
|
||||||
$this->__dbSetInsertId(
|
$this->__dbSetInsertId(
|
||||||
$this->returning_id,
|
$this->returning_id,
|
||||||
@@ -3123,16 +3123,13 @@ class IO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* switches the debug flag on or off
|
* switches the debug flag on or off
|
||||||
* if none given, then return current set only
|
*
|
||||||
* @param bool|null $debug true/false or null for just getting current set
|
* @param bool $debug True/False to turn debugging in this calss on or off
|
||||||
* @return bool Current debug flag as set
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function dbSetDebug(?bool $debug = null): bool
|
public function dbSetDebug(bool $debug): void
|
||||||
{
|
{
|
||||||
if ($debug !== null) {
|
$this->db_debug = $debug;
|
||||||
$this->db_debug = $debug;
|
|
||||||
}
|
|
||||||
return $this->db_debug;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3140,9 +3137,11 @@ class IO
|
|||||||
* OR
|
* OR
|
||||||
* with the optional parameter fix sets debug
|
* with the optional parameter fix sets debug
|
||||||
* returns current set stats
|
* returns current set stats
|
||||||
|
*
|
||||||
* @param bool|null $debug Flag to turn debug on off or null for toggle
|
* @param bool|null $debug Flag to turn debug on off or null for toggle
|
||||||
* @return bool Current debug status
|
* @return bool Current debug status
|
||||||
* True for debug is on, False for off
|
* True for debug is on, False for off
|
||||||
|
* @deprecated Use dbSetDebug and dbGetDebug
|
||||||
*/
|
*/
|
||||||
public function dbToggleDebug(?bool $debug = null): bool
|
public function dbToggleDebug(?bool $debug = null): bool
|
||||||
{
|
{
|
||||||
@@ -3156,6 +3155,7 @@ class IO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return current set db debug flag status
|
* Return current set db debug flag status
|
||||||
|
*
|
||||||
* @return bool Current debug status
|
* @return bool Current debug status
|
||||||
*/
|
*/
|
||||||
public function dbGetDebug(): bool
|
public function dbGetDebug(): bool
|
||||||
|
|||||||
@@ -34,29 +34,29 @@ class Support
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* prints a html formatted (pre) array
|
* prints a html formatted (pre) data
|
||||||
*
|
*
|
||||||
* @param array<mixed> $array any array
|
* @param mixed $data any data
|
||||||
* @param bool $no_html default add <pre>
|
* @param bool $no_html default add <pre>
|
||||||
* @return string formatted array for output with <pre> tag added
|
* @return string formatted array for output with <pre> tag added
|
||||||
*/
|
*/
|
||||||
public static function printAr(array $array, bool $no_html = false): string
|
public static function printAr(mixed $data, bool $no_html = false): string
|
||||||
{
|
{
|
||||||
return $no_html ?
|
return $no_html ?
|
||||||
print_r($array, true) :
|
print_r($data, true) :
|
||||||
'<pre>' . print_r($array, true) . '</pre>';
|
'<pre>' . print_r($data, true) . '</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* alternate name for printAr function
|
* alternate name for printAr function
|
||||||
*
|
*
|
||||||
* @param array<mixed> $array any array
|
* @param mixed $data any array
|
||||||
* @param bool $no_html default add <pre>
|
* @param bool $no_html default add <pre>
|
||||||
* @return string formatted array for output with <pre> tag added
|
* @return string formatted array for output with <pre> tag added
|
||||||
*/
|
*/
|
||||||
public static function printArray(array $array, bool $no_html = false): string
|
public static function printArray(mixed $data, bool $no_html = false): string
|
||||||
{
|
{
|
||||||
return self::printAr($array, $no_html);
|
return self::printAr($data, $no_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,12 +65,12 @@ class Support
|
|||||||
* Do not use this without using it in a string in debug function
|
* Do not use this without using it in a string in debug function
|
||||||
* Note: for full data debug dumps use Support::dumpVar()
|
* Note: for full data debug dumps use Support::dumpVar()
|
||||||
*
|
*
|
||||||
* @param array<mixed> $a Array to format
|
* @param mixed $data Data to print
|
||||||
* @return string print_r formated
|
* @return string print_r formated
|
||||||
*/
|
*/
|
||||||
public static function prAr(array $a): string
|
public static function prAr(mixed $data): string
|
||||||
{
|
{
|
||||||
return self::printAr($a, true);
|
return self::printAr($data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,7 +177,6 @@ class Support
|
|||||||
$caller_level = 1;
|
$caller_level = 1;
|
||||||
$caller_list = self::getCallerMethodList();
|
$caller_list = self::getCallerMethodList();
|
||||||
if ($caller_list[0] == 'dV') {
|
if ($caller_list[0] == 'dV') {
|
||||||
echo "Raise caller level<br>: " . $caller_list[0] . "<br>";
|
|
||||||
$caller_level = 2;
|
$caller_level = 2;
|
||||||
}
|
}
|
||||||
// we need to strip the string in <small></small that is
|
// we need to strip the string in <small></small that is
|
||||||
|
|||||||
@@ -675,9 +675,11 @@ class Logging
|
|||||||
*
|
*
|
||||||
* @return bool True, we are at debug level
|
* @return bool True, we are at debug level
|
||||||
*/
|
*/
|
||||||
public function getJsDebug(): bool
|
public function loggingLevelIsDebug(): bool
|
||||||
{
|
{
|
||||||
return $this->log_level === Level::Debug ? true : false;
|
return $this->getLoggingLevel()->includes(
|
||||||
|
Level::Debug
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// log file id set (file name prefix)
|
// log file id set (file name prefix)
|
||||||
@@ -1080,12 +1082,12 @@ class Logging
|
|||||||
* But this does not wrap it in <pre></pre>
|
* But this does not wrap it in <pre></pre>
|
||||||
* Do not use this without using it in a string in debug function
|
* Do not use this without using it in a string in debug function
|
||||||
*
|
*
|
||||||
* @param array<mixed> $a Array to format
|
* @param mixed $data Data to format
|
||||||
* @return string print_r formated
|
* @return string print_r formated
|
||||||
*/
|
*/
|
||||||
public function prAr(array $a): string
|
public function prAr(mixed $data): string
|
||||||
{
|
{
|
||||||
return Support::printArray($a, true);
|
return Support::printArray($data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -232,13 +232,13 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public string $col_name; // the name of the columen (before _<type>) [used for order button]
|
public string $col_name; // the name of the columen (before _<type>) [used for order button]
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public int $yes; // the yes flag that triggers the template to show ALL and not only new/load
|
public int $yes = 0; // the yes flag that triggers the template to show ALL and not only new/load
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $msg; // the error msg
|
public string $msg = ''; // the error msg
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public int $error; // the error flag set for printing red error msg
|
public int $error = 0; // the error flag set for printing red error msg
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public int $warning; // warning flag, for information (saved, loaded, etc)
|
public int $warning = 0; // warning flag, for information (saved, loaded, etc)
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $archive_pk_name; // the pk name for the load select form
|
public string $archive_pk_name; // the pk name for the load select form
|
||||||
/** @var string */
|
/** @var string */
|
||||||
@@ -282,7 +282,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
|||||||
public array $login_acl = [];
|
public array $login_acl = [];
|
||||||
// layout publics
|
// layout publics
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public int $table_width;
|
public int $table_width = 0;
|
||||||
// internal lang & encoding vars
|
// internal lang & encoding vars
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $lang_dir = '';
|
public string $lang_dir = '';
|
||||||
|
|||||||
@@ -77,79 +77,79 @@ class SmartyExtend extends \Smarty
|
|||||||
public string $COMPILE_ID = '';
|
public string $COMPILE_ID = '';
|
||||||
// template vars
|
// template vars
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $MASTER_TEMPLATE_NAME;
|
public string $MASTER_TEMPLATE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $PAGE_FILE_NAME;
|
public string $PAGE_FILE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CONTENT_INCLUDE;
|
public string $CONTENT_INCLUDE = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $FORM_NAME;
|
public string $FORM_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $FORM_ACTION;
|
public string $FORM_ACTION = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $L_TITLE;
|
public string $L_TITLE = '';
|
||||||
/** @var string|int */
|
/** @var string|int */
|
||||||
public string|int $PAGE_WIDTH;
|
public string|int $PAGE_WIDTH;
|
||||||
// smarty include/set var
|
// smarty include/set var
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $TEMPLATE_PATH;
|
public string $TEMPLATE_PATH = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $TEMPLATE_NAME;
|
public string $TEMPLATE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $INC_TEMPLATE_NAME;
|
public string $INC_TEMPLATE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $JS_TEMPLATE_NAME;
|
public string $JS_TEMPLATE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CSS_TEMPLATE_NAME;
|
public string $CSS_TEMPLATE_NAME = '';
|
||||||
/** @var string|null */
|
/** @var string|null */
|
||||||
public string|null $TEMPLATE_TRANSLATE;
|
public string|null $TEMPLATE_TRANSLATE;
|
||||||
/** @var string|null */
|
/** @var string|null */
|
||||||
public string|null $JS_TRANSLATE;
|
public string|null $JS_TRANSLATE;
|
||||||
// core group
|
// core group
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $JS_CORE_TEMPLATE_NAME;
|
public string $JS_CORE_TEMPLATE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CSS_CORE_TEMPLATE_NAME;
|
public string $CSS_CORE_TEMPLATE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $JS_CORE_INCLUDE;
|
public string $JS_CORE_INCLUDE = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CSS_CORE_INCLUDE;
|
public string $CSS_CORE_INCLUDE = '';
|
||||||
// local names
|
// local names
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $JS_SPECIAL_TEMPLATE_NAME = '';
|
public string $JS_SPECIAL_TEMPLATE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CSS_SPECIAL_TEMPLATE_NAME = '';
|
public string $CSS_SPECIAL_TEMPLATE_NAME = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $JS_INCLUDE;
|
public string $JS_INCLUDE = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CSS_INCLUDE;
|
public string $CSS_INCLUDE = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $JS_SPECIAL_INCLUDE;
|
public string $JS_SPECIAL_INCLUDE = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CSS_SPECIAL_INCLUDE;
|
public string $CSS_SPECIAL_INCLUDE = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $ADMIN_JAVASCRIPT;
|
public string $ADMIN_JAVASCRIPT = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $ADMIN_STYLESHEET;
|
public string $ADMIN_STYLESHEET = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $FRONTEND_JAVASCRIPT;
|
public string $FRONTEND_JAVASCRIPT = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $FRONTEND_STYLESHEET;
|
public string $FRONTEND_STYLESHEET = '';
|
||||||
// other smarty folder vars
|
// other smarty folder vars
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $INCLUDES;
|
public string $INCLUDES = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $JAVASCRIPT;
|
public string $JAVASCRIPT = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CSS;
|
public string $CSS = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $FONT;
|
public string $FONT = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $PICTURES;
|
public string $PICTURES = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CACHE_PICTURES;
|
public string $CACHE_PICTURES = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public string $CACHE_PICTURES_ROOT;
|
public string $CACHE_PICTURES_ROOT = '';
|
||||||
|
|
||||||
// constructor class, just sets the language stuff
|
// constructor class, just sets the language stuff
|
||||||
/**
|
/**
|
||||||
@@ -373,7 +373,7 @@ class SmartyExtend extends \Smarty
|
|||||||
// check for template include
|
// check for template include
|
||||||
if (
|
if (
|
||||||
$this->USE_INCLUDE_TEMPLATE === true &&
|
$this->USE_INCLUDE_TEMPLATE === true &&
|
||||||
!$this->TEMPLATE_NAME
|
empty($this->TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
$this->TEMPLATE_NAME = $this->CONTENT_INCLUDE;
|
$this->TEMPLATE_NAME = $this->CONTENT_INCLUDE;
|
||||||
// add to cache & compile id
|
// add to cache & compile id
|
||||||
@@ -390,7 +390,7 @@ class SmartyExtend extends \Smarty
|
|||||||
exit('MASTER TEMPLATE: ' . $this->MASTER_TEMPLATE_NAME . ' could not be found');
|
exit('MASTER TEMPLATE: ' . $this->MASTER_TEMPLATE_NAME . ' could not be found');
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
$this->TEMPLATE_NAME &&
|
!empty($this->TEMPLATE_NAME) &&
|
||||||
!file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->TEMPLATE_NAME)
|
!file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
exit('INCLUDE TEMPLATE: ' . $this->TEMPLATE_NAME . ' could not be found');
|
exit('INCLUDE TEMPLATE: ' . $this->TEMPLATE_NAME . ' could not be found');
|
||||||
@@ -418,7 +418,12 @@ class SmartyExtend extends \Smarty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we can't find it, dump it
|
// if we can't find it, dump it
|
||||||
if (!file_exists($this->getTemplateDir()[0] . DIRECTORY_SEPARATOR . $this->TEMPLATE_TRANSLATE)) {
|
if (
|
||||||
|
!file_exists(
|
||||||
|
$this->getTemplateDir()[0] . DIRECTORY_SEPARATOR
|
||||||
|
. $this->TEMPLATE_TRANSLATE
|
||||||
|
)
|
||||||
|
) {
|
||||||
$this->TEMPLATE_TRANSLATE = null;
|
$this->TEMPLATE_TRANSLATE = null;
|
||||||
}
|
}
|
||||||
if (empty($this->JS_TRANSLATE)) {
|
if (empty($this->JS_TRANSLATE)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user