Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Class simulating empty directories.

Copyright: 2008 Petr Skoda (http://skodak.org)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 352 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: virtual_root_file  - X-Ref

Represents the root directory of an empty file area in the tree navigated by {@link file_browser}.

__construct($contextid, $component, $filearea, $itemid)   X-Ref
Constructor

param: int $contextid context ID
param: string $component component
param: string $filearea file area
param: int $itemid item ID

is_directory()   X-Ref
Whether or not this is a directory

return: bool

delete()   X-Ref
Delete file

return: success

add_to_curl_request(&$curlrequest, $key)   X-Ref
adds this file path to a curl request (POST only)

param: curl $curlrequest the curl request object
param: string $key what key to use in the POST request

get_content_file_handle()   X-Ref
Returns file handle - read only mode, no writing allowed into pool files!

return: resource file handle

readfile()   X-Ref
Dumps file content to page

return: resource file handle

get_content()   X-Ref
Returns file content as string

return: string content

copy_content_to($pathname)   X-Ref
Copy content of file to given pathname

param: string $pathname real path to new file
return: bool success

list_files(file_packer $packer)   X-Ref
List contents of archive

param: file_packer $packer file packer instance
return: array of file infos

extract_to_pathname(file_packer $packer, $pathname)   X-Ref
Extract file to given file path (real OS filesystem), existing files are overwrited

param: file_packer $packer file packer instance
param: string $pathname target directory
return: mixed list of processed files; false if error

extract_to_storage(file_packer $packer, $contextid, $component, $filearea, $itemid, $pathbase, $userid = NULL)   X-Ref
Extract file to given file path (real OS filesystem), existing files are overwrited

param: file_packer $packer file packer instance
param: int $contextid context ID
param: string $component component
param: string $filearea file area
param: int $itemid item ID
param: string $pathbase path base
param: int $userid user ID
return: mixed list of processed files; false if error

archive_file(file_archive $filearch, $archivepath)   X-Ref
Add file/directory into archive

param: file_archive $filearch file archive instance
param: string $archivepath pathname in archive
return: bool success

get_parent_directory()   X-Ref
Returns parent directory

return: stored_file

get_contextid()   X-Ref
Returns context ID

return: int context ID

get_component()   X-Ref
Returns file component

return: string component

get_filearea()   X-Ref
Returns file area

return: string filearea

get_itemid()   X-Ref
Returns file itemid

return: int itemid

get_filepath()   X-Ref
Returns file path

return: string filepath

get_filename()   X-Ref
Returns file name

return: string filename

get_userid()   X-Ref
Returns user ID

return: int userid

get_filesize()   X-Ref
Returns file size

return: int filesize

get_mimetype()   X-Ref
Returns mimetype

return: string mimetype

get_timecreated()   X-Ref
Returns time created

return: int

get_timemodified()   X-Ref
Returns time modified

return: int

get_status()   X-Ref
Returns status

return: int

get_id()   X-Ref
Returns ID

return: int

get_contenthash()   X-Ref
Returns sha1 hash code

return: string

get_pathnamehash()   X-Ref
Returns path name hash

return: string

get_license()   X-Ref
Returns license

return: string

get_author()   X-Ref
Returns file's author

return: string

get_source()   X-Ref
Returns file source

return: string

get_sortorder()   X-Ref
Returns file sort order

return: int