1. These forums are still being retired! Please use GitHub discussions or Discord. You cannot create new threads or new accounts now. If you need to contact some user of the forums, you should do it sooner, rather than later. This notice was last updated on May 30th, 2021.

1.22 (obsolete) Purge Players

Purge Players based on last access date

  1. GrandPa-G
    API Version:
    TShock Version:
    Source URL:
    Purge Players

    Purge Players will delete users and associated character information from the database based upon criteria given in a config file or by command line options. The plugin is invoked by the command purgeplayers or pp. The command options are:
    Syntax: /purgeplayers [-help]
    -purge        starts purge operation
    -reload/-r    reloads options from purgeplayers.json config file
    -verbose/-v   show each user purge
    -!verbose/-!v don't show each user purged
    -days n       purges any user not accessed in the last n days before today
    -!preview/!p  negates preview, thus users will be deleted
    -preview/p    performs purge action without actually purging any users
    -list/l       show current purge criteria
    -help         this information
    The options may be set in the config file name purgeplayers.json held in the TShock folder. The options are:
      "purgeBeforeDays": 20,
      "archiveDeletes": false,
      "archiveFileName": "DeletedPlayers.sql",
      "DoNotDelete": [
      "DoNotDeleteGroups": [
      "autoPurge": false,
      "autoPurgeTime": "12:00:00"
    purgeBeforeDays specifies how many days ago the user has accessed the server. Users with no accessed date will be purged as well.

    archiveDeletes is a true/false to indicate if archiving the data from the database will be performed. If true, text SQL insert records will be placed in the file specified by archiveFileName. An external tool maybe used to replace the records in case there is a mistake made in the purge criteria.

    DoNotDelete is a list of quoted usernames from the users table in the database that are not to be deleted even if they meet the criteria.

    DoNotDeleteGroupsis a list of quoted groups from the users table in the database that are not to be deleted even if they meet the criteria.

    autoPurge is a true/false indicator to set the option to perform automatic purging based upon the time specified by autoPurgeTime. The time is given in HH:MM:SS (though seconds are not used). When this time is reached in the day, the server will perform a purge based upon the config file criteria.

    [NOTE] A huge thank you to member Kjkillercom for all his help. He made most of the suggestions and help debug the result.
    Kojiro_S and Kjkillercom like this.

Recent Reviews

  1. Kojiro_S
    Neat little tool to keep your user database in order. As an added plus, it has auto-purge options included.