Page 1 of 1
nulog format
Posted: Wed May 05, 2021 2:09 pm
by vario
Hi,
Is there any reason why I should not change the logged user and time to a more user-friendly format?
I would choose #LOGIN_NAME# and date('Y-m-d H:i:s') for my purposes.
Neil.
Re: nulog format
Posted: Wed May 05, 2021 7:06 pm
by kev1n
One of the primary benefits of using Unix time is that it can be represented as an integer making it easier to parse and use across different systems. And depending on the country and preference, different formats would be chosen.
To parse the unix date (and then also display it in your preferred format), check out:
https://github.com/nuBuilder/nuBuilder- ... g_activity
https://github.com/nuBuilder/nuBuilder- ... g_activity
Re: nulog format
Posted: Sat May 08, 2021 7:41 am
by vario
I have added the code but it shows zzzzsys_user_id rather than the readable sus_login_name or sus_name I want. Are there going to be any bugs if I change the stored user to LOGIN_NAME at line 172 of nudata.php?
Neil
Re: nulog format
Posted: Sat May 08, 2021 12:01 pm
by kev1n
I will try adding an additional format to the nulog column so you can use either of them
Re: nulog format
Posted: Sat May 08, 2021 12:51 pm
by vario
OK thanks - I have modified nudata.php anyway to test and all working well. If anyone else is interested here is a bit of SQL to update existing data (presuming your SQL supports the regexp code).
Code: Select all
update yourtable
join zzzzsys_user on (zzzzsys_user_id = regexp_substr(yourtable_nulog,'"added":{"user":"\\K[0-9a-z]+'))
set yourtable_nulog = replace(yourtable_nulog,regexp_substr(yourtable_nulog,'"added":{"user":"\\K[0-9a-z]+'),sus_login_name)
Repeat as required for "edited" and so on.