3namespace Bitrix\Landing\Assets;
5use Bitrix\Landing\Agent;
6use Bitrix\Landing\File;
7use Bitrix\Landing\Manager;
9use Bitrix\Main\FileTable;
10use Bitrix\Main\Security\Random;
11use Bitrix\Main\Web\WebPacker;
22 protected const LANG_RESOURCE =
'/bitrix/js/landing/webpackassets/message_loader.js';
72 $this->
package = new WebPacker\Resource\Package();
82 $this->landingId = $lid;
91 $this->packageHash =
$hash;
100 $this->filename =
$name;
105 if($this->packageHash)
107 $this->filename = self::DEFAULT_NAME .
'_' . $this->packageHash .
'_' . time() .
'.js';
111 $this->filename = self::DEFAULT_NAME .
'_' . Random::getString(16) .
'.js';
136 $res = $this->fileController->build();
137 if (
$res->isSuccess())
139 $this->fileId =
$res->getId();
156 $file = \CFile::GetByID(
$fileId)->Fetch();
157 $this->
setFileName($file[
'ORIGINAL_NAME'] ?: $this->filename);
160 $this->fileController->configureFile(
174 if ($this->landingId)
180 && $this->packageHash
181 && ($file = \CFile::GetByID(
$fileId)->Fetch())
182 && strpos($file[
'ORIGINAL_NAME'], self::DEFAULT_NAME .
'_' . $this->packageHash) === 0
193 $fileQuery = FileTable::query()
195 ->addSelect(
'ORIGINAL_NAME')
196 ->where(
'MODULE_ID', self::MODULE_ID)
197 ->where(
'%ORIGINAL_NAME', self::DEFAULT_NAME)
199 $file = $fileQuery->fetch();
201 return $file ? $file[
'ID'] :
null;
206 $this->profile->useAllLangs(
true);
212 $this->fileController->addExtension(self::CORE_EXTENSION);
213 $this->fileController->addModule(
229 return $this->fileController
231 ->setCacheTtl(self::$cacheTtl)
243 if (!$lid || empty($lid))
static addUniqueAgent(string $funcName, array $params=[], int $time=7200, ?int $nextExecDelay=null)
static markToRebuild($lid)
WebPacker FileController $fileController
addResource(string $resource)
WebPacker Resource Profile $profile
setPackageHash(string $hash)
setFileName(string $name)
WebPacker Resource Package $package
static markAllToRebuild()
static markAssetToRebuild($assetId=[])
static addToAsset($assetId, $fileId)
static getFilesFromAsset($assetId)
static clearCacheForLanding(int $lid)