Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
maarchRM
Commits
b4fbb2c7
Verified
Commit
b4fbb2c7
authored
Mar 17, 2020
by
Alexandre Morin
Browse files
hotfix 2.6.2
parent
a9398cf6
Pipeline
#7370
failed with stages
Changes
8
Pipelines
1
Show whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
b4fbb2c7
# CHANGELOG
## Version 2.6.2
-
`Added`
Possibiliter de récupérer un lien de téléchargement à la place du contenu binaire dans les réponses à l'appel web service de consultation
## Version 2.6.1
-
`Fixed`
Suppression du fichier temporaire lors de la validation de la ressource
...
...
MIGRATION.md
View file @
b4fbb2c7
# Migration 2.5 vers 2.6
## Configuration
### Lien de téléchargement d'une ressource
Cette configuration facultative permet au moment de la consultation, de recevoir une uri vers une ressource au lieu du contenu binaire.
À renseigner dans [recordsManagement] :
```
exportPath = "%laabsDirectory%/web/tmp"
```
## Configuration des instances publiées (hôte(s) virtuel(s) http et scripts en ligne de commande)
...
...
VERSION.md
View file @
b4fbb2c7
2.
6.
1
2.
6.
2
\ No newline at end of file
core/Response/AbstractResponse.php
View file @
b4fbb2c7
...
...
@@ -71,6 +71,12 @@ abstract class AbstractResponse
public
function
send
()
{
echo
$this
->
body
.
PHP_EOL
;
if
(
is_scalar
(
$this
->
body
))
{
echo
$this
->
body
.
PHP_EOL
;
}
elseif
(
is_resource
(
$this
->
body
))
{
$output
=
fopen
(
'php://output'
,
'w+'
);
stream_copy_to_stream
(
$this
->
body
,
$output
);
echo
PHP_EOL
;
}
}
}
\ No newline at end of file
core/Response/BatchResponse.php
View file @
b4fbb2c7
...
...
@@ -26,6 +26,12 @@ class BatchResponse
public
function
send
()
{
echo
$this
->
body
;
if
(
is_scalar
(
$this
->
body
))
{
echo
$this
->
body
.
PHP_EOL
;
}
elseif
(
is_resource
(
$this
->
body
))
{
$output
=
fopen
(
'php://output'
,
'w+'
);
stream_copy_to_stream
(
$this
->
body
,
$output
);
echo
PHP_EOL
;
}
}
}
\ No newline at end of file
data/maarchRM/conf/configuration.ini.default
View file @
b4fbb2c7
...
...
@@ -116,6 +116,9 @@ descriptionSchemes = "{
}
}"
; The path of resource export folder
exportPath = "%laabsDirectory%/web/tmp"
[audit]
; Send notifications on audit event
;notifications = "{
...
...
src/bundle/recordsManagement/Controller/archiveAccessTrait.php
View file @
b4fbb2c7
...
...
@@ -511,10 +511,11 @@ trait archiveAccessTrait
* @param string $archiveId The archive identifier
* @param string $resId The resource identifier
* @param bool $checkAccess Check access for originator or archiver. if false, caller MUST control access before or after
* @param bool $embedded Generate a binary content or a link
*
* @return digitalResource/digitalResource Archive resource contents
*/
public
function
consultation
(
$archiveId
,
$resId
,
$checkAccess
=
true
,
$isCommunication
=
false
)
public
function
consultation
(
$archiveId
,
$resId
,
$checkAccess
=
true
,
$isCommunication
=
false
,
$embedded
=
true
)
{
$accountController
=
\
laabs
::
newController
(
'auth/userAccount'
);
$accountController
->
isAuthorized
(
'user'
);
...
...
@@ -553,18 +554,21 @@ trait archiveAccessTrait
$binaryDataObject
=
\
laabs
::
newInstance
(
"recordsManagement/BinaryDataObject"
);
$binaryDataObject
->
attachment
=
new
\
stdClass
();
$binaryDataObject
->
attachment
->
uri
=
""
;
$binaryDataObject
->
attachment
->
filename
=
$digitalResource
->
fileName
;
if
(
\
laabs
::
isServiceClient
())
{
// Returns base64 encoded contents for web service clients
if
(
$embedded
===
false
||
$embedded
===
'false'
)
{
$binaryDataObject
->
attachment
->
uri
=
$this
->
createPublicResource
(
$digitalResource
->
getHandler
());
}
else
{
$binaryDataObject
->
attachment
->
data
=
\
core\Encoding\Base64
::
encode
(
$digitalResource
->
getHandler
());
}
}
else
{
// Let presenter stream the contents
$binaryDataObject
->
attachment
->
data
=
$digitalResource
->
getHandler
();
}
$binaryDataObject
->
attachment
->
uri
=
""
;
$binaryDataObject
->
attachment
->
filename
=
$digitalResource
->
fileName
;
if
(
!
empty
(
$digitalResource
->
fileExtension
))
{
$digitalResource
->
fileName
=
$digitalResource
->
fileName
.
$digitalResource
->
fileExtension
;
}
...
...
@@ -1275,4 +1279,34 @@ trait archiveAccessTrait
return
$archive
;
}
/**
* Create public resource
* @param $content The content of resource
*
* @return string $uri The uri of resource
*/
private
function
createPublicResource
(
$content
)
{
if
(
is_scalar
(
$content
))
{
$uid
=
hash
(
'md5'
,
$content
);
}
else
{
$uid
=
\
laabs\uniqid
();
}
if
(
isset
(
\
laabs
::
configuration
(
"recordsManagement"
)[
"exportPath"
]))
{
$dir
=
\
laabs
::
configuration
(
"recordsManagement"
)[
"exportPath"
];
}
else
{
$dir
=
".."
.
DIRECTORY_SEPARATOR
.
LAABS_WEB
.
DIRECTORY_SEPARATOR
.
LAABS_TMP
;
}
$pathUri
=
str_replace
(
DIRECTORY_SEPARATOR
,
LAABS_URI_SEPARATOR
,
$dir
);
$uri
=
$pathUri
.
LAABS_URI_SEPARATOR
.
$uid
;
$fp
=
fopen
(
$uri
,
'w'
);
stream_copy_to_stream
(
$content
,
$fp
);
fclose
(
$fp
);
return
$uri
;
}
}
src/bundle/recordsManagement/archiveInterface.php
View file @
b4fbb2c7
...
...
@@ -95,7 +95,7 @@ interface archiveInterface
*
* @action recordsManagement/archive/consultation
*/
public
function
readConsultation_archiveId_Digitalresource_resId_
(
$isCommunication
=
false
);
public
function
readConsultation_archiveId_Digitalresource_resId_
(
$isCommunication
=
false
,
$embedded
=
true
);
/**
* Retrieve an archive by its id
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment