Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
DriverInterface Interface Reference
Inheritance diagram for DriverInterface:
File Http Zlib Https

Public Member Functions

 isExists ($path)
 
 stat ($path)
 
 isReadable ($path)
 
 isFile ($path)
 
 isDirectory ($path)
 
 fileGetContents ($path, $flag=null, $context=null)
 
 isWritable ($path)
 
 getParentDirectory ($path)
 
 createDirectory ($path, $permissions=0777)
 
 readDirectory ($path)
 
 readDirectoryRecursively ($path=null)
 
 search ($pattern, $path)
 
 rename ($oldPath, $newPath, DriverInterface $targetDriver=null)
 
 copy ($source, $destination, DriverInterface $targetDriver=null)
 
 symlink ($source, $destination, DriverInterface $targetDriver=null)
 
 deleteFile ($path)
 
 deleteDirectory ($path)
 
 changePermissions ($path, $permissions)
 
 changePermissionsRecursively ($path, $dirPermissions, $filePermissions)
 
 touch ($path, $modificationTime=null)
 
 filePutContents ($path, $content, $mode=null)
 
 fileOpen ($path, $mode)
 
 fileReadLine ($resource, $length, $ending=null)
 
 fileRead ($resource, $length)
 
 fileGetCsv ($resource, $length=0, $delimiter=',', $enclosure='"', $escape = '\\')
 
 fileTell ($resource)
 
 fileSeek ($resource, $offset, $whence=SEEK_SET)
 
 endOfFile ($resource)
 
 fileClose ($resource)
 
 fileWrite ($resource, $data)
 
 filePutCsv ($resource, array $data, $delimiter=',', $enclosure='"')
 
 fileFlush ($resource)
 
 fileLock ($resource, $lockMode=LOCK_EX)
 
 fileUnlock ($resource)
 
 getAbsolutePath ($basePath, $path, $scheme=null)
 
 getRealPath ($path)
 
 getRealPathSafety ($path)
 
 getRelativePath ($basePath, $path=null)
 

Data Fields

const WRITEABLE_DIRECTORY_MODE = 0770
 
const WRITEABLE_FILE_MODE = 0660
 

Detailed Description

Class Driver

@api

Since
100.0.2

Definition at line 18 of file DriverInterface.php.

Member Function Documentation

◆ changePermissions()

changePermissions (   $path,
  $permissions 
)

Change permissions of given path

Parameters
string$path
int$permissions
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ changePermissionsRecursively()

changePermissionsRecursively (   $path,
  $dirPermissions,
  $filePermissions 
)

Recursively hange permissions of given path

Parameters
string$path
int$dirPermissions
int$filePermissions
Returns
bool
Exceptions
FileSystemException

◆ copy()

copy (   $source,
  $destination,
DriverInterface  $targetDriver = null 
)

Copy source into destination

Parameters
string$source
string$destination
DriverInterface | null$targetDriver
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ createDirectory()

createDirectory (   $path,
  $permissions = 0777 
)

Create directory

Parameters
string$path
int$permissions
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ deleteDirectory()

deleteDirectory (   $path)

Delete directory

Parameters
string$path
Returns
bool
Exceptions
FileSystemException

◆ deleteFile()

deleteFile (   $path)

Delete file

Parameters
string$path
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ endOfFile()

endOfFile (   $resource)

Returns true if pointer at the end of file or in case of exception

Parameters
resource$resource
Returns
boolean

Implemented in File.

◆ fileClose()

fileClose (   $resource)

Close file

Parameters
resource$resource
Returns
boolean
Exceptions
FileSystemException

Implemented in File.

◆ fileFlush()

fileFlush (   $resource)

Flushes the output

Parameters
resource$resource
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ fileGetContents()

fileGetContents (   $path,
  $flag = null,
  $context = null 
)

Retrieve file contents from given path

Parameters
string$path
string | null$flag
resource | null$context
Returns
string
Exceptions
FileSystemException

Implemented in File, and Http.

◆ fileGetCsv()

fileGetCsv (   $resource,
  $length = 0,
  $delimiter = ',',
  $enclosure = '"',
  $escape = '\\' 
)

Reads one CSV row from the file

Parameters
resource$resource
int$length[optional]
string$delimiter[optional]
string$enclosure[optional]
string$escape[optional]
Returns
array|bool|null
Exceptions
FileSystemException

Implemented in File.

◆ fileLock()

fileLock (   $resource,
  $lockMode = LOCK_EX 
)

Lock file in selected mode

Parameters
resource$resource
int$lockMode
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ fileOpen()

fileOpen (   $path,
  $mode 
)

Open file

Parameters
string$path
string$mode
Returns
resource
Exceptions
FileSystemException

Implemented in File, and Http.

◆ filePutContents()

filePutContents (   $path,
  $content,
  $mode = null 
)

Put contents into given file

Parameters
string$path
string$content
string | null$mode
Returns
int The number of bytes that were written.
Exceptions
FileSystemException

Implemented in File.

◆ filePutCsv()

filePutCsv (   $resource,
array  $data,
  $delimiter = ',',
  $enclosure = '"' 
)

Writes one CSV row to the file.

Parameters
resource$resource
array$data
string$delimiter
string$enclosure
Returns
int
Exceptions
FileSystemException

◆ fileRead()

fileRead (   $resource,
  $length 
)

Reads the specified number of bytes from the current position.

Parameters
resource$resource
int$length
Returns
string
Exceptions
FileSystemException

Implemented in File.

◆ fileReadLine()

fileReadLine (   $resource,
  $length,
  $ending = null 
)

Reads the line content from file pointer (with specified number of bytes from the current position).

Parameters
resource$resource
int$length
string$ending[optional]
Returns
string
Exceptions
FileSystemException

Implemented in File, and Http.

◆ fileSeek()

fileSeek (   $resource,
  $offset,
  $whence = SEEK_SET 
)

Seeks to the specified offset

Parameters
resource$resource
int$offset
int$whence
Returns
int
Exceptions
FileSystemException

Implemented in File.

◆ fileTell()

fileTell (   $resource)

Returns position of read/write pointer

Parameters
resource$resource
Returns
int
Exceptions
FileSystemException

Implemented in File.

◆ fileUnlock()

fileUnlock (   $resource)

Unlock file

Parameters
resource$resource
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ fileWrite()

fileWrite (   $resource,
  $data 
)

Writes data to file

Parameters
resource$resource
string$data
Returns
int
Exceptions
FileSystemException

Implemented in File.

◆ getAbsolutePath()

getAbsolutePath (   $basePath,
  $path,
  $scheme = null 
)
Parameters
string$basePath
string$path
string | null$scheme
Returns
mixed

Implemented in File, and Http.

◆ getParentDirectory()

getParentDirectory (   $path)

Returns parent directory's path

Parameters
string$path
Returns
string

Implemented in File.

◆ getRealPath()

getRealPath (   $path)
Parameters
string$path
Returns
mixed

Implemented in File.

◆ getRealPathSafety()

getRealPathSafety (   $path)

Return correct path for link

Parameters
string$path
Returns
mixed

Implemented in File.

◆ getRelativePath()

getRelativePath (   $basePath,
  $path = null 
)
Parameters
string$basePath
null$path
Returns
mixed

Implemented in File.

◆ isDirectory()

isDirectory (   $path)

Tells whether the filename is a regular directory

Parameters
string$path
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ isExists()

isExists (   $path)
Parameters
string$path
Returns
bool
Exceptions
FileSystemException

Implemented in File, and Http.

◆ isFile()

isFile (   $path)

Tells whether the filename is a regular file

Parameters
string$path
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ isReadable()

isReadable (   $path)

Check permissions for reading file or directory

Parameters
string$path
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ isWritable()

isWritable (   $path)

Check if given path is writable

Parameters
string$path
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ readDirectory()

readDirectory (   $path)

Read directory

Parameters
string$path
Returns
array
Exceptions
FileSystemException

◆ readDirectoryRecursively()

readDirectoryRecursively (   $path = null)

Read directory recursively

Parameters
string | null$path
Returns
array
Exceptions
FileSystemException

◆ rename()

rename (   $oldPath,
  $newPath,
DriverInterface  $targetDriver = null 
)

Renames a file or directory

Parameters
string$oldPath
string$newPath
DriverInterface | null$targetDriver
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ search()

search (   $pattern,
  $path 
)

Search paths by given regex

Parameters
string$pattern
string$path
Returns
array
Exceptions
FileSystemException

Implemented in File.

◆ stat()

stat (   $path)

Gathers the statistics of the given path

Parameters
string$path
Returns
array
Exceptions
FileSystemException

Implemented in File, and Http.

◆ symlink()

symlink (   $source,
  $destination,
DriverInterface  $targetDriver = null 
)

Create symlink on source and place it into destination

Parameters
string$source
string$destination
DriverInterface | null$targetDriver
Returns
bool
Exceptions
FileSystemException

Implemented in File.

◆ touch()

touch (   $path,
  $modificationTime = null 
)

Sets access and modification time of file.

Parameters
string$path
int | null$modificationTime
Returns
bool
Exceptions
FileSystemException

Implemented in File.

Field Documentation

◆ WRITEABLE_DIRECTORY_MODE

const WRITEABLE_DIRECTORY_MODE = 0770

Permissions to give read/write/execute access to owner and owning group, but not to all users

Deprecated:

Definition at line 25 of file DriverInterface.php.

◆ WRITEABLE_FILE_MODE

const WRITEABLE_FILE_MODE = 0660

Permissions to give read/write access to owner and owning group, but not to all users

Deprecated:

Definition at line 32 of file DriverInterface.php.


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