34 $warning = error_get_last();
35 if ($warning && $warning[
'type'] == E_WARNING) {
36 return 'Warning!' . $warning[
'message'];
152 'The contents from the "%1" file can\'t be read. %2',
217 $parentDir = dirname(
$path);
218 while (!
is_dir($parentDir)) {
226 throw new FileSystemException(
228 'Directory "%1" cannot be created %2',
247 $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS;
252 $result[] = $file->getPathname();
256 }
catch (\Exception $e) {
257 throw new FileSystemException(
new \
Magento\Framework\Phrase($e->getMessage()), $e);
272 $globPattern = rtrim(
$path,
'/') .
'/' . ltrim(
$pattern,
'/');
289 $targetDriver = $targetDriver ?: $this;
290 if (get_class($targetDriver) == get_class($this)) {
294 if (
false !== $targetDriver->filePutContents($newPath,
$content)) {
301 'The path "%1" cannot be renamed into "%2" %3',
320 $targetDriver = $targetDriver ?: $this;
321 if (get_class($targetDriver) == get_class($this)) {
330 'The file or directory "%1" cannot be copied to "%2" %3',
354 if ($targetDriver ===
null || get_class($targetDriver) == get_class($this)) {
360 'A symlink for "%1" can\'t be created and placed to "%2". %3',
385 'The "%1" file can\'t be deleted. %2',
402 $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS;
414 throw new FileSystemException(
416 'The directory "%1" cannot be deleted %2',
438 'The permissions can\'t be changed for the "%1" path. %2.',
464 throw new FileSystemException(
466 'The permissions can\'t be changed for the "%1" path. %2.',
472 $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS;
474 $iterator = new \RecursiveIteratorIterator(
475 new \RecursiveDirectoryIterator(
$path, $flags),
476 \RecursiveIteratorIterator::CHILD_FIRST
486 throw new FileSystemException(
488 'The permissions can\'t be changed for the "%1" path. %2.',
507 if (!$modificationTime) {
515 'The "%1" file or directory can\'t be touched. %2',
538 'The specified "%1" file couldn\'t be written. %2',
621 'The "%1" CSV handle is incorrect. Verify the handle and try again.',
662 'An error occurred during "%1" fileSeek execution.',
694 'An error occurred during "%1" fileClose execution.',
712 $lenData = strlen(
$data);
716 $this->fileSystemException(
'Unable to write');
718 if (
false === $fwrite) {
719 $this->fileSystemException(
720 'An error occurred during "%1" fileWrite execution.',
764 if (isset(
$value[0]) && in_array(
$value[0], [
'=',
'+',
'-'])) {
771 throw new FileSystemException(
773 'An error occurred during "%1" filePutCsv execution.',
794 'An error occurred during "%1" fileFlush execution.',
816 'An error occurred during "%1" fileLock execution.',
837 'An error occurred during "%1" fileUnlock execution.',
856 if (0 === strpos(
$path, $basePath)) {
873 if (strpos(
$path, $basePath) === 0 || $basePath ==
$path .
'/') {
890 return str_replace(
'\\',
'/',
$path);
914 $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS;
916 $iterator = new \RecursiveIteratorIterator(
917 new \RecursiveDirectoryIterator(
$path, $flags),
918 \RecursiveIteratorIterator::CHILD_FIRST
922 $result[] = $file->getPathname();
924 }
catch (\Exception $e) {
925 throw new FileSystemException(
new \
Magento\Framework\
Phrase($e->getMessage()), $e);
939 return realpath(
$path);
950 if (strpos(
$path, DIRECTORY_SEPARATOR .
'..' . DIRECTORY_SEPARATOR) ===
false) {
955 $path = preg_replace(
956 '/\\' .DIRECTORY_SEPARATOR .
'\\' .DIRECTORY_SEPARATOR .
'+/',
960 $pathParts = explode(DIRECTORY_SEPARATOR,
$path);
962 foreach ($pathParts as $pathPart) {
963 if ($pathPart ==
'.') {
966 if ($pathPart ==
'..') {
967 array_pop($realPath);
970 $realPath[] = $pathPart;
972 return implode(DIRECTORY_SEPARATOR, $realPath);
createDirectory($path, $permissions=0777)
copy($source, $destination, DriverInterface $targetDriver=null)
symlink($source, $destination, DriverInterface $targetDriver=null)
getAbsolutePath($basePath, $path, $scheme=null)
fileWrite($resource, $data)
static glob($pattern, $flags=0, $forceFallback=false)
fileGetContents($path, $flag=null, $context=null)
filePutContents($path, $content, $mode=null)
fileGetCsv($resource, $length=0, $delimiter=',', $enclosure='"', $escape = '\\')
readDirectoryRecursively($path=null)
rename($oldPath, $newPath, DriverInterface $targetDriver=null)
fileReadLine($resource, $length, $ending=null)
touch($path, $modificationTime=null)
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
fileRead($resource, $length)
fileSeek($resource, $offset, $whence=SEEK_SET)
changePermissions($path, $permissions)
changePermissionsRecursively($path, $dirPermissions, $filePermissions)
mkdir($pathname, $mode=0777, $recursive=false, $context=null)
getRelativePath($basePath, $path=null)
fileLock($resource, $lockMode=LOCK_EX)
filePutCsv($resource, array $data, $delimiter=',', $enclosure='"')
getParentDirectory($path)