Skip to content

Maintenance EN

sqkl520 edited this page Nov 28, 2026 · 3 revisions

Maintenance & Upgrades

简体中文 | English

Upgrading

Step 1: Back up

# stop the server, then back up the whole data directory
cp -r plugins/LetsLearnEnglish/ ~/lle_backup_$(date +%Y%m%d)/

You can also run /lea export in-game to dump online player data to CSV.

Step 2: Swap the JAR

rm "plugins/Let's Learn English!"-*.jar
cp ~/downloads/"Let's Learn English!"-1.0.7.jar plugins/

Step 3: Restart

stop, then start again. Don't use the server's built-in /reload — the database connection and some periodic tasks won't rebuild correctly.

The config assets upgrade in completely different ways

Asset What happens on upgrade Your edits
config.yml No migration. Missing keys fall back to defaults on read Fully preserved
ai_config.yml The plugin neither generates nor migrates it; only one api-key is read. If missing or still a placeholder, it logs a WARNING and disables AI conversation — no default fallback Fully preserved
messages/*.yml Merge-style upgrade when the version is behind, with a .bak snapshot first Fully preserved (comments are lost; key order is kept)
words/*.yml Overwritten wholesale Wiped out — but there is a rollback point

Why word banks get overwritten

saveResourceIfNotExists only writes the bundled word bank when the file is missing, so an existing server would forever keep its old word bank — players notice "the new words I was promised are gone" while the log says nothing.

So the plugin performs a one-shot "back up then replace" pass keyed on words-version.txt: when the on-disk version is below the bundled version, it copies the three existing word banks into words-backup-v<old version>-<timestamp>/ and writes the new ones wholesale. The new version stamp is applied only when all three succeed; if any fails, the old version number stays and the next startup retries.

It does not merge row by row — "should a word the owner deleted come back?" and "whose definition wins?" have no correct answers; back-up-plus-replace is at least explainable and reversible.

If the backup fails, the plugin does not replace

It prefers an upgrade that doesn't take effect over losing your edits with no rollback point. The console logs SEVERE, telling you to back up manually, delete words-version.txt, and restart (deleting the file treats the on-disk version as 0, forcing the upgrade path to run again).

If you edited the bundled word banks

Approach How Result
Merge manually after upgrading Take your version from words-backup-v*/ and merge it into the new file Both your edits and the new word bank are kept
Skip this overwrite Write the current version number into words-version.txt before starting The word bank stays as-is; you don't get the new one
Save under a new filename (recommended) Create any *.yml under words/ Both sets of words survive and are never overwritten

The skip criterion is "on-disk version >= bundled version" — writing a high enough number is all it takes. Deleting the file has the opposite effect: unreadable content is treated as 0, which triggers the upgrade. Saving under a new filename is permanently safe because any *.yml under words/ is auto-discovered; only the fixed names beginner / intermediate / advanced get overwritten.

Routine maintenance

Task Frequency How
Database backup Daily Automatic every 1440 minutes by default; a manual copy is still recommended
Log check Weekly grep -i letslearnenglish logs/latest.log
Prune old backups Monthly Delete entries in backups/ older than a month, or lower max-backups
Word bank updates As needed Edit words/*.yml, then /lea reload
Report cleanup Automatic Reports in exports/reports/ older than report.keep-days (default 30 days) are lazily pruned on the next generation
Feed cleanup Automatic Posts older than social.feed.retention-days (default 7 days) are removed along with their cheers

Backing up the database

You must stop the server

The plugin enables WAL mode, so playerdata.db is not a complete database — unmerged transactions live in playerdata.db-wal.

Copying only the .db file silently loses data — no error at all; you only discover the loss when you restore.

The correct way

# 1. after stopping the server, enter the data directory
cd plugins/LetsLearnEnglish/

# 2. merge the WAL back into the main file
sqlite3 playerdata.db "PRAGMA wal_checkpoint(TRUNCATE);"

# 3. use SQLite's own backup command (handles WAL correctly)
sqlite3 playerdata.db ".backup 'playerdata.db.bak'"

The plugin's automatic backups are safe

Backups produced by the plugin use VACUUM INTO (WAL-safe, producing a self-consistent snapshot), followed by PRAGMA quick_check. Only a check that explicitly reports corruption deletes the file; an inconclusive check keeps it — see the "Corrupted database file" section of Troubleshooting.

SQLite maintenance (VACUUM)

When you need it

SQLite's DELETE / UPDATE only mark pages reusable; the space is never returned to the OS. Tables that grow and shrink continuously — ai_chat_history, social_feed, word_progress — leave playerdata.db growing forever over months of operation.

Automatic backups cannot reclaim those holes: VACUUM INTO only produces a copy, leaving the main file byte-for-byte unchanged. Reclaiming requires an in-place VACUUM.

Manual steps

Run this in a maintenance window — VACUUM holds a write lock and takes time proportional to the database size.

cd plugins/LetsLearnEnglish/

# 1. back up first (a VACUUM interrupted by a full disk can corrupt the file)
sqlite3 playerdata.db "PRAGMA wal_checkpoint(TRUNCATE);"
sqlite3 playerdata.db ".backup 'playerdata.db.bak'"

# 2. compact in place
sqlite3 playerdata.db "PRAGMA optimize; VACUUM;"

# 3. verify (expect "ok")
sqlite3 playerdata.db "PRAGMA quick_check;"

# 4. check the reclaim: freelist_count should be near 0
sqlite3 playerdata.db "PRAGMA freelist_count; PRAGMA page_count;"

Restart once everything checks out.

MySQL does not need this. MySQL has no VACUUM; space is managed via innodb_file_per_table and OPTIMIZE TABLE.

Security recommendations

  1. Grant admin only to people you trust — letslearnenglish.admin. Teachers and parents only need letslearnenglish.report (no reset / reload / broadcast)

  2. Config file permissions — make sure config.yml can't be edited by ordinary FTP users

  3. Don't use root for the database — create a dedicated low-privilege account:

    CREATE USER 'lle_plugin'@'localhost' IDENTIFIED BY 'secure_password';
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX ON letslearnenglish.* TO 'lle_plugin'@'localhost';
    FLUSH PRIVILEGES;

    Note that CREATE / ALTER / INDEX cannot be omitted: tables, columns, and indexes are all created automatically by the plugin at startup, so granting only DML privileges makes the first startup fail outright. The database itself (CREATE DATABASE) still has to be created by an administrator in advance.

  4. Export regularly — /lea export

  5. Disable update checks on internal servers — general.check-updates: false

  6. The web panel must have its password changed — statistics-server.auth.password defaults to changeme; change it before exposing anything to the internet, and keep ip-whitelist as narrow as possible

Uninstalling

  1. /lea export to dump data (optional)
  2. Stop the server
  3. Delete plugins/Let's Learn English!-*.jar
  4. Decide whether to keep plugins/LetsLearnEnglish/ (database and config)
  5. Restart

Think before deleting the data directory: player progress, achievements, and check-in streaks all live there. Once deleted they are unrecoverable without a backup.

Clone this wiki locally