ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
League\Flysystem\Adapter\Local Class Reference
+ Inheritance diagram for League\Flysystem\Adapter\Local:
+ Collaboration diagram for League\Flysystem\Adapter\Local:

Public Member Functions

 __construct ($root, $writeFlags=LOCK_EX, $linkHandling=self::DISALLOW_LINKS, array $permissions=[])
 Constructor. More...
 
 has ($path)
 Check whether a file exists.
Parameters
string$path
Returns
array|bool|null
More...
 
 write ($path, $contents, Config $config)
 Write a new file.
Parameters
string$path
string$contents
Config$configConfig object
Returns
array|false false on failure file meta data on success
More...
 
 writeStream ($path, $resource, Config $config)
 Write a new file using a stream.
Parameters
string$path
resource$resource
Config$configConfig object
Returns
array|false false on failure file meta data on success
More...
 
 readStream ($path)
 Read a file as a stream.
Parameters
string$path
Returns
array|false
More...
 
 updateStream ($path, $resource, Config $config)
 Update a file using a stream.
Parameters
string$path
resource$resource
Config$configConfig object
Returns
array|false false on failure file meta data on success
More...
 
 update ($path, $contents, Config $config)
 Update a file.
Parameters
string$path
string$contents
Config$configConfig object
Returns
array|false false on failure file meta data on success
More...
 
 read ($path)
 Read a file.
Parameters
string$path
Returns
array|false
More...
 
 rename ($path, $newpath)
 Rename a file.
Parameters
string$path
string$newpath
Returns
bool
More...
 
 copy ($path, $newpath)
 Copy a file.
Parameters
string$path
string$newpath
Returns
bool
More...
 
 delete ($path)
 Delete a file.
Parameters
string$path
Returns
bool
More...
 
 listContents ($directory='', $recursive=false)
 List contents of a directory.
Parameters
string$directory
bool$recursive
Returns
array
More...
 
 getMetadata ($path)
 Get all the meta data of a file or directory.
Parameters
string$path
Returns
array|false
More...
 
 getSize ($path)
 Get the size of a file.
Parameters
string$path
Returns
array|false
More...
 
 getMimetype ($path)
 Get the mimetype of a file.
Parameters
string$path
Returns
array|false
More...
 
 getTimestamp ($path)
 Get the timestamp of a file.
Parameters
string$path
Returns
array|false
More...
 
 getVisibility ($path)
 Get the visibility of a file.
Parameters
string$path
Returns
array|false
More...
 
 setVisibility ($path, $visibility)
 Set the visibility for a file.
Parameters
string$path
string$visibility
Returns
array|false file meta data
More...
 
 createDir ($dirname, Config $config)
 Create a directory.
Parameters
string$dirnamedirectory name
Config$config
Returns
array|false
More...
 
- Public Member Functions inherited from League\Flysystem\Adapter\AbstractAdapter
 setPathPrefix ($prefix)
 Set the path prefix. More...
 
 getPathPrefix ()
 Get the path prefix. More...
 
 applyPathPrefix ($path)
 Prefix a path. More...
 
 removePathPrefix ($path)
 Remove a path prefix. More...
 
- Public Member Functions inherited from League\Flysystem\AdapterInterface
 deleteDir ($dirname)
 Delete a directory. More...
 

Data Fields

const SKIP_LINKS = 0001
 
const DISALLOW_LINKS = 0002
 
- Data Fields inherited from League\Flysystem\AdapterInterface
const VISIBILITY_PUBLIC = 'public'
 VISIBILITY_PUBLIC public visibility More...
 
const VISIBILITY_PRIVATE = 'private'
 VISIBILITY_PRIVATE private visibility More...
 

Protected Member Functions

 ensureDirectory ($root)
 Ensure the root directory exists. More...
 
 deleteFileInfoObject (SplFileInfo $file)
 
 normalizeFileInfo (SplFileInfo $file)
 Normalize the file info. More...
 
 getFilePath (SplFileInfo $file)
 Get the normalized path from a SplFileInfo object. More...
 
 getRecursiveDirectoryIterator ($path, $mode=RecursiveIteratorIterator::SELF_FIRST)
 
 getDirectoryIterator ($path)
 
 mapFileInfo (SplFileInfo $file)
 
 guardAgainstUnreadableFileInfo (SplFileInfo $file)
 

Protected Attributes

 $pathSeparator = DIRECTORY_SEPARATOR
 
 $permissionMap
 
 $writeFlags
 
- Protected Attributes inherited from League\Flysystem\Adapter\AbstractAdapter
 $pathPrefix
 
 $pathSeparator = '/'
 

Static Protected Attributes

static $permissions
 

Private Attributes

 $linkHandling
 

Detailed Description

Definition at line 19 of file Local.php.

Constructor & Destructor Documentation

◆ __construct()

League\Flysystem\Adapter\Local::__construct (   $root,
  $writeFlags = LOCK_EX,
  $linkHandling = self::DISALLOW_LINKS,
array  $permissions = [] 
)

Constructor.

Parameters
string$root
int$writeFlags
int$linkHandling
array$permissions
Exceptions
LogicException

Definition at line 74 of file Local.php.

References League\Flysystem\Adapter\Local\$linkHandling, League\Flysystem\Adapter\Local\$permissions, League\Flysystem\Adapter\Local\$writeFlags, League\Flysystem\Adapter\Local\ensureDirectory(), and League\Flysystem\Adapter\AbstractAdapter\setPathPrefix().

75  {
76  $root = is_link($root) ? realpath($root) : $root;
77  $this->permissionMap = array_replace_recursive(static::$permissions, $permissions);
78  $this->ensureDirectory($root);
79 
80  if ( ! is_dir($root) || ! is_readable($root)) {
81  throw new LogicException('The root path ' . $root . ' is not readable.');
82  }
83 
84  $this->setPathPrefix($root);
85  $this->writeFlags = $writeFlags;
86  $this->linkHandling = $linkHandling;
87  }
setPathPrefix($prefix)
Set the path prefix.
ensureDirectory($root)
Ensure the root directory exists.
Definition: Local.php:98
+ Here is the call graph for this function:

Member Function Documentation

◆ copy()

League\Flysystem\Adapter\Local::copy (   $path,
  $newpath 
)

Copy a file.

Parameters
string$path
string$newpath
Returns
bool

Implements League\Flysystem\AdapterInterface.

Definition at line 240 of file Local.php.

References $destination, $location, $path, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), and League\Flysystem\Adapter\Local\ensureDirectory().

241  {
242  $location = $this->applyPathPrefix($path);
243  $destination = $this->applyPathPrefix($newpath);
244  $this->ensureDirectory(dirname($destination));
245 
246  return copy($location, $destination);
247  }
$location
Definition: buildRTE.php:44
$destination
ensureDirectory($root)
Ensure the root directory exists.
Definition: Local.php:98
copy($path, $newpath)
Copy a file.bool
Definition: Local.php:240
+ Here is the call graph for this function:

◆ createDir()

League\Flysystem\Adapter\Local::createDir (   $dirname,
Config  $config 
)

Create a directory.

Parameters
string$dirnamedirectory name
Config$config
Returns
array|false

Implements League\Flysystem\AdapterInterface.

Definition at line 361 of file Local.php.

References $contents, $file, $location, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), League\Flysystem\AdapterInterface\deleteDir(), League\Flysystem\Adapter\Local\deleteFileInfoObject(), League\Flysystem\Config\get(), League\Flysystem\Adapter\Local\getRecursiveDirectoryIterator(), and League\Flysystem\Adapter\Local\guardAgainstUnreadableFileInfo().

362  {
363  $location = $this->applyPathPrefix($dirname);
364  $umask = umask(0);
365  $visibility = $config->get('visibility', 'public');
366 
367  if ( ! is_dir($location) && ! mkdir($location, $this->permissionMap['dir'][$visibility], true)) {
368  $return = false;
369  } else {
370  $return = ['path' => $dirname, 'type' => 'dir'];
371  }
372 
373  umask($umask);
374 
375  return $return;
376  }
$location
Definition: buildRTE.php:44
+ Here is the call graph for this function:

◆ delete()

League\Flysystem\Adapter\Local::delete (   $path)

Delete a file.

Parameters
string$path
Returns
bool

Implements League\Flysystem\AdapterInterface.

Definition at line 252 of file Local.php.

References $location, $path, and League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix().

253  {
254  $location = $this->applyPathPrefix($path);
255 
256  return unlink($location);
257  }
$location
Definition: buildRTE.php:44
+ Here is the call graph for this function:

◆ deleteFileInfoObject()

League\Flysystem\Adapter\Local::deleteFileInfoObject ( SplFileInfo  $file)
protected
Parameters
SplFileInfo$file

Definition at line 403 of file Local.php.

Referenced by League\Flysystem\Adapter\Local\createDir().

404  {
405  switch ($file->getType()) {
406  case 'dir':
407  rmdir($file->getRealPath());
408  break;
409  case 'link':
410  unlink($file->getPathname());
411  break;
412  default:
413  unlink($file->getRealPath());
414  }
415  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

◆ ensureDirectory()

League\Flysystem\Adapter\Local::ensureDirectory (   $root)
protected

Ensure the root directory exists.

Parameters
string$rootroot directory path
Returns
void
Exceptions
Exceptionin case the root directory can not be created

Definition at line 98 of file Local.php.

Referenced by League\Flysystem\Adapter\Local\__construct(), League\Flysystem\Adapter\Local\copy(), League\Flysystem\Adapter\Local\rename(), League\Flysystem\Adapter\Local\write(), and League\Flysystem\Adapter\Local\writeStream().

99  {
100  if ( ! is_dir($root)) {
101  $umask = umask(0);
102  @mkdir($root, $this->permissionMap['dir']['public'], true);
103  umask($umask);
104 
105  if ( ! is_dir($root)) {
106  throw new Exception(sprintf('Impossible to create the root directory "%s".', $root));
107  }
108  }
109  }
+ Here is the caller graph for this function:

◆ getDirectoryIterator()

League\Flysystem\Adapter\Local::getDirectoryIterator (   $path)
protected
Parameters
string$path
Returns
DirectoryIterator

Definition at line 471 of file Local.php.

References $path.

Referenced by League\Flysystem\Adapter\Local\listContents().

472  {
473  $iterator = new DirectoryIterator($path);
474 
475  return $iterator;
476  }
+ Here is the caller graph for this function:

◆ getFilePath()

League\Flysystem\Adapter\Local::getFilePath ( SplFileInfo  $file)
protected

Get the normalized path from a SplFileInfo object.

Parameters
SplFileInfo$file
Returns
string

Definition at line 444 of file Local.php.

References $location, $path, and League\Flysystem\Adapter\AbstractAdapter\removePathPrefix().

Referenced by League\Flysystem\Adapter\Local\listContents(), and League\Flysystem\Adapter\Local\mapFileInfo().

445  {
446  $location = $file->getPathname();
447  $path = $this->removePathPrefix($location);
448 
449  return trim(str_replace('\\', '/', $path), '/');
450  }
$location
Definition: buildRTE.php:44
removePathPrefix($path)
Remove a path prefix.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMetadata()

League\Flysystem\Adapter\Local::getMetadata (   $path)

Get all the meta data of a file or directory.

Parameters
string$path
Returns
array|false

Implements League\Flysystem\ReadInterface.

Definition at line 289 of file Local.php.

References $info, $location, $path, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), and League\Flysystem\Adapter\Local\normalizeFileInfo().

Referenced by League\Flysystem\Adapter\Local\getSize(), and League\Flysystem\Adapter\Local\getTimestamp().

290  {
291  $location = $this->applyPathPrefix($path);
292  $info = new SplFileInfo($location);
293 
294  return $this->normalizeFileInfo($info);
295  }
$location
Definition: buildRTE.php:44
normalizeFileInfo(SplFileInfo $file)
Normalize the file info.
Definition: Local.php:426
$info
Definition: index.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMimetype()

League\Flysystem\Adapter\Local::getMimetype (   $path)

Get the mimetype of a file.

Parameters
string$path
Returns
array|false

Implements League\Flysystem\ReadInterface.

Definition at line 308 of file Local.php.

References $location, $path, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), and League\Flysystem\Util\MimeType\detectByFilename().

309  {
310  $location = $this->applyPathPrefix($path);
311  $finfo = new Finfo(FILEINFO_MIME_TYPE);
312  $mimetype = $finfo->file($location);
313 
314  if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty'])) {
316  }
317 
318  return ['path' => $path, 'type' => 'file', 'mimetype' => $mimetype];
319  }
static detectByFilename($filename)
Definition: MimeType.php:61
$location
Definition: buildRTE.php:44
+ Here is the call graph for this function:

◆ getRecursiveDirectoryIterator()

League\Flysystem\Adapter\Local::getRecursiveDirectoryIterator (   $path,
  $mode = RecursiveIteratorIterator::SELF_FIRST 
)
protected
Parameters
string$path
int$mode
Returns
RecursiveIteratorIterator

Definition at line 458 of file Local.php.

References $path.

Referenced by League\Flysystem\Adapter\Local\createDir(), and League\Flysystem\Adapter\Local\listContents().

459  {
460  return new RecursiveIteratorIterator(
461  new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
462  $mode
463  );
464  }
+ Here is the caller graph for this function:

◆ getSize()

League\Flysystem\Adapter\Local::getSize (   $path)

Get the size of a file.

Parameters
string$path
Returns
array|false

Implements League\Flysystem\ReadInterface.

Definition at line 300 of file Local.php.

References $path, and League\Flysystem\Adapter\Local\getMetadata().

301  {
302  return $this->getMetadata($path);
303  }
getMetadata($path)
Get all the meta data of a file or directory.array|false
Definition: Local.php:289
+ Here is the call graph for this function:

◆ getTimestamp()

League\Flysystem\Adapter\Local::getTimestamp (   $path)

Get the timestamp of a file.

Parameters
string$path
Returns
array|false

Implements League\Flysystem\ReadInterface.

Definition at line 324 of file Local.php.

References $path, and League\Flysystem\Adapter\Local\getMetadata().

325  {
326  return $this->getMetadata($path);
327  }
getMetadata($path)
Get all the meta data of a file or directory.array|false
Definition: Local.php:289
+ Here is the call graph for this function:

◆ getVisibility()

League\Flysystem\Adapter\Local::getVisibility (   $path)

Get the visibility of a file.

Parameters
string$path
Returns
array|false

Implements League\Flysystem\ReadInterface.

Definition at line 332 of file Local.php.

References $location, $path, League\Flysystem\Adapter\Local\$permissions, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), League\Flysystem\AdapterInterface\VISIBILITY_PRIVATE, and League\Flysystem\AdapterInterface\VISIBILITY_PUBLIC.

333  {
334  $location = $this->applyPathPrefix($path);
335  clearstatcache(false, $location);
336  $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4));
338 
339  return compact('path', 'visibility');
340  }
const VISIBILITY_PUBLIC
VISIBILITY_PUBLIC public visibility
$location
Definition: buildRTE.php:44
const VISIBILITY_PRIVATE
VISIBILITY_PRIVATE private visibility
+ Here is the call graph for this function:

◆ guardAgainstUnreadableFileInfo()

League\Flysystem\Adapter\Local::guardAgainstUnreadableFileInfo ( SplFileInfo  $file)
protected
Parameters
SplFileInfo$file
Exceptions
UnreadableFileException

Definition at line 504 of file Local.php.

References League\Flysystem\UnreadableFileException\forFileInfo().

Referenced by League\Flysystem\Adapter\Local\createDir().

505  {
506  if ( ! $file->isReadable()) {
508  }
509  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ has()

League\Flysystem\Adapter\Local::has (   $path)

Check whether a file exists.

Parameters
string$path
Returns
array|bool|null

Implements League\Flysystem\ReadInterface.

Definition at line 114 of file Local.php.

References $location, $path, and League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix().

115  {
116  $location = $this->applyPathPrefix($path);
117 
118  return file_exists($location);
119  }
$location
Definition: buildRTE.php:44
+ Here is the call graph for this function:

◆ listContents()

League\Flysystem\Adapter\Local::listContents (   $directory = '',
  $recursive = false 
)

List contents of a directory.

Parameters
string$directory
bool$recursive
Returns
array

Implements League\Flysystem\ReadInterface.

Definition at line 262 of file Local.php.

References $file, $location, $path, $result, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), League\Flysystem\Adapter\Local\getDirectoryIterator(), League\Flysystem\Adapter\Local\getFilePath(), League\Flysystem\Adapter\Local\getRecursiveDirectoryIterator(), and League\Flysystem\Adapter\Local\normalizeFileInfo().

263  {
264  $result = [];
265  $location = $this->applyPathPrefix($directory);
266 
267  if ( ! is_dir($location)) {
268  return [];
269  }
270 
271  $iterator = $recursive ? $this->getRecursiveDirectoryIterator($location) : $this->getDirectoryIterator($location);
272 
273  foreach ($iterator as $file) {
274  $path = $this->getFilePath($file);
275 
276  if (preg_match('#(^|/|\\\\)\.{1,2}$#', $path)) {
277  continue;
278  }
279 
280  $result[] = $this->normalizeFileInfo($file);
281  }
282 
283  return array_filter($result);
284  }
$result
$location
Definition: buildRTE.php:44
normalizeFileInfo(SplFileInfo $file)
Normalize the file info.
Definition: Local.php:426
getRecursiveDirectoryIterator($path, $mode=RecursiveIteratorIterator::SELF_FIRST)
Definition: Local.php:458
getFilePath(SplFileInfo $file)
Get the normalized path from a SplFileInfo object.
Definition: Local.php:444
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ mapFileInfo()

League\Flysystem\Adapter\Local::mapFileInfo ( SplFileInfo  $file)
protected
Parameters
SplFileInfo$file
Returns
array

Definition at line 483 of file Local.php.

References League\Flysystem\Adapter\Local\getFilePath().

Referenced by League\Flysystem\Adapter\Local\normalizeFileInfo().

484  {
485  $normalized = [
486  'type' => $file->getType(),
487  'path' => $this->getFilePath($file),
488  ];
489 
490  $normalized['timestamp'] = $file->getMTime();
491 
492  if ($normalized['type'] === 'file') {
493  $normalized['size'] = $file->getSize();
494  }
495 
496  return $normalized;
497  }
getFilePath(SplFileInfo $file)
Get the normalized path from a SplFileInfo object.
Definition: Local.php:444
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalizeFileInfo()

League\Flysystem\Adapter\Local::normalizeFileInfo ( SplFileInfo  $file)
protected

Normalize the file info.

Parameters
SplFileInfo$file
Returns
array|void
Exceptions
NotSupportedException

Definition at line 426 of file Local.php.

References League\Flysystem\NotSupportedException\forLink(), and League\Flysystem\Adapter\Local\mapFileInfo().

Referenced by League\Flysystem\Adapter\Local\getMetadata(), and League\Flysystem\Adapter\Local\listContents().

427  {
428  if ( ! $file->isLink()) {
429  return $this->mapFileInfo($file);
430  }
431 
432  if ($this->linkHandling & self::DISALLOW_LINKS) {
434  }
435  }
mapFileInfo(SplFileInfo $file)
Definition: Local.php:483
static forLink(SplFileInfo $file)
Create a new exception for a link.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

League\Flysystem\Adapter\Local::read (   $path)

Read a file.

Parameters
string$path
Returns
array|false

Implements League\Flysystem\ReadInterface.

Definition at line 212 of file Local.php.

References $contents, $location, $path, and League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix().

213  {
214  $location = $this->applyPathPrefix($path);
215  $contents = file_get_contents($location);
216 
217  if ($contents === false) {
218  return false;
219  }
220 
221  return ['type' => 'file', 'path' => $path, 'contents' => $contents];
222  }
$location
Definition: buildRTE.php:44
+ Here is the call graph for this function:

◆ readStream()

League\Flysystem\Adapter\Local::readStream (   $path)

Read a file as a stream.

Parameters
string$path
Returns
array|false

Implements League\Flysystem\ReadInterface.

Definition at line 175 of file Local.php.

References $location, $path, GuzzleHttp\Psr7\$stream, and League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix().

176  {
177  $location = $this->applyPathPrefix($path);
178  $stream = fopen($location, 'rb');
179 
180  return ['type' => 'file', 'path' => $path, 'stream' => $stream];
181  }
$location
Definition: buildRTE.php:44
$stream
PHP stream implementation.
+ Here is the call graph for this function:

◆ rename()

League\Flysystem\Adapter\Local::rename (   $path,
  $newpath 
)

Rename a file.

Parameters
string$path
string$newpath
Returns
bool

Implements League\Flysystem\AdapterInterface.

Definition at line 227 of file Local.php.

References $destination, $location, $path, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), League\Flysystem\Util\dirname(), and League\Flysystem\Adapter\Local\ensureDirectory().

228  {
229  $location = $this->applyPathPrefix($path);
230  $destination = $this->applyPathPrefix($newpath);
231  $parentDirectory = $this->applyPathPrefix(Util::dirname($newpath));
232  $this->ensureDirectory($parentDirectory);
233 
234  return rename($location, $destination);
235  }
static dirname($path)
Get a normalized dirname from a path.
Definition: Util.php:45
$location
Definition: buildRTE.php:44
$destination
rename($path, $newpath)
Rename a file.bool
Definition: Local.php:227
ensureDirectory($root)
Ensure the root directory exists.
Definition: Local.php:98
+ Here is the call graph for this function:

◆ setVisibility()

League\Flysystem\Adapter\Local::setVisibility (   $path,
  $visibility 
)

Set the visibility for a file.

Parameters
string$path
string$visibility
Returns
array|false file meta data

Implements League\Flysystem\AdapterInterface.

Definition at line 345 of file Local.php.

References $location, $path, $success, $type, and League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix().

Referenced by League\Flysystem\Adapter\Local\write(), and League\Flysystem\Adapter\Local\writeStream().

346  {
347  $location = $this->applyPathPrefix($path);
348  $type = is_dir($location) ? 'dir' : 'file';
349  $success = chmod($location, $this->permissionMap[$type][$visibility]);
350 
351  if ($success === false) {
352  return false;
353  }
354 
355  return compact('path', 'visibility');
356  }
$type
$location
Definition: buildRTE.php:44
$success
Definition: Utf8Test.php:86
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

League\Flysystem\Adapter\Local::update (   $path,
  $contents,
Config  $config 
)

Update a file.

Parameters
string$path
string$contents
Config$configConfig object
Returns
array|false false on failure file meta data on success

Implements League\Flysystem\AdapterInterface.

Definition at line 194 of file Local.php.

References $contents, $location, $path, $size, $type, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), and League\Flysystem\Util\guessMimeType().

195  {
196  $location = $this->applyPathPrefix($path);
197  $mimetype = Util::guessMimeType($path, $contents);
198  $size = file_put_contents($location, $contents, $this->writeFlags);
199 
200  if ($size === false) {
201  return false;
202  }
203 
204  $type = 'file';
205 
206  return compact('type', 'path', 'size', 'contents', 'mimetype');
207  }
$size
Definition: RandomTest.php:84
$type
static guessMimeType($path, $content)
Guess MIME Type based on the path of the file and it's content.
Definition: Util.php:177
$location
Definition: buildRTE.php:44
+ Here is the call graph for this function:

◆ updateStream()

League\Flysystem\Adapter\Local::updateStream (   $path,
  $resource,
Config  $config 
)

Update a file using a stream.

Parameters
string$path
resource$resource
Config$configConfig object
Returns
array|false false on failure file meta data on success

Implements League\Flysystem\AdapterInterface.

Definition at line 186 of file Local.php.

References $path, and League\Flysystem\Adapter\Local\writeStream().

187  {
188  return $this->writeStream($path, $resource, $config);
189  }
writeStream($path, $resource, Config $config)
Write a new file using a stream.Config objectarray|false false on failure file meta data on success ...
Definition: Local.php:147
+ Here is the call graph for this function:

◆ write()

League\Flysystem\Adapter\Local::write (   $path,
  $contents,
Config  $config 
)

Write a new file.

Parameters
string$path
string$contents
Config$configConfig object
Returns
array|false false on failure file meta data on success

Implements League\Flysystem\AdapterInterface.

Definition at line 124 of file Local.php.

References $contents, $location, $path, $result, $size, $type, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), League\Flysystem\Adapter\Local\ensureDirectory(), League\Flysystem\Config\get(), and League\Flysystem\Adapter\Local\setVisibility().

125  {
126  $location = $this->applyPathPrefix($path);
127  $this->ensureDirectory(dirname($location));
128 
129  if (($size = file_put_contents($location, $contents, $this->writeFlags)) === false) {
130  return false;
131  }
132 
133  $type = 'file';
134  $result = compact('contents', 'type', 'size', 'path');
135 
136  if ($visibility = $config->get('visibility')) {
137  $result['visibility'] = $visibility;
138  $this->setVisibility($path, $visibility);
139  }
140 
141  return $result;
142  }
$size
Definition: RandomTest.php:84
$result
$type
$location
Definition: buildRTE.php:44
setVisibility($path, $visibility)
Set the visibility for a file.array|false file meta data
Definition: Local.php:345
ensureDirectory($root)
Ensure the root directory exists.
Definition: Local.php:98
+ Here is the call graph for this function:

◆ writeStream()

League\Flysystem\Adapter\Local::writeStream (   $path,
  $resource,
Config  $config 
)

Write a new file using a stream.

Parameters
string$path
resource$resource
Config$configConfig object
Returns
array|false false on failure file meta data on success

Implements League\Flysystem\AdapterInterface.

Definition at line 147 of file Local.php.

References $location, $path, GuzzleHttp\Psr7\$stream, $type, League\Flysystem\Adapter\AbstractAdapter\applyPathPrefix(), League\Flysystem\Adapter\Local\ensureDirectory(), League\Flysystem\Config\get(), and League\Flysystem\Adapter\Local\setVisibility().

Referenced by League\Flysystem\Adapter\Local\updateStream().

148  {
149  $location = $this->applyPathPrefix($path);
150  $this->ensureDirectory(dirname($location));
151  $stream = fopen($location, 'w+b');
152 
153  if ( ! $stream) {
154  return false;
155  }
156 
157  stream_copy_to_stream($resource, $stream);
158 
159  if ( ! fclose($stream)) {
160  return false;
161  }
162 
163  if ($visibility = $config->get('visibility')) {
164  $this->setVisibility($path, $visibility);
165  }
166 
167  $type = 'file';
168 
169  return compact('type', 'path', 'visibility');
170  }
$type
$location
Definition: buildRTE.php:44
setVisibility($path, $visibility)
Set the visibility for a file.array|false file meta data
Definition: Local.php:345
$stream
PHP stream implementation.
ensureDirectory($root)
Ensure the root directory exists.
Definition: Local.php:98
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $linkHandling

League\Flysystem\Adapter\Local::$linkHandling
private

Definition at line 62 of file Local.php.

Referenced by League\Flysystem\Adapter\Local\__construct().

◆ $pathSeparator

League\Flysystem\Adapter\Local::$pathSeparator = DIRECTORY_SEPARATOR
protected

Definition at line 48 of file Local.php.

◆ $permissionMap

League\Flysystem\Adapter\Local::$permissionMap
protected

Definition at line 53 of file Local.php.

◆ $permissions

League\Flysystem\Adapter\Local::$permissions
staticprotected
Initial value:
= [
'file' => [
'public' => 0644

Definition at line 34 of file Local.php.

Referenced by League\Flysystem\Adapter\Local\__construct(), and League\Flysystem\Adapter\Local\getVisibility().

◆ $writeFlags

League\Flysystem\Adapter\Local::$writeFlags
protected

Definition at line 58 of file Local.php.

Referenced by League\Flysystem\Adapter\Local\__construct().

◆ DISALLOW_LINKS

const League\Flysystem\Adapter\Local::DISALLOW_LINKS = 0002

◆ SKIP_LINKS

const League\Flysystem\Adapter\Local::SKIP_LINKS = 0001

The documentation for this class was generated from the following file: