Sha256: 303bba7a55aeec042d5847660673faf5407081547e01e00668fdaea14115f5a0

Contents?: true

Size: 802 Bytes

Versions: 9

Compression:

Stored size: 802 Bytes

Contents

event :admin_tasks, on: :update, before: :approve do
  if task = Env.params[:task]
    if Auth.always_ok?
      case task.to_sym
      when :clear_cache           ;  Card::Cache.reset_global; Card::ViewCache.reset
      when :repair_references     ;  Card::Reference.repair_all
      when :empty_trash           ;  Card.empty_trash
      when :clear_view_cache      ;  Card::ViewCache.reset
      when :delete_old_revisions  ;  Card::Action.delete_old
      when :delete_old_sessions
        if months = Env.params[:months].to_i and months > 0
          ActiveRecord::SessionStore::Session.delete_all ["updated_at < ?", months.months.ago]
        end
      end
      Env.params[:success] = Card[:stats].name
      abort :success
    else
      raise Card::PermissionDenied.new(self)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-1.16.15 mod/05_standard/set/self/all.rb
card-1.16.14 mod/05_standard/set/self/all.rb
card-1.16.13 mod/05_standard/set/self/all.rb
card-1.16.12 mod/05_standard/set/self/all.rb
card-1.16.11 mod/05_standard/set/self/all.rb
card-1.16.10 mod/05_standard/set/self/all.rb
card-1.16.9 mod/05_standard/set/self/all.rb
card-1.16.8 mod/05_standard/set/self/all.rb
card-1.16.7 mod/05_standard/set/self/all.rb