MDL-60848 editor_atto: upgrade to add recordrtc

This commit is contained in:
Mark Nelson 2018-03-15 20:04:02 +08:00
parent dde2a79a70
commit 6b21108b44
3 changed files with 27 additions and 2 deletions

View File

@ -41,5 +41,30 @@ function xmldb_editor_atto_upgrade($oldversion) {
// Automatically generated Moodle v3.4.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2018041100) {
$toolbar = get_config('editor_atto', 'toolbar');
if (strpos($toolbar, 'recordrtc') === false) {
$glue = "\r\n";
if (strpos($toolbar, $glue) === false) {
$glue = "\n";
}
$groups = explode($glue, $toolbar);
// Try to put recordrtc in files group.
foreach ($groups as $i => $group) {
$parts = explode('=', $group);
if (trim($parts[0]) == 'files') {
$groups[$i] = 'files = ' . trim($parts[1]) . ', recordrtc';
// Update config variable.
$toolbar = implode($glue, $groups);
set_config('toolbar', $toolbar, 'editor_atto');
}
}
}
// Atto editor savepoint reached.
upgrade_plugin_savepoint(true, 2018041100, 'editor', 'atto');
}
return true;
}

View File

@ -36,7 +36,7 @@ if ($ADMIN->fulltree) {
style1 = title, bold, italic
list = unorderedlist, orderedlist
links = link
files = image, media, managefiles
files = image, media, managefiles, recordrtc
style2 = underline, strike, subscript, superscript
align = align
indent = indent

View File

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017111300; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2018041100; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2017110800; // Requires this Moodle version.
$plugin->component = 'editor_atto'; // Full name of the plugin (used for diagnostics).