mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
PHRAS-1856_PORT-PHRAS-1347
This commit is contained in:
@@ -432,8 +432,8 @@ class RegenerateSqliteDb extends Command
|
||||
if ($i < 3) {
|
||||
/** @var SubdefSubstituer $substituer */
|
||||
$substituer = $this->container['subdef.substituer'];
|
||||
$substituer->substitute($story, 'preview', $media);
|
||||
$substituer->substitute($story, 'thumbnail', $media);
|
||||
$substituer->substituteSubdef($story, 'preview', $media);
|
||||
$substituer->substituteSubdef($story, 'thumbnail', $media);
|
||||
}
|
||||
$DI['record_story_' . $i] = $story;
|
||||
}
|
||||
|
@@ -1010,7 +1010,15 @@ class V1Controller extends Controller
|
||||
return $this->getBadRequestAction($request, 'Missing name parameter');
|
||||
}
|
||||
|
||||
$media = $this->app->getMediaFromUri($file->getPathname());
|
||||
// Add file extension
|
||||
$uploadedFilename = $file->getRealPath();
|
||||
|
||||
$renamedFilename = $file->getRealPath() . '.' . pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION);
|
||||
|
||||
$this->getFilesystem()->rename($uploadedFilename, $renamedFilename);
|
||||
|
||||
$media = $this->app->getMediaFromUri($renamedFilename);
|
||||
|
||||
$record = $this->findDataboxById($request->get('databox_id'))->get_record($request->get('record_id'));
|
||||
$base_id = $record->getBaseId();
|
||||
$collection = \collection::getByBaseId($this->app, $base_id);
|
||||
@@ -1021,7 +1029,11 @@ class V1Controller extends Controller
|
||||
}
|
||||
$adapt = ($request->get('adapt')===null || !(\p4field::isno($request->get('adapt'))));
|
||||
$ret['adapt'] = $adapt;
|
||||
$this->getSubdefSubstituer()->substitute($record, $request->get('name'), $media, $adapt);
|
||||
if($request->get('name') == 'document') {
|
||||
$this->getSubdefSubstituer()->substituteDocument($record, $media, $adapt);
|
||||
} else {
|
||||
$this->getSubdefSubstituer()->substituteSubdef($record, $request->get('name'), $media, $adapt);
|
||||
}
|
||||
foreach ($record->get_embedable_medias() as $name => $media) {
|
||||
if ($name == $request->get('name') &&
|
||||
null !== ($subdef = $this->listEmbeddableMedia($request, $record, $media))) {
|
||||
@@ -2623,7 +2635,7 @@ class V1Controller extends Controller
|
||||
continue;
|
||||
}
|
||||
$media = $this->app->getMediaFromUri($value->getRealPath());
|
||||
$this->getSubdefSubstituer()->substitute($story, $name, $media);
|
||||
$this->getSubdefSubstituer()->substituteSubdef($story, $name, $media); // name = thumbnail | preview
|
||||
$this->getDataboxLogger($story->getDatabox())->log(
|
||||
$story,
|
||||
\Session_Logger::EVENT_SUBSTITUTE,
|
||||
|
@@ -225,8 +225,7 @@ class LazaretController extends Controller
|
||||
$media = $this->app->getMediaFromUri($lazaretFileName);
|
||||
|
||||
$record = $lazaretFile->getCollection($this->app)->get_databox()->get_record($recordId);
|
||||
$this->getSubDefinitionSubstituer()
|
||||
->substitute($record, 'document', $media);
|
||||
$this->getSubDefinitionSubstituer()->substituteDocument($record, $media);
|
||||
$this->getDataboxLogger($record->getDatabox())->log(
|
||||
$record,
|
||||
\Session_Logger::EVENT_SUBSTITUTE,
|
||||
|
@@ -192,7 +192,7 @@ class ToolsController extends Controller
|
||||
|
||||
$media = $this->app->getMediaFromUri($tempoFile);
|
||||
|
||||
$this->getSubDefinitionSubstituer()->substitute($record, 'document', $media);
|
||||
$this->getSubDefinitionSubstituer()->substituteDocument($record, $media);
|
||||
$record->insertTechnicalDatas($this->getMediaVorus());
|
||||
$this->getMetadataSetter()->replaceMetadata($this->getMetadataReader() ->read($media), $record);
|
||||
|
||||
@@ -252,7 +252,7 @@ class ToolsController extends Controller
|
||||
|
||||
$media = $this->app->getMediaFromUri($tempoFile);
|
||||
|
||||
$this->getSubDefinitionSubstituer()->substitute($record, 'thumbnail', $media);
|
||||
$this->getSubDefinitionSubstituer()->substituteSubdef($record, 'thumbnail', $media);
|
||||
$this->getDataboxLogger($record->getDatabox())
|
||||
->log($record, \Session_Logger::EVENT_SUBSTITUTE, 'thumbnail', '');
|
||||
|
||||
@@ -416,7 +416,11 @@ class ToolsController extends Controller
|
||||
|
||||
$media = $this->app->getMediaFromUri($fileName);
|
||||
|
||||
$this->getSubDefinitionSubstituer()->substitute($record, $subDefName, $media);
|
||||
if($subDefName == 'document') {
|
||||
$this->getSubDefinitionSubstituer()->substituteDocument($record, $media);
|
||||
} else {
|
||||
$this->getSubDefinitionSubstituer()->substituteSubdef($record, $subDefName, $media);
|
||||
}
|
||||
$this->getDataboxLogger($record->getDatabox())
|
||||
->log($record, \Session_Logger::EVENT_SUBSTITUTE, $subDefName, '');
|
||||
|
||||
|
@@ -193,7 +193,7 @@ class UploadController extends Controller
|
||||
file_put_contents($fileName, $dataUri->getData());
|
||||
$media = $this->app->getMediaFromUri($fileName);
|
||||
|
||||
$this->getSubDefinitionSubstituer()->substitute($elementCreated, 'thumbnail', $media);
|
||||
$this->getSubDefinitionSubstituer()->substituteSubdef($elementCreated, 'thumbnail', $media);
|
||||
$this->getDataboxLogger($elementCreated->getDatabox())
|
||||
->log($elementCreated, \Session_Logger::EVENT_SUBSTITUTE, 'thumbnail', '');
|
||||
|
||||
|
@@ -1003,7 +1003,7 @@ class ArchiveJob extends AbstractJob
|
||||
}
|
||||
|
||||
$story = \record_adapter::createStory($app, $collection);
|
||||
$app['subdef.substituer']->substitute($story, 'document', $media);
|
||||
$app['subdef.substituer']->substituteDocument($story, $media);
|
||||
|
||||
$story->set_metadatas($metadatas->toMetadataArray($metadatasStructure), true);
|
||||
|
||||
|
Reference in New Issue
Block a user