Studio/uses mixed modulestore

https://edx-wiki.atlassian.net/browse/STUD-1540
Wiki doc: https://github.com/edx/edx-platform/wiki/Mixed-Modulestore

**MixedModuleStore API**
* Updated Studio and LMS so all callers, with a few exceptions, go through the `MixedModulestore`.
  * to find the exceptions (a few tests and 2 management commands), search for callers to `_get_modulestore_by_type`.
* Updated the `MixedModuleStore` API and all their callers to take in the `user_id` for all Edit operations.

**Mongo Modulestore**
* Callers should no longer distinguish between 'direct' and 'draft' Mongo modulestores.  All users of the Mongo store now always go through the `DraftModuleStore`.
* Callers can specify whether they want only published versions in their runtime by configuring the modulestore's branch to 'published' (LMS).  The default setting is 'draft' (used by CMS and Preview) which prefers Draft versions over Published versions.
* Since (most) test code now go through the Draft store, some tests needed to be updated to explicitly Publish their newly created items if they assumed they would be in that state.
* API changes:
  * Updated APIs for `has_item`, `get_parent_locations`, `get_items`, and `delete_item` to take in a `revision` parameter.  Refer to docstrings for more detail.
* Improvements to the implementation of the following APIs:
  * Publish - so it automatically publishes all the downstream children.
  * Delete - so it does the "right" thing depending on which revision is deleted, etc.

**Settings**
* Changed the configuration setting format so the Stores listed in the Mixed configuration can be ordered by preference, via a `list` rather than a `dict`.
* Updated the settings for all Test code so they should all go through Mixed, unless they are explicitly testing a particular store.
* Introduced a new Setting called `MODULESTORE_BRANCH` that specifies the default "branch" (draft or published) to be used by relevant modulestore methods.  Currently, the `DraftModuleStore` uses this setting.  Eventually, the `SplitModuleStore` will also honor it.

**Testing**  @jzoldak 
The following should be tested before Release:  
* Performance - new indirection through Mixed (for CMS) and through Draft (for LMS).
* Preview from Studio - make sure both Draft and Published items are seen correctly.
* Migration of very old roles since 0036_access_roles_orgless.py was changed.
* Different configurations - devstack, non-devstack, sandbox, prod.
* Which tests have multiple stores configured at once (xml and old mongo)?
* Export/Import course - draft/published content

**Reviewers**: @cahrens (Studio) @dianakhuang (LMS) @feanil (Devops)
We agree and are working to change that.


On Thu, Jul 3, 2014 at 1:28 PM, Carson Gee <notifications@github.com> wrote:

> In lms/envs/test.py:
>
> > @@ -108,17 +109,20 @@
> >      if os.path.isdir(COMMON_TEST_DATA_ROOT / course_dir)
> >  ]
> >
> > -# point tests at the test courses by default
> > -
> > -MODULESTORE = {
> > -    'default': {
> > -        'ENGINE': 'xmodule.modulestore.xml.XMLModuleStore',
> > -        'OPTIONS': {
> > -            'data_dir': COMMON_TEST_DATA_ROOT,
> > -            'default_class': 'xmodule.hidden_module.HiddenDescriptor',
> > -        }
> > -    }
> > -}
> > +MODULESTORE_BRANCH = 'draft'
>
> I know this is after the fact, but using draft to test out lms just seems
> like a bad idea in general since the vast majority of lms in real life is
> done on published resources and not draft. My $.02 for keeping a reasonably
> close to production test environment.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/edx/edx-platform/pull/3915/files#r14526817>.
>