Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
virtual_root_file Class Reference

Represents the root directory of an empty file area in the tree navigated by file_browser. More...

Public Member Functions

 __construct ($contextid, $component, $filearea, $itemid)
 Constructor.
 
 add_to_curl_request (&$curlrequest, $key)
 adds this file path to a curl request (POST only)
 
 archive_file (file_archive $filearch, $archivepath)
 Add file/directory into archive.
 
 copy_content_to ($pathname)
 Copy content of file to given pathname.
 
 delete ()
 Delete file.
 
 extract_to_pathname (file_packer $packer, $pathname)
 Extract file to given file path (real OS filesystem), existing files are overwrited.
 
 extract_to_storage (file_packer $packer, $contextid, $component, $filearea, $itemid, $pathbase, $userid=NULL)
 Extract file to given file path (real OS filesystem), existing files are overwrited.
 
 get_author ()
 Returns file's author.
 
 get_component ()
 Returns file component.
 
 get_content ()
 Returns file content as string.
 
 get_content_file_handle ()
 Returns file handle - read only mode, no writing allowed into pool files!
 
 get_contenthash ()
 Returns sha1 hash code.
 
 get_contextid ()
 Returns context ID.
 
 get_filearea ()
 Returns file area.
 
 get_filename ()
 Returns file name.
 
 get_filepath ()
 Returns file path.
 
 get_filesize ()
 Returns file size.
 
 get_id ()
 Returns ID.
 
 get_itemid ()
 Returns file itemid.
 
 get_license ()
 Returns license.
 
 get_mimetype ()
 Returns mimetype.
 
 get_parent_directory ()
 Returns parent directory.
 
 get_pathnamehash ()
 Returns path name hash.
 
 get_sortorder ()
 Returns file sort order.
 
 get_source ()
 Returns file source.
 
 get_status ()
 Returns status.
 
 get_timecreated ()
 Returns time created.
 
 get_timemodified ()
 Returns time modified.
 
 get_userid ()
 Returns user ID.
 
 is_directory ()
 Whether or not this is a directory.
 
 list_files (file_packer $packer)
 List contents of archive.
 
 readfile ()
 Dumps file content to page.
 

Protected Attributes

string $component
 file component
 
int $contextid
 context id
 
string $filearea
 file area
 
int $itemid
 file itemid
 

Detailed Description

Represents the root directory of an empty file area in the tree navigated by file_browser.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

virtual_root_file::__construct ( $contextid,
$component,
$filearea,
$itemid )

Constructor.

Parameters
int$contextidcontext ID
string$componentcomponent
string$fileareafile area
int$itemiditem ID

Member Function Documentation

◆ add_to_curl_request()

virtual_root_file::add_to_curl_request ( & $curlrequest,
$key )

adds this file path to a curl request (POST only)

Parameters
curl$curlrequestthe curl request object
string$keywhat key to use in the POST request

◆ archive_file()

virtual_root_file::archive_file ( file_archive $filearch,
$archivepath )

Add file/directory into archive.

Parameters
file_archive$filearchfile archive instance
string$archivepathpathname in archive
Return values
boolsuccess

◆ copy_content_to()

virtual_root_file::copy_content_to ( $pathname)

Copy content of file to given pathname.

Parameters
string$pathnamereal path to new file
Return values
boolsuccess

◆ delete()

virtual_root_file::delete ( )

Delete file.

Return values
success

◆ extract_to_pathname()

virtual_root_file::extract_to_pathname ( file_packer $packer,
$pathname )

Extract file to given file path (real OS filesystem), existing files are overwrited.

Parameters
file_packer$packerfile packer instance
string$pathnametarget directory
Return values
mixedlist of processed files; false if error

◆ extract_to_storage()

virtual_root_file::extract_to_storage ( file_packer $packer,
$contextid,
$component,
$filearea,
$itemid,
$pathbase,
$userid = NULL )

Extract file to given file path (real OS filesystem), existing files are overwrited.

Parameters
file_packer$packerfile packer instance
int$contextidcontext ID
string$componentcomponent
string$fileareafile area
int$itemiditem ID
string$pathbasepath base
int$useriduser ID
Return values
mixedlist of processed files; false if error

◆ get_author()

virtual_root_file::get_author ( )

Returns file's author.

Return values
string

◆ get_component()

virtual_root_file::get_component ( )

Returns file component.

Return values
stringcomponent

◆ get_content()

virtual_root_file::get_content ( )

Returns file content as string.

Return values
stringcontent

◆ get_content_file_handle()

virtual_root_file::get_content_file_handle ( )

Returns file handle - read only mode, no writing allowed into pool files!

Return values
resourcefile handle

◆ get_contenthash()

virtual_root_file::get_contenthash ( )

Returns sha1 hash code.

Return values
string

◆ get_contextid()

virtual_root_file::get_contextid ( )

Returns context ID.

Return values
intcontext ID

◆ get_filearea()

virtual_root_file::get_filearea ( )

Returns file area.

Return values
stringfilearea

◆ get_filename()

virtual_root_file::get_filename ( )

Returns file name.

Return values
stringfilename

◆ get_filepath()

virtual_root_file::get_filepath ( )

Returns file path.

Return values
stringfilepath

◆ get_filesize()

virtual_root_file::get_filesize ( )

Returns file size.

Return values
intfilesize

◆ get_id()

virtual_root_file::get_id ( )

Returns ID.

Return values
int

◆ get_itemid()

virtual_root_file::get_itemid ( )

Returns file itemid.

Return values
intitemid

◆ get_license()

virtual_root_file::get_license ( )

Returns license.

Return values
string

◆ get_mimetype()

virtual_root_file::get_mimetype ( )

Returns mimetype.

Return values
stringmimetype

◆ get_parent_directory()

virtual_root_file::get_parent_directory ( )

Returns parent directory.

Return values
stored_file

◆ get_pathnamehash()

virtual_root_file::get_pathnamehash ( )

Returns path name hash.

Return values
string

◆ get_sortorder()

virtual_root_file::get_sortorder ( )

Returns file sort order.

Return values
int

◆ get_source()

virtual_root_file::get_source ( )

Returns file source.

Return values
string

◆ get_status()

virtual_root_file::get_status ( )

Returns status.

Return values
int

◆ get_timecreated()

virtual_root_file::get_timecreated ( )

Returns time created.

Return values
int

◆ get_timemodified()

virtual_root_file::get_timemodified ( )

Returns time modified.

Return values
int

◆ get_userid()

virtual_root_file::get_userid ( )

Returns user ID.

Return values
intuserid

◆ is_directory()

virtual_root_file::is_directory ( )

Whether or not this is a directory.

Return values
bool

◆ list_files()

virtual_root_file::list_files ( file_packer $packer)

List contents of archive.

Parameters
file_packer$packerfile packer instance
Return values
arrayof file infos

◆ readfile()

virtual_root_file::readfile ( )

Dumps file content to page.

Return values
resourcefile handle

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