Skip to content

Commit

Permalink
Merge branch 'MDL-54901' of git://github.com/stronk7/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Apr 19, 2017
2 parents afa5a3d + 55946a8 commit ac0553a
Show file tree
Hide file tree
Showing 18 changed files with 275 additions and 46 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ php:
- 7.1
- 5.6

addons:
postgresql: "9.3"

services:
- redis-server

Expand Down Expand Up @@ -114,7 +117,7 @@ before_script:
# The wwwroot and dataroot.
sed -i \
-e "s%http://example.com/moodle%http://localhost%" \
-e "s%http://example.com/moodle%https://localhost%" \
-e "s%/home/example/moodledata%/home/travis/roots/base%" \
config.php ;
Expand Down
175 changes: 175 additions & 0 deletions admin/environment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1905,4 +1905,179 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.3" requires="2.7">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="5.5.31" />
<VENDOR name="mysql" version="5.5.31" />
<VENDOR name="postgres" version="9.3" />
<VENDOR name="mssql" version="10.0" />
<VENDOR name="oracle" version="10.2" />
</DATABASE>
<PHP version="5.6.5" level="required">
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="pcreunicodewarning" />
</FEEDBACK>
</PCREUNICODE>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_ERROR message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_ERROR message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="required">
<FEEDBACK>
<ON_ERROR message="opensslrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="optional">
<FEEDBACK>
<ON_CHECK message="intlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="hash" level="required"/>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
<FEEDBACK>
<ON_CHECK message="ishttpswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
<FEEDBACK>
<ON_CHECK message="incompleteunicodesupport" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
20 changes: 9 additions & 11 deletions admin/tool/mobile/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ public function test_get_autologin_key() {
$this->assertTrue(isset($token->privatetoken));

// Enable requeriments.
$CFG->httpswwwroot = str_replace('http:', 'https:', $CFG->httpswwwroot); // Mock https.
$CFG->enablewebservices = 1;
$CFG->enablemobilewebservice = 1;
$_GET['wstoken'] = $token->token; // Mock parameters.

// Even if we force the password change for the current user we should be able to retrieve the key.
Expand All @@ -212,8 +209,13 @@ public function test_get_autologin_key() {
* Test get_autologin_key missing ws.
*/
public function test_get_autologin_key_missing_ws() {
global $CFG;
$this->resetAfterTest(true);

// Need to disable webservices to verify that's checked.
$CFG->enablewebservices = 0;
$CFG->enablemobilewebservice = 0;

$this->setAdminUser();
$this->expectException('moodle_exception');
$this->expectExceptionMessage(get_string('enablewsdescription', 'webservice'));
Expand All @@ -226,10 +228,12 @@ public function test_get_autologin_key_missing_ws() {
public function test_get_autologin_key_missing_https() {
global $CFG;

// Need to simulate a non HTTPS site here.
$CFG->wwwroot = str_replace('https:', 'http:', $CFG->wwwroot);
$CFG->httpswwwroot = str_replace('https:', 'http:', $CFG->wwwroot);

$this->resetAfterTest(true);
$this->setAdminUser();
$CFG->enablewebservices = 1;
$CFG->enablemobilewebservice = 1;

$this->expectException('moodle_exception');
$this->expectExceptionMessage(get_string('httpsrequired', 'tool_mobile'));
Expand All @@ -244,9 +248,6 @@ public function test_get_autologin_key_missing_admin() {

$this->resetAfterTest(true);
$this->setAdminUser();
$CFG->enablewebservices = 1;
$CFG->enablemobilewebservice = 1;
$CFG->httpswwwroot = str_replace('http:', 'https:', $CFG->httpswwwroot);

$this->expectException('moodle_exception');
$this->expectExceptionMessage(get_string('autologinnotallowedtoadmins', 'tool_mobile'));
Expand All @@ -262,9 +263,6 @@ public function test_get_autologin_key_missing_locked() {
$this->resetAfterTest(true);
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
$CFG->enablewebservices = 1;
$CFG->enablemobilewebservice = 1;
$CFG->httpswwwroot = str_replace('http:', 'https:', $CFG->httpswwwroot);

$service = $DB->get_record('external_services', array('shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE));

Expand Down
10 changes: 5 additions & 5 deletions enrol/lti/tests/helper_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function test_get_launch_url() {

$id = $tool1->id;
$launchurl = \enrol_lti\helper::get_launch_url($id);
$this->assertEquals('http://www.example.com/moodle/enrol/lti/tool.php?id=' . $id, $launchurl->out());
$this->assertEquals('https://www.example.com/moodle/enrol/lti/tool.php?id=' . $id, $launchurl->out());
}

/**
Expand All @@ -281,13 +281,13 @@ public function test_get_cartridge_url() {
$id = $tool1->id;
$token = \enrol_lti\helper::generate_cartridge_token($id);
$launchurl = \enrol_lti\helper::get_cartridge_url($tool1);
$this->assertEquals('http://www.example.com/moodle/enrol/lti/cartridge.php?id=' . $id . '&amp;token=' . $token,
$this->assertEquals('https://www.example.com/moodle/enrol/lti/cartridge.php?id=' . $id . '&amp;token=' . $token,
$launchurl->out());

$CFG->slasharguments = true;

$launchurl = \enrol_lti\helper::get_cartridge_url($tool1);
$this->assertEquals('http://www.example.com/moodle/enrol/lti/cartridge.php/' . $id . '/' . $token . '/cartridge.xml',
$this->assertEquals('https://www.example.com/moodle/enrol/lti/cartridge.php/' . $id . '/' . $token . '/cartridge.xml',
$launchurl->out());

$CFG->slasharguments = $slasharguments;
Expand All @@ -311,13 +311,13 @@ public function test_get_proxy_url() {
$id = $tool1->id;
$token = \enrol_lti\helper::generate_proxy_token($id);
$launchurl = \enrol_lti\helper::get_proxy_url($tool1);
$this->assertEquals('http://www.example.com/moodle/enrol/lti/proxy.php?id=' . $id . '&amp;token=' . $token,
$this->assertEquals('https://www.example.com/moodle/enrol/lti/proxy.php?id=' . $id . '&amp;token=' . $token,
$launchurl->out());

$CFG->slasharguments = true;

$launchurl = \enrol_lti\helper::get_proxy_url($tool1);
$this->assertEquals('http://www.example.com/moodle/enrol/lti/proxy.php/' . $id . '/' . $token . '/',
$this->assertEquals('https://www.example.com/moodle/enrol/lti/proxy.php/' . $id . '/' . $token . '/',
$launchurl->out());

$CFG->slasharguments = $slasharguments;
Expand Down
2 changes: 1 addition & 1 deletion files/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function test_get_files() {
'itemid' => $itemid,
'filepath' => '/',
'filename' => 'Simple4.txt',
'url' => 'http://www.example.com/moodle/pluginfile.php/'.$context->id.'/mod_data/content/'.$itemid.'/Simple4.txt',
'url' => 'https://www.example.com/moodle/pluginfile.php/'.$context->id.'/mod_data/content/'.$itemid.'/Simple4.txt',
'isdir' => false,
'timemodified' => $timemodified,
'timecreated' => $timecreated,
Expand Down
2 changes: 1 addition & 1 deletion filter/emoticon/tests/filter_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function test_filter_emoticon_formats() {
$this->assertEquals($expected, $filter->filter('(grr)', $options));

// And texts matching target formats are filtered.
$expected = '<img class="icon emoticon" alt="angry" title="angry" src="http://www.example.com/moodle/theme/image.php/_s/boost/core/1/s/angry" />';
$expected = '<img class="icon emoticon" alt="angry" title="angry" src="https://www.example.com/moodle/theme/image.php/_s/boost/core/1/s/angry" />';
$options = array('originalformat' => FORMAT_HTML); // Only FORMAT_HTML is filtered, see {@link testable_filter_emoticon}.
$this->assertEquals($expected, $filter->filter('(grr)', $options));
}
Expand Down
2 changes: 2 additions & 0 deletions lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@
It is recommended to install local copy of free GeoLite2 City database from MaxMind.<br />
IP address location is displayed on simple map or using Google Maps. Please note that you need to have a Google account and apply for free Google Maps API key to enable interactive maps.';
$string['iplookupmaxmindnote'] = 'This product includes GeoLite2 data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.';
$string['ishttpswarning'] = 'It has been detected that your site is not secured using HTTPS. For increased security and improved integrations with other systems is highly recommended to migrate your site to HTTPS.';
$string['keeptagnamecase'] = 'Keep tag name casing';
$string['lang'] = 'Default language';
$string['langcache'] = 'Cache language menu';
Expand Down Expand Up @@ -800,6 +801,7 @@
$string['onlynoreply'] = 'Only when from a no-reply address';
$string['opcacherecommended'] = 'PHP opcode caching improves performance and lowers memory requirements, OPcache extension is recommended and fully supported.';
$string['opensslrecommended'] = 'Installing the optional OpenSSL library is highly recommended -- it enables Moodle Networking functionality.';
$string['opensslrequired'] = 'The OpenSSL PHP extension is now required by Moodle to provide stronger cryptographic services.';
$string['opentogoogle'] = 'Open to Google';
$string['optionalmaintenancemessage'] = 'Optional maintenance message';
$string['order1'] = 'First';
Expand Down
2 changes: 1 addition & 1 deletion lib/outputrequirementslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function __construct() {
$this->yui3loader = new stdClass();
$this->YUI_config = new YUI_config();

if (is_https()) {
if (is_https() && !empty($CFG->useexternalyui)) {
// On HTTPS sites all JS must be loaded from https sites,
// YUI CDN does not support https yet, sorry.
$CFG->useexternalyui = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/phpunit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
}

// override CFG settings if necessary and throw away extra CFG settings
$CFG->wwwroot = 'http://www.example.com/moodle';
$CFG->wwwroot = 'https://www.example.com/moodle';
$CFG->dataroot = $CFG->phpunit_dataroot;
$CFG->prefix = $CFG->phpunit_prefix;
$CFG->dbtype = isset($CFG->phpunit_dbtype) ? $CFG->phpunit_dbtype : $CFG->dbtype;
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/configonlylib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function test_min_get_slash_argument() {
global $CFG;

$this->resetAfterTest();
$this->assertEquals('http://www.example.com/moodle', $CFG->wwwroot);
$this->assertEquals('https://www.example.com/moodle', $CFG->wwwroot);

$_SERVER = array();
$_SERVER['SERVER_SOFTWARE'] = 'Apache/2.2.22 (Unix)';
Expand Down
6 changes: 3 additions & 3 deletions lib/tests/filter_manager_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function filter_text($text, $skipfilters) {
public function test_filter_normal() {
$this->resetAfterTest();
filter_set_global_state('emoticon', TEXTFILTER_ON);
$this->assertRegExp('~^<p><img class="icon emoticon" alt="smile" title="smile" src="http://www.example.com/moodle/theme/image.php/_s/boost/core/1/s/smiley" /></p>$~',
$this->assertRegExp('~^<p><img class="icon emoticon" alt="smile" title="smile" src="https://www.example.com/moodle/theme/image.php/_s/boost/core/1/s/smiley" /></p>$~',
$this->filter_text('<p>:-)</p>', array()));
}

Expand All @@ -68,15 +68,15 @@ public function test_one_filter_disabled() {
public function test_disabling_other_filter_does_not_break_it() {
$this->resetAfterTest();
filter_set_global_state('emoticon', TEXTFILTER_ON);
$this->assertRegExp('~^<p><img class="icon emoticon" alt="smile" title="smile" src="http://www.example.com/moodle/theme/image.php/_s/boost/core/1/s/smiley" /></p>$~',
$this->assertRegExp('~^<p><img class="icon emoticon" alt="smile" title="smile" src="https://www.example.com/moodle/theme/image.php/_s/boost/core/1/s/smiley" /></p>$~',
$this->filter_text('<p>:-)</p>', array('urltolink')));
}

public function test_one_filter_of_two_disabled() {
$this->resetAfterTest();
filter_set_global_state('emoticon', TEXTFILTER_ON);
filter_set_global_state('urltolink', TEXTFILTER_ON);
$this->assertRegExp('~^<p><img class="icon emoticon" alt="smile" title="smile" src="http://www.example.com/moodle/theme/image.php/_s/boost/core/1/s/smiley" /> http://google.com/</p>$~',
$this->assertRegExp('~^<p><img class="icon emoticon" alt="smile" title="smile" src="https://www.example.com/moodle/theme/image.php/_s/boost/core/1/s/smiley" /> http://google.com/</p>$~',
$this->filter_text('<p>:-) http://google.com/</p>', array('glossary', 'urltolink')));
}
}
Loading

0 comments on commit ac0553a

Please sign in to comment.