From 558119c87d60867415de23f3af2af80b0ed42f85 Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Sun, 16 Apr 2017 11:33:11 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BC=D0=B5=D0=B4=D0=B8=D0=B0=20-=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B5=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classes/modules/media/Media.class.php | 32 +++++++++++++++++++ framework | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/application/classes/modules/media/Media.class.php b/application/classes/modules/media/Media.class.php index 0a815ea9..ddc2131c 100644 --- a/application/classes/modules/media/Media.class.php +++ b/application/classes/modules/media/Media.class.php @@ -1149,6 +1149,38 @@ class ModuleMedia extends ModuleORM return false; } + /** + * Перегенерация всех превью + * + * @param array|string|null $aTypes Список типов для перегенерации + */ + public function ReCreateFilePreviewAll($aTypes = null) + { + $iPage = 1; + $aFilter = array( + 'is_preview' => 1, + 'target_id <>' => null, + '#with' => array('media'), + '#page' => array($iPage, 100) + ); + if ($aTypes) { + if (!is_array($aTypes)) { + $aTypes = array($aTypes); + } + $aFilter['target_type in'] = $aTypes; + } + + while ($aRes = $this->GetTargetItemsByFilter($aFilter) and $aRes['collection']) { + foreach ($aRes['collection'] as $oTarget) { + if ($oMedia = $oTarget->getMedia()) { + $this->CreateFilePreview($oMedia, $oTarget); + } + } + $iPage++; + $aFilter['#page'][0] = $iPage; + } + } + /** * Создает превью у файла для определенного типа * diff --git a/framework b/framework index 8b2b455b..d8082f10 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit 8b2b455b5efe9055e934576bd9cfa0f103173e6b +Subproject commit d8082f10ab01ba1fd9d30316378a392a1dc9dd55