Rev 786 | Rev 1150 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 786 | Rev 1130 | ||
---|---|---|---|
Line 119... | Line 119... | ||
119 | exit($num_errs > 0 ? 1 : 0); |
119 | exit($num_errs > 0 ? 1 : 0); |
120 | } |
120 | } |
121 | 121 | ||
122 | # --- |
122 | # --- |
123 | 123 | ||
- | 124 | /** |
|
- | 125 | * @param \ViaThinkSoft\OIDplus\OIDplusDatabaseConnection $db |
|
124 | function dotest($db) { |
126 | * @return void |
- | 127 | */ |
|
- | 128 | function dotest(\ViaThinkSoft\OIDplus\OIDplusDatabaseConnection $db): string { |
|
125 | echo "Database: " . get_class($db) . "\n"; |
129 | echo "Database: " . get_class($db) . "\n"; |
126 | try { |
130 | try { |
127 | $db->connect(); |
131 | $db->connect(); |
128 | } catch (Exception $e) { |
132 | } catch (Exception $e) { |
129 | echo "Connection ".redtext("FAILED")." (check userdata/baseconfig/config.inc.php): ".$e->getMessage()."\n\n"; |
133 | echo "Connection ".redtext("FAILED")." (check userdata/baseconfig/config.inc.php): ".$e->getMessage()."\n\n"; |
Line 364... | Line 368... | ||
364 | } |
368 | } |
365 | $db->disconnect(); |
369 | $db->disconnect(); |
366 | echo "\n"; |
370 | echo "\n"; |
367 | } |
371 | } |
368 | 372 | ||
- | 373 | /** |
|
- | 374 | * @param string $str |
|
- | 375 | * @return string |
|
- | 376 | */ |
|
369 | function redtext($str) { |
377 | function redtext(string $str): string { |
370 | global $num_errs; |
378 | global $num_errs; |
371 | $num_errs++; |
379 | $num_errs++; |
372 | return PHP_SAPI == 'cli' ? "\033[31m$str\033[0m" : '<font color="red">'.$str.'</font>'; |
380 | return PHP_SAPI == 'cli' ? "\033[31m$str\033[0m" : '<font color="red">'.$str.'</font>'; |
373 | } |
381 | } |
374 | 382 | ||
- | 383 | /** |
|
- | 384 | * @param string $str |
|
- | 385 | * @return string |
|
- | 386 | */ |
|
375 | function greentext($str) { |
387 | function greentext(string $str): string { |
376 | global $num_succ; |
388 | global $num_succ; |
377 | $num_succ++; |
389 | $num_succ++; |
378 | return PHP_SAPI == 'cli' ? "\033[32m$str\033[0m" : '<font color="green">'.$str.'</font>'; |
390 | return PHP_SAPI == 'cli' ? "\033[32m$str\033[0m" : '<font color="green">'.$str.'</font>'; |
379 | } |
391 | } |
380 | 392 | ||
- | 393 | /** |
|
- | 394 | * @param string $msg |
|
- | 395 | * @return bool |
|
- | 396 | */ |
|
381 | function is_known_errormsg($msg) { |
397 | function is_known_errormsg(string $msg): bool { |
382 | // Oracle: |
398 | // Oracle: |
383 | //Error-Function after failed direct query: |
399 | //Error-Function after failed direct query: |
384 | // ==> OCIStmtExecute: ORA-00942: table or view does not exist (ext\pdo_oci\oci_statement.c:155) |
400 | // ==> OCIStmtExecute: ORA-00942: table or view does not exist (ext\pdo_oci\oci_statement.c:155) |
385 | //Error-Function after failed prepared query: |
401 | //Error-Function after failed prepared query: |
386 | // ==> OCIBindByPos: ORA-01036: illegal variable name/number (ext\pdo_oci\oci_statement.c:346) |
402 | // ==> OCIBindByPos: ORA-01036: illegal variable name/number (ext\pdo_oci\oci_statement.c:346) |
387 | if (strpos($msg,'ORA-') !== false) return true; |
403 | return strpos($msg,'ORA-') !== false; |
388 | - | ||
389 | return false; |
- | |
390 | } |
404 | } |