Migrating multi-domain configuration

From MoodleDocs
workplacelogo.png 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:

  1. Upgrade your site to Moodle Workplace 4.5
  2. Run the CLI script:
    php admin/tool/tenant/cli/migrate_tenant_domains.php
    
    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.
  3. 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!
  4. Add the following line to your config.php:
    $CFG->allowmultipledomains = true;