file_support extends facade
Facade for local_middag\framework\support\moodle\file_support.
Tags
Table of Contents
Methods
- count_area_files() : int
- create_file_from_pathname() : stored_file|null
- create_file_from_stored() : stored_file|null
- create_file_from_string() : stored_file|null
- delete_area_files() : bool
- delete_file() : bool
- delete_file_by_id() : bool
- get_area_files() : array<string|int, mixed>
- get_area_size() : int
- get_content() : string|null
- get_content_file_handle() : mixed
- get_facade_accessor() : string
- Return the service accessor key for this facade.
- get_file() : stored_file|false|null
- get_file_by_id() : stored_file|null
- get_file_by_path() : stored_file|null
- get_file_url() : string
- get_storage() : file_storage
- has_files() : bool
- is_valid_image() : bool
Methods
count_area_files()
public
static count_area_files(int $contextid, string $component, string $filearea, int $itemid) : int
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
Return values
intcreate_file_from_pathname()
public
static create_file_from_pathname(int $contextid, string $component, string $filearea, int $itemid, string $filepath, string $filename, string $pathname) : stored_file|null
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
- $filepath : string
- $filename : string
- $pathname : string
Return values
stored_file|nullcreate_file_from_stored()
public
static create_file_from_stored(stored_file $sourcefile, int $contextid, string $component, string $filearea, int $itemid[, string $filepath = = '\'/\'' ][, string|null $filename = = 'null' ]) : stored_file|null
Parameters
- $sourcefile : stored_file
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
- $filepath : string = = '\'/\''
- $filename : string|null = = 'null'
Return values
stored_file|nullcreate_file_from_string()
public
static create_file_from_string(int $contextid, string $component, string $filearea, int $itemid, string $filepath, string $filename, string $content) : stored_file|null
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
- $filepath : string
- $filename : string
- $content : string
Return values
stored_file|nulldelete_area_files()
public
static delete_area_files(int $contextid, string $component, string $filearea[, int|false $itemid = = 'false' ]) : bool
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int|false = = 'false'
Return values
booldelete_file()
public
static delete_file(stored_file $file) : bool
Parameters
- $file : stored_file
Return values
booldelete_file_by_id()
public
static delete_file_by_id(int $fileid) : bool
Parameters
- $fileid : int
Return values
boolget_area_files()
public
static get_area_files(int $contextid, string $component, string $filearea, int $itemid) : array<string|int, mixed>
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
Return values
array<string|int, mixed>get_area_size()
public
static get_area_size(int $contextid, string $component, string $filearea, int $itemid) : int
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
Return values
intget_content()
public
static get_content(stored_file $file) : string|null
Parameters
- $file : stored_file
Return values
string|nullget_content_file_handle()
public
static get_content_file_handle(stored_file $file) : mixed
Parameters
- $file : stored_file
get_facade_accessor()
Return the service accessor key for this facade.
public
static get_facade_accessor() : string
Return values
stringget_file()
public
static get_file(int $contextid, string $component, string $filearea, int $itemid[, bool $validimage = = 'false' ]) : stored_file|false|null
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
- $validimage : bool = = 'false'
Return values
stored_file|false|nullget_file_by_id()
public
static get_file_by_id(int $fileid) : stored_file|null
Parameters
- $fileid : int
Return values
stored_file|nullget_file_by_path()
public
static get_file_by_path(int $contextid, string $component, string $filearea, int $itemid, string $filepath, string $filename) : stored_file|null
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
- $filepath : string
- $filename : string
Return values
stored_file|nullget_file_url()
public
static get_file_url(stored_file $file[, bool $forcedownload = = 'false' ][, string|null $preview = = 'null' ]) : string
Parameters
- $file : stored_file
- $forcedownload : bool = = 'false'
- $preview : string|null = = 'null'
Return values
stringget_storage()
public
static get_storage() : file_storage
Return values
file_storagehas_files()
public
static has_files(int $contextid, string $component, string $filearea, int $itemid) : bool
Parameters
- $contextid : int
- $component : string
- $filearea : string
- $itemid : int
Return values
boolis_valid_image()
public
static is_valid_image(stored_file $file) : bool
Parameters
- $file : stored_file