Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_files\converter Class Reference

Class for converting files between different formats using unoconv. More...

Public Member Functions

 can_convert_format_to ($from, $to)
 Check whether document conversion is supported for this file and target format.
 
 can_convert_storedfile_to (stored_file $file, $to)
 Check whether document conversion is supported for this file and target format.
 
 poll_conversion (conversion $conversion)
 Poll for updates to the supplied conversion.
 
 start_conversion (stored_file $file, $format, $forcerefresh=false)
 Start the conversion for a stored_file into a new format.
 

Protected Member Functions

 get_document_converter_classes ($from, $to)
 Fetch the class for the preferred document converter.
 
 get_enabled_plugins ()
 Get a list of enabled plugins and classes.
 
 get_file_storage ()
 Return the file_storage API.
 
 get_next_converter ($converters, $currentconverter=null)
 Fetch the next converter to try.
 

Detailed Description

Class for converting files between different formats using unoconv.

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

Member Function Documentation

◆ can_convert_format_to()

core_files\converter::can_convert_format_to ( $from,
$to )

Check whether document conversion is supported for this file and target format.

Parameters
string$fromThe source target file (file extension)
string$toThe desired target file format (file extension)
Return values
boolWhether the target type can be converted

◆ can_convert_storedfile_to()

core_files\converter::can_convert_storedfile_to ( stored_file $file,
$to )

Check whether document conversion is supported for this file and target format.

Parameters
stored_file$fileThe file to convert
string$toThe desired target file format (file extension)
Return values
boolWhether the target type can be converted

◆ get_document_converter_classes()

core_files\converter::get_document_converter_classes ( $from,
$to )
protected

Fetch the class for the preferred document converter.

Parameters
string$fromThe source target file (file extension)
string$toThe desired target file format (file extension)
Return values
stringThe class for document conversion

◆ get_enabled_plugins()

core_files\converter::get_enabled_plugins ( )
protected

Get a list of enabled plugins and classes.

Return values
arrayList of enabled plugins

◆ get_file_storage()

core_files\converter::get_file_storage ( )
protected

Return the file_storage API.

This allows for mocking of the file_storage API.

Return values
file_storage

◆ get_next_converter()

core_files\converter::get_next_converter ( $converters,
$currentconverter = null )
protected

Fetch the next converter to try.

Parameters
array$convertersThe list of converters to try
string | null$currentconverterThe converter currently in use
Return values
string|falseName of next converter if present

◆ poll_conversion()

core_files\converter::poll_conversion ( conversion $conversion)

Poll for updates to the supplied conversion.

Parameters
conversion$conversionThe conversion in progress
Return values
$this

◆ start_conversion()

core_files\converter::start_conversion ( stored_file $file,
$format,
$forcerefresh = false )

Start the conversion for a stored_file into a new format.

Parameters
stored_file$fileThe file to convert
string$formatThe desired target file format (file extension)
boolean$forcerefreshIf true, the file will be converted every time (not cached).
Return values
conversionconversion object

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