diff --git a/admin/registration/forms.php b/admin/registration/forms.php index 81429992d44..4cb0e40e927 100644 --- a/admin/registration/forms.php +++ b/admin/registration/forms.php @@ -128,7 +128,7 @@ class hub_selector_form extends moodleform { //remove moodle.org from the hub list foreach ($hubs as $key => $hub) { - if ($hub['url'] == HUB_MOODLEORGHUBURL) { + if ($hub['url'] == HUB_MOODLEORGHUBURL || $hub['url'] == HUB_OLDMOODLEORGHUBURL) { unset($hubs[$key]); } } diff --git a/admin/renderer.php b/admin/renderer.php index f7d1516e679..63cc1ad840b 100644 --- a/admin/renderer.php +++ b/admin/renderer.php @@ -784,7 +784,7 @@ class core_admin_renderer extends plugin_renderer_base { if (has_capability('moodle/site:config', context_system::instance())) { $registerbutton = $this->single_button(new moodle_url('/admin/registration/register.php', - array('huburl' => HUB_MOODLEORGHUBURL, 'hubname' => 'Moodle.org')), + array('huburl' => HUB_MOODLEORGHUBURL, 'hubname' => 'Moodle.net')), get_string('register', 'admin')); $str = 'registrationwarning'; } else { diff --git a/admin/settings/top.php b/admin/settings/top.php index 5d4495c9cf5..c78c90908f8 100644 --- a/admin/settings/top.php +++ b/admin/settings/top.php @@ -11,7 +11,7 @@ $hassiteconfig = has_capability('moodle/site:config', $systemcontext); $ADMIN->add('root', new admin_externalpage('adminnotifications', new lang_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php")); $ADMIN->add('root', new admin_externalpage('registrationmoodleorg', new lang_string('registration', 'admin'), - "$CFG->wwwroot/$CFG->admin/registration/register.php?huburl=" . HUB_MOODLEORGHUBURL . "&hubname=Moodle.org&sesskey=" . sesskey())); + "$CFG->wwwroot/$CFG->admin/registration/register.php?huburl=" . HUB_MOODLEORGHUBURL . "&hubname=Moodle.net&sesskey=" . sesskey())); $ADMIN->add('root', new admin_externalpage('registrationhub', new lang_string('registerwith', 'hub'), "$CFG->wwwroot/$CFG->admin/registration/register.php", 'moodle/site:config', true)); $ADMIN->add('root', new admin_externalpage('registrationhubs', new lang_string('hubs', 'admin'), diff --git a/blocks/community/forms.php b/blocks/community/forms.php index c5159119fdb..a61b2732cde 100644 --- a/blocks/community/forms.php +++ b/blocks/community/forms.php @@ -109,6 +109,13 @@ class community_hub_search_form extends moodleform { $mform->addElement('static', 'errorhub', '', $error); } + // Hubdirectory returns old URL for the moodle.net hub, substitute it. + foreach ($hubs as $key => $hub) { + if ($hub['url'] === HUB_OLDMOODLEORGHUBURL) { + $hubs[$key]['url'] = HUB_MOODLEORGHUBURL; + } + } + //display list of registered on hub $registrationmanager = new registration_manager(); $registeredhubs = $registrationmanager->get_registered_on_hubs(); diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 3120399a619..575f04e63d6 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2214,6 +2214,7 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2017072000.02); } +<<<<<<< HEAD if ($oldversion < 2017072700.01) { // Changing nullability of field email on table oauth2_system_account to null. $table = new xmldb_table('oauth2_system_account'); @@ -2226,5 +2227,34 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2017072700.01); } + if ($oldversion < 2017072700.02) { + + // If the site was previously registered with http://hub.moodle.org change the registration to + // point to https://moodle.net - this is the correct hub address using https protocol. + $oldhuburl = "http://hub.moodle.org"; + $newhuburl = "https://moodle.net"; + $cleanoldhuburl = preg_replace('/[^A-Za-z0-9_-]/i', '', $oldhuburl); + $cleannewhuburl = preg_replace('/[^A-Za-z0-9_-]/i', '', $newhuburl); + + // Update existing registration. + $DB->execute("UPDATE {registration_hubs} SET hubname = ?, huburl = ? WHERE huburl = ?", + ['Moodle.net', $newhuburl, $oldhuburl]); + + // Update settings of existing registration. + $sqlnamelike = $DB->sql_like('name', '?'); + $entries = $DB->get_records_sql("SELECT * FROM {config_plugins} where plugin=? and " . $sqlnamelike, + ['hub', '%' . $DB->sql_like_escape('_' . $cleanoldhuburl)]); + foreach ($entries as $entry) { + $newname = substr($entry->name, 0, -strlen($cleanoldhuburl)) . $cleannewhuburl; + $DB->update_record('config_plugins', ['id' => $entry->id, 'name' => $newname]); + } + + // Update published courses. + $DB->execute('UPDATE {course_published} SET huburl = ? WHERE huburl = ?', [$newhuburl, $oldhuburl]); + + // Main savepoint reached. + upgrade_main_savepoint(true, 2017072700.02); + } + return true; } diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 96d13f4048c..9e5ede0ded3 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -488,13 +488,14 @@ define('HOMEPAGE_USER', 2); /** * Hub directory url (should be moodle.org) */ -define('HUB_HUBDIRECTORYURL', "http://hubdirectory.moodle.org"); +define('HUB_HUBDIRECTORYURL', "https://hubdirectory.moodle.org"); /** - * Moodle.org url (should be moodle.org) + * Moodle.net url (should be moodle.net) */ -define('HUB_MOODLEORGHUBURL', "http://hub.moodle.org"); +define('HUB_MOODLEORGHUBURL', "https://moodle.net"); +define('HUB_OLDMOODLEORGHUBURL', "http://hub.moodle.org"); /** * Moodle mobile app service name diff --git a/message/output/airnotifier/lang/en/message_airnotifier.php b/message/output/airnotifier/lang/en/message_airnotifier.php index 19c888f73dd..7896464fde0 100644 --- a/message/output/airnotifier/lang/en/message_airnotifier.php +++ b/message/output/airnotifier/lang/en/message_airnotifier.php @@ -41,7 +41,7 @@ $string['nodevices'] = 'No registered devices. Devices will automatically appear $string['nopermissiontomanagedevices'] = 'You don\'t have permission to manage devices.'; $string['notconfigured'] = 'The Airnotifier server hasn\'t been configured so Airnotifier messages cannot be sent'; $string['pluginname'] = 'Mobile'; -$string['sitemustberegistered'] = 'In order to use the public Airnotifier instance you must register your site with Moodle.org'; +$string['sitemustberegistered'] = 'In order to use the public Airnotifier instance you must register your site with Moodle.net'; $string['showhide'] = 'Enable/disable the device.'; $string['requestaccesskey'] = 'Request access key'; $string['unknowndevice'] = 'Unknown device'; diff --git a/version.php b/version.php index cf1bb369b02..d58a3119e9a 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2017072700.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2017072700.02; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.