mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-07 18:14:35 +00:00
change behavior api_token_header
This commit is contained in:
76
lib/classes/patch/412.php
Normal file
76
lib/classes/patch/412.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class patch_412 implements patchInterface
|
||||
{
|
||||
/** @var string */
|
||||
private $release = '4.1.2';
|
||||
|
||||
/** @var array */
|
||||
private $concern = [base::APPLICATION_BOX];
|
||||
|
||||
/**
|
||||
* Returns the release version.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDoctrineMigrations()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply patch.
|
||||
*
|
||||
* @param base $base The Application Box or the Data Boxes where the patch is applied.
|
||||
* @param \Alchemy\Phrasea\Application $app
|
||||
*
|
||||
* @return boolean returns true if the patch succeed.
|
||||
*/
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
// move api_require_ssl place in configuration.yml
|
||||
if ($app['conf']->has(['main', 'api_require_ssl'])) {
|
||||
$apiRequireSslValue = $app['conf']->get(['main', 'api_require_ssl']);
|
||||
$app['conf']->remove(['main', 'api_require_ssl']);
|
||||
$app['conf']->set(['registry', 'api-clients', 'api_require_ssl'], $apiRequireSslValue);
|
||||
}
|
||||
|
||||
// change api_token_header place and name in configuration.yml
|
||||
if ($app['conf']->has(['main', 'api_token_header'])) {
|
||||
$apiTokenHeaderValue = $app['conf']->get(['main', 'api_token_header']);
|
||||
$app['conf']->remove(['main', 'api_token_header']);
|
||||
$app['conf']->set(['registry', 'api-clients', 'api_token_header_only'], $apiTokenHeaderValue);
|
||||
}
|
||||
|
||||
// add svg in extension-mapping
|
||||
if (!$app['conf']->has(['border-manager', 'extension-mapping', 'svg'])) {
|
||||
$app['conf']->set(['border-manager', 'extension-mapping', 'svg'], 'image/svg+xml');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user