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