Class: Hyrax::DataDestroyers::CollectionBrandingDestroyer

Inherits:
Object
  • Object
show all
Defined in:
app/utils/hyrax/data_destroyers/collection_branding_destroyer.rb

Overview

TODO:

This destroys branding info in the database. Should it also delete related banner and logo files?

Note:

WARNING: DO NOT USE IN PRODUCTION! The methods in this class are destructive. Data can not be recovered.

Collection branding info is tightly coupled to collections. When they are removed using wipe!, the associated database entries for collection branding also have to be deleted.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



15
16
17
# File 'app/utils/hyrax/data_destroyers/collection_branding_destroyer.rb', line 15

def logger
  @logger
end

Class Method Details

.destroy_data(logger: Logger.new(STDOUT), allow_destruction_in_production: false) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'app/utils/hyrax/data_destroyers/collection_branding_destroyer.rb', line 17

def destroy_data(logger: Logger.new(STDOUT), allow_destruction_in_production: false)
  raise("CollectionBrandingDestroyer is not for use in production!") if Rails.env.production? && !allow_destruction_in_production
  @logger = logger

  logger.info("Destroying collection branding...")

  Hyrax::CollectionBrandingInfo.destroy_all
  logger.info("   collection branding -- DESTROYED")
end