mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
MDL-42671 EditPDF: Disable EditPDF is zlib is not available
Also put a warning on the admin page if this is the case.
This commit is contained in:
parent
61bac37cf1
commit
237f484188
4 changed files with 80 additions and 2 deletions
|
@ -89,3 +89,5 @@ $string['unsavedchanges'] = 'Unsaved changes';
|
|||
$string['viewfeedbackonline'] = 'View annotated pdf...';
|
||||
$string['white'] = 'White';
|
||||
$string['yellow'] = 'Yellow';
|
||||
$string['zlibenabled'] = 'zlib enabled';
|
||||
$string['zlibnotavailable'] = 'Php extension "zlib" is not available. The annotate PDF feature relies on this php extension and will be disabled until zlib is installed and enabled.';
|
||||
|
|
|
@ -266,6 +266,9 @@ class assign_feedback_editpdf extends assign_feedback_plugin {
|
|||
*/
|
||||
public function is_enabled() {
|
||||
$testpath = assignfeedback_editpdf\pdf::test_gs_path();
|
||||
if (!extension_loaded('zlib')) {
|
||||
return false;
|
||||
}
|
||||
if ($testpath->status == assignfeedback_editpdf\pdf::GSPATH_OK) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,16 @@ $settings->add($setting);
|
|||
|
||||
// Ghostscript setting.
|
||||
$settings->add(new admin_setting_configexecutable('assignfeedback_editpdf/gspath',
|
||||
get_string('gspath', 'assignfeedback_editpdf'),
|
||||
get_string('gspath_help', 'assignfeedback_editpdf'), '/usr/bin/gs'));
|
||||
get_string('gspath', 'assignfeedback_editpdf'),
|
||||
get_string('gspath_help', 'assignfeedback_editpdf'),
|
||||
'/usr/bin/gs'));
|
||||
|
||||
$setting = new admin_setting_php_extension_enabled('assignfeedback_editpdf/zlibenabled',
|
||||
get_string('zlibenabled', 'assignfeedback_editpdf'),
|
||||
get_string('zlibnotavailable', 'assignfeedback_editpdf'),
|
||||
'zlib');
|
||||
|
||||
$settings->add($setting);
|
||||
|
||||
$url = new moodle_url('/mod/assign/feedback/editpdf/testgs.php');
|
||||
$link = html_writer::link($url, get_string('testgs', 'assignfeedback_editpdf'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue