/**
 * @file
 * Upgrade instructions for Domain Access
 */

CONTENTS
--------

1. Upgrading from Drupal 6 to Drupal 7
2. Upgrading from Domain Access 7.x.2 to 7.x.3.
3. Upgrading from Domain Access 6.x.1 to 6.x.2
3.1. Who Needs to Upgrade?
3.2. How to Upgrade
3.3. Error Notices
3.4. Change Summary
4. Upgrading From Drupal 5


----
1. Upgrading from Drupal 6 to Drupal 7

To upgrade Domain Access from Drupal 6 to Drupal 7, you should follow
Drupal's guide (found in the core UPGRADE.txt file in Drupal's root directory.)

When upgrading, follow the additional steps below to ensure that the required
changes for Domain Access do not interfere with Drupal's update process.

  -- Remove the Domain Access include line from settings.php.

    /**
     * Add the domain module setup routine.
     */
    include './sites/all/modules/domain/settings.inc';

  See INSTALL.txt for more information about this code.

  -- Update Drupal, following the process described in the core UPGRADE.txt.
  This step includes disabling (but not uninstalling) all Domain Access modules
  before you continue.

  -- Download Domain Access for Drupal 7.

  -- Run the database update script.
  This step will make the necessary changes that update Domain Access for
  Drupal 7.

  -- Enable the Domain Access module.

  -- Add the Domain Access settings line back to settings.php. Be sure to
  include these lines _below_ the database configuration information. (The
  Drupal update may place the new $databases array at the bottom of
  settings.php.)

    /**
     * Add the domain module setup routine.
     */
    include DRUPAL_ROOT . './sites/all/modules/domain/settings.inc';

  Refer to the Domain Access INSTALL.txt for information about the new syntax
  for the Domain Access include.

  -- If prompted, rebuild content access permissions.

  -- Enable Domain submodules (if desired).

You should now be ready to use your Drupal 7 site.


----
2. Upgrading from Domain Access 7.x.2 to 7.x.3.

If you are using Domain Access 7.x.2, you must upgrade to 7.x.3 using the
Drupal update script. To do so, follow the steps below.

  -- Disable Domain Access 7.x.2 and its dependent modules.
  -- Download Domain Access 7.x.3 and replace the existing 'domain' files
     with the new module files.
  -- Run update.php, either through the user interface or drush.
  -- Enable Domain Access and its dependent modules.

If you do not disable the module before upgrading, fatal errors will occur.
These errors are temporary but look pretty scary. Your site will not be
damaged, so Don't Panic.

After you upgrade, you may be prompted to perform additional actions. Simply
follow the on-screen instructions. These additional updates may not be
accessible via drush.

----
3. Upgrading from Domain Access 6.x.1 to 6.x.2

If you are using Domain Access 6.x.1, you must upgrade to 6.x.2 before
migrating to Drupal 7. This section outlines that upgrade process.


----
3.1  Who Needs to Upgrade?

If you are using Domain Access prior to 6.x.2.0, then you should
follow these upgrade instructions.

Note that if you are upgrading from 6.x.1 to 7.x.2, you must first perform this
update in Drupal 6.


----
3.2  How to Upgrade

In previous versions, Domain Access asked you to make several
changes to your site's settings.php file.  The 6.x.2.0 version
has made this process easier.

NOTE: You must leave the Domain Access module and its child
modules turned on during the upgrade process.

When you first update the source code, you may see some
Drupal error messages printed on screen. These are normal and
will disappear after the upgrade is complete.


To upgrade, follow the steps below.

STEP  1:  Update the module source code

Replace your existing module files with the new downloaded source.


STEP  2:   Add new code to settings.php

Add the following code to your site's settings.php file:

/**
 * Add the domain module setup routine.
 */
include './sites/all/modules/domain/settings.inc';

See INSTALL.txt for additional information.


STEP  3:  Remove old code from settings.php

If you have any of the following code in settings.php from earlier
versions, you should remove it:

/**
 * Add the custom_url_rewrite_outbound function.
 */
require_once './sites/all/modules/domain/settings_custom_url.inc';

/**
 * Add the domain_conf settings override
 */
require_once './sites/all/modules/domain/domain_conf/settings_domain_conf.inc';

/**
 * Add the domain_prefix tables
 */
require_once './sites/all/modules/domain/domain_prefix/settings_domain_prefix.inc';


STEP  4:  Register the module updates

After you have edited settings.php, log in to your Primary Domain as user 1
and run the Drupal update script.

The update must be run from your primary domain.

STEP 5:  Rebuild node access permissions

After running the update script, when you return to the administration pages
you will be prompted to rebuild the node access table. Click on the link or go
to Admin > Content > Post settings and click the 'Rebuild Permissions' button.

STEP 6: Reset permissions for domain module

The old 'Content Editing Forms' setting has been replaced by role-based
permissions.  Please see section 3.1 of README.txt and reset your
site permissions accordingly. The upgrade does not split permissions for you.

There are also new permissions documented in README.txt.

----
3.3  Error Notices

If your module is not configured correctly, you should see an error notice
on the top of the page -- this message is shown only to users with the
'administer domains' permission.  The error is also written to your site's
error logs, if any.

If you encounter this error, please check that you have installed or upgraded
the module correctly.  If the problem persists, please file a support request
at http://drupal.org/project/domain.


----
3.4  Change Summary

Below are some notes about the changes to the new version.

-- Pre-load functions are now handled automatically.
-- Domain Alias has been added.
-- The old setting for 'Content editing forms' has been made a permission,
    so these functions can now be set per user role.
-- The Primary Domain is now stored in both the {variables} and
    {domain} tables. Doing so allows full integration with Views and
    simplifies some of the core code. However, it will also force the module
    to skip a domain_id in the database. This change will not cause any
    issues, but there will be a skipped domain_id for all sites.
-- Fresh installs of Domain Access will never have a domain_id of 1.
-- The 'domain editor' grant has been deprecated.
-- The new function domain_get_user_domains($uid) can be used
    to find which domains as user is assigned to.


----
4. Upgrading from Drupal 5

The upgrade process should work fine when upgrading from Drupal 5 to Drupal 6.

Upgrading from Drupal 5 to Drupal 7 is not supported.

Best practice is to disable contributed modules when upgrading Drupal.
Be sure you disable (but do not uninstall) the Domain Access module
before upgrading Drupal.

When you have upgraded Drupal core, you may upgrade Domain Access.
Be sure to turn the Domain Access module (and its children) back on
before running any Domain Access updates.
