Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | List of all members
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. More...
 
 can_convert_storedfile_to (stored_file $file, $to)
 Check whether document conversion is supported for this file and target format. More...
 
 poll_conversion (conversion $conversion)
 Poll for updates to the supplied conversion. More...
 
 start_conversion (stored_file $file, $format, $forcerefresh=false)
 Start the conversion for a stored_file into a new format. More...
 

Protected Member Functions

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

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: