mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-06 17:44:21 +00:00
PHRAS-3935 : phraseanet_local_id became instance_id (#4396)
* phraseanet_local_id patch * display phraseanet_local_id * phraseanet_local_id to instance_id * update embed bumdle
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
"php": ">=7.0 <7.1",
|
||||
"ext-intl": "*",
|
||||
"alchemy-fr/tcpdf-clone": "~6.0",
|
||||
"alchemy/embed-bundle": "^2.0.15",
|
||||
"alchemy/embed-bundle": "^2.0.16",
|
||||
"alchemy/geonames-api-consumer": "~0.1.0",
|
||||
"alchemy/mediavorus": "^0.4.4",
|
||||
"alchemy/oauth2php": "1.1.0",
|
||||
|
14
composer.lock
generated
14
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "9e7490439544a7184da9a64bd9f3012f",
|
||||
"content-hash": "08ce5acbe4eab8cb20d1881545d60071",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alchemy-fr/tcpdf-clone",
|
||||
@@ -131,16 +131,16 @@
|
||||
},
|
||||
{
|
||||
"name": "alchemy/embed-bundle",
|
||||
"version": "2.0.15",
|
||||
"version": "2.0.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alchemy-fr/embed-bundle.git",
|
||||
"reference": "835a6b0cfce6b966df1b73c3a651a742ebe9449a"
|
||||
"reference": "81b67d90d1720f9ff49ee4033f6d1b61b56e4809"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/835a6b0cfce6b966df1b73c3a651a742ebe9449a",
|
||||
"reference": "835a6b0cfce6b966df1b73c3a651a742ebe9449a",
|
||||
"url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/81b67d90d1720f9ff49ee4033f6d1b61b56e4809",
|
||||
"reference": "81b67d90d1720f9ff49ee4033f6d1b61b56e4809",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
@@ -178,10 +178,10 @@
|
||||
],
|
||||
"description": "Embed resources bundle",
|
||||
"support": {
|
||||
"source": "https://github.com/alchemy-fr/embed-bundle/tree/2.0.15",
|
||||
"source": "https://github.com/alchemy-fr/embed-bundle/tree/2.0.16",
|
||||
"issues": "https://github.com/alchemy-fr/embed-bundle/issues"
|
||||
},
|
||||
"time": "2023-10-14T10:42:19+00:00"
|
||||
"time": "2023-10-19T11:28:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "alchemy/geonames-api-consumer",
|
||||
|
@@ -35,15 +35,6 @@ class PSAdminController extends Controller
|
||||
if ($form->isValid()) {
|
||||
$app['conf']->set(['phraseanet-service', 'expose-service'], $form->getData());
|
||||
|
||||
// generate a uniq key between phraseanet service and the phraseanet instance if not exist
|
||||
if(!$app['conf']->has(['phraseanet-service', 'phraseanet_local_id'])) {
|
||||
$instanceKey = $this->app['conf']->get(['main', 'key']);
|
||||
|
||||
$phraseanetLocalId = md5($instanceKey);
|
||||
|
||||
$app['conf']->set(['phraseanet-service', 'phraseanet_local_id'], $phraseanetLocalId);
|
||||
}
|
||||
|
||||
return $app->redirectPath('ps_admin', ['_fragment'=>'expose']);
|
||||
}
|
||||
|
||||
|
@@ -1195,9 +1195,9 @@ class PSExposeController extends Controller
|
||||
*/
|
||||
private function getExposeMappingName($mappingContext)
|
||||
{
|
||||
$phraseanetLocalId = $this->app['conf']->get(['phraseanet-service', 'phraseanet_local_id']);
|
||||
$instanceId = $this->app['conf']->get(['main', 'instance_id']);
|
||||
|
||||
return $phraseanetLocalId.'_'. $mappingContext . '_mapping';
|
||||
return $instanceId . '_' . $mappingContext . '_mapping';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -192,6 +192,9 @@ class Installer
|
||||
$config['servername'] = $serverName;
|
||||
$config['main']['key'] = $this->app['random.medium']->generateString(16);
|
||||
|
||||
// generate from the random instance key
|
||||
$config['main']['instance_id'] = md5($config['main']['key']);
|
||||
|
||||
// define storage config
|
||||
$defaultStoragePaths = [
|
||||
'subdefs' => __DIR__ . '/../../../../datas',
|
||||
|
@@ -106,12 +106,12 @@ class ExposeUploadWorker implements WorkerInterface
|
||||
$helpers = new PhraseanetExtension($this->app);
|
||||
|
||||
// the identification of phraseanet instance in expose
|
||||
$phraseanetLocalId = $this->app['conf']->get(['phraseanet-service', 'phraseanet_local_id']);
|
||||
$instanceId = $this->app['conf']->get(['main', 'instance_id']);
|
||||
|
||||
// get mapping if exist
|
||||
$clientAnnotationProfile = $this->getClientAnnotationProfile($exposeClient, $payload['publicationId']);
|
||||
|
||||
$exposeFieldMappingName = $phraseanetLocalId . '_field_mapping';
|
||||
$exposeFieldMappingName = $instanceId . '_field_mapping';
|
||||
$fieldMapping = !empty($clientAnnotationProfile[$exposeFieldMappingName]) ? $clientAnnotationProfile[$exposeFieldMappingName] : [];
|
||||
$fieldListToUpload = !empty($fieldMapping['fields']) ? $fieldMapping['fields'] : [];
|
||||
|
||||
@@ -199,7 +199,7 @@ class ExposeUploadWorker implements WorkerInterface
|
||||
}
|
||||
}
|
||||
|
||||
$exposeSubdefMappingName = $phraseanetLocalId . '_subdef_mapping';
|
||||
$exposeSubdefMappingName = $instanceId . '_subdef_mapping';
|
||||
$actualSubdefMapping = !empty($clientAnnotationProfile[$exposeSubdefMappingName]) ? $clientAnnotationProfile[$exposeSubdefMappingName] : [];
|
||||
$documentType = $record->getType();
|
||||
|
||||
@@ -217,8 +217,8 @@ class ExposeUploadWorker implements WorkerInterface
|
||||
unset($mapping[$phraseanetSubdefAsDocument]);
|
||||
|
||||
// this is the unique reference for record in phraseanet and assets in expose
|
||||
// phraseanetLocalKey_basedID_record_id
|
||||
$assetId = $phraseanetLocalId.'_'.$record->getId();
|
||||
// instanceId_basedID_record_id
|
||||
$assetId = $instanceId . '_' . $record->getId();
|
||||
|
||||
if ($record->has_subdef($phraseanetSubdefAsDocument) && $record->get_subdef($phraseanetSubdefAsDocument)->is_physically_present()) {
|
||||
$requestBody = [
|
||||
|
85
lib/classes/patch/418RC7PHRAS3935.php
Normal file
85
lib/classes/patch/418RC7PHRAS3935.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||
|
||||
class patch_418RC7PHRAS3935 implements patchInterface
|
||||
{
|
||||
/** @var string */
|
||||
private $release = '4.1.8-rc7';
|
||||
|
||||
/** @var array */
|
||||
private $concern = [base::APPLICATION_BOX];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDoctrineMigrations()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function apply(base $base, Application $app)
|
||||
{
|
||||
if ($base->get_base_type() === base::DATA_BOX) {
|
||||
$this->patch_databox($base, $app);
|
||||
} elseif ($base->get_base_type() === base::APPLICATION_BOX) {
|
||||
$this->patch_appbox($base, $app);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function patch_databox(databox $databox, Application $app)
|
||||
{
|
||||
}
|
||||
|
||||
private function patch_appbox(base $appbox, Application $app)
|
||||
{
|
||||
/** @var PropertyAccess $conf */
|
||||
$conf = $app['conf'];
|
||||
|
||||
if (!$conf->has(['main', 'instance_id'])) {
|
||||
if ($conf->has(['phraseanet-service', 'phraseanet_local_id'])) {
|
||||
// get phraseanet_local_id if exist
|
||||
$conf->set(['main', 'instance_id'], $conf->get(['phraseanet-service', 'phraseanet_local_id']));
|
||||
$conf->remove(['phraseanet-service', 'phraseanet_local_id']);
|
||||
} else {
|
||||
// instance key is already a random value
|
||||
$instanceKey = $conf->get(['main', 'key']);
|
||||
|
||||
$instanceId = md5($instanceKey);
|
||||
|
||||
$conf->set(['main', 'instance_id'], $instanceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,9 @@
|
||||
<h1>{{ 'admin:phrasea-service-setting:tab-title:: Page title' | trans }}</h1>
|
||||
|
||||
<div style="margin-bottom:20px;">
|
||||
<label>instance_id: <code style="padding:10px 15px;">{{ app['conf'].get(['main', 'instance_id'], '') }}</code></label>
|
||||
</div>
|
||||
|
||||
<div class="phraseanet-service-setting-tabs">
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="auth"><a aria-controls="auth" href="#auth" role="tab" data-toggle="tab" data-url="/admin/phraseanet-service/auth">{{ 'admin:phrasea-service-setting:tab:: Auth' | trans }}</a></li>
|
||||
|
Reference in New Issue
Block a user