Доработка медиа - перегенерация превью

This commit is contained in:
Mzhelskiy Maxim 2017-04-16 11:33:11 +07:00
parent 3ec7342ef2
commit 558119c87d
2 changed files with 33 additions and 1 deletions

View File

@ -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;
}
}
/**
* Создает превью у файла для определенного типа
*

@ -1 +1 @@
Subproject commit 8b2b455b5efe9055e934576bd9cfa0f103173e6b
Subproject commit d8082f10ab01ba1fd9d30316378a392a1dc9dd55