Commit 28774dff authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remove differences with CE version of update_pages_service.rb

parent e0c77b31
...@@ -74,7 +74,7 @@ module Projects ...@@ -74,7 +74,7 @@ module Projects
end end
def extract_archive!(temp_path) def extract_archive!(temp_path)
if artifacts_filename.ends_with?('.zip') if artifacts.ends_with?('.zip')
extract_zip_archive!(temp_path) extract_zip_archive!(temp_path)
else else
raise InvaildStateError, 'unsupported artifacts format' raise InvaildStateError, 'unsupported artifacts format'
...@@ -97,7 +97,7 @@ module Projects ...@@ -97,7 +97,7 @@ module Projects
# We add * to end of SITE_PATH, because we want to extract SITE_PATH and all subdirectories # We add * to end of SITE_PATH, because we want to extract SITE_PATH and all subdirectories
site_path = File.join(SITE_PATH, '*') site_path = File.join(SITE_PATH, '*')
build.artifacts_file.use_file do |artifacts_path| build.artifacts_file.use_file do |artifacts_path|
unless system(*%W(unzip -qq -n #{artifacts_path} #{site_path} -d #{temp_path})) unless system(*%W(unzip -n #{artifacts_path} #{site_path} -d #{temp_path}))
raise FailedToExtractError, 'pages failed to extract' raise FailedToExtractError, 'pages failed to extract'
end end
end end
...@@ -130,10 +130,6 @@ module Projects ...@@ -130,10 +130,6 @@ module Projects
1 + max_size / BLOCK_SIZE 1 + max_size / BLOCK_SIZE
end end
def artifacts_filename
build.artifacts_file.filename
end
def max_size def max_size
max_pages_size = Gitlab::CurrentSettings.max_pages_size.megabytes max_pages_size = Gitlab::CurrentSettings.max_pages_size.megabytes
...@@ -162,6 +158,10 @@ module Projects ...@@ -162,6 +158,10 @@ module Projects
build.ref build.ref
end end
def artifacts
build.artifacts_file.path
end
def delete_artifact! def delete_artifact!
build.reload # Reload stable object to prevent erase artifacts with old state build.reload # Reload stable object to prevent erase artifacts with old state
build.erase_artifacts! unless build.has_expiring_artifacts? build.erase_artifacts! unless build.has_expiring_artifacts?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment