Migrating multi-domain configuration
From MoodleDocs
This feature is part of Moodle Workplace™, which is available through Moodle Certified Partners and Service Providers only.
If you were using the experimental multi-domain feature in Moodle Workplace 4.0-4.4 (WP-3781), you must change to the modified implementation introduced in Moodle Workplace 4.5.
If you have $CFG->tool_tenant_wwwroot defined in your config.php, it will no longer work as expected.
Below are the instructions on how to migrate multi-domain configuration. If you did not use the experimental feature but want to use tenant domains in 4.5, you only need to do step 4 from below. Refer to the Multi-tenancy domain configuration documentation page.
Perform the following steps in this exact order:
- Upgrade your site to Moodle Workplace 4.5
- Run the CLI script:This script reads the content of the $CFG->tool_tenant_wwwroot variable from your config.php and will insert the tenant domains into the database.
php admin/tool/tenant/cli/migrate_tenant_domains.php
- Remove all modifications from config.php that are described in experimental feature documentation (4.4). Remove the $CFG->tool_tenant_wwwroot entry and ensure that you only set $CFG->wwwroot once. Note: Do not modify its value afterwards!
- Add the following line to your config.php:
$CFG->allowmultipledomains = true;