Freshrss: There is any way to remove user older than 365 days ?

Created on 12 May 2020  路  9Comments  路  Source: FreshRSS/FreshRSS

Hello

I host a FreshRSS instance and the size of the database is constantly increasing (logic).
But, I suspect some users are registering to test FreshRSS and import some (or many) and there are no remove there accounts. (I have more user registered than access on front web).
So FreshRSS get rss for unused user, consume ressource and use space in DB.

I research a way to remove users who don't connect on front web or who don't get there rss feed after x days.
It is possible ?

Thank :)

All 9 comments

Hello,
FreshRSS has a command line interface, which offers user status and the possibility to delete them.

https://github.com/FreshRSS/FreshRSS/tree/master/cli

Try e.g.

./cli/user-info.php -h --header

So you could have a cron job to run a little logic regularly.

I was planning to make a JSON output to ease parsing

Hooo, I can't see that !

Thank :D

So the date/time of last user action Accessing the rss of the account without logging in via the interface is considered as an action. ?

No, I have tried to count only significant actions, that are most likely not automatic (but some double-check on this part would be nice). See e.g. https://github.com/FreshRSS/FreshRSS/pull/2936#issuecomment-622933327

See https://github.com/FreshRSS/FreshRSS/pull/2968 , it should help.

./cli/user-info.php --json | jq .
[
  {
    "is_default": true,
    "user": "alex",
    "last_user_activity": "2020-05-12T17:45:29+02:00",
    "database_size": 422281216,
    "categories": "20",
    "feeds": 196,
    "reads": 128747,
    "unreads": 833,
    "favourites": 274,
    "tags": "18",
    "lang": "fr",
    "mail_login": "[email protected]"
  },
  {
    "is_default": false,
    "user": "alice",
    "last_user_activity": "2020-01-06T20:40:41+01:00",
    "database_size": 221184,
    "categories": "1",
    "feeds": 1,
    "reads": 2,
    "unreads": 9,
    "favourites": 0,
    "tags": "0",
    "lang": "fr",
    "mail_login": ""
  }
]

Example of user selection with jq:

./cli/user-info.php --json 2> /dev/null | jq '.[] | select(.last_user_activity < "2020-04-30") | .user'
"alice"
"thomas"

Hooo ~I think I'll wait for that MR.
It must be more pratical to parse json than parse with awk ^^

Thank !

I have added a few examples to filter on date https://github.com/FreshRSS/FreshRSS/pull/2968

Merged in master. Feedback welcome

It's work !

Thank you ! :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Alkarex picture Alkarex  路  5Comments

Stegemueller picture Stegemueller  路  3Comments

Alkarex picture Alkarex  路  5Comments

cwldev picture cwldev  路  5Comments

Paxistatis picture Paxistatis  路  3Comments