Class: Hyrax::DataDestroyers::StatsDestroyer
- Inherits:
-
Object
- Object
- Hyrax::DataDestroyers::StatsDestroyer
- Defined in:
- app/utils/hyrax/data_destroyers/stats_destroyer.rb
Overview
Note:
WARNING: DO NOT USE IN PRODUCTION! The methods in this class are destructive. Data can not be recovered.
Stats are tightly coupled to works and files in the repository. When they are removed using wipe!, the associated database entries for stats also need to be deleted.
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
13 14 15 |
# File 'app/utils/hyrax/data_destroyers/stats_destroyer.rb', line 13 def logger @logger end |
Class Method Details
.destroy_data(logger: Logger.new(STDOUT), allow_destruction_in_production: false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/utils/hyrax/data_destroyers/stats_destroyer.rb', line 15 def destroy_data(logger: Logger.new(STDOUT), allow_destruction_in_production: false) raise("StatsDataDestroyer is not for use in production!") if Rails.env.production? && !allow_destruction_in_production @logger = logger logger.info("Destroying stats...") FileDownloadStat.destroy_all logger.info(" file download stats -- DESTROYED") FileViewStat.destroy_all logger.info(" file view stats -- DESTROYED") WorkViewStat.destroy_all logger.info(" work view stats -- DESTROYED") end |