The Red Matrix
 All Classes Namespaces Files Functions Variables Pages
RedDirectory Class Reference

RedDirectory class. More...

Inheritance diagram for RedDirectory:

Public Member Functions

 __construct ($ext_path, &$auth_plugin)
 Sets up the directory node, expects a full path. More...
 
 getChildren ()
 Returns an array with all the child nodes. More...
 
 getChild ($name)
 Returns a child by name. More...
 
 getName ()
 Returns the name of the directory. More...
 
 setName ($name)
 Renames the directory. More...
 
 createFile ($name, $data=null)
 Creates a new file in the directory. More...
 
 createDirectory ($name)
 Creates a new subdirectory. More...
 
 childExists ($name)
 Checks if a child exists. More...
 
 getDir ()
 
 getLastModified ()
 Returns the last modification time for the directory, as a UNIX timestamp. More...
 
 getQuotaInfo ()
 Return quota usage. More...
 

Private Member Functions

 log ()
 

Private Attributes

 $red_path
 The path inside /cloud. More...
 
 $folder_hash
 
 $ext_path
 The full path as seen in the browser. /cloud + $red_path. More...
 
 $root_dir = ''
 
 $auth
 
 $os_path = ''
 The real path on the filesystem. The actual path in store/ with the hashed names. More...
 

Detailed Description

RedDirectory class.

A class that represents a directory.

Constructor & Destructor Documentation

RedDirectory::__construct (   $ext_path,
$auth_plugin 
)

Sets up the directory node, expects a full path.

Parameters
string$ext_patha full path
RedBasicAuth&$auth_plugin

Member Function Documentation

RedDirectory::childExists (   $name)

Checks if a child exists.

Parameters
string$name
Returns
boolean
RedDirectory::createDirectory (   $name)

Creates a new subdirectory.

Parameters
string$namethe directory to create
Returns
void
RedDirectory::createFile (   $name,
  $data = null 
)

Creates a new file in the directory.

Data will either be supplied as a stream resource, or in certain cases as a string. Keep in mind that you may have to support either.

After successful creation of the file, you may choose to return the ETag of the new file here.

Exceptions
DAV\Exception\Forbidden
Parameters
string$nameName of the file
resource | string$dataInitial payload
Returns
null|string ETag
RedDirectory::getChild (   $name)

Returns a child by name.

Exceptions
DAV\Exception\Forbidden
DAV\Exception\NotFound
Parameters
string$name
RedDirectory::getChildren ( )

Returns an array with all the child nodes.

Exceptions
DAV\Exception\Forbidden
Returns
array DAV[]
RedDirectory::getDir ( )
Todo:
add description of what this function does.
Exceptions
DAV\Exception\NotFound
Returns
void

Referenced by __construct().

RedDirectory::getLastModified ( )

Returns the last modification time for the directory, as a UNIX timestamp.

It looks for the last edited file in the folder. If it is an empty folder it returns the lastmodified time of the folder itself, to prevent zero timestamps.

Returns
int last modification time in UNIX timestamp
RedDirectory::getName ( )

Returns the name of the directory.

Returns
string
RedDirectory::getQuotaInfo ( )

Return quota usage.

Do guests relly see the used/free values from filesystem of the complete store directory?

Returns
array with used and free values in bytes.
RedDirectory::log ( )
private

Referenced by getChildren().

RedDirectory::setName (   $name)

Renames the directory.

Todo:
handle duplicate directory name
Exceptions
DAV\Exception\Forbidden
Parameters
string$nameThe new name of the directory.
Returns
void

Member Data Documentation

RedDirectory::$auth
private
RedDirectory::$ext_path
private

The full path as seen in the browser. /cloud + $red_path.

Todo:
I think this is not used anywhere, we always strip '/cloud' and only use it in debug

Referenced by __construct(), and getDir().

RedDirectory::$folder_hash
private
RedDirectory::$os_path = ''
private

The real path on the filesystem. The actual path in store/ with the hashed names.

Referenced by createFile(), and getDir().

RedDirectory::$red_path
private

The path inside /cloud.

RedDirectory::$root_dir = ''
private

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