Sha256: 8e9ccf5e6a05836d729533b9e6485710a60d74a6c11217d4ea51cea1c9bca9a9

Contents?: true

Size: 921 Bytes

Versions: 19

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module DataDestroyers
    # Featured works are tightly coupled to works in the repository. When they
    # are removed using wipe!, the associated database entries for featured
    # works also need to be deleted.
    #
    # @note WARNING: DO NOT USE IN PRODUCTION!  The methods in this class are destructive.
    #   Data can not be recovered.
    #
    class FeaturedWorksDestroyer
      class << self
        attr_accessor :logger

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

          logger.info("Destroying featured works...")

          FeaturedWork.destroy_all
          logger.info("   featured works -- DESTROYED")
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hyrax-5.1.0.pre.beta1 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-5.0.4 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-5.0.3 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-5.0.2 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-5.0.1 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-5.0.0 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-5.0.0.rc3 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-5.0.0.rc2 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-5.0.0.rc1 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-3.6.0 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-4.0.0 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-4.0.0.rc3 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-4.0.0.rc2 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-4.0.0.rc1 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-3.5.0 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-4.0.0.beta2 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-3.4.2 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-4.0.0.beta1 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
hyrax-3.4.1 app/utils/hyrax/data_destroyers/featured_works_destroyer.rb