Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Class for converting files between different file formats using unoconv.

Copyright: 2017 Damyon Wiese
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 248 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: converter  - X-Ref

Class for converting files between different formats using unoconv.

get_enabled_plugins()   X-Ref
Get a list of enabled plugins and classes.

return: array List of enabled plugins

get_file_storage()   X-Ref
Return the file_storage API.

This allows for mocking of the file_storage API.

return: \file_storage

start_conversion(stored_file $file, $format, $forcerefresh = false)   X-Ref
Start the conversion for a stored_file into a new format.

param: stored_file $file The file to convert
param: string $format The desired target file format (file extension)
param: boolean $forcerefresh If true, the file will be converted every time (not cached).
return: conversion conversion object

poll_conversion(conversion $conversion)   X-Ref
Poll for updates to the supplied conversion.

param: conversion $conversion The conversion in progress
return: $this

get_next_converter($converters, $currentconverter = null)   X-Ref
Fetch the next converter to try.

param: array $converters The list of converters to try
param: string|null $currentconverter The converter currently in use
return: string|false Name of next converter if present

get_document_converter_classes($from, $to)   X-Ref
Fetch the class for the preferred document converter.

param: string $from The source target file (file extension)
param: string $to The desired target file format (file extension)
return: string The class for document conversion

can_convert_storedfile_to(stored_file $file, $to)   X-Ref
Check whether document conversion is supported for this file and target format.

param: stored_file $file The file to convert
param: string $to The desired target file format (file extension)
return: bool Whether the target type can be converted

can_convert_format_to($from, $to)   X-Ref
Check whether document conversion is supported for this file and target format.

param: string $from The source target file (file extension)
param: string $to The desired target file format (file extension)
return: bool Whether the target type can be converted