ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\FS\File Class Reference

File class. More...

+ Inheritance diagram for Sabre\DAV\FS\File:
+ Collaboration diagram for Sabre\DAV\FS\File:

Public Member Functions

 put ($data)
 Updates the data. More...
 
 get ()
 Returns the data. More...
 
 delete ()
 Delete the current file. More...
 
 getSize ()
 Returns the size of the node, in bytes. More...
 
 getETag ()
 Returns the ETag for a file. More...
 
 getContentType ()
 Returns the mime-type for a file. More...
 
- Public Member Functions inherited from Sabre\DAV\FS\Node
 __construct ($path)
 Sets up the node, expects a full path name. More...
 
 getName ()
 Returns the name of the node. More...
 
 setName ($name)
 Renames the node. More...
 
 getLastModified ()
 Returns the last modification time, as a unix timestamp. More...
 

Additional Inherited Members

- Protected Attributes inherited from Sabre\DAV\FS\Node
 $path
 

Detailed Description

File class.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 14 of file File.php.

Member Function Documentation

◆ delete()

Sabre\DAV\FS\File::delete ( )

Delete the current file.

Returns
void

Implements Sabre\DAV\INode.

Definition at line 45 of file File.php.

45  {
46 
47  unlink($this->path);
48 
49  }

◆ get()

Sabre\DAV\FS\File::get ( )

Returns the data.

Returns
resource

Implements Sabre\DAV\IFile.

Definition at line 34 of file File.php.

34  {
35 
36  return fopen($this->path, 'r');
37 
38  }

◆ getContentType()

Sabre\DAV\FS\File::getContentType ( )

Returns the mime-type for a file.

If null is returned, we'll assume application/octet-stream

Returns
mixed

Implements Sabre\DAV\IFile.

Definition at line 89 of file File.php.

89  {
90 
91  return null;
92 
93  }

◆ getETag()

Sabre\DAV\FS\File::getETag ( )

Returns the ETag for a file.

An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. The ETag is an arbitrary string, but MUST be surrounded by double-quotes.

Return null if the ETag can not effectively be determined

Returns
mixed

Implements Sabre\DAV\IFile.

Definition at line 72 of file File.php.

72  {
73 
74  return '"' . sha1(
75  fileinode($this->path) .
76  filesize($this->path) .
77  filemtime($this->path)
78  ) . '"';
79 
80  }

◆ getSize()

Sabre\DAV\FS\File::getSize ( )

Returns the size of the node, in bytes.

Returns
int

Implements Sabre\DAV\IFile.

Definition at line 56 of file File.php.

56  {
57 
58  return filesize($this->path);
59 
60  }

◆ put()

Sabre\DAV\FS\File::put (   $data)

Updates the data.

Parameters
resource$data
Returns
void

Implements Sabre\DAV\IFile.

Definition at line 22 of file File.php.

References $data.

22  {
23 
24  file_put_contents($this->path, $data);
25  clearstatcache(true, $this->path);
26 
27  }
$data
Definition: bench.php:6

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