view modules/apache/templates/mod/_require.erb @ 275:d9352a684e62

Mass update of modules to remove deprecation warnings
author IBBoard <dev@ibboard.co.uk>
date Sun, 26 Jan 2020 11:36:07 +0000
parents
children b8d6ada284dd
line wrap: on
line source

<% if @requires != nil -%>
  <%- _requires = @requires -%>
<% elsif @allow_from != nil and ! @allow_from.empty? -%>
  <%- scope.function_warning(["Class #{@title}: Using Allow"]) -%>
  <%- scope.function_warning(["is deprecated in Apache #{@_apache_version}"]) -%>
  <%- _requires = 'ip ' + Array(@allow_from).join(" ") -%>
<% else -%>
  <%- _requires = @requires_defaults -%>
<% end -%>
<%-# -%>
<% if _requires.is_a?(String) -%>
  <%- if ! ['', 'unmanaged'].include?_requires.downcase -%>
    Require <%= _requires %>
  <%- end -%>
<% elsif _requires.is_a?(Array) -%>
  <%- _requires.each do |req| -%>
    Require <%= req %>
  <%- end -%>
<% elsif _requires.is_a?(Hash) -%>
  <%- if _requires.has_key?('enforce') and ['all', 'none', 'any'].include?_requires['enforce'].downcase -%>
    <%- enforce_str = "Require#{_requires['enforce'].capitalize}>\n" -%>
    <%- enforce_open = "    <#{enforce_str}" -%>
    <%- enforce_close = "    </#{enforce_str}" -%>
    <%- indentation = '    ' -%>
  <%- else -%>
    <%- if _requires.has_key?('enforce') -%>
      <%- scope.function_warning(["Class #{@title}: Require can only"]) -%>
      <%- scope.function_warning(["be overwritten with all, none or any."]) -%>
    <%- end -%>
    <%- enforce_open = '' -%>
    <%- enforce_close = '' -%>
    <%- indentation = '' -%>
  <%- end -%>
  <%- if _requires.has_key?('requires') and _requires['requires'].is_a?(Array) -%>
<%# %><%= enforce_open -%>
      <%- _requires['requires'].each do |req| -%>
<%# %>    <%= indentation -%>Require <%= req %>
      <%- end -%>
<%# %><%= enforce_close -%>
  <%- else -%>
    <%- scope.function_warning(["Class #{@title}: Require hash must have"]) -%>
    <%- scope.function_warning(["a key named \"requires\" with array value"]) -%>
  <%- end -%>
<% end -%>