Enable setting to allow admins to permanently delete data

:bookmark: This is a guide on how to enable the setting for administrators to permanently delete data on a Discourse instance.

:person_raising_hand: Required user level: System Admin

:wrench: Console access required

As of 2.8.0.beta7: Security Release, Fast Edits, Topic Bookmarks, and more there is a hidden site setting to allow admins to permanently delete data.

Enabling permanent deletion via the Rails console

To enable the setting using the Rails console, execute the following commands:

  1. Access your Discourse application directory:
cd /var/discourse
  1. Enter the app container:
./launcher enter app
  1. Access the Rails console:
rails c
  1. Set the site setting can_permanently_delete to true:
SiteSetting.can_permanently_delete = true
  1. Exit the Rails console:
exit
  1. Exit the app container:
exit

This change takes effect immediately, and no further action is required.

Enabling permanent deletion via app.yml

Another way to enable permanent deletion is through the app.yml configuration file. Follow these steps:

  1. Open the app.yml file located in your Discourse application directory.

  2. Locate the env: section. You can find this under DISCOURSE_HOSTNAME.

  3. Add the following line to enable permanent deletion:

    DISCOURSE_CAN_PERMANENTLY_DELETE: true
    
  4. Save the changes and execute the following command to rebuild your app:

    ./launcher rebuild app
    

Your changes will take effect once the rebuild process is complete.

Last edited by @SaraDev 2024-09-17T23:55:45Z

Check documentPerform check on document:
20 Likes

โ€œDelete Dataโ€ means all the topics, posts, uploads etc, everything will be deleted from our site and itโ€™ll be just an empty new website?


Or itโ€™d delete โ€˜Dataโ€™ container or something?

It refers to this feature - Introducing permanently delete post functionality

It allows admins to hard delete posts/topics when enabled, rather than the normal soft-delete without it.

4 Likes