The Hubzilla
 All Classes Namespaces Files Functions Variables Pages
Zotlabs\Storage\Directory Class Reference

RedDirectory class. More...

Inheritance diagram for Zotlabs\Storage\Directory:
[legend]

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...
 
 delete ()
 delete directory More...
 
 childExists ($name)
 Checks if a child exists. More...
 
 moveInto ($targetName, $sourcePath, DAV\INode $sourceNode)
 
 getDir ()
 
 getLastModified ()
 Returns the last modification time for the directory, as a UNIX timestamp. More...
 
 getQuotaInfo ()
 Return quota usage. More...
 
 CollectionData ($file, &$auth)
 Array with all Directory and File DAV\Node items for the given path. More...
 
 ChannelList (&$auth)
 Returns an array with viewable channels. More...
 
 FileData ($file, &$auth, $test=false)
 

Private Member Functions

 log ()
 

Private Attributes

string $red_path
 The path inside /cloud. More...
 
 $folder_hash
 
string $ext_path
 The full path as seen in the browser. /cloud + $red_path. More...
 
 $root_dir = ''
 
 $auth
 
string $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.

\DAV\Node \DAV\ICollection \DAV\IQuota

License: http://opensource.org/licenses/mit-license.php The MIT License (MIT)

Constructor & Destructor Documentation

Zotlabs\Storage\Directory::__construct (   $ext_path,
$auth_plugin 
)

Sets up the directory node, expects a full path.

Parameters
string$ext_patha full path
BasicAuth&$auth_plugin

Member Function Documentation

Zotlabs\Storage\Directory::ChannelList ( $auth)

Returns an array with viewable channels.

Get a list of Directory objects with all the channels where the visitor has view_storage perms.

Parameters
BasicAuth&$auth
Returns
array Directory[]
Zotlabs\Storage\Directory::childExists (   $name)

Checks if a child exists.

Parameters
string$nameThe name to check if it exists.
Returns
boolean
Zotlabs\Storage\Directory::CollectionData (   $file,
$auth 
)

Array with all Directory and File DAV\Node items for the given path.

Parameters
string$filepath to a directory
\Zotlabs\Storage\BasicAuth&$auth
Returns
null|array \Sabre\DAV\INode[]
Exceptions
\Sabre\DAV\Exception\Forbidden
\Sabre\DAV\Exception\NotFound
Zotlabs\Storage\Directory::createDirectory (   $name)

Creates a new subdirectory.

Parameters
string$namethe directory to create
Returns
void
Zotlabs\Storage\Directory::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
\Sabre\DAV\Exception\Forbidden
Parameters
string$nameName of the file
resource | string$dataInitial payload
Returns
null|string ETag
Zotlabs\Storage\Directory::delete ( )

delete directory

Zotlabs\Storage\Directory::FileData (   $file,
$auth,
  $test = false 
)
Parameters
string$filepath to file or directory
BasicAuth&$auth
boolean$test(optional) enable test mode
Returns
File|Directory|boolean|null
Exceptions
\Sabre\DAV\Exception\Forbidden
Zotlabs\Storage\Directory::getChild (   $name)

Returns a child by name.

Exceptions
\Sabre\DAV\Exception\Forbidden
\Sabre\DAV\Exception\NotFound
Parameters
string$name
Zotlabs\Storage\Directory::getChildren ( )

Returns an array with all the child nodes.

Exceptions
\Sabre\DAV\Exception\Forbidden
Returns
array \Sabre\DAV\INode[]
Zotlabs\Storage\Directory::getDir ( )
Todo:
add description of what this function does.
Exceptions
\Sabre\DAV\Exception\NotFound
Returns
void
Zotlabs\Storage\Directory::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
Zotlabs\Storage\Directory::getName ( )

Returns the name of the directory.

Returns
string
Zotlabs\Storage\Directory::getQuotaInfo ( )

Return quota usage.

Fixme:
Should guests relly see the used/free values from filesystem of the complete store directory?
Returns
array with used and free values in bytes.
Zotlabs\Storage\Directory::log ( )
private
Zotlabs\Storage\Directory::moveInto (   $targetName,
  $sourcePath,
DAV\INode  $sourceNode 
)
Zotlabs\Storage\Directory::setName (   $name)

Renames the directory.

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

Member Data Documentation

Zotlabs\Storage\Directory::$auth
private
string Zotlabs\Storage\Directory::$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 $ext_path
Zotlabs\Storage\Directory::$folder_hash
private
string Zotlabs\Storage\Directory::$os_path = ''
private

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

$os_path

string Zotlabs\Storage\Directory::$red_path
private

The path inside /cloud.

$red_path

Zotlabs\Storage\Directory::$root_dir = ''
private

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