Sha256: 7c039bb5322f8f0b9f368e9c34ec8888c1be06349d55a50f1ebf4e15f0419341

Contents?: true

Size: 1005 Bytes

Versions: 2

Compression:

Stored size: 1005 Bytes

Contents

module Admin
end
class Admin::BaseController < ApplicationController
  cattr_accessor :look_for_migrations
  @@look_for_migrations = true
  layout 'administration'
  before_filter :login_required, :except => [ :login, :signup ]
  before_filter :look_for_needed_db_updates, :except => [:login, :signup, :update_database, :migrate]

  private
  def look_for_needed_db_updates
    if Migrator.offer_migration_when_available
      redirect_to :controller => '/admin/settings', :action => 'update_database' if Migrator.current_schema_version != Migrator.max_schema_version
    end
  end

  def sweep_cache
    if Blog.default
      if Blog.default.cache_option == "caches_action_with_params"
        sweep_cache_action
      end
      if Blog.default.cache_option == "caches_page"
        sweep_cache_html
      end
    end
  end

  def sweep_cache_action
    PageCache.sweep_all
    expire_fragment(/.*/)
  end

  def sweep_cache_html
    PageCache.sweep_all
    expire_fragment(/^contents_html.*/)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typo-5.1.98 app/controllers/admin/base_controller.rb
typo-5.2 app/controllers/admin/base_controller.rb