An utility for purging old data of CoreProtect in production
WARNING: This repo is still in development. Use at your own risk.
- Ruby >= 2.0.0
rbenv --version
# rbenv 1.0.0ruby --version
# ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-darwin18]mysql --version
# mysql Ver 14.14 Distrib 5.7.21, for osx10.11 (x86_64) using EditLine wrapper
-
Install Ruby if you haven't yet:
$ rbenv install --skip-existing
-
Install bundler if you haven't yet:
$ gem install bundler
-
Install gems:
$ bundle install --path vendor/bundle --binstubs bin
-
Create your own environment variables configuration:
$ cp .env.template .env
-
Edit database configurations:
$ vi .env
Use bin/thor help co:purge
command for help:
Usage:
thor co:purge
Options:
-a, [--action=ACTION] # Specific actions (separated by commas)
[--end=N] # Stop at specific timestamp
[--start=N] # Started at specific timestamp
[--step=N] # Iterate with specific number of rows
# Default: 1000
-u, [--user=USER] # Specific users (separated by commas)
-w, [--world=WORLD] # Specific worlds (separated by commas)
-y, [--yes], [--no-yes] # Delete the records without prompt
Purge blocks from the database
-
Delete blocks older than 30 days ago (default):
$ bin/thor co:purge
-
Delete blocks older than 1546300800 (Tue, 01 Jan 2019 00:00:00 UTC +00:00):
$ bin/thor co:purge --end=1546300800
-
Delete blocks of fire, water and lava spreading:
$ bin/thor co:purge --user=#fire,#water,#lava --action=+block
-
Delete blocks of a specific world:
$ bin/thor co:purge --world=world_2018
-
Delete blocks without prompt:
$ bin/thor co:purge --yes
Bug reports and pull requests are welcome.
coreprotect-ruby is released under the MIT License.