diff --git a/lib/Alchemy/Phrasea/PhraseanetService/Controller/PSAdminController.php b/lib/Alchemy/Phrasea/PhraseanetService/Controller/PSAdminController.php index 8093f61f0e..0c5e3e4c39 100644 --- a/lib/Alchemy/Phrasea/PhraseanetService/Controller/PSAdminController.php +++ b/lib/Alchemy/Phrasea/PhraseanetService/Controller/PSAdminController.php @@ -30,6 +30,15 @@ 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_key'])) { + $instanceKey = $this->app['conf']->get(['main', 'key']); + + $phraseanetLocalKey = md5($instanceKey); + + $app['conf']->set(['phraseanet-service', 'phraseanet_local_key'], $phraseanetLocalKey); + } + return $app->redirectPath('ps_admin'); } diff --git a/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php b/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php index 71f250a535..c94f45cc39 100644 --- a/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php +++ b/lib/Alchemy/Phrasea/WorkerManager/Worker/ExposeUploadWorker.php @@ -126,11 +126,11 @@ class ExposeUploadWorker implements WorkerInterface } } - $instanceKey = $this->app['conf']->get(['main', 'key']); + $phraseanetLocalKey = $this->app['conf']->get(['phraseanet-service', 'phraseanet_local_key']); // this is the unique reference for record in phraseanet and assets in expose - // instanceKey_basedID_record_id - $assetId = $instanceKey.'_'.$record->getId(); + // phraseanetLocalKey_basedID_record_id + $assetId = $phraseanetLocalKey.'_'.$record->getId(); $requestBody = [ 'publication_id' => $payload['publicationId'],