Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
4d76de6f
Commit
4d76de6f
authored
Feb 27, 2017
by
Ankit Agarwal
Browse files
MDL-55859 assign_editpdf: cleanup htmlfile in case of errors
parent
e40d5048
Changes
3
Hide whitespace changes
Inline
Side-by-side
mod/assign/feedback/editpdf/classes/document_services.php
View file @
4d76de6f
...
...
@@ -200,7 +200,13 @@ EOD;
$record
->
filename
=
$plugin
->
get_type
()
.
'-'
.
$filename
;
$htmlfile
=
$fs
->
create_file_from_string
(
$record
,
$file
);
$convertedfile
=
$fs
->
get_converted_document
(
$htmlfile
,
'pdf'
);
try
{
$convertedfile
=
$fs
->
get_converted_document
(
$htmlfile
,
'pdf'
);
}
catch
(
\
Exception
$e
)
{
// Let us delete the file and re-throw the exception.
$htmlfile
->
delete
();
throw
$e
;
}
$htmlfile
->
delete
();
if
(
$convertedfile
)
{
$files
[
$filename
]
=
$convertedfile
;
...
...
mod/assign/feedback/editpdf/db/upgrade.php
View file @
4d76de6f
...
...
@@ -71,5 +71,21 @@ function xmldb_assignfeedback_editpdf_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
if
(
$oldversion
<
2017022700
)
{
// Get orphaned, duplicate files and delete them.
$fs
=
get_file_storage
();
$sqllike
=
$DB
->
sql_like
(
"filename"
,
"?"
);
$where
=
"component='assignfeedback_editpdf' AND filearea = 'importhtml' AND "
.
$sqllike
;
$filerecords
=
$DB
->
get_records_select
(
"files"
,
$where
,
[
"onlinetext-%"
]);
foreach
(
$filerecords
as
$filerecord
)
{
$file
=
$fs
->
get_file_instance
(
$filerecord
);
$file
->
delete
();
}
// Editpdf savepoint reached.
upgrade_plugin_savepoint
(
true
,
2017022700
,
'assignfeedback'
,
'editpdf'
);
}
return
true
;
}
mod/assign/feedback/editpdf/version.php
View file @
4d76de6f
...
...
@@ -24,7 +24,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$plugin
->
version
=
201
61205
00
;
$plugin
->
version
=
201
70227
00
;
$plugin
->
requires
=
2016112900
;
$plugin
->
component
=
'assignfeedback_editpdf'
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment