MDL-61876 admin: set default forceclean=1

This commit is contained in:
Marina Glancy 2018-04-06 11:36:31 +08:00
parent b197da8770
commit c182f060fa
4 changed files with 14 additions and 2 deletions

View File

@ -44,7 +44,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
new lang_string('configuserquota', 'admin', $params), $defaultuserquota, PARAM_INT, 30));
$temp->add(new admin_setting_configcheckbox('forceclean', new lang_string('forceclean', 'core_admin'),
new lang_string('forceclean_desc', 'core_admin'), 0));
new lang_string('forceclean_desc', 'core_admin'), 1));
$temp->add(new admin_setting_configcheckbox('allowobjectembed', new lang_string('allowobjectembed', 'admin'), new lang_string('configallowobjectembed', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enabletrusttext', new lang_string('enabletrusttext', 'admin'), new lang_string('configenabletrusttext', 'admin'), 0));

View File

@ -858,7 +858,9 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
* Test get_course_contents
*/
public function test_get_course_contents() {
global $CFG;
$this->resetAfterTest(true);
$CFG->forceclean = 0;
list($course, $forumcm, $datacm, $pagecm, $labelcm, $urlcm) = $this->prepare_get_course_contents_test();

View File

@ -109,6 +109,9 @@ class core_weblib_format_text_testcase extends advanced_testcase {
* @param string $expected The expected filter value
*/
public function test_format_text_blanktarget($link, $expected) {
global $CFG;
$this->resetAfterTest();
$CFG->forceclean = 0;
$actual = format_text($link, FORMAT_MOODLE, array('blanktarget' => true, 'filter' => false, 'noclean' => true));
$this->assertEquals($expected, $actual);
}

View File

@ -104,6 +104,7 @@ class media_swf_testcase extends advanced_testcase {
*/
public function test_embed_link() {
global $CFG;
$CFG->forceclean = 0;
$url = new moodle_url('http://example.org/some_filename.swf');
$text = html_writer::link($url, 'Watch this one');
$content = format_text($text, FORMAT_HTML, ['trusted' => true]);
@ -113,9 +114,13 @@ class media_swf_testcase extends advanced_testcase {
$this->assertRegExp('~width="' . $CFG->media_default_width . '" height="' .
$CFG->media_default_height . '"~', $content);
// Not working without trust!
// Not working without trust or with $CFG->forceclean!
$content = format_text($text, FORMAT_HTML);
$this->assertNotRegExp('~mediaplugin_swf~', $content);
$CFG->forceclean = 1;
$content = format_text($text, FORMAT_HTML, ['trusted' => true]);
$this->assertNotRegExp('~mediaplugin_swf~', $content);
}
/**
@ -125,6 +130,8 @@ class media_swf_testcase extends advanced_testcase {
*/
public function test_embed_media() {
global $CFG;
$CFG->forceclean = 0;
$url = new moodle_url('http://example.org/some_filename.swf');
$trackurl = new moodle_url('http://example.org/some_filename.vtt');
$text = '<video controls="true"><source src="'.$url.'"/>' .