Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new command to clean old log entries, fixes issue #622 #623

Merged
merged 11 commits into from
Mar 9, 2021

Conversation

rochdi80tn
Copy link
Contributor

What are you changing/introducing

Adding new console command implementing the log cleaning feature
This new command will do it (via a cron job on a monthly bases for instance) where it will delete log files older than YYY years but only if we have more more then XXX rows. This ensures log files won’t be deleted if there just a few log entries.

What is the reason for changing/introducing

Overtime log tables such as admin_ngrest_log and cms_log will contain large amount of data. To keep the database cleaner and if we don not need these logs anymore we have to manually perform a cleanup.

QA

Q A
Is bugfix? no
New feature? yes
Breaks BC? no
Tests pass? n/a
Fixed issues 622

@nadar
Copy link
Member

nadar commented Mar 9, 2021

@rochdi80tn thanks for your PR. Please add your @author name, also it would be very nice to have some examples in the php doc header with how to use the command, showing the different options. Cause this is what will be rendered on luya.io in the api docs.

I will adjust the code a little, also to meet the psr2 standards (we usually take https://github.com/FriendsOfPHP/PHP-CS-Fixer to fix coding standards)

@nadar nadar self-assigned this Mar 9, 2021
@nadar nadar merged commit 22d4371 into luyadev:master Mar 9, 2021
@rochdi80tn
Copy link
Contributor Author

@nadar , looking at what you altered helped me a lot better understanding the coding standards. Thanks.
I believe will add some documentation, but this shall be done in a different PR right ?

@rochdi80tn rochdi80tn deleted the clean_log branch March 9, 2021 13:51
@nadar
Copy link
Member

nadar commented Mar 9, 2021

I just added one more usage example. Yes, more documentation and usage is welcome, maybe also add your mail adresse as author, i just had your username.

Your commands works perfectly and is a really good tool when i comes to cleanup the tables. thanks again

@rochdi80tn
Copy link
Contributor Author

rochdi80tn commented Mar 10, 2021 via email

@nadar
Copy link
Member

nadar commented Mar 10, 2021

No sadly we don't have a preview, sorry. But looking at the other controllers might help https://luya.io/api/luya-admin-commands-ProxyController

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants