-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #386 from UN-OCHA/develop
v1.0.14
- Loading branch information
Showing
55 changed files
with
975 additions
and
1,019 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
uuid: f56298fa-014b-462a-a177-b767582d60c1 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- system | ||
theme: | ||
- common_design_subtheme | ||
id: soft_footer | ||
theme: common_design_subtheme | ||
region: footer_soft | ||
weight: 0 | ||
provider: null | ||
plugin: system_powered_by_block | ||
settings: | ||
id: system_powered_by_block | ||
label: 'Soft Footer' | ||
label_display: '0' | ||
provider: system | ||
visibility: { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 28 additions & 10 deletions
38
docker/etc/nginx/custom/lua/01_legacy_attachment_redirections.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
local attachment_file = ngx.var.attachment_file | ||
|
||
-- The generation of the UUID from the legacy URL is similar to what is done | ||
-- in \Drupal\reliefeb_utility\Helpers\LegacyHelper::getAttachmentUuid(). | ||
-- Try to get the attachment from a potential symlink. | ||
-- This handles the redirection for some location maps so that they all have | ||
-- the same pattern for example to compensate for some inconsistencies between | ||
-- the URL, URI in DB and file on disk in D7. | ||
-- This can also be used to handle aliases for some specific files. | ||
local symlink = ngx.var.document_root .. '/sites/default/files/legacy-attachments/' .. attachment_file; | ||
local handle = io.popen('readlink "' .. symlink .. '"') | ||
local target = handle:read() | ||
handle:close() | ||
|
||
-- Strip the % characters. | ||
attachment_file = string.gsub(attachment_file, "%%", '') | ||
-- If there was no symlink then we generated the target based on the filename. | ||
if target == nil or target == '' then | ||
-- The generation of the UUID from the legacy URL is similar to what is done | ||
-- in \Drupal\reliefeb_utility\Helpers\LegacyHelper::getAttachmentUuid(). | ||
|
||
-- Consolidate the URL. | ||
local legacy_url = 'https://reliefweb.int/sites/reliefweb.int/files/resources/' .. attachment_file | ||
-- Strip the % characters. | ||
attachment_file = string.gsub(attachment_file, "%%", '') | ||
|
||
-- Generate the UUID corresponding to the URL. | ||
local jit_uuid = require 'resty.jit-uuid' | ||
local uuid = jit_uuid.generate_v3('6ba7b811-9dad-11d1-80b4-00c04fd430c8', legacy_url) | ||
-- Consolidate the URL. | ||
local legacy_url = 'https://reliefweb.int/sites/reliefweb.int/files/resources/' .. attachment_file | ||
|
||
-- Generate the UUID corresponding to the URL. | ||
local jit_uuid = require 'resty.jit-uuid' | ||
local uuid = jit_uuid.generate_v3('6ba7b811-9dad-11d1-80b4-00c04fd430c8', legacy_url) | ||
|
||
target = uuid .. '/' .. attachment_file | ||
else | ||
local uuid = string.gsub(target, '../attachments/[^/]+/[^/]+/([^.]+).+', '%1') | ||
target = uuid .. '/' .. attachment_file | ||
end | ||
|
||
-- Redirect to the new URL. | ||
return ngx.redirect('/attachments/' .. uuid .. '/' .. attachment_file, 301) | ||
return ngx.redirect('/attachments/' .. target, 301) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
services: | ||
reliefweb_files.commands: | ||
class: \Drupal\reliefweb_files\Commands\ReliefWebFilesCommands | ||
arguments: ['@config.factory', '@database', '@entity_field.manager', '@entity_type.manager', '@reliefweb_files.client'] | ||
arguments: ['@config.factory', '@database', '@entity_field.manager', '@entity_type.manager', '@file_system', '@reliefweb_files.client'] | ||
tags: | ||
- { name: drush.command } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.