5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-28 17:26:23 +00:00

Merge branch 'blazer' into panel.sutty.nl

This commit is contained in:
f 2022-04-29 17:59:17 -03:00
commit d444995521

View file

@ -58,12 +58,20 @@ class UriCollectionJob < PeriodicJob
# Acumular por mes y año # Acumular por mes y año
reduce_rollup('host', beginning, **dimensions) reduce_rollup('host', beginning, **dimensions)
# Obtener orígenes de visitas por host columns = %i[http_referer geoip2_data_country_name]
AccessLog.where(host: host).distinct(:http_referer).pluck(:http_referer).each do |http_referer| columns.each do |column|
dimensions[:http_referer] = http_referer # Obtener orígenes de visitas por host
AccessLog.where(host: host).distinct(column).pluck(column).each do |value|
dimensions.delete_if do |k, _|
columns.include? k
end
rollup('host|referer', beginning, **dimensions) name = "host|#{column}"
reduce_rollup('host|referer', beginning, **dimensions) dimensions[column] = value
rollup(name, beginning, **dimensions)
reduce_rollup(name, beginning, **dimensions)
end
end end
end end
@ -115,11 +123,17 @@ class UriCollectionJob < PeriodicJob
STAT_NAME STAT_NAME
end end
# Obtiene todas las ubicaciones de archivos
#
# @return [String] # @return [String]
# #
# TODO: Cambiar al mergear origin-referer # TODO: Cambiar al mergear origin-referer
def destination def destinations
@destination ||= site.deploys.find_by(type: 'DeployLocal').destination @destinations ||= site.deploys.map(&:destination).select do |d|
File.directory?(d)
end.map do |d|
File.realpath(d)
end.uniq
end end
# Recolecta todas las URIs menos imágenes # Recolecta todas las URIs menos imágenes
@ -127,14 +141,16 @@ class UriCollectionJob < PeriodicJob
# @return [Array] # @return [Array]
def uris def uris
@uris ||= @uris ||=
locales.map do |locale| destinations.map do |destination|
uri = "/#{locale}/".squeeze('/') locales.map do |locale|
dir = File.join(destination, locale) uri = "/#{locale}/".squeeze('/')
dir = File.join(destination, locale)
files(dir).map do |f| files(dir).map do |f|
uri + f uri + f
end
end end
end.flatten(2) end.flatten(3)
end end
# @return [Array] # @return [Array]