mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
Merge branch 'MDL-58398-master' of git://github.com/ankitagarwal/moodle
This commit is contained in:
commit
12b471a4d3
@ -61,6 +61,11 @@ class conversion extends \core\persistent {
|
||||
*/
|
||||
const TABLE = 'file_conversion';
|
||||
|
||||
/**
|
||||
* Define properties.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function define_properties() {
|
||||
return array(
|
||||
'sourcefileid' => [
|
||||
@ -209,7 +214,7 @@ class conversion extends \core\persistent {
|
||||
/**
|
||||
* Fetch the source file.
|
||||
*
|
||||
* @return stored_file|false
|
||||
* @return stored_file|false The source file
|
||||
*/
|
||||
public function get_sourcefile() {
|
||||
$fs = get_file_storage();
|
||||
@ -276,7 +281,7 @@ class conversion extends \core\persistent {
|
||||
/**
|
||||
* Get the destination file.
|
||||
*
|
||||
* @return stored_file|this
|
||||
* @return stored_file|bool Destination file
|
||||
*/
|
||||
public function get_destfile() {
|
||||
$fs = get_file_storage();
|
||||
@ -287,7 +292,7 @@ class conversion extends \core\persistent {
|
||||
/**
|
||||
* Helper to ensure that the returned status is always an int.
|
||||
*
|
||||
* @return int
|
||||
* @return int status
|
||||
*/
|
||||
protected function get_status() {
|
||||
return (int) $this->raw_get('status');
|
||||
@ -296,7 +301,7 @@ class conversion extends \core\persistent {
|
||||
/**
|
||||
* Get an instance of the current converter.
|
||||
*
|
||||
* @return converter_interface|false
|
||||
* @return converter_interface|false current converter instance
|
||||
*/
|
||||
public function get_converter_instance() {
|
||||
$currentconverter = $this->get('converter');
|
||||
@ -311,7 +316,7 @@ class conversion extends \core\persistent {
|
||||
/**
|
||||
* Transform data into a storable format.
|
||||
*
|
||||
* @param stdClass $data The data to be stored
|
||||
* @param \stdClass $data The data to be stored
|
||||
* @return $this
|
||||
*/
|
||||
protected function set_data($data) {
|
||||
@ -323,7 +328,7 @@ class conversion extends \core\persistent {
|
||||
/**
|
||||
* Transform data into a storable format.
|
||||
*
|
||||
* @return stdClass The stored data
|
||||
* @return \stdClass The stored data
|
||||
*/
|
||||
protected function get_data() {
|
||||
$data = $this->raw_get('data');
|
||||
@ -338,7 +343,7 @@ class conversion extends \core\persistent {
|
||||
/**
|
||||
* Return the file record base for use in the files table.
|
||||
*
|
||||
* @return array
|
||||
* @return array|bool
|
||||
*/
|
||||
protected function get_file_record() {
|
||||
$file = $this->get_sourcefile();
|
||||
|
@ -39,7 +39,7 @@ class converter {
|
||||
/**
|
||||
* Get a list of enabled plugins and classes.
|
||||
*
|
||||
* @return array
|
||||
* @return array List of enabled plugins
|
||||
*/
|
||||
protected function get_enabled_plugins() {
|
||||
$plugins = \core\plugininfo\fileconverter::get_enabled_plugins();
|
||||
@ -57,7 +57,7 @@ class converter {
|
||||
*
|
||||
* This allows for mocking of the file_storage API.
|
||||
*
|
||||
* @return file_storage
|
||||
* @return \file_storage
|
||||
*/
|
||||
protected function get_file_storage() {
|
||||
return get_file_storage();
|
||||
@ -69,7 +69,7 @@ class converter {
|
||||
* @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
|
||||
* @return conversion conversion object
|
||||
*/
|
||||
public function start_conversion(stored_file $file, $format, $forcerefresh = false) {
|
||||
$conversions = conversion::get_conversions_for_file($file, $format);
|
||||
@ -160,7 +160,7 @@ class converter {
|
||||
*
|
||||
* @param array $converters The list of converters to try
|
||||
* @param string|null $currentconverter The converter currently in use
|
||||
* @return string|false
|
||||
* @return string|false Name of next converter if present
|
||||
*/
|
||||
protected function get_next_converter($converters, $currentconverter = null) {
|
||||
if ($currentconverter) {
|
||||
@ -226,7 +226,7 @@ class converter {
|
||||
|
||||
$from = \core_filetypes::get_file_extension($file->get_mimetype());
|
||||
if (!$from) {
|
||||
// No mimetype could be found. Unable to determine converter.
|
||||
// No mime type could be found. Unable to determine converter.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
|
@ -26,8 +26,8 @@ namespace fileconverter_unoconv;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
use stored_file;
|
||||
|
||||
use stored_file;
|
||||
use \core_files\conversion;
|
||||
|
||||
/**
|
||||
@ -118,9 +118,9 @@ class converter implements \core_files\converter_interface {
|
||||
try {
|
||||
// This function can either return false, or throw an exception so we need to handle both.
|
||||
if ($file->copy_content_to($filename) === false) {
|
||||
throw new file_exception('storedfileproblem', 'Could not copy file contents to temp file.');
|
||||
throw new \file_exception('storedfileproblem', 'Could not copy file contents to temp file.');
|
||||
}
|
||||
} catch (file_exception $fe) {
|
||||
} catch (\file_exception $fe) {
|
||||
throw $fe;
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ class converter implements \core_files\converter_interface {
|
||||
/**
|
||||
* Generate and serve the test document.
|
||||
*
|
||||
* @return stored_file
|
||||
* @return void
|
||||
*/
|
||||
public function serve_test_document() {
|
||||
global $CFG;
|
||||
@ -267,7 +267,7 @@ class converter implements \core_files\converter_interface {
|
||||
/**
|
||||
* Whether the plugin is fully configured.
|
||||
*
|
||||
* @return bool
|
||||
* @return \stdClass
|
||||
*/
|
||||
public static function test_unoconv_path() {
|
||||
global $CFG;
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
/**
|
||||
* A set of tests for some of the unoconv functionality within Moodle.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user