Problem/Motivation

Add a cron function to purge login records with a configurable interval setting

Comments

scalas89 created an issue. See original summary.

scalas89’s picture

leewillis77’s picture

Hi;

Thanks for opening this issue & for the associated patch. I haven't yet run it up and tested, but I have a few suggestions based on a quick skim through the code:

  1. You have debug print_r calls left in login_tracker_cron()
  2. It looks like the code is deleting entries newer than the cut-off, not older than?
  3. I'm not keen on the setting titles, e.g. '#title' => $this->t('Purge records every'). This setting doesn't control how often records are purged, it controls the age of records that will be purged, and should describe itself as such. Maybe "Periodically purge records older than"?
  4. See previous comment. I don't think the description really describes the setting.
scalas89’s picture

StatusFileSize
new4.79 KB

Sorry, wrong patch attached! Here is a new one :)

leewillis77’s picture

Thanks. I'm happy with this in principal, with a few corrections / additions:

1. In login_tracker.links.menu.yml, please can you amend the description to:
"Configure settings related to tracking of user logins."
That avoids the inconsistent capitalisation in the current string, and is more consistent with the tone that other modules use (ie referring to the feature, not the module name).
2. In login_tracker.module:
if (isset($settings['purge_interval']) && $settings['purge_interval']) {
can be simplified to:
if (!empty($settings['purge_interval'])) {
3. In login_tracker.permissions.yml, can you amend the following

+  title: 'Manage Login Tracker settings'
+  description: 'Users with this permission will be able to manage login tracker settings.'

to

+  title: 'Manage settings for login tracking'
+  description: 'Users with this permission will be able to manage settings for login tracking.'

4. In login_tracker.routing.yml the permission declaration is incorrect (typo) so isn't checking the permission correctly
5. Also in login_tracker.routing.yml, the title should either be "Login Tracker settings", or "User login tracking settings"

scalas89’s picture

StatusFileSize
new4.79 KB

Here is the new patch

scalas89’s picture

Status: Active » Needs review
leewillis77’s picture

Thanks - I'll review this week.

  • leewillis77 committed 80c662c on 8.x-1.x authored by scalas89
    Issue #3267300 by scalas89, leewillis77: Add possibility to purge...
leewillis77’s picture

Status: Needs review » Closed (fixed)

Committed thanks. Will be in 8.x-1.5 release.