mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-21 08:56:27 +02:00
refactor all media create to centralise copy of medias and save, etc.
This commit is contained in:
parent
92146ba8e1
commit
04a40049ce
18 changed files with 400 additions and 367 deletions
|
@ -332,10 +332,13 @@ namespace controllers\publics;
|
|||
{
|
||||
foreach ($files_arrays as $file)
|
||||
{
|
||||
$new_media_id = $this->internal_media->upload_and_create_for_user($_SESSION['user']['id'], $file);
|
||||
if (!$new_media_id)
|
||||
try
|
||||
{
|
||||
\FlashMessage\FlashMessage::push('danger', 'Impossible d\'upload et d\'enregistrer le fichier ' . $file['name']);
|
||||
$new_media_id = $this->internal_media->create_from_uploaded_file_for_user($_SESSION['user']['id'], $file);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
\FlashMessage\FlashMessage::push('danger', 'Impossible d\'upload et d\'enregistrer le fichier ' . $file['name'] . ':' . $e->getMessage());
|
||||
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
||||
}
|
||||
|
||||
|
@ -459,8 +462,11 @@ namespace controllers\publics;
|
|||
{
|
||||
foreach ($files_arrays as $file)
|
||||
{
|
||||
$new_media_id = $this->internal_media->upload_and_create_for_user($_SESSION['user']['id'], $file);
|
||||
if (!$new_media_id)
|
||||
try
|
||||
{
|
||||
$new_media_id = $this->internal_media->create_from_uploaded_file_for_user($_SESSION['user']['id'], $file);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
continue 2;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue