Skip to content

Commit

Permalink
Merge branch 'MDL-71604-master' of git://github.com/rezaies/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyatregubov committed Jul 20, 2021
2 parents 494a9bb + da509ff commit 501bc9e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
39 changes: 39 additions & 0 deletions lib/editor/atto/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,44 @@ function xmldb_editor_atto_upgrade($oldversion) {
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2021062400) {
// The old default toolbar config for 311 and below.
$oldtoolbar = 'collapse = collapse
style1 = title, bold, italic
list = unorderedlist, orderedlist, indent
links = link
files = emojipicker, image, media, recordrtc, managefiles, h5p
style2 = underline, strike, subscript, superscript
align = align
insert = equation, charmap, table, clear
undo = undo
accessibility = accessibilitychecker, accessibilityhelper
other = html';

// Check if the current toolbar config matches the old toolbar config.
$sametoolbar = str_replace(["\r\n", "\r"], "\n", get_config('editor_atto', 'toolbar')) == $oldtoolbar;
// Check if the current showgroups config matches the old showgroups config.
$sameshowgroups = get_config('atto_collapse', 'showgroups') == 5;

if ($sametoolbar && $sameshowgroups) {
// If the site is still using the old defaults, upgrade to the new default.
$newtoolbar = 'collapse = collapse
style1 = title, bold, italic
list = unorderedlist, orderedlist, indent
links = link
files = emojipicker, image, media, recordrtc, managefiles, h5p
accessibility = accessibilitychecker, accessibilityhelper
style2 = underline, strike, subscript, superscript
align = align
insert = equation, charmap, table, clear
undo = undo
other = html';
set_config('toolbar', $newtoolbar, 'editor_atto');
set_config('showgroups', 6, 'atto_collapse');
}

upgrade_plugin_savepoint(true, 2021062400, 'editor', 'atto');
}

return true;
}
2 changes: 1 addition & 1 deletion lib/editor/atto/plugins/collapse/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// Number of groups to show when collapsed.
$name = new lang_string('showgroups', 'atto_collapse');
$desc = new lang_string('showgroups_desc', 'atto_collapse');
$default = 5;
$default = 6;
$options = array_combine(range(1, 20), range(1, 20));

$setting = new admin_setting_configselect('atto_collapse/showgroups',
Expand Down
2 changes: 1 addition & 1 deletion lib/editor/atto/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
list = unorderedlist, orderedlist, indent
links = link
files = emojipicker, image, media, recordrtc, managefiles, h5p
accessibility = accessibilitychecker, accessibilityhelper
style2 = underline, strike, subscript, superscript
align = align
insert = equation, charmap, table, clear
undo = undo
accessibility = accessibilitychecker, accessibilityhelper
other = html';
$setting = new editor_atto_toolbar_setting('editor_atto/toolbar', $name, $desc, $default);

Expand Down
2 changes: 1 addition & 1 deletion lib/editor/atto/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2021062400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'editor_atto'; // Full name of the plugin (used for diagnostics).

0 comments on commit 501bc9e

Please sign in to comment.