jbox-web/redmine_git_hosting

View on GitHub
lib/redmine_git_hosting/patches/setting_patch.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require_dependency 'setting'

module RedmineGitHosting
  module Patches
    module SettingPatch
      def self.prepended(base)
        class << base
          prepend ClassMethods
        end
      end

      module ClassMethods
        def check_cache
          settings_updated_on = Setting.maximum :updated_on
          if settings_updated_on && @cached_cleared_on <= settings_updated_on
            clear_cache
            RedmineGitHosting::Config.check_cache
          end
        end
      end
    end
  end
end

Setting.prepend RedmineGitHosting::Patches::SettingPatch unless Setting.included_modules.include? RedmineGitHosting::Patches::SettingPatch