Commit Graph
100 Commits
Author SHA1 Message Date
Clemens Schwaighofer 2f81009a97 Fix TestCalls class folder name based on namespace 2023-10-04 18:26:38 +09:00
Clemens Schwaighofer e9799f888b Install PHP CS Fixer 2023-10-04 15:12:14 +09:00
Clemens Schwaighofer 94b24b4eae Basic documentation tools: phpdox/phpdocumentor installed for testing which is best 2023-10-04 15:07:49 +09:00
Clemens Schwaighofer a304d29698 Switch check to to phive installed tools, fix in phpunit bootsrap file 2023-10-04 14:58:29 +09:00
Clemens Schwaighofer c4c809be66 Remove all base composer installed packages and move tool phive install for phan/phpstan/etc 2023-10-04 14:47:48 +09:00
Clemens Schwaighofer a3bf38f6cf Update bootstrap file for phpunit to work with different folder layouts
we have the autoloader in different base folders for some dev work
2023-10-04 14:35:53 +09:00
Clemens Schwaighofer c1b906e701 Install composer viea phive and remove phpunit from composer dev install
Update comoser test files to work with both, but primary is the phive
installed one.

run tests via 4dev/check/phpunit.sh as before
2023-10-04 14:22:24 +09:00
Clemens Schwaighofer 32f8e1440d Update Logging\ErrorMsg jump target with level for css
So we can have different stylesheets for the levels like in the error
messages.

Output changes to ...[$target] = ['info' ..., 'level'] and on return
this is converted into an array for each entry so it can be handled
like the error msg return string
2023-10-02 17:31:11 +09:00
Clemens Schwaighofer 2f8f98642b Update Logging\ErrorMsg to add a Jump Target list for direct jumps
So we can return a list for css element ids we want to jump directly to
2023-10-02 14:02:00 +09:00
Clemens Schwaighofer 7ab03913ac Merge remote-tracking branch 'all/master' into development 2023-10-02 12:27:36 +09:00
Clemens Schwaighofer a7853171e0 Merge remote-tracking branch 'all/master' into development 2023-10-02 12:26:35 +09:00
Clemens Schwaighofer dfdfcf87f2 Merge branch 'development' 2023-10-02 12:26:14 +09:00
Clemens Schwaighofer 6218e0a6a8 Output\Form\Generate fix for phan check 2023-10-02 12:25:07 +09:00
Clemens Schwaighofer a84a745be2 Logging\ErrorMsg class update to log error level automatically for debug
if log level is debug, automatically log the error messages.
We still skip warn and info levels from logging.

The rest is based on the logging level (notice eg only gets logged if
log level is at least notice)
2023-10-02 12:23:44 +09:00
Clemens Schwaighofer 312762e92e Composer update 2023-10-02 12:23:15 +09:00
Clemens Schwaighofer fa4c1f0597 Form\Generate and DB\Extend\ArrayIO split
Move DB\Extend\ArrayIO to internal class in variable and do not extend
Form\Generate from it (as we do not have a base class anymore, this is
no longer neded)

Update all calls in connected classes.

Add interface methods for DB\Extend\ArrayIO to interface with all class
vars that are now all private
2023-09-29 19:05:58 +09:00
Clemens Schwaighofer 438a75af23 Merge branch 'development' 2023-09-27 11:42:32 +09:00
Clemens Schwaighofer afd8ff3e31 Composer updates 2023-09-27 11:42:07 +09:00
Clemens Schwaighofer 4343af7937 Composer core updates 2023-09-27 11:41:41 +09:00
Clemens Schwaighofer d06769c48b empty admin folder page for edit base page creation tests 2023-09-27 11:38:32 +09:00
Clemens Schwaighofer 4c0390f082 ErrorMessage class: add notice for non error logging to log file
info is already used for write back to front. So we use notice for
non error level messages into the log file
2023-09-27 11:37:26 +09:00
Clemens Schwaighofer 95bee3dc8c Update DB\IO dbWriteDataExt to allow null primary key
So we do not get an error on a new data call with a null primary key
2023-09-27 11:22:16 +09:00
Clemens Schwaighofer 65132d8a4a Fix DB\ArrayIO access to unset pk_id 2023-09-27 09:41:41 +09:00
Clemens Schwaighofer b2243cd06d Add EditOrder dummy template class for edit_order page
without this dummy class the Form\Generate cannot load.

We don't need it, except for the set page name
2023-09-26 18:36:29 +09:00
Clemens Schwaighofer 8f09b67d86 Update for phpunit tests 2023-09-15 18:31:41 +09:00
Clemens Schwaighofer fe459aec80 Update ErrorMsg with optional target_style string for one style
Applied to master or to target style
2023-09-15 18:22:38 +09:00
Clemens Schwaighofer de0ed058ca ErrorMessage: new flag for logging 'error' level to log 2023-09-11 13:35:35 +09:00
Clemens Schwaighofer f90bd193d9 Change setError to setMessage to make it clear what is the corret name 2023-09-08 18:54:44 +09:00
Clemens Schwaighofer 0e31180868 Rename setErrorMsgLevel to setError for backend calls 2023-09-08 18:47:44 +09:00
Clemens Schwaighofer 68c9164eaa New ErrorMessage class for frontend return error messages 2023-09-08 18:30:05 +09:00
Clemens Schwaighofer c2389db1c9 Composer updates 2023-09-08 18:30:02 +09:00
Clemens Schwaighofer f9558cd3aa Fix for the SetVarType / SetVarTypeNull
string: if it is stringable in anyway, set string (it converts)
this is not check IF it is a string value as it was before
int/float: same, if it is numerc it will be convert to int or float
All other stay the same

Note "set ..." imply to set, and not to convert to 0 if it is int
string that can be covnerted to int
2023-09-05 14:26:57 +09:00
Clemens Schwaighofer ae3011fe22 php unit test fix for DB\IO 2023-09-01 18:29:00 +09:00
Clemens Schwaighofer 9b9dfeac69 phan error supress 2023-09-01 18:21:25 +09:00
Clemens Schwaighofer 33cb05a002 Update to Exceptions: add codes, update phpunit tests
DB Class throws Exception if on init it fails to connect to the DB,
will not throw Exception if failed connection during execution but
will do the normal retry and soft failure run
DB\ArrayIO will throw Exception on missing table array and table name

All Exceptions have a code set
2023-09-01 08:37:15 +09:00
Clemens Schwaighofer ec110499a8 phan fixs 2023-08-31 19:06:16 +09:00
Clemens Schwaighofer 09839f3451 phpstan fixes 2023-08-31 19:04:45 +09:00
Clemens Schwaighofer 067e0aed5d L10n change Exception to RuntimeException 2023-08-31 18:08:34 +09:00
Clemens Schwaighofer 545de5c4a1 Fixed more Exceptions to be not Errors but Exceptions
DateTime, Session, FileWrite, Image, SymmetricEncryption

phpunit tests updated, run checks added
2023-08-31 18:06:02 +09:00
Clemens Schwaighofer 2fe37bf92a Exceptions change in Check\Colors, add in Cmbined\ArrayHandler
Chech\Colors now throws correct exceptions for wrong values
Combined\ArrayHandler will throw errors and not return false
2023-08-31 12:07:28 +09:00
Clemens Schwaighofer cd81d15d9a Convert\Color methods will throw Exception instead of false on error
All Color methods will throw Exceptions:
LengthException,
InvalidArgumentException,
UnexpectedValueException

instead of returning bool: false

All methods will return valid color data as expected only
2023-08-31 10:45:33 +09:00
Clemens Schwaighofer 8a33ee5c15 Slight update for ACL\Login class exit codes
exit will add message as first parameter (string) next to code (int)
Log this to info or critical.
3000 -> 100: info
rest >=1000: critical
previous 4000 = 3000 (options not set)

update unit tests for this

Possible change idea: critical abort throw error?
2023-08-31 10:41:44 +09:00
Clemens Schwaighofer 46e1419ef5 phan checks and updates 2023-08-30 19:26:13 +09:00
Clemens Schwaighofer c441063437 Composer updates 2023-08-30 19:25:48 +09:00
Clemens Schwaighofer 5290d5f351 Update db class tests in admin run 2023-08-28 09:28:17 +09:00
Clemens Schwaighofer 2635ccb82b edit.css: rename animation, Bug fix in DB\IO cursor_ext access and others
Make sure cursor_ext is set before we access it, else return null for
not set yet.
false for errors, else data value

Other class var access checks to be sure to never fail
2023-08-28 07:40:41 +09:00
Clemens Schwaighofer 4f2ac2ed1b Change Logging class / method name and Debug Support for backtrace
Debug Support:
getCallerClass now returns level 1 class from the trace like the
getCallerMethod. There is also a new getCallerClassMethod that returns
namespace\class->method (or :: for static).

getCallerTopLevelClass works like getCallerClass did before and returns
the TOP level (first entry on the call stack that has a set class name)

Logging:
Do not use the Support getCallerClass/Method/File but call it inside
and use level 2 in trace to get the data we need For the last call
before debug call
Also update the strack trace for the debug call to use ->/:: for method
type
2023-08-22 13:28:59 +09:00
Clemens Schwaighofer 5b8e4e4e3e Core composer packages update 2023-08-22 13:04:19 +09:00
Clemens Schwaighofer 53192da571 www folder composer updates 2023-08-22 13:04:01 +09:00
Clemens Schwaighofer f29e915068 class_test fixes for phpstan checks 2023-08-02 16:32:11 +09:00
Clemens Schwaighofer 46bc5f2da6 Json phpunit tests updates, fixes in test php with ignore for deprecated 2023-08-02 16:22:09 +09:00
Clemens Schwaighofer d70182a84e Add JSON convert array to json with always return string
Allows the same post run error check like the other way around
2023-08-02 16:12:01 +09:00
Clemens Schwaighofer 7243f69826 Email Type class returns correct "false" instead of "bool" 2023-08-02 16:08:39 +09:00
Clemens Schwaighofer 1fc144e178 Composer Workspace global packages 2023-08-02 14:52:33 +09:00
Clemens Schwaighofer c383a7b7b7 Update convert colors to return false and not bool
All convert color either return the color value or false.
To make sure any checker knows that we only return "value" or "false"
change all return bool to false
2023-08-02 07:29:49 +09:00
Clemens Schwaighofer 69077c384c phpdoc fix for DB\IO dbGetCursorNumRows 2023-08-01 09:00:43 +09:00
Clemens Schwaighofer cfd49947ad Bug fix in ACL\Login: mnake sure ['base'] acl is int 2023-07-26 11:48:56 +09:00
Clemens Schwaighofer 6985dc4e9d ACL\Login fix for UNIT DEFAULT return
It has to be int or null but because the SQL result is undefined (string)
it needs to be converted on return if it is a numeric value, else
null will be returned (it is the edit access id PK so it has to be
numeric)
2023-07-24 09:11:32 +09:00
Clemens Schwaighofer 5f2668b011 ACL\Login
Remove log per class flag set inside Login.
If per class logging is needed here, set that BEFORE and AFTER the class
call
2023-07-21 19:03:24 +09:00
Clemens Schwaighofer eba1ef9c59 Init DB\IO dbh with null to avoid any problems
There could have been some problems where the dbh var was not touched
even thought it was inited.
2023-07-21 17:48:09 +09:00
Clemens Schwaighofer 8497144053 Admin\Backend level check, DB\IO Error/Warning message update
on Admin\Backend init check that the provided default acl level is valid

DB\IO warning and error drop the "db :" prefix part as this is not needed
we have [DB_ERROR] and [DB_WARNING] sub prefixes anyway, also we run
dedicated log level alerts with context
2023-07-14 15:01:46 +09:00
Clemens Schwaighofer 2006798388 Init set empty db config if db config not found 2023-07-10 08:18:49 +09:00
Clemens Schwaighofer bf63d850ca Add new DateTime class has date range weekened method
dateRangeHasWeekend with two dates, checks if between those two dates
a weekend (sat or sun) is set
2023-07-04 11:43:27 +09:00
Clemens Schwaighofer 53e267ce24 Updates and fixes from phan/phpstan runs 2023-06-28 15:30:08 +09:00
Clemens Schwaighofer 1754ecf2ee HtmlBuilder: change all return error to Throw, update Element/StrinReplace
We do not return old style bool on error, we throw Exceptions: HtmlBuilderExcpetion

Element has more classes to set tag, id, etc with basic checks for valid data

String Replace to set strings is one array with key -> value entries

Errors thrown on index for element/replace blocks
2023-06-28 14:16:44 +09:00
Clemens Schwaighofer 3c37899a48 Rename Replace to StringReplace to match the actual content
Replace is too general. it is String Replace
2023-06-27 18:33:04 +09:00
Clemens Schwaighofer 0436cfe3da HtmlBuilder classes for Object, Array, String Replace build
Object build is a replicata from the JS one
Array is similar but build on pure Array elements
String replace is just a simple string replacer for now

General\Error for overall error handling
General\Settings for Object/Array based checks and settings
2023-06-27 18:30:26 +09:00
Clemens Schwaighofer 3606de1a00 Back add some checks for the phfo function that matches the php one 2023-06-27 18:30:00 +09:00
Clemens Schwaighofer 3081439eda Switch edit_base CSS name from ADMIN_STYLESHEET to EDIT_BASE_STYLESHEET 2023-06-27 18:29:28 +09:00
Clemens Schwaighofer 7af0e74b85 Fix phpUnit test name for Security\SymmetricEncryption 2023-06-26 14:25:36 +09:00
Clemens Schwaighofer 7748b83a6b DB\IO add stack trace to debug/error/warning calls
To add the actuall call reference for DB IO debug calls we add the
call trace as context options
2023-06-16 13:17:49 +09:00
Clemens Schwaighofer f83293ff1a Info comments for DB\IO convert options 2023-06-13 11:47:38 +09:00
Clemens Schwaighofer 9c3be2942e phan and phpstan fixes, also add a convert flag reset to original
dbResetConvertFlag resets to the settings given on init of class
2023-06-09 18:23:28 +09:00
Clemens Schwaighofer ee62bd98ee Add auto type convert for DB\IO
set via db options "db_convert_type" as array with "on", "json", "numeric",
"bytea"

"on" only converts know good types: "bool", "int"

"json" will convert json/jsonb to array
"bytea" will decode escaped bytea to string (note: this might change to resource)

"numeric" will convert to float.
NOTE: if a numeric number is too large a covnersion might drop data.
Use with care.

Convert flags can be chagned with dbSetConvertFlag and dbUnsetConvertFlag

All convert flags are in "DB\Options\Convert" as enum.
2023-06-09 17:01:03 +09:00
Clemens Schwaighofer 02e9610fad Add a general log method to Logger class
the params order is the actual correct one:
log level, message, context, group_id, prefix

not that group_id and prefix are only used if log level is debug

Switched debug params order for context and prefix so prefix is last
2023-06-09 16:59:22 +09:00
Clemens Schwaighofer 8a41db4649 Output\Image cleanup for phpstan 2023-06-09 12:16:49 +09:00
Clemens Schwaighofer e27ea3dc9f DB\IO phpdoc update 2023-06-09 10:24:26 +09:00
Clemens Schwaighofer ec4bf54d81 DB\IO phpdoc layout update
Add line between params and method description
2023-06-09 10:21:02 +09:00
Clemens Schwaighofer ec3ca787fa Logging: prepare message only if log level is high enough
Also some clean ups on internal method call parameters
2023-06-05 09:30:26 +09:00
Clemens Schwaighofer 86acbbb85b Per run logging was not set if flag changed
if setFlag was set for per_run or per_date the init values where not set

Fixed that on setFlag it is checked if we have per_date or per_run and
then set if not set.

Not that for date, set the flag will set a new date, for per run no.
2023-06-02 17:38:09 +09:00
Clemens Schwaighofer 8e0af7a5f7 Class var init fixes 2023-06-01 13:03:46 +09:00
Clemens Schwaighofer b022662dfc Removed restrictions for printAr to only accept arrays
print_r call takes any value, changed that for all functions

array -> mixed
2023-06-01 12:00:20 +09:00
Clemens Schwaighofer 3039ebf913 Unlink files after test 2023-06-01 11:02:53 +09:00
Clemens Schwaighofer e2e080c404 Bug fix for DB\IO 2023-06-01 10:58:11 +09:00
Clemens Schwaighofer 4671143d1c phpunit debug fixes 2023-06-01 09:13:59 +09:00
Clemens Schwaighofer b492558cca Logging unit test regex fix 2023-06-01 08:54:47 +09:00
Clemens Schwaighofer 64e76530d4 deprecated log method call name change in test file 2023-06-01 08:43:47 +09:00
Clemens Schwaighofer 0b93f9f146 Bug fixes and minor updates
- Removed echo from Support Debug dumpVar call
- deprecated DB\IO toggle dbDebug and changed set/get to be like normal
  ones where set just sets and doesn't return anything
- Renamed the logJsDebug to loggingLevelIsDebug
  (other levels can be checked with ->getLoggingLevel()->includes(Level::...))

Adjusted tests for all changes
2023-06-01 08:40:55 +09:00
Clemens Schwaighofer 4c6fe1cd6c Fix Logger\Logger Psr Excpetion calls 2023-05-31 18:44:40 +09:00
Clemens Schwaighofer 83ba48f598 Remove db_debug flag from DB\IO, is set from Logging level 2023-05-31 18:41:13 +09:00
Clemens Schwaighofer 62c6de8244 minor phan config fix 2023-05-31 17:32:00 +09:00
Clemens Schwaighofer 1c2f9f0c2c ACL\Login if euid was set from SESSION and EUID is not int, error
Force to (int)
2023-05-31 16:30:25 +09:00
Clemens Schwaighofer 30bb0e8895 phpunit checks and fixes 2023-05-31 16:14:40 +09:00
Clemens Schwaighofer 75c4c98de8 Convert all classes to strict variable types
All variable declarations in all classes have a strict type set

Exception: constants (will be setable from PHP 8.3 on), resources (no type)

Debug\LoggingLegacy is kept as is, will be deprecated
2023-05-31 15:58:06 +09:00
Clemens Schwaighofer f72055909b Update in class error/warning/etc calls instead of debug calls
For anything that is not debug use the proper reporting level
2023-05-30 18:30:31 +09:00
Clemens Schwaighofer b0a8783276 Logging class major change, Debug\Support update
old Debug\Logging is in Debug\LoggingLegacy and Debug\Logging extends
Logging\Logging

Logging\Logging is a new class with most of the functionality except
there is no more print/outout to screen, but we use the default log
levels (RFC5424)
The plan is to be a frontend between the old type class and
Monolog\Monolog

Updated all other classes to use new class interface
2023-05-30 18:12:24 +09:00
Clemens Schwaighofer 7b5ad92e66 Composer updates 2023-05-29 16:21:51 +09:00
Clemens Schwaighofer 250067927a fdebug deprecated message update, update debug logger tester script 2023-05-25 17:55:04 +09:00
Clemens Schwaighofer 7c2cbbaca7 Fix Password phpunit test class name 2023-05-24 15:57:34 +09:00
Clemens Schwaighofer ac037eabde New Secruity namespace added
Move Passwords from Check to Security and deprecate old

Add new SymmetricEncryption and CreateKey

CreateKey class just creates keys for the SymmetricEncryption
SymmetricEncryption uses the hex2bin calls to convert the hex key to the
internal binary key

Example:
$key = CreateKey::generateRandomKey();
$encrypted = SymmetricEncryption::encrypt($string, $key);
$decrypted = SymmetricEncryption::decrypt($encrypted, $key);

Above $key must be stored in some secure location (.env file)
2023-05-24 15:47:02 +09:00