36 $tempDirPath = \CTempFile::getDirectoryName($timeToLive,
array($prefix, \uniqid($prefix,
true)));
37 $tempDir =
new static($tempDirPath);
38 if (!$tempDir->isExists())
62 bool $recursive =
false,
63 bool $convertEncoding =
false,
64 string $sourceEncoding =
'',
65 string $targetEncoding =
''
68 if (\mb_strpos($target->getPhysicalPath(), $this->getPhysicalPath()) === 0)
80 if (!$target->isExists())
92 if (in_array($entry->getName(), Translate\IGNORE_FS_NAMES,
true))
98 ($entry instanceof Main\IO\Directory) &&
99 $entry->isDirectory() &&
103 $source =
new self($entry->getPhysicalPath());
104 $res = $source->copy(
105 (
new Main\IO\Directory($target->getPhysicalPath().
'/'. $entry->getName())),
120 ($entry instanceof Main\IO\File) &&
124 $file =
new Main\IO\File($target->getPhysicalPath().
'/'. $entry->getName());
125 if ($file->isExists() && !$reWrite)
135 if ($convertEncoding)
137 $content = \Bitrix\Main\Text\Encoding::convertEncoding(
$content, $sourceEncoding, $targetEncoding);
142 catch (Main\IO\IoException $exception)
165 public function copyLangOnly(
166 Main\IO\Directory $target,
168 bool $convertEncoding =
false,
169 string $sourceEncoding =
'',
170 string $targetEncoding =
''
173 if (mb_strpos($target->getPhysicalPath(), $this->getPhysicalPath()) === 0)
175 $this->
addError(
new Main\
Error(
'Destination is inside in the source folder.'));
193 $dirName =
$dir->getName();
195 !
$dir instanceof Main\IO\Directory ||
196 !
$dir->isDirectory() ||
197 \in_array($dirName, Translate\IGNORE_FS_NAMES,
true)
203 if ($dirName ===
'lang' || $dirName ===
'payment')
205 $source =
new self(
$dir->getPhysicalPath().
'/'. $languageId);
206 if ($source->isExists())
208 if (!$target->isExists())
212 $targetDir = $target->createSubdirectory($dirName)->createSubdirectory($languageId);
214 $res = $source->copy(
231 $source =
new self(
$dir->getPhysicalPath());
232 $res = $source->copyLangOnly(
233 (
new Main\IO\Directory($target->getPhysicalPath().
'/'. $dirName)),
274 if (
$filter instanceof \Closure)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)