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
 write ($path, $contents, Config $config)
 Write a new file. More...
 
 writeStream ($path, $resource, Config $config)
 Write a new file using a stream. More...
 
 update ($path, $contents, Config $config)
 Update a file. More...
 
 updateStream ($path, $resource, Config $config)
 Update a file using a stream. More...
 
 rename ($path, $newpath)
 Rename a file. More...
 
 copy ($path, $newpath)
 Copy a file. More...
 
 delete ($path)
 Delete a file. More...
 
 deleteDir ($dirname)
 Delete a directory. More...
 
 createDir ($dirname, Config $config)
 Create a directory. More...
 
 setVisibility ($path, $visibility)
 Set the visibility for a file. More...
 
 has ($path)
 Check whether a file exists. More...
 
 read ($path)
 Read a file. More...
 
 readStream ($path)
 Read a file as a stream. More...
 
 listContents ($directory='', $recursive=false)
 List contents of a directory. More...
 
 getMetadata ($path)
 Get all the meta data of a file or directory. More...
 
 getSize ($path)
 Get the size of a file. More...
 
 getMimetype ($path)
 Get the mimetype of a file. More...
 
 getTimestamp ($path)
 Get the timestamp of a file. More...
 
 getVisibility ($path)
 Get the visibility of a file. More...
 

Data Fields

const SKIP_LINKS = 0001
 
const DISALLOW_LINKS = 0002
 
- Data Fields inherited from League\Flysystem\AdapterInterface
const VISIBILITY_PUBLIC = 'public'
 @const VISIBILITY_PUBLIC public visibility More...
 
const VISIBILITY_PRIVATE = 'private'
 @const 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.

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

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().

+ 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.

241 {
243 $destination = $this->applyPathPrefix($newpath);
244 $this->ensureDirectory(dirname($destination));
245
246 return copy($location, $destination);
247 }
$location
Definition: buildRTE.php:44
copy($path, $newpath)
Copy a file.bool
Definition: Local.php:240
$destination

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

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

+ Here is the call graph for this function:
+ Here is the caller 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.

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 }

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

+ 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.

253 {
255
256 return unlink($location);
257 }

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

+ 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.

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

References $file.

◆ 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.

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 }
sprintf('%.4f', $callTime)

References sprintf.

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().

+ 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.

472 {
473 $iterator = new DirectoryIterator($path);
474
475 return $iterator;
476 }

References $path.

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

+ 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.

445 {
446 $location = $file->getPathname();
448
449 return trim(str_replace('\\', '/', $path), '/');
450 }
removePathPrefix($path)
Remove a path prefix.

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

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

+ 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.

290 {
292 $info = new SplFileInfo($location);
293
294 return $this->normalizeFileInfo($info);
295 }
normalizeFileInfo(SplFileInfo $file)
Normalize the file info.
Definition: Local.php:426
$info
Definition: index.php:5

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().

+ 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.

309 {
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

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

+ 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.

459 {
460 return new RecursiveIteratorIterator(
461 new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
462 $mode
463 );
464 }

References $path.

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

+ 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.

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

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

+ 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.

325 {
326 return $this->getMetadata($path);
327 }

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

+ 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.

333 {
335 clearstatcache(false, $location);
336 $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4));
338
339 return compact('path', 'visibility');
340 }
const VISIBILITY_PUBLIC
@const VISIBILITY_PUBLIC public visibility
const VISIBILITY_PRIVATE
@const VISIBILITY_PRIVATE private visibility

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

+ 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.

505 {
506 if ( ! $file->isReadable()) {
508 }
509 }

References $file, and League\Flysystem\UnreadableFileException\forFileInfo().

+ Here is the call 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.

115 {
117
118 return file_exists($location);
119 }

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

+ 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.

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
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

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().

+ 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.

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 }

References $file, and League\Flysystem\Adapter\Local\getFilePath().

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

+ 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.

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.

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

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

+ 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.

213 {
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 }

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

+ 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.

176 {
178 $stream = fopen($location, 'rb');
179
180 return ['type' => 'file', 'path' => $path, 'stream' => $stream];
181 }
$stream
PHP stream implementation.

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

+ 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.

228 {
230 $destination = $this->applyPathPrefix($newpath);
231 $parentDirectory = $this->applyPathPrefix(Util::dirname($newpath));
232 $this->ensureDirectory($parentDirectory);
233
235 }
rename($path, $newpath)
Rename a file.bool
Definition: Local.php:227
static dirname($path)
Get a normalized dirname from a path.
Definition: Util.php:45

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

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

+ Here is the call graph for this function:
+ Here is the caller 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.

346 {
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 }
$success
Definition: Utf8Test.php:86
$type

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

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

+ 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.

195 {
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
static guessMimeType($path, $content)
Guess MIME Type based on the path of the file and it's content.
Definition: Util.php:177

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

+ 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.

187 {
188 return $this->writeStream($path, $resource, $config);
189 }
writeStream($path, $resource, Config $config)
Write a new file using a stream.array|false false on failure file meta data on success
Definition: Local.php:147

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

+ 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.

125 {
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 }
setVisibility($path, $visibility)
Set the visibility for a file.array|false file meta data
Definition: Local.php:345

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

+ 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.

148 {
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 }

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

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

+ 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,
'private' => 0600,
],
'dir' => [
'public' => 0755,
'private' => 0700,
]
]

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: