diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 4e8df5c..f460155 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -2442,13 +2442,9 @@ function drupal_container(Container $reset = NULL) {
     $container->register('config.storage', 'Drupal\Core\Config\DatabaseStorage')
       ->addArgument('%config.storage.options%');
 
-    $container->register('config.subscriber.globalconf', 'Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber');
-    $container->register('dispatcher', 'Symfony\Component\EventDispatcher\EventDispatcher')
-      ->addMethodCall('addSubscriber', array(new Reference('config.subscriber.globalconf')));
     // Register configuration object factory.
     $container->register('config.factory', 'Drupal\Core\Config\ConfigFactory')
-      ->addArgument(new Reference('config.storage'))
-      ->addArgument(new Reference('dispatcher'));
+      ->addArgument(new Reference('config.storage'));
   }
   return $container;
 }
@@ -2632,7 +2628,7 @@ function language($type, $reset = FALSE) {
 
   // Reset the language manager's cache and our own.
   if ($reset) {
-    if (drupal_container()->isScopeActive('request')) {
+    if (drupal_container()->has('language_manager')) {
       drupal_container()->get('language_manager')->reset($type);
     }
     if (!isset($type)) {
@@ -2723,7 +2719,7 @@ function language_list($flags = LANGUAGE_CONFIGURABLE) {
     $default = language_default();
     if (language_multilingual() || module_exists('language')) {
       // Use language module configuration if available.
-      $languages = db_query('SELECT * FROM {language} ORDER BY weight ASC, name ASC')->fetchAllAssoc('langcode', PDO::FETCH_ASSOC);
+      $languages = db_query('SELECT *, 0 as `default` FROM {language} ORDER BY weight ASC, name ASC')->fetchAllAssoc('langcode', PDO::FETCH_ASSOC);
 
       // Initialize default property so callers have an easy reference and can
       // save the same object without data loss.
@@ -3538,51 +3534,3 @@ function drupal_check_memory_limit($required, $memory_limit = NULL) {
   //   the operation.
   return ((!$memory_limit) || ($memory_limit == -1) || (parse_size($memory_limit) >= parse_size($required)));
 }
-
-/**
- * Instantiates and statically caches a storage controller for generated PHP code.
- *
- * By default, this returns an instance of the
- * Drupal\Component\PhpStorage\MTimeProtectedFileStorage class.
- *
- * Classes implementing
- * Drupal\Component\PhpStorage\PhpStorageInterface can be registered for a
- * specific bin or as a default implementation.
- *
- * @param $name
- *   The name for which the storage controller should be returned. Defaults to
- *   'default'. The name is also used as the storage bin if one is not
- *   specified in the configuration.
- *
- * @return Drupal\Component\PhpStorage\PhpStorageInterface
- *   An instantiated storage controller for the specified name.
- *
- * @see Drupal\Component\PhpStorage\PhpStorageInterface
- */
-function drupal_php_storage($name = 'default') {
-  global $conf;
-  $storage_controllers = &drupal_static(__FUNCTION__);
-  if (!isset($storage_controllers[$name])) {
-    if (isset($conf['php_storage'][$name])) {
-      $configuration = $conf['php_storage'][$name];
-    }
-    elseif (isset($conf['php_storage']['default'])) {
-      $configuration = $conf['php_storage']['default'];
-    }
-    else {
-      $configuration = array(
-        'class' => 'Drupal\Component\PhpStorage\MTimeProtectedFileStorage',
-        'secret' => $GLOBALS['drupal_hash_salt'],
-      );
-    }
-    $class = isset($configuration['class']) ? $configuration['class'] : 'Drupal\Component\PhpStorage\MTimeProtectedFileStorage';
-    if (!isset($configuration['bin'])) {
-      $configuration['bin'] = $name;
-    }
-    if (!isset($configuration['directory'])) {
-      $configuration['directory'] = DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php';
-    }
-    $storage_controllers[$name] = new $class($configuration);
-  }
-  return $storage_controllers[$name];
-}
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 0842201..17e1363 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -2090,9 +2090,9 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) {
  *     Defaults to empty string when clean URLs are in effect, and to
  *     'index.php/' when they are not.
  *   - 'entity_type': The entity type of the object that called url(). Only
- *     set if url() is invoked by Drupal\entity\Entity::uri().
+ *     set if url() is invoked by entity_uri().
  *   - 'entity': The entity object (such as a node) for which the URL is being
- *     generated. Only set if url() is invoked by Drupal\entity\Entity::uri().
+ *     generated. Only set if url() is invoked by entity_uri().
  *
  * @return
  *   A string containing a URL to the given path.
diff --git a/core/includes/config.inc b/core/includes/config.inc
index 347bf85..e5f04c8 100644
--- a/core/includes/config.inc
+++ b/core/includes/config.inc
@@ -117,6 +117,7 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf
 function config_sync_changes(array $config_changes, StorageInterface $source_storage, StorageInterface $target_storage) {
   foreach (array('delete', 'create', 'change') as $op) {
     foreach ($config_changes[$op] as $name) {
+      Config::validateNamespace($name);
       if ($op == 'delete') {
         $target_storage->delete($name);
       }
@@ -188,6 +189,7 @@ function config_import_invoke_owner(array $config_changes, StorageInterface $sou
   // handle dependencies correctly.
   foreach (array('delete', 'create', 'change') as $op) {
     foreach ($config_changes[$op] as $key => $name) {
+      Config::validateNamespace($name);
       // Extract owner from configuration object name.
       $module = strtok($name, '.');
       // Check whether the module implements hook_config_import() and ask it to
diff --git a/core/includes/file.inc b/core/includes/file.inc
index ed4bdce..133d64f 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -580,19 +580,27 @@ function file_save_htaccess($directory, $private = TRUE) {
 /**
  * Loads file entities from the database.
  *
- * @param array $fids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ * @param array|bool $fids
+ *   An array of file IDs, or FALSE to load all files.
+ * @param array $conditions
+ *   (deprecated) An associative array of conditions on the {file_managed}
+ *   table, where the keys are the database fields and the values are the
+ *   values those fields must have. Instead, it is preferable to use
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  *
  * @return array
  *   An array of file entities, indexed by fid.
  *
+ * @todo Remove $conditions in Drupal 8.
+ *
  * @see hook_file_load()
  * @see file_load()
  * @see entity_load()
  * @see Drupal\entity\EntityFieldQuery
  */
-function file_load_multiple(array $fids = NULL) {
-  return entity_load_multiple('file', $fids);
+function file_load_multiple($fids = array(), array $conditions = array()) {
+  return entity_load_multiple('file', $fids, $conditions);
 }
 
 /**
@@ -608,7 +616,7 @@ function file_load_multiple(array $fids = NULL) {
  * @see file_load_multiple()
  */
 function file_load($fid) {
-  $files = file_load_multiple(array($fid));
+  $files = file_load_multiple(array($fid), array());
   return reset($files);
 }
 
@@ -795,7 +803,7 @@ function file_copy(File $source, $destination = NULL, $replace = FILE_EXISTS_REN
     $file->filename = drupal_basename($uri);
     // If we are replacing an existing file re-use its database record.
     if ($replace == FILE_EXISTS_REPLACE) {
-      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
+      $existing_files = file_load_multiple(array(), array('uri' => $uri));
       if (count($existing_files)) {
         $existing = reset($existing_files);
         $file->fid = $existing->fid;
@@ -1044,7 +1052,7 @@ function file_move(File $source, $destination = NULL, $replace = FILE_EXISTS_REN
     $file->uri = $uri;
     // If we are replacing an existing file re-use its database record.
     if ($replace == FILE_EXISTS_REPLACE) {
-      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
+      $existing_files = file_load_multiple(array(), array('uri' => $uri));
       if (count($existing_files)) {
         $existing = reset($existing_files);
         $delete_source = TRUE;
@@ -1317,10 +1325,6 @@ function file_unmanaged_delete($path) {
  *
  * @param $path
  *   A string containing either an URI or a file or directory path.
- * @param $callback
- *   (optional) Callback function to run on each file prior to deleting it and
- *   on each directory prior to traversing it. For example, can be used to
- *   modify permissions.
  *
  * @return
  *   TRUE for success or if path does not exist, FALSE in the event of an
@@ -1328,10 +1332,7 @@ function file_unmanaged_delete($path) {
  *
  * @see file_unmanaged_delete()
  */
-function file_unmanaged_delete_recursive($path, $callback = NULL) {
-  if (isset($callback)) {
-    call_user_func($callback, $path);
-  }
+function file_unmanaged_delete_recursive($path) {
   if (is_dir($path)) {
     $dir = dir($path);
     while (($entry = $dir->read()) !== FALSE) {
@@ -1339,7 +1340,7 @@ function file_unmanaged_delete_recursive($path, $callback = NULL) {
         continue;
       }
       $entry_path = $path . '/' . $entry;
-      file_unmanaged_delete_recursive($entry_path, $callback);
+      file_unmanaged_delete_recursive($entry_path);
     }
     $dir->close();
 
@@ -1564,7 +1565,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
 
   // If we are replacing an existing file re-use its database record.
   if ($replace == FILE_EXISTS_REPLACE) {
-    $existing_files = entity_load_multiple_by_properties('file', array('uri' => $file->uri));
+    $existing_files = file_load_multiple(array(), array('uri' => $file->uri));
     if (count($existing_files)) {
       $existing = reset($existing_files);
       $file->fid = $existing->fid;
@@ -1857,7 +1858,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
     ));
     // If we are replacing an existing file re-use its database record.
     if ($replace == FILE_EXISTS_REPLACE) {
-      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
+      $existing_files = file_load_multiple(array(), array('uri' => $uri));
       if (count($existing_files)) {
         $existing = reset($existing_files);
         $file->fid = $existing->fid;
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 9aa8be9..65ef9bc 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -4638,8 +4638,7 @@ function _form_set_class(&$element, $class = array()) {
  *   //   1 (or no value explicitly set) means the operation is finished
  *   //   and the batch processing can continue to the next operation.
  *
- *   $nodes = entity_load_multiple_by_properties('node', array('uid' => $uid, 'type' => $type));
- *   $node = reset($nodes);
+ *   $node = node_load(array('uid' => $uid, 'type' => $type));
  *   $context['results'][] = $node->nid . ' : ' . check_plain($node->label());
  *   $context['message'] = check_plain($node->label());
  * }
@@ -4659,7 +4658,7 @@ function _form_set_class(&$element, $class = array()) {
  *     ->range(0, $limit)
  *     ->execute();
  *   foreach ($result as $row) {
- *     $node = node_load($row->nid, TRUE);
+ *     $node = node_load($row->nid, NULL, TRUE);
  *     $context['results'][] = $node->nid . ' : ' . check_plain($node->label());
  *     $context['sandbox']['progress']++;
  *     $context['sandbox']['current_node'] = $node->nid;
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index cf8f1ed..edaf8ec 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -250,12 +250,6 @@ function install_begin_request(&$install_state) {
     exit;
   }
 
-  // Initialize conf_path().
-  // This primes the site path to be used during installation. By not requiring
-  // settings.php, a bare site folder can be prepared in the /sites directory,
-  // which will be used for installing Drupal.
-  conf_path(FALSE);
-
   drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
 
   // A request object from the HTTPFoundation to tell us about the request.
diff --git a/core/includes/path.inc b/core/includes/path.inc
index 07aeee5..36556a0 100644
--- a/core/includes/path.inc
+++ b/core/includes/path.inc
@@ -370,7 +370,7 @@ function current_path() {
   // @todo Remove the check for whether the request service exists and the
   // fallback code below, once the path alias logic has been figured out in
   // http://drupal.org/node/1269742.
-  if (drupal_container()->isScopeActive('request')) {
+  if (drupal_container()->has('request')) {
     return drupal_container()->get('request')->attributes->get('system_path');
   }
   // If we are outside the request scope, fall back to using the path stored in
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 504030e..f807979 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -649,7 +649,7 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) {
  *     their base theme), direct sub-themes of sub-themes, etc. The keys are
  *     the themes' machine names, and the values are the themes' human-readable
  *     names. This element is not set if there are no themes on the system that
- *     declare this theme as their base theme.
+ *     declare this theme as their base theme. 
 */
 function list_themes($refresh = FALSE) {
   $list = &drupal_static(__FUNCTION__, array());
@@ -913,7 +913,7 @@ function theme($hook, $variables = array()) {
       // Only log a message when not trying theme suggestions ($hook being an
       // array).
       if (!isset($candidate)) {
-        watchdog('theme', 'Theme hook %hook not found.', array('%hook' => $hook), WATCHDOG_WARNING);
+        watchdog('theme', 'Theme key "@key" not found.', array('@key' => $hook), WATCHDOG_WARNING);
       }
       return '';
     }
diff --git a/core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php b/core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php
deleted file mode 100644
index 3d1bd95..0000000
--- a/core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\Component\PhpStorage\FileStorage.
- */
-
-namespace Drupal\Component\PhpStorage;
-
-/**
- * Reads code as regular PHP files, but won't write them.
- */
-class FileReadOnlyStorage implements PhpStorageInterface {
-
-  /**
-   * The directory where the files should be stored.
-   *
-   * @var string
-   */
-  protected $directory;
-
-  /**
-   * Constructs this FileStorage object.
-   *
-   * @param $configuration
-   *   An associative array, containing at least two keys (the rest are ignored):
-   *   - directory: The directory where the files should be stored.
-   *   - bin: The storage bin. Multiple storage objects can be instantiated with
-   *   the same configuration, but for different bins.
-   */
-  public function __construct(array $configuration) {
-
-    $this->directory = $configuration['directory'] . '/' . $configuration['bin'];
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
-   */
-  public function exists($name) {
-    return file_exists($this->getFullPath($name));
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
-   */
-  public function load($name) {
-    // The FALSE returned on failure is enough for the caller to handle this,
-    // we do not want a warning too.
-    return (@include_once $this->getFullPath($name)) !== FALSE;
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::save().
-   */
-  public function save($name, $code) {
-    return FALSE;
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::delete().
-   */
-  public function delete($name) {
-    return FALSE;
-  }
-
-  /**
-   * Returns the full path where the file is or should be stored.
-   */
-  protected function getFullPath($name) {
-    return $this->directory . '/' . $name;
-  }
-}
diff --git a/core/lib/Drupal/Component/PhpStorage/FileStorage.php b/core/lib/Drupal/Component/PhpStorage/FileStorage.php
deleted file mode 100644
index 80f3ec4..0000000
--- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\Component\PhpStorage\FileStorage.
- */
-
-namespace Drupal\Component\PhpStorage;
-
-/**
- * Stores the code as regular PHP files.
- */
-class FileStorage implements PhpStorageInterface {
-
-  /**
-   * The directory where the files should be stored.
-   *
-   * @var string
-   */
-  protected $directory;
-
-  /**
-   * Constructs this FileStorage object.
-   *
-   * @param $configuration
-   *   An associative array, containing at least these two keys:
-   *   - directory: The directory where the files should be stored.
-   *   - bin: The storage bin. Multiple storage objects can be instantiated with the
-   *     same configuration, but for different bins..
-   */
-  public function __construct(array $configuration) {
-    $this->directory = $configuration['directory'] . '/' . $configuration['bin'];
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
-   */
-  public function exists($name) {
-    return file_exists($this->getFullPath($name));
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
-   */
-  public function load($name) {
-    // The FALSE returned on failure is enough for the caller to handle this,
-    // we do not want a warning too.
-    return (@include_once $this->getFullPath($name)) !== FALSE;
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::save().
-   */
-  public function save($name, $code) {
-    $path = $this->getFullPath($name);
-    mkdir(dirname($path), 0700, TRUE);
-    return (bool) file_put_contents($path, $code);
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::delete().
-   */
-  public function delete($name) {
-    $path = $this->getFullPath($name);
-    return @unlink($path);
-  }
-
-  /**
-   * Returns the full path where the file is or should be stored.
-   */
-  protected function getFullPath($name) {
-    return $this->directory . '/' . $name;
-  }
-}
diff --git a/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php b/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
deleted file mode 100644
index 707c28b..0000000
--- a/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
+++ /dev/null
@@ -1,210 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage.
- */
-namespace Drupal\Component\PhpStorage;
-
-use DirectoryIterator;
-
-/**
- * Stores PHP code in files with securely hashed names.
- *
- * The goal of this class is to ensure that if a PHP file is replaced with
- * an untrusted one, it does not get loaded. Since mtime granularity is 1
- * second, we cannot prevent an attack that happens within one second of the
- * initial save(). However, it is very unlikely for an attacker exploiting an
- * upload or file write vulnerability to also know when a legitimate file is
- * being saved, discover its hash, undo its file permissions, and override the
- * file with an upload all within a single second. Being able to accomplish
- * that would indicate a site very likely vulnerable to many other attack
- * vectors.
- *
- * Each file is stored in its own unique containing directory. The hash is based
- * on the virtual file name, the containing directory's mtime, and a
- * cryptographically hard to guess secret string. Thus, even if the hashed file
- * name is discovered and replaced by an untrusted file (e.g., via a
- * move_uploaded_file() invocation by a script that performs insufficient
- * validation), the directory's mtime gets updated in the process, invalidating
- * the hash and preventing the untrusted file from getting loaded.
- *
- * This class does not protect against overwriting a file in-place (e.g. a
- * malicious module that does a file_put_contents()) since this will not change
- * the mtime of the directory. MTimeProtectedFileStorage protects against this
- * at the cost of an additional system call for every load() and exists().
- *
- * The containing directory is created with the same name as the virtual file
- * name (slashes removed) to assist with debugging, since the file itself is
- * stored with a name that's meaningless to humans.
- */
-class MTimeProtectedFastFileStorage extends FileStorage {
-
-  /**
-   * The secret used in the HMAC.
-   *
-   * @var string
-   */
-  protected $secret;
-
-  /**
-   * Constructs this MTimeProtectedFastFileStorage object.
-   *
-   * @param $configuration
-   *   An associated array, containing at least these keys (the rest are
-   *   ignored):
-   *   - directory: The directory where the files should be stored.
-   *   - secret: A cryptographically hard to guess secret string.
-   *   -bin. The storage bin. Multiple storage objects can be instantiated with
-   *   the same configuration, but for different bins.
-   */
-  public function __construct(array $configuration) {
-    parent::__construct($configuration);
-    $this->secret = $configuration['secret'];
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::save().
-   */
-  public function save($name, $data) {
-    $this->ensureDirectory();
-
-    // Write the file out to a temporary location. Prepend with a '.' to keep it
-    // hidden from listings and web servers.
-    $temporary_path = $this->directory . '/.' . str_replace('/', '#', $name);
-    if (!@file_put_contents($temporary_path, $data)) {
-      return FALSE;
-    }
-    chmod($temporary_path, 0400);
-
-    // Prepare a directory dedicated for just this file. Ensure it has a current
-    // mtime so that when the file (hashed on that mtime) is moved into it, the
-    // mtime remains the same (unless the clock ticks to the next second during
-    // the rename, in which case we'll try again).
-    $directory = $this->getContainingDirectoryFullPath($name);
-    if (file_exists($directory)) {
-      $this->cleanDirectory($directory);
-      touch($directory);
-    }
-    else {
-      mkdir($directory);
-    }
-
-    // Move the file to its final place. The mtime of a directory is the time of
-    // the last file create or delete in the directory. So the moving will
-    // update the directory mtime. However, this update will very likely not
-    // show up, because it has a coarse, one second granularity and typical
-    // moves takes significantly less than that. In the unlucky case the clock
-    // ticks during the move, we need to keep trying until the mtime we hashed
-    // on and the updated mtime match.
-    $previous_mtime = 0;
-    $i = 0;
-    while (($mtime = $this->getUncachedMTime($directory)) && ($mtime != $previous_mtime)) {
-      $previous_mtime = $mtime;
-      chmod($directory, 0300);
-      // Reset the file back in the temporary location if this is not the first
-      // iteration.
-      if ($i > 0) {
-        rename($full_path, $temporary_path);
-        // Make sure to not loop infinitely on a hopelessly slow filesystem.
-        if ($i > 10) {
-          unlink($temporary_path);
-          return FALSE;
-        }
-      }
-      $full_path = $this->getFullPath($name, $directory, $mtime);
-      rename($temporary_path, $full_path);
-
-      // Leave the directory neither readable nor writable. Since the file
-      // itself is not writable (set to 0400 at the beginning of this function),
-      // there's no way to tamper with it without access to change permissions.
-      chmod($directory, 0100);
-      $i++;
-    }
-    return TRUE;
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::delete().
-   */
-  public function delete($name) {
-    $directory = dirname($this->getFullPath($name));
-    if (file_exists($directory)) {
-      $this->cleanDirectory($directory);
-      return rmdir($directory);
-    }
-    return FALSE;
-  }
-
-  /**
-   * Ensures the root directory exists and has correct permissions.
-   */
-  protected function ensureDirectory() {
-    if (!file_exists($this->directory)) {
-      mkdir($this->directory, 0700, TRUE);
-    }
-    chmod($this->directory, 0700);
-    file_save_htaccess($this->directory);
-  }
-
-  /**
-   * Removes everything in a directory, leaving it empty.
-   *
-   * @param $directory
-   *   The directory to be emptied out.
-   */
-  protected function cleanDirectory($directory) {
-    chmod($directory, 0700);
-    foreach (new DirectoryIterator($directory) as $fileinfo) {
-      if (!$fileinfo->isDot()) {
-        unlink($fileinfo->getPathName());
-      }
-    }
-  }
-
-  /**
-   * Returns the full path where the file is or should be stored.
-   *
-   * This function creates a file path that includes a unique containing
-   * directory for the file and a file name that is a hash of the virtual file
-   * name, a cryptographic secret, and the containing directory mtime. If the
-   * file is overridden by an insecure upload script, the directory mtime gets
-   * modified, invalidating the file, thus protecting against untrusted code
-   * getting executed.
-   *
-   * @param string $name
-   *   The virtual file name. Can be a relative path.
-   * @param string $directory
-   *   (optional) The directory containing the file. If not passed, this is
-   *   retrieved by calling getContainingDirectoryFullPath().
-   * @param int $directory_mtime
-   *   (optional) The mtime of $directory. Can be passed to avoid an extra
-   *   filesystem call when the mtime of the directory is already known.
-   * @return string
-   *    The full path where the file is or should be stored.
-   */
-  protected function getFullPath($name, &$directory = NULL, &$directory_mtime = NULL) {
-    if (!isset($directory)) {
-      $directory = $this->getContainingDirectoryFullPath($name);
-    }
-    if (!isset($directory_mtime)) {
-      $directory_mtime = file_exists($directory) ? filemtime($directory) : 0;
-    }
-    return $directory . '/' . hash_hmac('sha256', $name, $this->secret . $directory_mtime) . '.php';
-  }
-
-  /**
-   * Returns the full path of the containing directory where the file is or should be stored.
-   */
-  protected function getContainingDirectoryFullPath($name) {
-    return $this->directory . '/' . str_replace('/', '#', $name);
-  }
-
-  /**
-   * Clears PHP's stat cache and returns the directory's mtime.
-   */
-  protected function getUncachedMTime($directory) {
-    clearstatcache();
-    return filemtime($directory);
-  }
-}
diff --git a/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFileStorage.php b/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFileStorage.php
deleted file mode 100644
index b9dd5b0..0000000
--- a/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFileStorage.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\Component\PhpStorage\MTimeProtectedFileStorage.
- */
-namespace Drupal\Component\PhpStorage;
-
-/**
- * Stores PHP code in files with securely hashed names.
- *
- * The goal of this class is to ensure that if a PHP file is replaced with
- * an untrusted one, it does not get loaded. Since mtime granularity is 1
- * second, we cannot prevent an attack that happens within one second of the
- * initial save(). However, it is very unlikely for an attacker exploiting an
- * upload or file write vulnerability to also know when a legitimate file is
- * being saved, discover its hash, undo its file permissions, and override the
- * file with an upload all within a single second. Being able to accomplish
- * that would indicate a site very likely vulnerable to many other attack
- * vectors.
- *
- * Each file is stored in its own unique containing directory. The hash is
- * based on the virtual file name, the containing directory's mtime, and a
- * cryptographically hard to guess secret string. Thus, even if the hashed file
- * name is discovered and replaced by an untrusted file (e.g., via a
- * move_uploaded_file() invocation by a script that performs insufficient
- * validation), the directory's mtime gets updated in the process, invalidating
- * the hash and preventing the untrusted file from getting loaded. Also, the
- * file mtime will be checked providing security against overwriting in-place,
- * at the cost of an additional system call for every load() and exists().
- *
- * The containing directory is created with the same name as the virtual file
- * name (slashes replaced with hashmarks) to assist with debugging, since the
- * file itself is stored with a name that's meaningless to humans.
- */
-class MTimeProtectedFileStorage extends MTimeProtectedFastFileStorage {
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
-   */
-  public function load($name) {
-    if (($filename = $this->checkFile($name)) !== FALSE) {
-      // Inline parent::load() to avoid an expensive getFullPath() call.
-      return (@include_once $filename) !== FALSE;
-    }
-    return FALSE;
-  }
-
-  /**
-   * Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
-   */
-  public function exists($name) {
-    return $this->checkFile($name) !== FALSE;
-  }
-
-  /**
-   * Determines whether a protected file exists and sets the filename too.
-   *
-   * @param string $name
-   *   The virtual file name. Can be a relative path.
-   * return string
-   *   The full path where the file is if it is valid, FALSE otherwise.
-   */
-  protected function checkFile($name) {
-    $filename = $this->getFullPath($name, $directory, $directory_mtime);
-    return file_exists($filename) && filemtime($filename) <= $directory_mtime ? $filename : FALSE;
-  }
-}
diff --git a/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php b/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php
deleted file mode 100644
index 1eaece3..0000000
--- a/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\Component\PhpStorage\PhpStorageInterface.
- */
-
-namespace Drupal\Component\PhpStorage;
-
-/**
- * Stores and loads PHP code.
- *
- * Each interface function takes $name as a parameter. This is a virtual file
- * name: for example, 'foo.php' or 'some/relative/path/to/foo.php'. The
- * storage implementation may store these as files within the local file system,
- * use a remote stream, combine multiple virtual files into an archive, store
- * them in database records, or use some other storage technique.
- */
-interface PhpStorageInterface {
-
-  /**
-   * Checks whether the PHP code exists in storage.
-   *
-   * @param string $name
-   *   The virtual file name. Can be a relative path.
-   *
-   * @return bool
-   *   TRUE if the virtual file exists, FALSE otherwise.
-   */
-  public function exists($name);
-
-  /**
-   * Loads PHP code from storage.
-   *
-   * Depending on storage implementation, exists() checks can be expensive, so
-   * this function may be called for a file that doesn't exist, and that should
-   * not result in errors. This function does not return anything, so it is
-   * up to the caller to determine if any code was loaded (for example, check
-   * class_exists() or function_exists() for what was expected in the code).
-   *
-   * @param string $name
-   *   The virtual file name. Can be a relative path.
-   */
-  public function load($name);
-
-  /**
-   * Saves PHP code to storage.
-   *
-   * @param string $name
-   *   The virtual file name. Can be a relative path.
-   * @param string $code
-   *    The PHP code to be saved.
-   *
-   * @return bool
-   *   TRUE if the save succeeded, FALSE if it failed.
-   */
-  public function save($name, $code);
-
-  /**
-   * Deletes PHP code from storage.
-   *
-   * @param string $name
-   *   The virtual file name. Can be a relative path.
-   *
-   * @return bool
-   *   TRUE if the delete succeeded, FALSE if it failed.
-   */
-  public function delete($name);
-}
diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php
index 7fd6967..cf07560 100644
--- a/core/lib/Drupal/Core/Config/Config.php
+++ b/core/lib/Drupal/Core/Config/Config.php
@@ -8,7 +8,7 @@
 namespace Drupal\Core\Config;
 
 use Drupal\Component\Utility\NestedArray;
-use Symfony\Component\EventDispatcher\EventDispatcher;
+use Drupal\Core\Config\ConfigException;
 
 /**
  * Defines the default configuration object.
@@ -41,7 +41,7 @@ class Config {
    *
    * @var array
    */
-  protected $overrides = array();
+  protected $overrides;
 
   /**
    * The current runtime data ($data + $overrides).
@@ -51,20 +51,13 @@ class Config {
   protected $overriddenData;
 
   /**
-   * The storage used to load and save this configuration object.
+   * The storage used for reading and writing.
    *
    * @var Drupal\Core\Config\StorageInterface
    */
   protected $storage;
 
   /**
-   * The event dispatcher used to notify subscribers.
-   *
-   * @var Symfony\Component\EventDispatcher\EventDispatcher
-   */
-  protected $eventDispatcher;
-
-  /**
    * Constructs a configuration object.
    *
    * @param string $name
@@ -72,21 +65,10 @@ class Config {
    * @param Drupal\Core\Config\StorageInterface $storage
    *   A storage controller object to use for reading and writing the
    *   configuration data.
-   * @param Symfony\Component\EventDispatcher\EventDispatcher $event_dispatcher
-   *   The event dispatcher used to notify subscribers.
    */
-  public function __construct($name, StorageInterface $storage, EventDispatcher $event_dispatcher = NULL) {
+  public function __construct($name, StorageInterface $storage) {
     $this->name = $name;
     $this->storage = $storage;
-    $this->eventDispatcher = $event_dispatcher ? $event_dispatcher : drupal_container()->get('dispatcher');
-  }
-
-  /**
-   * Initializes a configuration object.
-   */
-  public function init() {
-    $this->notify('init');
-    return $this;
   }
 
   /**
@@ -178,7 +160,7 @@ class Config {
    *   The overridden values of the configuration data.
    */
   public function setOverride(array $data) {
-    $this->overrides = NestedArray::mergeDeepArray(array($this->overrides, $data));
+    $this->overrides = $data;
     $this->resetOverriddenData();
     return $this;
   }
@@ -302,7 +284,6 @@ class Config {
       $this->isNew = FALSE;
       $this->setData($data);
     }
-    $this->notify('load');
     return $this;
   }
 
@@ -310,23 +291,12 @@ class Config {
    * Saves the configuration object.
    */
   public function save() {
+    // All configuration objects need to be namespaced by extension, as it would
+    // be impossible to maintain them otherwise.
+    $this->validateNamespace($this->name);
     $this->sortByKey($this->data);
     $this->storage->write($this->name, $this->data);
     $this->isNew = FALSE;
-    $this->notify('save');
-    return $this;
-  }
-
-  /*
-   * Renames the configuration object.
-   *
-   * @param $new_name
-   *   The new name of the configuration object being constructed.
-   */
-  public function rename($new_name) {
-    if ($this->storage->rename($this->name, $new_name)) {
-      $this->name = $new_name;
-    }
     return $this;
   }
 
@@ -358,21 +328,17 @@ class Config {
     $this->storage->delete($this->name);
     $this->isNew = TRUE;
     $this->resetOverriddenData();
-    $this->notify('delete');
     return $this;
   }
 
   /**
-   * Retrieve the storage used to load and save this configuration object.
-   */
-  public function getStorage() {
-    return $this->storage;
-  }
-
-  /**
-   * Dispatch a config event.
+   * Validates that a configuration object is namespaced by extension.
+   *
+   * @throws Drupal\Core\Config\ConfigException
    */
-  protected function notify($config_event_name) {
-    $this->eventDispatcher->dispatch('config.' . $config_event_name, new ConfigEvent($this));
+  public static function validateNamespace($name) {
+    if (strpos($name, '.') === FALSE) {
+      throw new ConfigException(format_string('Missing namespace in Config name @name', array('@name' => $name)));
+    }
   }
 }
diff --git a/core/lib/Drupal/Core/Config/ConfigEvent.php b/core/lib/Drupal/Core/Config/ConfigEvent.php
deleted file mode 100644
index aabd1d8..0000000
--- a/core/lib/Drupal/Core/Config/ConfigEvent.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-namespace Drupal\Core\Config;
-
-use Symfony\Component\EventDispatcher\Event;
-use Drupal\Core\Config\Config;
-
-class ConfigEvent extends Event {
-  /**
-   * Configuration object.
-   *
-   * @var Drupal\Core\Config\Config
-   */
-  protected $config;
-
-  /**
-   * Constructor.
-   */
-  public function __construct(Config $config) {
-    $this->config = $config;
-  }
-
-  /**
-   * Get configuration object.
-   */
-  public function getConfig() {
-    return $this->config;
-  }
-}
diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php
index ca36ce7..4bf5b62 100644
--- a/core/lib/Drupal/Core/Config/ConfigFactory.php
+++ b/core/lib/Drupal/Core/Config/ConfigFactory.php
@@ -7,8 +7,6 @@
 
 namespace Drupal\Core\Config;
 
-use Symfony\Component\EventDispatcher\EventDispatcher;
-
 /**
  * Defines the configuration object factory.
  *
@@ -32,24 +30,14 @@ class ConfigFactory {
   protected $storage;
 
   /**
-   * An event dispatcher instance to use for configuration events.
-   *
-   * @var Symfony\Component\EventDispatcher\EventDispatcher
-   */
-  protected $eventDispatcher;
-
-  /**
    * Constructs the Config factory.
    *
    * @param Drupal\Core\Config\StorageInterface $storage
    *   The storage controller object to use for reading and writing
    *   configuration data.
-   * @param Symfony\Component\EventDispatcher\EventDispatcher
-   *   An event dispatcher instance to use for configuration events.
    */
-  public function __construct(StorageInterface $storage, EventDispatcher $event_dispatcher) {
+  public function __construct(StorageInterface $storage) {
     $this->storage = $storage;
-    $this->eventDispatcher = $event_dispatcher;
   }
 
   /**
@@ -82,8 +70,13 @@ class ConfigFactory {
     // @todo The decrease of CPU time is interesting, since that means that
     //   ContainerBuilder involves plenty of function calls (which are known to
     //   be slow in PHP).
-    $config = new Config($name, $this->storage, $this->eventDispatcher);
-    return $config->init();
+    $config = new Config($name, $this->storage);
+
+    // Set overridden values from global $conf, if any.
+    if (isset($conf[$name])) {
+      $config->setOverride($conf[$name]);
+    }
+    return $config;
   }
 
 }
diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php
index ad8c155..92aea45 100644
--- a/core/lib/Drupal/Core/Config/DatabaseStorage.php
+++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php
@@ -99,20 +99,6 @@ class DatabaseStorage implements StorageInterface {
       ->execute();
   }
 
-
-  /**
-   * Implements Drupal\Core\Config\StorageInterface::rename().
-   *
-   * @throws PDOException
-   */
-  public function rename($name, $new_name) {
-    $options = array('return' => Database::RETURN_AFFECTED) + $this->options;
-    return (bool) $this->getConnection()->update('config', $options)
-      ->fields(array('name' => $new_name))
-      ->condition('name', $name)
-      ->execute();
-  }
-
   /**
    * Implements Drupal\Core\Config\StorageInterface::encode().
    */
diff --git a/core/lib/Drupal/Core/Config/FileStorage.php b/core/lib/Drupal/Core/Config/FileStorage.php
index d96af7e..033555d 100644
--- a/core/lib/Drupal/Core/Config/FileStorage.php
+++ b/core/lib/Drupal/Core/Config/FileStorage.php
@@ -108,17 +108,6 @@ class FileStorage implements StorageInterface {
   }
 
   /**
-   * Implements Drupal\Core\Config\StorageInterface::rename().
-   */
-  public function rename($name, $new_name) {
-    $status = @rename($this->getFilePath($name), $this->getFilePath($new_name));
-    if ($status === FALSE) {
-      throw new StorageException('Failed to rename configuration file from: ' . $this->getFilePath($name) . ' to: ' . $this->getFilePath($new_name));
-    }
-    return TRUE;
-  }
-
-  /**
    * Implements Drupal\Core\Config\StorageInterface::encode().
    *
    * @throws Symfony\Component\Yaml\Exception\DumpException
diff --git a/core/lib/Drupal/Core/Config/NullStorage.php b/core/lib/Drupal/Core/Config/NullStorage.php
index ea21be1..fede4f0 100644
--- a/core/lib/Drupal/Core/Config/NullStorage.php
+++ b/core/lib/Drupal/Core/Config/NullStorage.php
@@ -50,13 +50,6 @@ class NullStorage implements StorageInterface {
   }
 
   /**
-   * Implements Drupal\Core\Config\StorageInterface::rename().
-   */
-  public function rename($name, $new_name) {
-    return FALSE;
-  }
-
-  /**
    * Implements Drupal\Core\Config\StorageInterface::encode().
    */
   public static function encode($data) {
diff --git a/core/lib/Drupal/Core/Config/StorageInterface.php b/core/lib/Drupal/Core/Config/StorageInterface.php
index a466538..806ee87 100644
--- a/core/lib/Drupal/Core/Config/StorageInterface.php
+++ b/core/lib/Drupal/Core/Config/StorageInterface.php
@@ -61,19 +61,6 @@ interface StorageInterface {
   public function delete($name);
 
   /**
-   * Renames a configuration object in the storage.
-   *
-   * @param string $name
-   *   The name of a configuration object to rename.
-   * @param string $new_name
-   *   The new name of a configuration object.
-   *
-   * @return bool
-   *   TRUE on success, FALSE otherwise.
-   */
-  public function rename($name, $new_name);
-
-  /**
    * Encodes configuration data into the storage-specific format.
    *
    * @param array $data
diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index f8e8691..b0830a0 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -58,7 +58,6 @@ class CoreBundle extends Bundle
     $dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\LegacyControllerSubscriber());
     $dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\FinishResponseSubscriber());
     $dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\RequestCloseSubscriber());
-    $dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber());
     $container->set('content_negotiation', $content_negotation);
     $dispatcher->addSubscriber(\Drupal\Core\ExceptionController::getExceptionListener($container));
     /*
@@ -86,7 +85,6 @@ class CoreBundle extends Bundle
       ->addTag('kernel.event_subscriber');
     $container->register('request_close_subscriber', 'Drupal\Core\EventSubscriber\RequestCloseSubscriber')
       ->addTag('kernel.event_subscriber');
-    $container->register('config_global_override_subscriber', '\Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber');
     $container->register('database', 'Drupal\Core\Database\Connection')
       ->setFactoryClass('Drupal\Core\Database\Database')
       ->setFactoryMethod('getConnection')
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Update.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Update.php
index 38d8d5c..18332e7 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Update.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Update.php
@@ -34,13 +34,11 @@ class Update extends QueryUpdate {
    */
   protected function removeFieldsInCondition(&$fields, ConditionInterface $condition) {
     foreach ($condition->conditions() as $child_condition) {
-      if (isset($child_condition['field'])) {
-        if ($child_condition['field'] instanceof ConditionInterface) {
-          $this->removeFieldsInCondition($fields, $child_condition['field']);
-        }
-        else {
-          unset($fields[$child_condition['field']]);
-        }
+      if ($child_condition['field'] instanceof ConditionInterface) {
+        $this->removeFieldsInCondition($fields, $child_condition['field']);
+      }
+      else {
+        unset($fields[$child_condition['field']]);
       }
     }
   }
@@ -79,4 +77,4 @@ class Update extends QueryUpdate {
     return parent::execute();
   }
 
-}
+}
\ No newline at end of file
diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php
deleted file mode 100644
index 899edfb..0000000
--- a/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * @file
- * Definition of Drupal\Core\EventSubscriber\ConfigGlobalOverridesubscriber.
- */
-
-namespace Drupal\Core\EventSubscriber;
-
-use Drupal\Core\Config\Config;
-use Drupal\Core\Config\ConfigEvent;
-use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-
-/**
- * Override configuration values with values in global $conf variable.
- */
-class ConfigGlobalOverridesubscriber implements EventSubscriberInterface {
-  /**
-   * Override configuration values with global $conf.
-   *
-   * @param Drupal\Core\Config\ConfigEvent $event
-   *   The Event to process.
-   */
-  public function configInit(ConfigEvent $event) {
-    global $conf;
-
-    $config = $event->getConfig();
-    if (isset($conf[$config->getName()])) {
-      $config->setOverride($conf[$config->getName()]);
-    }
-  }
-
-  /**
-   * Implements EventSubscriberInterface::getSubscribedEvents().
-   */
-  static function getSubscribedEvents() {
-    $events['config.init'][] = array('configInit', 30);
-    return $events;
-  }
-}
diff --git a/core/misc/batch.js b/core/misc/batch.js
index b3013e5..246e9ef 100644
--- a/core/misc/batch.js
+++ b/core/misc/batch.js
@@ -1,4 +1,4 @@
-(function ($, Drupal) {
+(function ($) {
 
 "use strict";
 
@@ -7,33 +7,31 @@
  */
 Drupal.behaviors.batch = {
   attach: function (context, settings) {
-    var batch = settings.batch;
-    var $progress = $('#progress').once('batch');
-    var progressBar;
+    $(context).find('#progress').once('batch', function () {
+      var holder = $(this);
+      // Remove HTML from no-js progress bar. The JS progress bar is created
+      // later on.
+      holder.empty();
 
-    // Success: redirect to the summary.
-    function updateCallback(progress, status, pb) {
-      if (progress === '100') {
-        pb.stopMonitoring();
-        window.location = batch.uri + '&op=finished';
-      }
-    }
+      // Success: redirect to the summary.
+      var updateCallback = function (progress, status, pb) {
+        if (progress === '100') {
+          pb.stopMonitoring();
+          window.location = settings.batch.uri + '&op=finished';
+        }
+      };
 
-    function errorCallback(pb) {
-      $progress.prepend($('<p class="error"></p>').html(batch.errorMessage));
-      $('#wait').hide();
-    }
+      var errorCallback = function (pb) {
+        holder.prepend($('<p class="error"></p>').html(settings.batch.errorMessage));
+        $('#wait').hide();
+      };
 
-    if ($progress.length) {
-      progressBar = new Drupal.ProgressBar('updateprogress', updateCallback, 'POST', errorCallback);
-      progressBar.setProgress(-1, batch.initMessage);
-      progressBar.startMonitoring(batch.uri + '&op=do', 10);
-      // Remove HTML from no-js progress bar.
-      $progress.empty();
-      // Append the JS progressbar element.
-      $progress.append(progressBar.element);
-    }
+      var progress = new Drupal.ProgressBar('updateprogress', updateCallback, 'POST', errorCallback);
+      progress.setProgress(-1, settings.batch.initMessage);
+      holder.append(progress.element);
+      progress.startMonitoring(settings.batch.uri + '&op=do', 10);
+    });
   }
 };
 
-})(jQuery, Drupal);
+})(jQuery);
diff --git a/core/modules/block/block.js b/core/modules/block/block.js
index 96ce310..7b0eb77 100644
--- a/core/modules/block/block.js
+++ b/core/modules/block/block.js
@@ -1,4 +1,4 @@
-(function ($, window) {
+(function ($) {
 
 "use strict";
 
@@ -90,7 +90,7 @@ Drupal.behaviors.blockDrag = {
       // Check whether the newly picked region is available for this block.
       if (regionField.find('option[value=' + regionName + ']').length === 0) {
         // If not, alert the user and keep the block in its old region setting.
-        window.alert(Drupal.t('The block cannot be placed in this region.'));
+        alert(Drupal.t('The block cannot be placed in this region.'));
         // Simulate that there was a selected element change, so the row is put
         // back to from where the user tried to drag it.
         regionField.change();
@@ -148,4 +148,4 @@ Drupal.behaviors.blockDrag = {
   }
 };
 
-})(jQuery, window);
+})(jQuery);
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index 6590aa8..9231082 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -1267,7 +1267,7 @@ function book_export_traverse($tree, $visit_func) {
 
   foreach ($tree as $data) {
     // Note- access checking is already performed when building the tree.
-    if ($node = node_load($data['link']['nid'])) {
+    if ($node = node_load($data['link']['nid'], FALSE)) {
       $children = '';
 
       if ($data['below']) {
diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
index e60142f..f4106ef 100644
--- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php
+++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
@@ -358,7 +358,7 @@ class BookTest extends WebTestBase {
      $this->drupalGet('node/' . $this->book->nid . '/outline/remove');
      $this->assertResponse('403', t('Deleting top-level book node properly forbidden.'));
      $this->drupalPost('node/' . $nodes[4]->nid . '/outline/remove', $edit, t('Remove'));
-     $node4 = node_load($nodes[4]->nid, TRUE);
+     $node4 = node_load($nodes[4]->nid, NULL, TRUE);
      $this->assertTrue(empty($node4->book), t('Deleting child book node properly allowed.'));
 
      // Delete all child book nodes and retest top-level node deletion.
@@ -367,7 +367,7 @@ class BookTest extends WebTestBase {
      }
      node_delete_multiple($nids);
      $this->drupalPost('node/' . $this->book->nid . '/outline/remove', $edit, t('Remove'));
-     $node = node_load($this->book->nid, TRUE);
+     $node = node_load($this->book->nid, NULL, TRUE);
      $this->assertTrue(empty($node->book), t('Deleting childless top-level book node properly allowed.'));
    }
 }
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index aef6209..9f5b2cf 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -10,8 +10,7 @@
  */
 
 use Drupal\node\Node;
-use Drupal\Core\File\File;
-use Drupal\entity\EntityInterface;
+
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -1050,10 +1049,6 @@ function comment_build_content(Comment $comment, Node $node, $view_mode = 'full'
   // Remove previously built content, if exists.
   $comment->content = array();
 
-  // Allow modules to change the view mode.
-  $context = array('langcode' => $langcode);
-  drupal_alter('entity_view_mode', $view_mode, $comment, $context);
-
   // Build fields content.
   field_attach_prepare_view('comment', array($comment->cid => $comment), $view_mode, $langcode);
   entity_prepare_view('comment', array($comment->cid => $comment), $langcode);
@@ -1447,7 +1442,7 @@ function comment_node_search_result(Node $node) {
 function comment_user_cancel($edit, $account, $method) {
   switch ($method) {
     case 'user_cancel_block_unpublish':
-      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->uid));
+      $comments = comment_load_multiple(array(), array('uid' => $account->uid));
       foreach ($comments as $comment) {
         $comment->status = 0;
         comment_save($comment);
@@ -1455,7 +1450,7 @@ function comment_user_cancel($edit, $account, $method) {
       break;
 
     case 'user_cancel_reassign':
-      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->uid));
+      $comments = comment_load_multiple(array(), array('uid' => $account->uid));
       foreach ($comments as $comment) {
         $comment->uid = 0;
         comment_save($comment);
@@ -1530,10 +1525,16 @@ function comment_delete_multiple($cids) {
 }
 
 /**
- * Loads comment entities from the database.
+ * Loads comments from the database.
  *
- * @param array $cids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ * @param array|bool $cids
+ *   An array of comment IDs, or FALSE to load all comments.
+ * @param array $conditions
+ *   (deprecated) An associative array of conditions on the {comments}
+ *   table, where the keys are the database fields and the values are the
+ *   values those fields must have. Instead, it is preferable to use
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  * @param bool $reset
  *   Whether to reset the internal static entity cache. Note that the static
  *   cache is disabled in comment_entity_info() by default.
@@ -1541,11 +1542,13 @@ function comment_delete_multiple($cids) {
  * @return array
  *   An array of comment objects, indexed by comment ID.
  *
+ * @todo Remove $conditions in Drupal 8.
+ *
  * @see entity_load()
  * @see Drupal\entity\EntityFieldQuery
  */
-function comment_load_multiple(array $cids = NULL, $reset = FALSE) {
-  return entity_load_multiple('comment', $cids, $reset);
+function comment_load_multiple($cids = array(), array $conditions = array(), $reset = FALSE) {
+  return entity_load_multiple('comment', $cids, $conditions, $reset);
 }
 
 /**
@@ -1718,9 +1721,9 @@ function comment_preview(Comment $comment) {
 
   if ($comment->pid) {
     $build = array();
-    $comment = comment_load($comment->pid);
-    if ($comment && $comment->status == COMMENT_PUBLISHED) {
-      $build = comment_view($comment, $node);
+    if ($comments = comment_load_multiple(array($comment->pid), array('status' => COMMENT_PUBLISHED))) {
+      $parent_comment = $comments[$comment->pid];
+      $build = comment_view($parent_comment, $node);
     }
   }
   else {
@@ -1760,7 +1763,7 @@ function template_preprocess_comment(&$variables) {
   $variables['user_picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $comment)) : '';
   $variables['signature'] = $comment->signature;
 
-  $uri = $comment->uri();
+  $uri = entity_uri('comment', $comment);
   $uri['options'] += array('attributes' => array('class' => 'permalink', 'rel' => 'bookmark'));
 
   $variables['title'] = l($comment->subject, $uri['path'], $uri['options']);
@@ -2133,8 +2136,8 @@ function comment_rdf_mapping() {
 /**
  * Implements hook_file_download_access().
  */
-function comment_file_download_access($field, EntityInterface $entity, File $file) {
-  if ($entity->entityType() == 'comment') {
+function comment_file_download_access($field, $entity_type, $entity) {
+  if ($entity_type == 'comment') {
     if (user_access('access comments') && $entity->status == COMMENT_PUBLISHED || user_access('administer comments')) {
       $node = node_load($entity->nid);
       return node_access('view', $node);
diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
index 5dcda40..3ca70a9 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
@@ -27,8 +27,8 @@ class CommentStorageController extends DatabaseStorageController {
   /**
    * Overrides Drupal\entity\DatabaseStorageController::buildQuery().
    */
-  protected function buildQuery($ids, $revision_id = FALSE) {
-    $query = parent::buildQuery($ids, $revision_id);
+  protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
+    $query = parent::buildQuery($ids, $conditions, $revision_id);
     // Specify additional fields from the user and node tables.
     $query->innerJoin('node', 'n', 'base.nid = n.nid');
     $query->addField('n', 'type', 'node_type');
@@ -41,7 +41,7 @@ class CommentStorageController extends DatabaseStorageController {
   /**
    * Overrides Drupal\entity\DatabaseStorageController::attachLoad().
    */
-  protected function attachLoad(&$comments, $load_revision = FALSE) {
+  protected function attachLoad(&$comments, $revision_id = FALSE) {
     // Set up standard comment properties.
     foreach ($comments as $key => $comment) {
       $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
@@ -49,7 +49,7 @@ class CommentStorageController extends DatabaseStorageController {
       $comment->node_type = 'comment_node_' . $comment->node_type;
       $comments[$key] = $comment;
     }
-    parent::attachLoad($comments, $load_revision);
+    parent::attachLoad($comments, $revision_id);
   }
 
   /**
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
index 2c324e2..b7f42ae 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
@@ -363,7 +363,7 @@ class CommentInterfaceTest extends CommentTestBase {
 
     // Checks the new values of node comment statistics with comment #1.
     // The node needs to be reloaded with a node_load_multiple cache reset.
-    $node = node_load($this->node->nid, TRUE);
+    $node = node_load($this->node->nid, NULL, TRUE);
     $this->assertEqual($node->last_comment_name, NULL, t('The value of node last_comment_name is NULL.'));
     $this->assertEqual($node->last_comment_uid, $this->web_user2->uid, t('The value of node last_comment_uid is the comment #1 uid.'));
     $this->assertEqual($node->comment_count, 1, t('The value of node comment_count is 1.'));
@@ -388,7 +388,7 @@ class CommentInterfaceTest extends CommentTestBase {
     // Checks the new values of node comment statistics with comment #2 and
     // ensure they haven't changed since the comment has not been moderated.
     // The node needs to be reloaded with a node_load_multiple cache reset.
-    $node = node_load($this->node->nid, TRUE);
+    $node = node_load($this->node->nid, NULL, TRUE);
     $this->assertEqual($node->last_comment_name, NULL, t('The value of node last_comment_name is still NULL.'));
     $this->assertEqual($node->last_comment_uid, $this->web_user2->uid, t('The value of node last_comment_uid is still the comment #1 uid.'));
     $this->assertEqual($node->comment_count, 1, t('The value of node comment_count is still 1.'));
@@ -409,7 +409,7 @@ class CommentInterfaceTest extends CommentTestBase {
 
     // Checks the new values of node comment statistics with comment #3.
     // The node needs to be reloaded with a node_load_multiple cache reset.
-    $node = node_load($this->node->nid, TRUE);
+    $node = node_load($this->node->nid, NULL, TRUE);
     $this->assertEqual($node->last_comment_name, $comment_loaded->name, t('The value of node last_comment_name is the name of the anonymous user.'));
     $this->assertEqual($node->last_comment_uid, 0, t('The value of node last_comment_uid is zero.'));
     $this->assertEqual($node->comment_count, 2, t('The value of node comment_count is 2.'));
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php
index a5d36a9..42e7513 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\config\Tests;
 
 use Drupal\Core\Config\DatabaseStorage;
+use Drupal\Core\Config\ConfigException;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -84,13 +85,6 @@ class ConfigCRUDTest extends WebTestBase {
     $new_config = config($name);
     $this->assertIdentical($new_config->get(), $config->get());
     $this->assertIdentical($config->isNew(), FALSE);
-
-    // Rename the configuration object.
-    $new_name = 'config_test.crud_rename';
-    $config->rename($new_name);
-    $renamed_config = config($new_name);
-    $this->assertIdentical($renamed_config->get(), $config->get());
-    $this->assertIdentical($renamed_config->isNew(), FALSE);
   }
 
   /**
@@ -119,4 +113,29 @@ class ConfigCRUDTest extends WebTestBase {
     // their order must be identical.
     $this->assertIdentical($new_config->get(), $config->get());
   }
+
+  /**
+   * Tests saving a config object without a namespace.
+   */
+  function testNamespace() {
+    $name = 'nonamespace';
+    try {
+      $config = config($name);
+      $config->save();
+      $this->fail('Expected ConfigException was not thrown.');
+    }
+    catch (ConfigException $e) {
+      $this->pass('Expected ConfigException was thrown.');
+    }
+
+    $name = 'config.namespace';
+    try {
+      $config = config($name);
+      $config->save();
+      $this->pass('ConfigException was not thrown.');
+    }
+    catch (ConfigException $e) {
+      $this->fail('ConfigException was thrown.');
+    }
+  }
 }
diff --git a/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php b/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php
deleted file mode 100644
index adfe0b9..0000000
--- a/core/modules/config/lib/Drupal/config/Tests/LocaleConfigOverride.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\config\Tests\LocaleConfigOverride.
- */
-
-namespace Drupal\config\Tests;
-
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Tests locale config override.
- */
-class LocaleConfigOverride extends WebTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('locale', 'config_test');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Locale override',
-      'description' => 'Confirm that locale overrides work',
-      'group' => 'Configuration',
-    );
-  }
-
-  function testLocaleConfigOverride() {
-    $name = 'config_test.system';
-    // Verify the default configuration values exist.
-    $config = config($name);
-    $this->assertIdentical($config->get('foo'), 'bar');
-    // Spoof multilingual.
-    $GLOBALS['conf']['language_count'] = 2;
-    drupal_language_initialize();
-    $config = config($name);
-    $this->assertIdentical($config->get('foo'), 'en bar');
-  }
-}
diff --git a/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php b/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php
index d07b0b7..2dbc627 100644
--- a/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php
+++ b/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php
@@ -68,14 +68,6 @@ abstract class ConfigStorageTestBase extends WebTestBase {
     $this->assertFalse(in_array('system.performance', $names));
     $this->assertTrue(in_array($name, $names));
 
-    // Rename the configuration storage object.
-    $new_name = 'config_test.storage_rename';
-    $this->storage->rename($name, $new_name);
-    $raw_data = $this->read($new_name);
-    $this->assertIdentical($raw_data, $data);
-    // Rename it back so further tests work.
-    $this->storage->rename($new_name, $name);
-
     // Deleting an existing name returns TRUE.
     $result = $this->storage->delete($name);
     $this->assertIdentical($result, TRUE);
@@ -117,25 +109,6 @@ abstract class ConfigStorageTestBase extends WebTestBase {
       $class = get_class($e);
       $this->pass($class . ' thrown upon listing from a non-existing storage bin.');
     }
-
-    // Test renaming an object that does not exist throws an exception.
-    try {
-      $this->storage->rename('config_test.storage_does_not_exist', 'config_test.storage_does_not_exist_rename');
-    }
-    catch (\Exception $e) {
-      $class = get_class($e);
-      $this->pass($class . ' thrown upon renaming a nonexistent storage bin.');
-    }
-
-    // Test renaming to an object that already exists throws an exception.
-    try {
-      $this->storage->rename('system.cron', 'system.performance');
-    }
-    catch (\Exception $e) {
-      $class = get_class($e);
-      $this->pass($class . ' thrown upon renaming a nonexistent storage bin.');
-    }
-
   }
 
   abstract protected function read($name);
diff --git a/core/modules/config/tests/config_test/config/locale.config.en.config_test.system.yml b/core/modules/config/tests/config_test/config/locale.config.en.config_test.system.yml
deleted file mode 100644
index 05f8d1a..0000000
--- a/core/modules/config/tests/config_test/config/locale.config.en.config_test.system.yml
+++ /dev/null
@@ -1 +0,0 @@
-foo: en bar
diff --git a/core/modules/entity/entity.api.php b/core/modules/entity/entity.api.php
index bd5d147..98e32b8 100644
--- a/core/modules/entity/entity.api.php
+++ b/core/modules/entity/entity.api.php
@@ -448,21 +448,3 @@ function hook_entity_prepare_view($entities, $entity_type) {
     }
   }
 }
-
-/**
- * Change the view mode of an entity that is being displayed.
- *
- * @param string $view_mode
- *   The view_mode that is to be used to display the entity.
- * @param Drupal\entity\EntityInterface $entity
- *   The entity that is being viewed.
- * @param array $context
- *   Array with additional context information, currently only contains the
- *   langcode the entity is viewed in.
- */
-function hook_entity_view_mode_alter(&$view_mode, Drupal\entity\EntityInterface $entity, $context) {
-  // For nodes, change the view mode when it is teaser.
-  if ($entity->entityType() == 'node' && $view_mode == 'teaser') {
-    $view_mode = 'my_custom_view_mode';
-  }
-}
diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module
index 2c54daa..2f4714f 100644
--- a/core/modules/entity/entity.module
+++ b/core/modules/entity/entity.module
@@ -6,6 +6,7 @@
  */
 
 use \InvalidArgumentException;
+
 use Drupal\entity\EntityFieldQuery;
 use Drupal\entity\EntityMalformedException;
 use Drupal\entity\EntityStorageException;
@@ -140,7 +141,7 @@ function entity_info_cache_clear() {
  * @param bool $reset
  *   Whether to reset the internal cache for the requested entity type.
  *
- * @return Drupal\entity\EntityInterface
+ * @return object
  *   The entity object, or FALSE if there is no entity with the given id.
  *
  * @see hook_entity_info()
@@ -150,31 +151,11 @@ function entity_info_cache_clear() {
  * @see Drupal\entity\EntityFieldQuery
  */
 function entity_load($entity_type, $id, $reset = FALSE) {
-  $entities = entity_load_multiple($entity_type, array($id), $reset);
+  $entities = entity_load_multiple($entity_type, array($id), array(), $reset);
   return isset($entities[$id]) ? $entities[$id] : FALSE;
 }
 
 /**
- * Loads an entity from the database.
- *
- * @param string $entity_type
- *   The entity type to load, e.g. node or user.
- * @param int $revision_id
- *   The id of the entity to load.
- *
- * @return Drupal\entity\EntityInterface
- *   The entity object, or FALSE if there is no entity with the given revision
- *   id.
- *
- * @see hook_entity_info()
- * @see Drupal\entity\EntityStorageControllerInterface
- * @see Drupal\entity\DatabaseStorageController
- */
-function entity_revision_load($entity_type, $revision_id) {
-  return entity_get_controller($entity_type)->loadRevision($revision_id);
-}
-
-/**
  * Loads an entity by UUID.
  *
  * Note that some entity types may not support UUIDs.
@@ -193,6 +174,9 @@ function entity_revision_load($entity_type, $revision_id) {
  *   Thrown in case the requested entity type does not support UUIDs.
  *
  * @see hook_entity_info()
+ *
+ * @todo D8: Make it easier to query entities by property; e.g., enhance
+ *   EntityStorageControllerInterface with a ::loadByProperty() method.
  */
 function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) {
   $entity_info = entity_get_info($entity_type);
@@ -201,12 +185,25 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) {
   }
   $uuid_key = $entity_info['entity keys']['uuid'];
 
+  // Look up the entity ID for the given UUID.
+  $entity_query = new EntityFieldQuery();
+  $result = $entity_query
+    ->entityCondition('entity_type', $entity_type)
+    ->propertyCondition($uuid_key, $uuid)
+    ->range(0, 1)
+    ->execute();
+
+  if (empty($result[$entity_type])) {
+    return FALSE;
+  }
+
   $controller = entity_get_controller($entity_type);
   if ($reset) {
     $controller->resetCache();
   }
-  $entities = $controller->loadByProperties(array($uuid_key => $uuid));
-  return reset($entities);
+  $id = key($result[$entity_type]);
+  $entities = $controller->load(array($id));
+  return isset($entities[$id]) ? $entities[$id] : FALSE;
 }
 
 /**
@@ -228,40 +225,31 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) {
  *
  * @param string $entity_type
  *   The entity type to load, e.g. node or user.
- * @param array $ids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ * @param array|bool $ids
+ *   An array of entity IDs, or FALSE to load all entities.
+ * @param array $conditions
+ *   (deprecated) An associative array of conditions on the base table, where
+ *   the keys are the database fields and the values are the values those
+ *   fields must have. Instead, it is preferable to use EntityFieldQuery to
+ *   retrieve a list of entity IDs loadable by this function.
  * @param bool $reset
  *   Whether to reset the internal cache for the requested entity type.
  *
  * @return array
  *   An array of entity objects indexed by their ids.
  *
+ * @todo Remove $conditions in Drupal 8.
+ *
  * @see hook_entity_info()
  * @see Drupal\entity\EntityStorageControllerInterface
  * @see Drupal\entity\DatabaseStorageController
  * @see Drupal\entity\EntityFieldQuery
  */
-function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) {
+function entity_load_multiple($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) {
   if ($reset) {
     entity_get_controller($entity_type)->resetCache();
   }
-  return entity_get_controller($entity_type)->load($ids);
-}
-
-/**
- * Load entities by their property values.
- *
- * @param string $entity_type
- *   The entity type to load, e.g. node or user.
- * @param array $values
- *   An associative array where the keys are the property names and the
- *   values are the values those properties must have.
- *
- * @return array
- *   An array of entity objects indexed by their ids.
- */
-function entity_load_multiple_by_properties($entity_type, array $values) {
-  return entity_get_controller($entity_type)->loadByProperties($values);
+  return entity_get_controller($entity_type)->load($ids, $conditions);
 }
 
 /**
@@ -371,6 +359,48 @@ function entity_prepare_view($entity_type, $entities) {
 }
 
 /**
+ * Returns the uri elements of an entity.
+ *
+ * @param $entity_type
+ *   The entity type; e.g. 'node' or 'user'.
+ * @param $entity
+ *   The entity for which to generate a path.
+ *
+ * @return
+ *   An array containing the 'path' and 'options' keys used to build the uri of
+ *   the entity, and matching the signature of url(). NULL if the entity has no
+ *   uri of its own.
+ *
+ * @todo
+ *   Remove once all entity types are implementing the EntityInterface.
+ */
+function entity_uri($entity_type, $entity) {
+  $info = entity_get_info($entity_type);
+
+  // A bundle-specific callback takes precedence over the generic one for the
+  // entity type.
+  if (isset($info['bundles'][$entity->bundle()]['uri callback'])) {
+    $uri_callback = $info['bundles'][$entity->bundle()]['uri callback'];
+  }
+  elseif (isset($info['uri callback'])) {
+    $uri_callback = $info['uri callback'];
+  }
+  else {
+    return NULL;
+  }
+
+  // Invoke the callback to get the URI. If there is no callback, return NULL.
+  if (isset($uri_callback)) {
+    $uri = $uri_callback($entity);
+    // Pass the entity data to url() so that alter functions do not need to
+    // lookup this entity again.
+    $uri['options']['entity_type'] = $entity_type;
+    $uri['options']['entity'] = $entity;
+    return $uri;
+  }
+}
+
+/**
  * Returns the label of an entity.
  *
  * This is a wrapper for Drupal\entity\EntityInterface::label(). This function
diff --git a/core/modules/entity/lib/Drupal/entity/DatabaseStorageController.php b/core/modules/entity/lib/Drupal/entity/DatabaseStorageController.php
index 947db2d..8c4f3c8 100644
--- a/core/modules/entity/lib/Drupal/entity/DatabaseStorageController.php
+++ b/core/modules/entity/lib/Drupal/entity/DatabaseStorageController.php
@@ -144,9 +144,19 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
   /**
    * Implements Drupal\entity\EntityStorageControllerInterface::load().
    */
-  public function load(array $ids = NULL) {
+  public function load($ids = array(), $conditions = array()) {
     $entities = array();
 
+    // Revisions are not statically cached, and require a different query to
+    // other conditions, so separate the revision id into its own variable.
+    if ($this->revisionKey && isset($conditions[$this->revisionKey])) {
+      $revision_id = $conditions[$this->revisionKey];
+      unset($conditions[$this->revisionKey]);
+    }
+    else {
+      $revision_id = FALSE;
+    }
+
     // Create a new variable which is either a prepared version of the $ids
     // array for later comparison with the entity cache, or FALSE if no $ids
     // were passed. The $ids array is reduced as items are loaded from cache,
@@ -155,8 +165,8 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
     $passed_ids = !empty($ids) ? array_flip($ids) : FALSE;
     // Try to load entities from the static cache, if the entity type supports
     // static caching.
-    if ($this->cache && $ids) {
-      $entities += $this->cacheGet($ids);
+    if ($this->cache && !$revision_id) {
+      $entities += $this->cacheGet($ids, $conditions);
       // If any entities were loaded, remove them from the ids still to load.
       if ($passed_ids) {
         $ids = array_keys(array_diff_key($passed_ids, $entities));
@@ -164,11 +174,11 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
     }
 
     // Load any remaining entities from the database. This is the case if $ids
-    // is set to NULL (so we load all entities) or if there are any ids left to
-    // load.
-    if ($ids === NULL || $ids) {
+    // is set to FALSE (so we load all entities), if there are any ids left to
+    // load, if loading a revision, or if $conditions was passed without $ids.
+    if ($ids === FALSE || $ids || $revision_id || ($conditions && !$passed_ids)) {
       // Build and execute the query.
-      $query_result = $this->buildQuery($ids)->execute();
+      $query_result = $this->buildQuery($ids, $conditions, $revision_id)->execute();
 
       if (!empty($this->entityInfo['entity class'])) {
         // We provide the necessary arguments for PDO to create objects of the
@@ -183,13 +193,13 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
     // which attaches fields (if supported by the entity type) and calls the
     // entity type specific load callback, for example hook_node_load().
     if (!empty($queried_entities)) {
-      $this->attachLoad($queried_entities);
+      $this->attachLoad($queried_entities, $revision_id);
       $entities += $queried_entities;
     }
 
     if ($this->cache) {
-      // Add entities to the cache.
-      if (!empty($queried_entities)) {
+      // Add entities to the cache if we are not loading a revision.
+      if (!empty($queried_entities) && !$revision_id) {
         $this->cacheSet($queried_entities);
       }
     }
@@ -209,62 +219,6 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
   }
 
   /**
-   * Implements Drupal\entity\EntityStorageControllerInterface::loadRevision().
-   */
-  public function loadRevision($revision_id) {
-    // Build and execute the query.
-    $query_result = $this->buildQuery(array(), $revision_id)->execute();
-
-    if (!empty($this->entityInfo['entity class'])) {
-      // We provide the necessary arguments for PDO to create objects of the
-      // specified entity class.
-      // @see Drupal\entity\EntityInterface::__construct()
-      $query_result->setFetchMode(PDO::FETCH_CLASS, $this->entityInfo['entity class'], array(array(), $this->entityType));
-    }
-    $queried_entities = $query_result->fetchAllAssoc($this->idKey);
-
-    // Pass the loaded entities from the database through $this->attachLoad(),
-    // which attaches fields (if supported by the entity type) and calls the
-    // entity type specific load callback, for example hook_node_load().
-    if (!empty($queried_entities)) {
-      $this->attachLoad($queried_entities, TRUE);
-    }
-    return reset($queried_entities);
-  }
-
-  /**
-   * Implements Drupal\entity\EntityStorageControllerInterface::loadByProperties().
-   */
-  public function loadByProperties(array $values = array()) {
-    // Build a query to fetch the entity IDs.
-    $entity_query = new EntityFieldQuery();
-    $entity_query->entityCondition('entity_type', $this->entityType);
-    $this->buildPropertyQuery($entity_query, $values);
-    $result = $entity_query->execute();
-
-    if (empty($result[$this->entityType])) {
-      return array();
-    }
-    // Load and return the found entities.
-    return $this->load(array_keys($result[$this->entityType]));
-  }
-
-  /**
-   * Builds an entity query.
-   *
-   * @param Drupal\entity\EntityFieldQuery $entity_query
-   *   EntityFieldQuery instance.
-   * @param array $values
-   *   An associative array of properties of the entity, where the keys are the
-   *   property names and the values are the values those properties must have.
-   */
-  protected function buildPropertyQuery(EntityFieldQuery $entity_query, array $values) {
-    foreach ($values as $name => $value) {
-      $entity_query->propertyCondition($name, $value);
-    }
-  }
-
-  /**
    * Builds the query to load the entity.
    *
    * This has full revision support. For entities requiring special queries,
@@ -276,8 +230,10 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
    * See Drupal\comment\CommentStorageController::buildQuery() or
    * Drupal\taxonomy\TermStorageController::buildQuery() for examples.
    *
-   * @param array|null $ids
-   *   An array of entity IDs, or NULL to load all entities.
+   * @param $ids
+   *   An array of entity IDs, or FALSE to load all entities.
+   * @param $conditions
+   *   An array of conditions in the form 'field' => $value.
    * @param $revision_id
    *   The ID of the revision to load, or FALSE if this query is asking for the
    *   most current revision(s).
@@ -285,7 +241,7 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
    * @return SelectQuery
    *   A SelectQuery object for loading the entity.
    */
-  protected function buildQuery($ids, $revision_id = FALSE) {
+  protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
     $query = db_select($this->entityInfo['base table'], 'base');
 
     $query->addTag($this->entityType . '_load_multiple');
@@ -326,6 +282,11 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
     if ($ids) {
       $query->condition("base.{$this->idKey}", $ids, 'IN');
     }
+    if ($conditions) {
+      foreach ($conditions as $field => $value) {
+        $query->condition('base.' . $field, $value);
+      }
+    }
     return $query;
   }
 
@@ -342,13 +303,14 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
    *
    * @param $queried_entities
    *   Associative array of query results, keyed on the entity ID.
-   * @param $load_revision
-   *   (optional) TRUE if the revision should be loaded, defaults to FALSE.
+   * @param $revision_id
+   *   ID of the revision that was loaded, or FALSE if the most current revision
+   *   was loaded.
    */
-  protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
+  protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
     // Attach fields.
     if ($this->entityInfo['fieldable']) {
-      if ($load_revision) {
+      if ($revision_id) {
         field_attach_load_revision($this->entityType, $queried_entities);
       }
       else {
@@ -375,15 +337,35 @@ class DatabaseStorageController implements EntityStorageControllerInterface {
    *
    * @param $ids
    *   If not empty, return entities that match these IDs.
+   * @param $conditions
+   *   If set, return entities that match all of these conditions.
    *
    * @return
    *   Array of entities from the entity cache.
    */
-  protected function cacheGet($ids) {
+  protected function cacheGet($ids, $conditions = array()) {
     $entities = array();
     // Load any available entities from the internal cache.
     if (!empty($this->entityCache)) {
-      $entities += array_intersect_key($this->entityCache, array_flip($ids));
+      if ($ids) {
+        $entities += array_intersect_key($this->entityCache, array_flip($ids));
+      }
+      // If loading entities only by conditions, fetch all available entities
+      // from the cache. Entities which don't match are removed later.
+      elseif ($conditions) {
+        $entities = $this->entityCache;
+      }
+    }
+
+    // Exclude any entities loaded from cache if they don't match $conditions.
+    // This ensures the same behavior whether loading from memory or database.
+    if ($conditions) {
+      foreach ($entities as $entity) {
+        $entity_values = (array) $entity;
+        if (array_diff_assoc($conditions, $entity_values)) {
+          unset($entities[$entity->{$this->idKey}]);
+        }
+      }
     }
     return $entities;
   }
diff --git a/core/modules/entity/lib/Drupal/entity/Entity.php b/core/modules/entity/lib/Drupal/entity/Entity.php
index 2055336..7e73024 100644
--- a/core/modules/entity/lib/Drupal/entity/Entity.php
+++ b/core/modules/entity/lib/Drupal/entity/Entity.php
@@ -66,13 +66,6 @@ class Entity implements EntityInterface {
   }
 
   /**
-   * Implements EntityInterface::uuid().
-   */
-  public function uuid() {
-    return isset($this->uuid) ? $this->uuid : NULL;
-  }
-
-  /**
    * Implements EntityInterface::isNew().
    */
   public function isNew() {
@@ -104,7 +97,7 @@ class Entity implements EntityInterface {
    * Implements EntityInterface::label().
    */
   public function label($langcode = NULL) {
-    $label = NULL;
+    $label = FALSE;
     $entity_info = $this->entityInfo();
     if (isset($entity_info['label callback']) && function_exists($entity_info['label callback'])) {
       $label = $entity_info['label callback']($this->entityType, $this, $langcode);
@@ -117,6 +110,8 @@ class Entity implements EntityInterface {
 
   /**
    * Implements EntityInterface::uri().
+   *
+   * @see entity_uri()
    */
   public function uri() {
     $bundle = $this->bundle();
diff --git a/core/modules/entity/lib/Drupal/entity/EntityInterface.php b/core/modules/entity/lib/Drupal/entity/EntityInterface.php
index ef95cc2..7aedb48 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityInterface.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityInterface.php
@@ -33,17 +33,6 @@ interface EntityInterface {
   public function id();
 
   /**
-   * Returns the entity UUID (Universally Unique Identifier).
-   *
-   * The UUID is guaranteed to be unique and can be used to identify an entity
-   * across multiple systems.
-   *
-   * @return string
-   *   The UUID of the entity, or NULL if the entity does not have one.
-   */
-  public function uuid();
-
-  /**
    * Returns whether the entity is new.
    *
    * Usually an entity is new if no ID exists for it yet. However, entities may
diff --git a/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php b/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php
index 22b6b4c..7f27e96 100644
--- a/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php
+++ b/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php
@@ -42,34 +42,13 @@ interface EntityStorageControllerInterface {
    *
    * @param $ids
    *   An array of entity IDs, or FALSE to load all entities.
+   * @param $conditions
+   *   An array of conditions in the form 'field' => $value.
    *
    * @return
    *   An array of entity objects indexed by their ids.
    */
-  public function load(array $ids = NULL);
-
-  /**
-   * Load a specific entity revision.
-   *
-   * @param int $revision_id
-   *   The revision id.
-   *
-   * @return Drupal\entity\EntityInterface|false
-   *   The specified entity revision or FALSE if not found.
-   */
-  public function loadRevision($revision_id);
-
-  /**
-   * Load entities by their property values.
-   *
-   * @param array $values
-   *   An associative array where the keys are the property names and the
-   *   values are the values those properties must have.
-   *
-   * @return array
-   *   An array of entity objects indexed by their ids.
-   */
-  public function loadByProperties(array $values);
+  public function load($ids = array(), $conditions = array());
 
   /**
    * Constructs a new entity object, without permanently saving it.
diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityApiTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityApiTest.php
index e8d979f..6a335c5 100644
--- a/core/modules/entity/lib/Drupal/entity/Tests/EntityApiTest.php
+++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityApiTest.php
@@ -43,7 +43,7 @@ class EntityApiTest extends WebTestBase {
     $entity = entity_create('entity_test', array('name' => 'test', 'uid' => NULL));
     $entity->save();
 
-    $entities = array_values(entity_load_multiple_by_properties('entity_test', array('name' => 'test')));
+    $entities = array_values(entity_test_load_multiple(FALSE, array('name' => 'test')));
 
     $this->assertEqual($entities[0]->get('name'), 'test', 'Created and loaded entity.');
     $this->assertEqual($entities[1]->get('name'), 'test', 'Created and loaded entity.');
@@ -53,23 +53,23 @@ class EntityApiTest extends WebTestBase {
     $this->assertEqual($loaded_entity->id, $entity->id, 'Loaded a single entity by id.');
 
     // Test deleting an entity.
-    $entities = array_values(entity_load_multiple_by_properties('entity_test', array('name' => 'test2')));
+    $entities = array_values(entity_test_load_multiple(FALSE, array('name' => 'test2')));
     $entities[0]->delete();
-    $entities = array_values(entity_load_multiple_by_properties('entity_test', array('name' => 'test2')));
+    $entities = array_values(entity_test_load_multiple(FALSE, array('name' => 'test2')));
     $this->assertEqual($entities, array(), 'Entity deleted.');
 
     // Test updating an entity.
-    $entities = array_values(entity_load_multiple_by_properties('entity_test', array('name' => 'test')));
+    $entities = array_values(entity_test_load_multiple(FALSE, array('name' => 'test')));
     $entities[0]->set('name', 'test3');
     $entities[0]->save();
     $entity = entity_test_load($entities[0]->id);
     $this->assertEqual($entity->get('name'), 'test3', 'Entity updated.');
 
     // Try deleting multiple test entities by deleting all.
-    $ids = array_keys(entity_test_load_multiple());
+    $ids = array_keys(entity_test_load_multiple(FALSE));
     entity_test_delete_multiple($ids);
 
-    $all = entity_test_load_multiple();
+    $all = entity_test_load_multiple(FALSE);
     $this->assertTrue(empty($all), 'Deleted all entities.');
   }
 
diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityTranslationTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityTranslationTest.php
index c7f7961..9875b39 100644
--- a/core/modules/entity/lib/Drupal/entity/Tests/EntityTranslationTest.php
+++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityTranslationTest.php
@@ -211,23 +211,23 @@ class EntityTranslationTest extends WebTestBase {
     // original language is the same of one used for a translation.
     $langcode = $this->langcodes[1];
     entity_create('entity_test', array('uid' => $properties[$langcode]['uid']))->save();
-    $entities = entity_test_load_multiple();
+    $entities = entity_test_load_multiple(FALSE, array(), TRUE);
     $this->assertEqual(count($entities), 3, 'Three entities were created.');
-    $entities = entity_test_load_multiple(array($translated_id));
+    $entities = entity_test_load_multiple(array($translated_id), array(), TRUE);
     $this->assertEqual(count($entities), 1, 'One entity correctly loaded by id.');
-    $entities = entity_load_multiple_by_properties('entity_test', array('name' => $name));
+    $entities = entity_test_load_multiple(array(), array('name' => $name), TRUE);
     $this->assertEqual(count($entities), 2, 'Two entities correctly loaded by name.');
     // @todo The default language condition should go away in favor of an
     // explicit parameter.
-    $entities = entity_load_multiple_by_properties('entity_test', array('name' => $properties[$langcode]['name'], 'default_langcode' => 0));
+    $entities = entity_test_load_multiple(array(), array('name' => $properties[$langcode]['name'], 'default_langcode' => 0), TRUE);
     $this->assertEqual(count($entities), 1, 'One entity correctly loaded by name translation.');
-    $entities = entity_load_multiple_by_properties('entity_test', array('langcode' => $default_langcode, 'name' => $name));
+    $entities = entity_test_load_multiple(array(), array('langcode' => $default_langcode, 'name' => $name), TRUE);
     $this->assertEqual(count($entities), 1, 'One entity correctly loaded by name and language.');
-    $entities = entity_load_multiple_by_properties('entity_test', array('langcode' => $langcode, 'name' => $properties[$langcode]['name']));
+    $entities = entity_test_load_multiple(array(), array('langcode' => $langcode, 'name' => $properties[$langcode]['name']), TRUE);
     $this->assertEqual(count($entities), 0, 'No entity loaded by name translation specifying the translation language.');
-    $entities = entity_load_multiple_by_properties('entity_test', array('langcode' => $langcode, 'name' => $properties[$langcode]['name'], 'default_langcode' => 0));
+    $entities = entity_test_load_multiple(array(), array('langcode' => $langcode, 'name' => $properties[$langcode]['name'], 'default_langcode' => 0), TRUE);
     $this->assertEqual(count($entities), 1, 'One entity loaded by name translation and language specifying to look for translations.');
-    $entities = entity_load_multiple_by_properties('entity_test', array('uid' => $properties[$langcode]['uid'], 'default_langcode' => NULL));
+    $entities = entity_test_load_multiple(array(), array('uid' => $properties[$langcode]['uid'], 'default_langcode' => NULL), TRUE);
     $this->assertEqual(count($entities), 2, 'Two entities loaded by uid without caring about property translatability.');
   }
 }
diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityUUIDTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityUUIDTest.php
index e7607dc..75333b4 100644
--- a/core/modules/entity/lib/Drupal/entity/Tests/EntityUUIDTest.php
+++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityUUIDTest.php
@@ -41,35 +41,35 @@ class EntityUUIDTest extends WebTestBase {
       'name' => $this->randomName(),
       'uuid' => $uuid,
     ));
-    $this->assertIdentical($custom_entity->uuid(), $uuid);
+    $this->assertIdentical($custom_entity->get('uuid'), $uuid);
     // Save this entity, so we have more than one later.
     $custom_entity->save();
 
     // Verify that a new UUID is generated upon creating an entity.
     $entity = entity_create('entity_test', array('name' => $this->randomName()));
-    $uuid = $entity->uuid();
+    $uuid = $entity->get('uuid');
     $this->assertTrue($uuid);
 
     // Verify that the new UUID is different.
-    $this->assertNotEqual($custom_entity->uuid(), $uuid);
+    $this->assertNotEqual($custom_entity->get('uuid'), $uuid);
 
     // Verify that the UUID is retained upon saving.
     $entity->save();
-    $this->assertIdentical($entity->uuid(), $uuid);
+    $this->assertIdentical($entity->get('uuid'), $uuid);
 
     // Verify that the UUID is retained upon loading.
     $entity_loaded = entity_test_load($entity->id(), TRUE);
-    $this->assertIdentical($entity_loaded->uuid(), $uuid);
+    $this->assertIdentical($entity_loaded->get('uuid'), $uuid);
 
     // Verify that entity_load_by_uuid() loads the same entity.
     $entity_loaded_by_uuid = entity_load_by_uuid('entity_test', $uuid, TRUE);
-    $this->assertIdentical($entity_loaded_by_uuid->uuid(), $uuid);
+    $this->assertIdentical($entity_loaded_by_uuid->get('uuid'), $uuid);
     $this->assertEqual($entity_loaded_by_uuid, $entity_loaded);
 
     // Creating a duplicate needs to result in a new UUID.
     $entity_duplicate = $entity->createDuplicate();
-    $this->assertNotEqual($entity_duplicate->uuid(), $entity->uuid());
-    $this->assertNotNull($entity_duplicate->uuid());
+    $this->assertNotEqual($entity_duplicate->get('uuid'), $entity->get('uuid'));
+    $this->assertNotNull($entity_duplicate->get('uuid'));
     $entity_duplicate->save();
     $this->assertNotEqual($entity->id(), $entity_duplicate->id());
   }
diff --git a/core/modules/entity/tests/modules/entity_test/entity_test.module b/core/modules/entity/tests/modules/entity_test/entity_test.module
index 02ec108..088706d 100644
--- a/core/modules/entity/tests/modules/entity_test/entity_test.module
+++ b/core/modules/entity/tests/modules/entity_test/entity_test.module
@@ -45,16 +45,18 @@ function entity_test_load($id, $reset = FALSE) {
 /**
  * Loads multiple test entities based on certain conditions.
  *
- * @param array $ids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ * @param array|bool $ids
+ *   An array of entity IDs, or FALSE to load all entities.
+ * @param array $conditions
+ *   An array of conditions to match against the {entity} table.
  * @param bool $reset
  *   A boolean indicating that the internal cache should be reset.
  *
  * @return array
  *   An array of test entity objects, indexed by ID.
  */
-function entity_test_load_multiple(array $ids = NULL, $reset = FALSE) {
-  return entity_load_multiple('entity_test', $ids, $reset);
+function entity_test_load_multiple($ids = array(), $conditions = array(), $reset = FALSE) {
+  return entity_load_multiple('entity_test', $ids, $conditions, $reset);
 }
 
 /**
diff --git a/core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php b/core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php
index b31e5ce..147f030 100644
--- a/core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php
+++ b/core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php
@@ -21,12 +21,22 @@ use Drupal\entity\DatabaseStorageController;
 class EntityTestStorageController extends DatabaseStorageController {
 
   /**
-   * Overrides Drupal\entity\DatabaseStorageController::loadByProperties().
+   * Overrides Drupal\entity\DatabaseStorageController::buildQuery().
    */
-  public function loadByProperties(array $values) {
-    $query = db_select($this->entityInfo['base table'], 'base');
-    $query->addTag($this->entityType . '_load_multiple');
-    if ($values) {
+  protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
+    $query = parent::buildQuery($ids, $conditions, $revision_id);
+
+    if ($conditions) {
+      // Reset conditions as the default storage controller applies them to the
+      // base table.
+      $query_conditions = &$query->conditions();
+      $query_conditions = array('#conjunction' => 'AND');
+
+      // Restore id conditions.
+      if ($ids) {
+        $query->condition("base.{$this->idKey}", $ids, 'IN');
+      }
+
       // Conditions need to be applied the property data table.
       $query->addJoin('inner', 'entity_test_property_data', 'data', "base.{$this->idKey} = data.{$this->idKey}");
       $query->distinct(TRUE);
@@ -36,31 +46,27 @@ class EntityTestStorageController extends DatabaseStorageController {
       // separate parameter during the following API refactoring.
       // Default to the original entity language if not explicitly specified
       // otherwise.
-      if (!array_key_exists('default_langcode', $values)) {
-        $values['default_langcode'] = 1;
+      if (!array_key_exists('default_langcode', $conditions)) {
+        $conditions['default_langcode'] = 1;
       }
       // If the 'default_langcode' flag is esplicitly not set, we do not care
       // whether the queried values are in the original entity language or not.
-      elseif ($values['default_langcode'] === NULL) {
-        unset($values['default_langcode']);
+      elseif ($conditions['default_langcode'] === NULL) {
+        unset($conditions['default_langcode']);
       }
 
-      $data_schema = drupal_get_schema('entity_test_property_data');
-      $query->addField('data', $this->idKey);
-      foreach ($values as $field => $value) {
-        // Check on which table the condition needs to be added.
-        $table = isset($data_schema['fields'][$field]) ? 'data' : 'base';
-        $query->condition($table . '.' . $field, $value);
+      foreach ($conditions as $field => $value) {
+        $query->condition('data.' . $field, $value);
       }
     }
-    $ids = $query->execute()->fetchCol();
-    return $ids ? $this->load($ids) : array();
+
+    return $query;
   }
 
   /**
    * Overrides Drupal\entity\DatabaseStorageController::attachLoad().
    */
-  protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
+  protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
     $data = db_select('entity_test_property_data', 'data', array('fetch' => PDO::FETCH_ASSOC))
       ->fields('data')
       ->condition('id', array_keys($queried_entities))
@@ -78,7 +84,7 @@ class EntityTestStorageController extends DatabaseStorageController {
       $entity->setProperties($values, $langcode);
     }
 
-    parent::attachLoad($queried_entities, $load_revision);
+    parent::attachLoad($queried_entities, $revision_id);
   }
 
   /**
diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc
index 8853126..a70796f 100644
--- a/core/modules/field/field.info.inc
+++ b/core/modules/field/field.info.inc
@@ -713,10 +713,6 @@ function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
  *   The field name for the instance.
  * @param $bundle_name
  *   The bundle name for the instance.
- *
- * @return
- *   An associative array of instance data for the specific field and bundle;
- *   NULL if the instance does not exist.
  */
 function field_info_instance($entity_type, $field_name, $bundle_name) {
   $info = _field_info_collate_fields();
diff --git a/core/modules/file/file.api.php b/core/modules/file/file.api.php
index 71039b1..7f20d83 100644
--- a/core/modules/file/file.api.php
+++ b/core/modules/file/file.api.php
@@ -8,16 +8,16 @@
 /**
  * Control download access to files.
  *
- * The hook is typically implemented to limit access based on the entity that
- * references the file; for example, only users with access to a node should be
- * allowed to download files attached to that node.
+ * The hook is typically implemented to limit access based on the entity the
+ * file is referenced, e.g., only users with access to a node should be allowed
+ * to download files attached to that node.
  *
  * @param $field
  *   The field to which the file belongs.
- * @param Drupal\entity\EntityInterface $entity
- *   The entity which references the file.
- * @param Drupal\Core\File\File $file
- *   The file entity that is being requested.
+ * @param $entity_type
+ *   The type of $entity; for example, 'node' or 'user'.
+ * @param $entity
+ *   The $entity to which $file is referenced.
  *
  * @return
  *   TRUE is access should be allowed by this entity or FALSE if denied. Note
@@ -26,8 +26,8 @@
  *
  * @see hook_field_access().
  */
-function hook_file_download_access($field, Drupal\entity\EntityInterface $entity, Drupal\Core\File\File $file) {
-  if ($entity->entityType() == 'node') {
+function hook_file_download_access($field, $entity_type, $entity) {
+  if ($entity_type == 'node') {
     return node_access('view', $entity);
   }
 }
@@ -45,21 +45,20 @@ function hook_file_download_access($field, Drupal\entity\EntityInterface $entity
  *   An array of grants gathered by hook_file_download_access(). The array is
  *   keyed by the module that defines the entity type's access control; the
  *   values are Boolean grant responses for each module.
- * @param array $context
- *   An associative array containing the following key-value pairs:
- *   - field: The field to which the file belongs.
- *   - entity: The entity which references the file.
- *   - file: The file entity that is being requested.
+ * @param $field
+ *   The field to which the file belongs.
+ * @param $entity_type
+ *   The type of $entity; for example, 'node' or 'user'.
+ * @param $entity
+ *   The $entity to which $file is referenced.
  *
  * @return
  *   An array of grants, keyed by module name, each with a Boolean grant value.
  *   Return an empty array to assert FALSE. You may choose to return your own
  *   module's value in addition to other grants or to overwrite the values set
  *   by other modules.
- *
- * @see hook_file_download_access().
  */
-function hook_file_download_access_alter(&$grants, $context) {
+function hook_file_download_access_alter(&$grants, $field, $entity_type, $entity) {
   // For our example module, we always enforce the rules set by node module.
   if (isset($grants['node'])) {
     $grants = array('node' => $grants['node']);
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index d2f6f76..24dd94f 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -127,7 +127,7 @@ function file_file_download($uri, $field_type = 'file') {
   global $user;
 
   // Get the file record based on the URI. If not in the database just return.
-  $files = entity_load_multiple_by_properties('file', array('uri' => $uri));
+  $files = file_load_multiple(array(), array('uri' => $uri));
   if (count($files)) {
     foreach ($files as $item) {
       // Since some database servers sometimes use a case-insensitive comparison
@@ -167,28 +167,24 @@ function file_file_download($uri, $field_type = 'file') {
       foreach ($type_references as $id => $reference) {
         // Try to load $entity and $field.
         $entity = entity_load($entity_type, $id);
-        $field = field_info_field($field_name);
-
-        // Load the field item that references the file.
-        $match = FALSE;
+        $field = NULL;
         if ($entity) {
-          // Load all fields items for that entity.
+          // Load all fields for that entity.
           $field_items = field_get_items($entity_type, $entity, $field_name);
 
-          // Try to find the field item that references the given file.
-          foreach ($field_items as $item) {
-            if ($file->fid == $item['fid']) {
-              $match = TRUE;
+          // Find the field item with the matching URI.
+          foreach ($field_items as $field_item) {
+            if (file_load($field_item['fid'])->uri == $uri) {
+              $field = field_info_field($field_name);
               break;
             }
           }
         }
 
-        // Check that $entity and $field were loaded successfully, a field
-        // item that references the file exists and check if access to that
-        // field is not disallowed. If any of these checks fail, stop checking
-        // access for this reference.
-        if (empty($entity) || empty($field) || !$match || !field_access('view', $field, $entity_type, $entity)) {
+        // Check that $entity and $field were loaded successfully and check if
+        // access to that field is not disallowed. If any of these checks fail,
+        // stop checking access for this reference.
+        if (empty($entity) || empty($field) || !field_access('view', $field, $entity_type, $entity)) {
           $denied = TRUE;
           break;
         }
@@ -197,15 +193,10 @@ function file_file_download($uri, $field_type = 'file') {
         // Default to FALSE and let entities overrule this ruling.
         $grants = array('system' => FALSE);
         foreach (module_implements('file_download_access') as $module) {
-          $grants = array_merge($grants, array($module => module_invoke($module, 'file_download_access', $field, $entity, $file)));
+          $grants = array_merge($grants, array($module => module_invoke($module, 'file_download_access', $field, $entity_type, $entity)));
         }
         // Allow other modules to alter the returned grants/denies.
-        $context = array(
-          'entity' => $entity,
-          'field' => $field,
-          'file' => $file,
-        );
-        drupal_alter('file_download_access', $grants, $context);
+        drupal_alter('file_download_access', $grants, $field, $entity_type, $entity);
 
         if (in_array(TRUE, $grants)) {
           // If TRUE is returned, access is granted and no further checks are
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
index 9d7dd30..2628dff 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
@@ -57,7 +57,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
     $this->drupalGet('node/' . $nid . '/edit');
 
     // Check that the default formatter is displaying with the file name.
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $default_output = theme('file_link', array('file' => $node_file));
     $this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.'));
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
index d963b89..636c8d1 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
@@ -32,7 +32,7 @@ class FileFieldPathTest extends FileFieldTestBase {
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
 
     // Check that the file was uploaded to the file root.
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $this->assertPathMatch('public://' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
 
@@ -43,7 +43,7 @@ class FileFieldPathTest extends FileFieldTestBase {
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
 
     // Check that the file was uploaded into the subdirectory.
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
 
@@ -55,7 +55,7 @@ class FileFieldPathTest extends FileFieldTestBase {
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
 
     // Check that the file was uploaded into the subdirectory.
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     // Do token replacement using the same user which uploaded the file, not
     // the user running the test case.
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
index c09be63..3d70d02 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
@@ -46,7 +46,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
 
     // Check that the file exists on disk and in the database.
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file_r1 = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $node_vid_r1 = $node->vid;
     $this->assertFileExists($node_file_r1, t('New file saved to disk on node creation.'));
@@ -55,7 +55,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
 
     // Upload another file to the same node in a new revision.
     $this->replaceNodeFile($test_file, $field_name, $nid);
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file_r2 = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $node_vid_r2 = $node->vid;
     $this->assertFileExists($node_file_r2, t('Replacement file exists on disk after creating new revision.'));
@@ -63,7 +63,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
     $this->assertFileIsPermanent($node_file_r2, t('Replacement file is permanent.'));
 
     // Check that the original file is still in place on the first revision.
-    $node = node_revision_load($node_vid_r1);
+    $node = node_load($nid, $node_vid_r1, TRUE);
     $this->assertEqual($node_file_r1, file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']), t('Original file still in place after replacing file in new revision.'));
     $this->assertFileExists($node_file_r1, t('Original file still in place after replacing file in new revision.'));
     $this->assertFileEntryExists($node_file_r1, t('Original file entry still in place after replacing file in new revision'));
@@ -72,7 +72,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
     // Save a new version of the node without any changes.
     // Check that the file is still the same as the previous revision.
     $this->drupalPost('node/' . $nid . '/edit', array('revision' => '1'), t('Save'));
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file_r3 = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $node_vid_r3 = $node->vid;
     $this->assertEqual($node_file_r2, $node_file_r3, t('Previous revision file still in place after creating a new revision without a new file.'));
@@ -80,7 +80,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
 
     // Revert to the first revision and check that the original file is active.
     $this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r1 . '/revert', array(), t('Revert'));
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file_r4 = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $node_vid_r4 = $node->vid;
     $this->assertEqual($node_file_r1, $node_file_r4, t('Original revision file still in place after reverting to the original revision.'));
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
index e291bec..c85a707 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
@@ -143,7 +143,7 @@ abstract class FileFieldTestBase extends WebTestBase {
       $nid = $node->nid;
       // Save at least one revision to better simulate a real site.
       $this->drupalCreateNode(get_object_vars($node));
-      $node = node_load($nid, TRUE);
+      $node = node_load($nid, NULL, TRUE);
       $this->assertNotEqual($nid, $node->vid, t('Node revision exists.'));
     }
 
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
index 050931b..443745f 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
@@ -44,7 +44,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
     $this->assertTrue($nid !== FALSE, t('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', array('@test_file' => $test_file->uri, '@field_name' => $field_name, '@type_name' => $type_name)));
 
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
 
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $this->assertFileExists($node_file, t('File exists after uploading to the required field.'));
@@ -61,7 +61,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
 
     // Create a new node with the uploaded file into the multivalue field.
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $this->assertFileExists($node_file, t('File exists after uploading to the required multiple value field.'));
     $this->assertFileEntryExists($node_file, t('File entry exists after uploading to the required multipel value field.'));
@@ -97,7 +97,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
 
       // Create a new node with the small file, which should pass.
       $nid = $this->uploadNodeFile($small_file, $field_name, $type_name);
-      $node = node_load($nid, TRUE);
+      $node = node_load($nid, NULL, TRUE);
       $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
       $this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
       $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
@@ -113,7 +113,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
 
     // Upload the big file successfully.
     $nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
     $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
@@ -140,7 +140,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
 
     // Check that the file can be uploaded with no extension checking.
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $this->assertFileExists($node_file, t('File exists after uploading a file with no extension checking.'));
     $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with no extension checking.'));
@@ -158,7 +158,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
 
     // Check that the file can be uploaded with extension checking.
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $this->assertFileExists($node_file, t('File exists after uploading a file with extension checking.'));
     $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with extension checking.'));
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
index 4f93ce0..599921a 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
@@ -41,7 +41,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
       // @todo This only tests a 'nojs' submission, because drupalPostAJAX()
       //   does not yet support file uploads.
       $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-      $node = node_load($nid, TRUE);
+      $node = node_load($nid, NULL, TRUE);
       $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
       $this->assertFileExists($node_file, t('New file saved to disk on node creation.'));
 
@@ -71,7 +71,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
 
       // Save the node and ensure it does not have the file.
       $this->drupalPost(NULL, array(), t('Save'));
-      $node = node_load($nid, TRUE);
+      $node = node_load($nid, NULL, TRUE);
       $this->assertTrue(empty($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']), t('File was successfully removed from the node.'));
     }
   }
@@ -192,7 +192,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
       $matches = array();
       preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches);
       $nid = $matches[1];
-      $node = node_load($nid, TRUE);
+      $node = node_load($nid, NULL, TRUE);
       $this->assertTrue(empty($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']), t('Node was successfully saved without any files.'));
     }
   }
@@ -217,7 +217,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
     $edit = array('field[settings][uri_scheme]' => 'private');
     $this->drupalPost("admin/structure/types/manage/$type_name/fields/$field_name", $edit, t('Save settings'));
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     $this->assertFileExists($node_file, t('New file saved to disk on node creation.'));
 
diff --git a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
index 2febd5f..03226ca 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
@@ -17,7 +17,7 @@ class FilePrivateTest extends FileFieldTestBase {
   *
   * @var array
   */
-  public static $modules = array('node_access_test', 'field_test');
+  public static $modules = array('node_access_test');
 
   public static function getInfo() {
     return array(
@@ -45,13 +45,9 @@ class FilePrivateTest extends FileFieldTestBase {
     $field_name = strtolower($this->randomName());
     $this->createFileField($field_name, $type_name, array('uri_scheme' => 'private'));
 
-    // Create a field with no view access - see field_test_field_access().
-    $no_access_field_name = 'field_no_view_access';
-    $this->createFileField($no_access_field_name, $type_name, array('uri_scheme' => 'private'));
-
     $test_file = $this->getTestFile('text');
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name, TRUE, array('private' => TRUE));
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     // Ensure the file can be downloaded.
     $this->drupalGet(file_create_url($node_file->uri));
@@ -59,14 +55,5 @@ class FilePrivateTest extends FileFieldTestBase {
     $this->drupalLogOut();
     $this->drupalGet(file_create_url($node_file->uri));
     $this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.'));
-
-    // Test with the field that should deny access through field access.
-    $this->drupalLogin($this->admin_user);
-    $nid = $this->uploadNodeFile($test_file, $no_access_field_name, $type_name, TRUE, array('private' => TRUE));
-    $node = node_load($nid, TRUE);
-    $node_file = file_load($node->{$no_access_field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
-    // Ensure the file cannot be downloaded.
-    $this->drupalGet(file_create_url($node_file->uri));
-    $this->assertResponse(403, t('Confirmed that access is denied for the file without view field access permission.'));
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
index 2781723..4efd9c5 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
@@ -45,7 +45,7 @@ class FileTokenReplaceTest extends FileFieldTestBase {
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
 
     // Load the node and the file.
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
 
     // Generate and test sanitized tokens.
diff --git a/core/modules/file/tests/file_module_test.module b/core/modules/file/tests/file_module_test.module
index f61d67d..216b10f 100644
--- a/core/modules/file/tests/file_module_test.module
+++ b/core/modules/file/tests/file_module_test.module
@@ -5,9 +5,6 @@
  * Provides File module pages for testing purposes.
  */
 
-use Drupal\entity\EntityInterface;
-use Drupal\Core\File\File;
-
 /**
  * Implements hook_menu().
  */
@@ -75,8 +72,8 @@ function file_module_test_form_submit($form, &$form_state) {
 /**
  * Implements hook_file_download_access().
  */
-function file_module_test_file_download_access($field, EntityInterface $entity, File $file) {
-  $instance = field_info_instance($entity->entityType(), $field['field_name'], $entity->bundle());
+function file_module_test_file_download_access($field, $entity_type, $entity) {
+  $instance = field_info_instance($entity_type, $field['field_name'], $entity->bundle());
   // Allow the file to be downloaded only if the given arguments are correct.
   // If any are wrong, $instance will be NULL.
   if (empty($instance)) {
diff --git a/core/modules/image/image.field.inc b/core/modules/image/image.field.inc
index 09b07eb..80b8fb8 100644
--- a/core/modules/image/image.field.inc
+++ b/core/modules/image/image.field.inc
@@ -546,7 +546,7 @@ function image_field_formatter_view($entity_type, $entity, $field, $instance, $l
 
   // Check if the formatter involves a link.
   if ($display['settings']['image_link'] == 'content') {
-    $uri = $entity->uri();
+    $uri = entity_uri($entity_type, $entity);
   }
   elseif ($display['settings']['image_link'] == 'file') {
     $link_file = TRUE;
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 25b7ea6..7f88f3f 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -286,9 +286,12 @@ function image_file_download($uri) {
           // Send headers describing the image's size, and MIME-type...
           'Content-Type' => $info['mime_type'],
           'Content-Length' => $info['file_size'],
-          // By not explicitly setting them here, this uses normal Drupal
-          // Expires, Cache-Control and ETag headers to prevent proxy or
-          // browser caching of private images.
+          // ...and allow the file to be cached for two weeks (matching the
+          // value we/ use for the mod_expires settings in .htaccess) and
+          // ensure that caching proxies do not share the image with other
+          // users.
+          'Expires' => gmdate(DATE_RFC1123, REQUEST_TIME + 1209600),
+          'Cache-Control' => 'max-age=1209600, private, must-revalidate',
         );
       }
     }
@@ -298,7 +301,7 @@ function image_file_download($uri) {
   // Private file access for the original files. Note that we only
   // check access for non-temporary images, since file.module will
   // grant access for all temporary files.
-  $files = entity_load_multiple_by_properties('file', array('uri' => $uri));
+  $files = file_load_multiple(array(), array('uri' => $uri));
   if (count($files)) {
     $file = reset($files);
     if ($file->status) {
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
index a72e052..4d44aa3 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
@@ -144,8 +144,8 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
     );
 
     // Reload the nodes and confirm the field instance defaults are used.
-    $article_built = node_view($article = node_load($article->nid, TRUE));
-    $page_built = node_view($page = node_load($page->nid, TRUE));
+    $article_built = node_view($article = node_load($article->nid, NULL, $reset = TRUE));
+    $page_built = node_view($page = node_load($page->nid, NULL, $reset = TRUE));
     $this->assertEqual(
       $article_built[$field_name]['#items'][0]['fid'],
       $default_images['instance']->fid,
@@ -180,8 +180,8 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
     );
 
     // Reload the nodes.
-    $article_built = node_view($article = node_load($article->nid,  TRUE));
-    $page_built = node_view($page = node_load($page->nid, TRUE));
+    $article_built = node_view($article = node_load($article->nid, NULL, $reset = TRUE));
+    $page_built = node_view($page = node_load($page->nid, NULL, $reset = TRUE));
 
     // Confirm the article uses the new default.
     $this->assertEqual(
@@ -215,8 +215,8 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
     );
 
     // Reload the nodes.
-    $article_built = node_view($article = node_load($article->nid, TRUE));
-    $page_built = node_view($page = node_load($page->nid, TRUE));
+    $article_built = node_view($article = node_load($article->nid, NULL, $reset = TRUE));
+    $page_built = node_view($page = node_load($page->nid, NULL, $reset = TRUE));
     // Confirm the article uses the new field (not instance) default.
     $this->assertEqual(
       $article_built[$field_name]['#items'][0]['fid'],
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
index e65f2fb..39eb53b 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
@@ -52,7 +52,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
     // Create a new node with an image attached.
     $test_image = current($this->drupalGetTestFiles('image'));
     $nid = $this->uploadNodeImage($test_image, $field_name, 'article');
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
 
     // Test that the default formatter is being used.
     $image_uri = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri;
@@ -156,7 +156,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
     $this->assertFieldByName($field_name . '[' . LANGUAGE_NOT_SPECIFIED . '][0][title]', '', t('Title field displayed on article form.'));
     // Verify that the attached image is being previewed using the 'medium'
     // style.
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $image_info = array(
       'uri' => image_style_url('medium', file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri),
       'width' => 220,
@@ -232,7 +232,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
     // Create a node with an image attached and ensure that the default image
     // is not displayed.
     $nid = $this->uploadNodeImage($images[1], $field_name, 'article');
-    $node = node_load($nid, TRUE);
+    $node = node_load($nid, NULL, TRUE);
     $image_info = array(
       'uri' => file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri,
       'width' => 40,
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
index 7dff11b..574cc1b 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
@@ -100,7 +100,7 @@ class ImageStylesPathAndUrlTest extends WebTestBase {
 
     // Create a working copy of the file.
     $files = $this->drupalGetTestFiles('image');
-    $file = array_shift($files);
+    $file = reset($files);
     $image_info = image_get_info($file->uri);
     $original_uri = file_unmanaged_copy($file->uri, $scheme . '://', FILE_EXISTS_RENAME);
     // Let the image_module_test module know about this file, so it can claim
@@ -126,34 +126,7 @@ class ImageStylesPathAndUrlTest extends WebTestBase {
     $this->assertEqual($this->drupalGetHeader('Content-Type'), $generated_image_info['mime_type'], t('Expected Content-Type was reported.'));
     $this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], t('Expected Content-Length was reported.'));
     if ($scheme == 'private') {
-      $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
-      $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, private', t('Cache-Control header was set to prevent caching.'));
       $this->assertEqual($this->drupalGetHeader('X-Image-Owned-By'), 'image_module_test', t('Expected custom header has been added.'));
-
-      // Make sure that a second request to the already existing derivate works
-      // too.
-      $this->drupalGet($generate_url);
-      $this->assertResponse(200, t('Image was generated at the URL.'));
-
-      // Repeat this with a different file that we do not have access to and
-      // make sure that access is denied.
-      $file_noaccess = array_shift($files);
-      $original_uri_noaccess = file_unmanaged_copy($file_noaccess->uri, $scheme . '://', FILE_EXISTS_RENAME);
-      $generated_uri_noaccess = $scheme . '://styles/' . $this->style_name . '/' . $scheme . '/'. drupal_basename($original_uri_noaccess);
-      $this->assertFalse(file_exists($generated_uri_noaccess), t('Generated file does not exist.'));
-      $generate_url_noaccess = image_style_url($this->style_name, $original_uri_noaccess);
-
-      $this->drupalGet($generate_url_noaccess);
-      $this->assertResponse(403, t('Confirmed that access is denied for the private image style.') );
-      // Verify that images are not appended to the response. Currently this test only uses PNG images.
-      if (strpos($generate_url, '.png') === FALSE ) {
-        $this->fail('Confirming that private image styles are not appended require PNG file.');
-      }
-      else {
-        // Check for PNG-Signature (cf. http://www.libpng.org/pub/png/book/chapter08.html#png.ch08.div.2) in the
-        // response body.
-        $this->assertNoRaw( chr(137) . chr(80) . chr(78) . chr(71) . chr(13) . chr(10) . chr(26) . chr(10), 'No PNG signature found in the response body.');
-      }
     }
 
     $GLOBALS['script_path'] = $script_path_original;
diff --git a/core/modules/image/tests/image_module_test.module b/core/modules/image/tests/image_module_test.module
index 0d398ab..766a9d9 100644
--- a/core/modules/image/tests/image_module_test.module
+++ b/core/modules/image/tests/image_module_test.module
@@ -9,6 +9,7 @@ function image_module_test_file_download($uri) {
   if (variable_get('image_module_test_file_download', FALSE) == $uri) {
     return array('X-Image-Owned-By' => 'image_module_test');
   }
+  return -1;
 }
 
 /**
diff --git a/core/modules/language/language.install b/core/modules/language/language.install
index 2884d4b..37f41d6 100644
--- a/core/modules/language/language.install
+++ b/core/modules/language/language.install
@@ -102,22 +102,3 @@ function language_schema() {
   );
   return $schema;
 }
-
-/**
- * Implements hook_enable().
- */
-function language_enable() {
-  // Update the language count, if the module was disabled before, the
-  // language_count variable was forced to 1.
-  language_update_count();
-}
-
-/**
- * Implements hook_disable().
- */
-function language_disable() {
-  // Force the language_count variable to be 1, so that the when checking if the
-  // site is multilingual (for example in language_multilingual()), the result
-  // will be FALSE, because the language module is disabled.
-  variable_set('language_count', 1);
-}
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index a94876e..3fb39e0 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -158,48 +158,6 @@ function language_theme() {
 }
 
 /**
- * Implements hook_element_info_alter().
- */
-function language_element_info_alter(&$type) {
-  // Alter the language_select element so that it will be rendered like a select
-  // field.
-  if (isset($type['language_select'])) {
-    if (!isset($type['language_select']['#process'])) {
-      $type['language_select']['#process'] = array();
-    }
-    if (!isset($type['language_select']['#theme_wrappers'])) {
-      $type['language_select']['#theme_wrappers'] = array();
-    }
-    $type['language_select']['#process'] = array_merge($type['language_select']['#process'], array('language_process_language_select', 'form_process_select', 'ajax_process_form'));
-    $type['language_select']['#theme'] = 'select';
-    $type['language_select']['#theme_wrappers'] = array_merge($type['language_select']['#theme_wrappers'], array('form_element'));
-    $type['language_select']['#languages'] = LANGUAGE_CONFIGURABLE;
-    $type['language_select']['#multiple'] = FALSE;
-  }
-}
-
-/**
- * Processes a language select list form element.
- *
- * @param array $element
- *   The form element to process.
- *
- * @return array $element
- *   The processed form element.
- */
-function language_process_language_select($element) {
-  // Don't set the options if another module (translation for example) already
-  // set the options.
-  if (!isset($element['#options'])) {
-    $element['#options'] = array();
-    foreach (language_list($element['#languages']) as $langcode => $language) {
-      $element['#options'][$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : $language->name;
-    }
-  }
-  return $element;
-}
-
-/**
  * API function to add or update a language.
  *
  * @param $language
@@ -239,7 +197,7 @@ function language_save($language) {
   }
 
   // Update language count based on unlocked language count.
-  language_update_count();
+  variable_set('language_count', db_query('SELECT COUNT(langcode) FROM {language} WHERE locked = 0')->fetchField());
 
   // Kill the static cache in language_list().
   drupal_static_reset('language_list');
@@ -248,17 +206,6 @@ function language_save($language) {
 }
 
 /**
- * Updates the language_count variable.
- *
- * This is used to check if a site is multilingual or not.
- *
- * @see language_multilingual()
- */
-function language_update_count() {
-  variable_set('language_count', db_query('SELECT COUNT(langcode) FROM {language} WHERE locked = 0')->fetchField());
-}
-
-/**
  * Delete a language.
  *
  * @param $langcode
@@ -278,7 +225,7 @@ function language_delete($langcode) {
       ->condition('langcode', $language->langcode)
       ->execute();
 
-    language_update_count();
+    variable_set('language_count', variable_get('language_count', 1) - 1);
 
     drupal_static_reset('language_list');
 
diff --git a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
deleted file mode 100644
index 64e27cd..0000000
--- a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * @file
- * Definition of Drupal\locale\LocaleConfigsubscriber.
- */
-
-namespace Drupal\locale;
-
-use Drupal\Core\Config\Config;
-use Drupal\Core\Config\ConfigEvent;
-use Drupal\Core\Config\StorageDispatcher;
-use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-
-
-/**
- * Locale Config helper
- *
- * $config is always a DrupalConfig object.
- */
-class LocaleConfigsubscriber implements EventSubscriberInterface {
-  /**
-   * Override configuration values with localized data.
-   *
-   * @param Drupal\Core\Config\ConfigEvent $event
-   *   The Event to process.
-   */
-  public function configLoad(ConfigEvent $event) {
-    $config = $event->getConfig();
-    $language = language(LANGUAGE_TYPE_INTERFACE);
-    $locale_name = $this->getLocaleConfigName($config->getName(), $language);
-    if ($override = $config->getStorage()->read($locale_name)) {
-      $config->setOverride($override);
-    }
-  }
-
-  /**
-   * Get configuration name for this language.
-   *
-   * It will be the same name with a prefix depending on language code:
-   * locale.config.LANGCODE.NAME
-   */
-  public function getLocaleConfigName($name, $language) {
-    return 'locale.config.' . $language->langcode . '.' . $name;
-  }
-
-  /**
-   * Implements EventSubscriberInterface::getSubscribedEvents().
-   */
-  static function getSubscribedEvents() {
-    $events['config.load'][] = array('configLoad', 20);
-    return $events;
-  }
-}
diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index aec8978..525a339 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -12,7 +12,6 @@
  */
 
 use Drupal\locale\LocaleLookup;
-use Drupal\locale\LocaleConfigSubscriber;
 
 /**
  * Regular expression pattern used to localize JavaScript strings.
@@ -880,11 +879,3 @@ function _locale_rebuild_js($langcode = NULL) {
       return TRUE;
   }
 }
-
-/**
- * Implements hook_language_init().
- */
-function locale_language_init() {
-  // Add locale helper to configuration subscribers.
-  drupal_container()->get('dispatcher')->addSubscriber(new LocaleConfigSubscriber());
-}
diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php
index c5763e8..ccf8daa 100644
--- a/core/modules/node/lib/Drupal/node/NodeFormController.php
+++ b/core/modules/node/lib/Drupal/node/NodeFormController.php
@@ -97,13 +97,28 @@ class NodeFormController extends EntityFormController {
       $form['title']['#weight'] = -5;
     }
 
-    $form['langcode'] = array(
-      '#title' => t('Language'),
-      '#type' => 'language_select',
-      '#default_value' => $node->langcode,
-      '#languages' => LANGUAGE_ALL,
-      '#access' => !variable_get('node_type_language_hidden_' . $node->type, TRUE),
-    );
+    if (module_exists('language')) {
+      $languages = language_list(LANGUAGE_ALL);
+      $language_options = array();
+      foreach ($languages as $langcode => $language) {
+        // Make locked languages appear special in the list.
+        $language_options[$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : $language->name;
+      }
+
+      $form['langcode'] = array(
+        '#type' => 'select',
+        '#title' => t('Language'),
+        '#default_value' => $node->langcode,
+        '#options' => $language_options,
+        '#access' => !variable_get('node_type_language_hidden_' . $node->type, TRUE),
+      );
+    }
+    else {
+      $form['langcode'] = array(
+        '#type' => 'value',
+        '#value' => $node->langcode,
+      );
+    }
 
     $form['additional_settings'] = array(
       '#type' => 'vertical_tabs',
diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php
index d4968a6..0fa7b33 100644
--- a/core/modules/node/lib/Drupal/node/NodeStorageController.php
+++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php
@@ -157,7 +157,7 @@ class NodeStorageController extends DatabaseStorageController {
   /**
    * Overrides Drupal\entity\DatabaseStorageController::attachLoad().
    */
-  protected function attachLoad(&$nodes, $load_revision = FALSE) {
+  protected function attachLoad(&$nodes, $revision_id = FALSE) {
     // Create an array of nodes for each content type and pass this to the
     // object type specific callback.
     $typed_nodes = array();
@@ -176,16 +176,16 @@ class NodeStorageController extends DatabaseStorageController {
     // hook_node_load(), containing a list of node types that were loaded.
     $argument = array_keys($typed_nodes);
     $this->hookLoadArguments = array($argument);
-    parent::attachLoad($nodes, $load_revision);
+    parent::attachLoad($nodes, $revision_id);
   }
 
   /**
    * Overrides Drupal\entity\DatabaseStorageController::buildQuery().
    */
-  protected function buildQuery($ids, $revision_id = FALSE) {
+  protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
     // Ensure that uid is taken from the {node} table,
     // alias timestamp to revision_timestamp and add revision_uid.
-    $query = parent::buildQuery($ids, $revision_id);
+    $query = parent::buildQuery($ids, $conditions, $revision_id);
     $fields =& $query->getFields();
     unset($fields['timestamp']);
     $query->addField('revision', 'timestamp', 'revision_timestamp');
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
index 3b8a8ae..f51342b 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
@@ -94,7 +94,7 @@ class NodeFieldMultilingualTestCase extends WebTestBase {
       'langcode' => 'it'
     );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $node = $this->drupalGetNodeByTitle($edit[$title_key], TRUE);
+    $node = $this->drupalGetNodeByTitle($edit[$title_key]);
     $this->assertTrue($node, t('Node found in database.'));
 
     $assert = isset($node->body['it']) && !isset($node->body['en']) && $node->body['it'][0]['value'] == $body_value;
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeLoadHooksTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeLoadHooksTest.php
index 5ca7ed6..36b99da 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeLoadHooksTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeLoadHooksTest.php
@@ -40,7 +40,7 @@ class NodeLoadHooksTest extends NodeTestBase {
     // Check that when a set of nodes that only contains articles is loaded,
     // the properties added to the node by node_test_load_node() correctly
     // reflect the expected values.
-    $nodes = entity_load_multiple_by_properties('node', array('status' => NODE_PUBLISHED));
+    $nodes = node_load_multiple(array(), array('status' => NODE_PUBLISHED));
     $loaded_node = end($nodes);
     $this->assertEqual($loaded_node->node_test_loaded_nids, array($node1->nid, $node2->nid), t('hook_node_load() received the correct list of node IDs the first time it was called.'));
     $this->assertEqual($loaded_node->node_test_loaded_types, array('article'), t('hook_node_load() received the correct list of node types the first time it was called.'));
@@ -48,7 +48,7 @@ class NodeLoadHooksTest extends NodeTestBase {
     // Now, as part of the same page request, load a set of nodes that contain
     // both articles and pages, and make sure the parameters passed to
     // node_test_node_load() are correctly updated.
-    $nodes = entity_load_multiple_by_properties('node', array('status' => NODE_NOT_PUBLISHED));
+    $nodes = node_load_multiple(array(), array('status' => NODE_NOT_PUBLISHED));
     $loaded_node = end($nodes);
     $this->assertEqual($loaded_node->node_test_loaded_nids, array($node3->nid, $node4->nid), t('hook_node_load() received the correct list of node IDs the second time it was called.'));
     $this->assertEqual($loaded_node->node_test_loaded_types, array('article', 'page'), t('hook_node_load() received the correct list of node types the second time it was called.'));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php
index 637574d..dd7f9da 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php
@@ -43,7 +43,7 @@ class NodeLoadMultipleTest extends NodeTestBase {
     $this->assertNoText($node4->label(), t('Node title does not appear in the default listing.'));
 
     // Load nodes with only a condition. Nodes 3 and 4 will be loaded.
-    $nodes = entity_load_multiple_by_properties('node', array('promote' => 0));
+    $nodes = node_load_multiple(FALSE, array('promote' => 0));
     $this->assertEqual($node3->label(), $nodes[$node3->nid]->label(), t('Node was loaded.'));
     $this->assertEqual($node4->label(), $nodes[$node4->nid]->label(), t('Node was loaded.'));
     $count = count($nodes);
@@ -59,5 +59,30 @@ class NodeLoadMultipleTest extends NodeTestBase {
     foreach ($nodes as $node) {
       $this->assertTrue(is_object($node), t('Node is an object'));
     }
+
+    // Load nodes by nid, where type = article. Nodes 1, 2 and 3 will be loaded.
+    $nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
+    $count = count($nodes);
+    $this->assertTrue($count == 3, t('@count nodes loaded', array('@count' => $count)));
+    $this->assertEqual($nodes[$node1->nid]->label(), $node1->label(), t('Node successfully loaded.'));
+    $this->assertEqual($nodes[$node2->nid]->label(), $node2->label(), t('Node successfully loaded.'));
+    $this->assertEqual($nodes[$node3->nid]->label(), $node3->label(), t('Node successfully loaded.'));
+    $this->assertFalse(isset($nodes[$node4->nid]));
+
+    // Now that all nodes have been loaded into the static cache, ensure that
+    // they are loaded correctly again when a condition is passed.
+    $nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
+    $count = count($nodes);
+    $this->assertTrue($count == 3, t('@count nodes loaded.', array('@count' => $count)));
+    $this->assertEqual($nodes[$node1->nid]->label(), $node1->label(), t('Node successfully loaded'));
+    $this->assertEqual($nodes[$node2->nid]->label(), $node2->label(), t('Node successfully loaded'));
+    $this->assertEqual($nodes[$node3->nid]->label(), $node3->label(), t('Node successfully loaded'));
+    $this->assertFalse(isset($nodes[$node4->nid]), t('Node was not loaded'));
+
+    // Load nodes by nid, where type = article and promote = 0.
+    $nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article', 'promote' => 0));
+    $count = count($nodes);
+    $this->assertTrue($count == 1, t('@count node loaded', array('@count' => $count)));
+    $this->assertEqual($nodes[$node3->nid]->label(), $node3->label(), t('Node successfully loaded.'));
   }
 }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
index 9a5bb56..7156e10 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
@@ -75,7 +75,7 @@ class NodeRevisionPermissionsTest extends NodeTestBase {
    * Tests the _node_revision_access() function.
    */
   function testNodeRevisionAccess() {
-    $revision = node_revision_load($this->node_revisions[1]->vid);
+    $revision = $this->node_revisions[1];
 
     $parameters = array(
       'op' => array_keys($this->map),
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
index 6b1b141..ee12f0a 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
@@ -87,7 +87,7 @@ class NodeRevisionsTest extends NodeTestBase {
     $this->assertTrue(($nodes[1]->body[LANGUAGE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[LANGUAGE_NOT_SPECIFIED][0]['value']), t('Node reverted correctly.'));
 
     // Confirm that this is not the current version.
-    $node = node_revision_load($node->vid);
+    $node = node_load($node->nid, $node->vid);
     $this->assertFalse($node->isCurrentRevision(), 'Third node revision is not the current one.');
 
     // Confirm revisions delete properly.
@@ -136,7 +136,7 @@ class NodeRevisionsTest extends NodeTestBase {
     $node->save();
     $this->drupalGet('node/' . $node->nid);
     $this->assertText($new_title, t('New node title appears on the page.'));
-    $node_revision = node_load($node->nid, TRUE);
+    $node_revision = node_load($node->nid, NULL, TRUE);
     $this->assertEqual($node_revision->log, $log, t('After an existing node revision is re-saved without a log message, the original log message is preserved.'));
 
     // Create another node with an initial log message.
@@ -154,7 +154,7 @@ class NodeRevisionsTest extends NodeTestBase {
     $node->save();
     $this->drupalGet('node/' . $node->nid);
     $this->assertText($new_title, 'New node title appears on the page.');
-    $node_revision = node_load($node->nid, TRUE);
+    $node_revision = node_load($node->nid, NULL, TRUE);
     $this->assertTrue(empty($node_revision->log), 'After a new node revision is saved with an empty log message, the log message for the node is empty.');
   }
 }
diff --git a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
index eaba85a..9fa1061 100644
--- a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
@@ -81,15 +81,15 @@ class PageEditTest extends NodeTestBase {
     $this->drupalPost(NULL, $edit, t('Save'));
 
     // Ensure that the node revision has been created.
-    $revised_node = $this->drupalGetNodeByTitle($edit['title'], TRUE);
+    $revised_node = $this->drupalGetNodeByTitle($edit['title']);
     $this->assertNotIdentical($node->vid, $revised_node->vid, 'A new revision has been created.');
     // Ensure that the node author is preserved when it was not changed in the
     // edit form.
     $this->assertIdentical($node->uid, $revised_node->uid, 'The node author has been preserved.');
     // Ensure that the revision authors are different since the revisions were
     // made by different users.
-    $first_node_version = node_revision_load($node->vid);
-    $second_node_version = node_revision_load($revised_node->vid);
+    $first_node_version = node_load($node->nid, $node->vid);
+    $second_node_version = node_load($node->nid, $revised_node->vid);
     $this->assertNotIdentical($first_node_version->revision_uid, $second_node_version->revision_uid, 'Each revision has a distinct user.');
   }
 
@@ -122,14 +122,14 @@ class PageEditTest extends NodeTestBase {
     // authorship to the anonymous user (uid 0).
     $edit['name'] = '';
     $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
-    $node = node_load($node->nid, TRUE);
+    $node = node_load($node->nid, NULL, TRUE);
     $this->assertIdentical($node->uid, '0', 'Node authored by anonymous user.');
 
     // Change the authored by field to another user's name (that is not
     // logged in).
     $edit['name'] = $this->web_user->name;
     $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
-    $node = node_load($node->nid, TRUE);
+    $node = node_load($node->nid, NULL, TRUE);
     $this->assertIdentical($node->uid, $this->web_user->uid, 'Node authored by normal user.');
 
     // Check that normal users cannot change the authored by information.
diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc
index 0bf8a91..7aa16ec 100644
--- a/core/modules/node/node.admin.inc
+++ b/core/modules/node/node.admin.inc
@@ -313,7 +313,7 @@ function node_mass_update($nodes, $updates) {
  * @see node_mass_update()
  */
 function _node_mass_update_helper($nid, $updates) {
-  $node = node_load($nid, TRUE);
+  $node = node_load($nid, NULL, TRUE);
   // For efficiency manually save the original node before applying any changes.
   $node->original = clone $node;
   foreach ($updates as $name => $value) {
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 349aab5..cf10c07 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -14,8 +14,6 @@ use Drupal\Core\Database\Query\AlterableInterface;
 use Drupal\Core\Database\Query\SelectExtender;
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\node\Node;
-use Drupal\Core\File\File;
-use Drupal\entity\EntityInterface;
 
 /**
  * Denotes that the node is not published.
@@ -987,47 +985,47 @@ function node_invoke($node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
  * from the database. Nodes are loaded into memory and will not require
  * database access if loaded again during the same page request.
  *
- * @param array $nids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ * @param array|bool $nids
+ *   (optional) An array of node IDs, or FALSE to load all nodes.
+ * @param array $conditions
+ *   (deprecated) An associative array of conditions on the {node}
+ *   table, where the keys are the database fields and the values are the
+ *   values those fields must have. Instead, it is preferable to use
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  * @param bool $reset
  *   (optional) Whether to reset the internal node_load() cache.
  *
  * @return array
  *   An array of node entities indexed by nid.
  *
+ * @todo Remove $conditions in Drupal 8.
+ *
  * @see entity_load_multiple()
  * @see Drupal\entity\EntityFieldQuery
  */
-function node_load_multiple(array $nids = NULL, $reset = FALSE) {
-  return entity_load_multiple('node', $nids, $reset);
+function node_load_multiple($nids = array(), array $conditions = array(), $reset = FALSE) {
+  return entity_load_multiple('node', $nids, $conditions, $reset);
 }
 
 /**
  * Loads a node entity from the database.
  *
  * @param int $nid
- *   The node ID.
+ *   (optional) The node ID.
+ * @param int $vid
+ *   (optional) The revision ID.
  * @param bool $reset
  *   (optional) Whether to reset the node_load_multiple() cache.
  *
  * @return Drupal\node\Node|false
  *   A fully-populated node entity, or FALSE if the node is not found.
  */
-function node_load($nid = NULL, $reset = FALSE) {
-  return entity_load('node', $nid, $reset);
-}
-
-/**
- * Loads a node revision from the database.
- *
- * @param int $nid
- *   The node revision id.
- *
- * @return Drupal\node\Node|false
- *   A fully-populated node entity, or FALSE if the node is not found.
- */
-function node_revision_load($vid = NULL) {
-  return entity_revision_load('node', $vid);
+function node_load($nid = NULL, $vid = NULL, $reset = FALSE) {
+  $nids = (isset($nid) ? array($nid) : array());
+  $conditions = (isset($vid) ? array('vid' => $vid) : array());
+  $node = node_load_multiple($nids, $conditions, $reset);
+  return $node ? reset($node) : FALSE;
 }
 
 /**
@@ -1102,9 +1100,10 @@ function node_delete_multiple($nids) {
  *   TRUE if the revision deletion was successful.
  */
 function node_revision_delete($revision_id) {
-  if ($revision = node_revision_load($revision_id)) {
+  if ($revision = node_load(NULL, $revision_id)) {
     // Prevent deleting the current revision.
-    if ($revision->isCurrentRevision()) {
+    $node = node_load($revision->nid);
+    if ($revision_id == $node->vid) {
       return FALSE;
     }
 
@@ -1202,10 +1201,6 @@ function node_build_content(Node $node, $view_mode = 'full', $langcode = NULL) {
   // Remove previously built content, if exists.
   $node->content = array();
 
-  // Allow modules to change the view mode.
-  $context = array('langcode' => $langcode);
-  drupal_alter('entity_view_mode', $view_mode, $node, $context);
-
   // The 'view' hook can be implemented to overwrite the default function
   // to display nodes.
   if (node_hook($node, 'view')) {
@@ -1334,7 +1329,7 @@ function template_preprocess_node(&$variables) {
     'link_attributes' => array('rel' => 'author'),
   ));
 
-  $uri = $node->uri();
+  $uri = entity_uri('node', $node);
   $variables['node_url']  = url($uri['path'], $uri['options']);
   $variables['title']     = check_plain($node->title);
   $variables['page']      = $variables['view_mode'] == 'full' && node_is_page($node);
@@ -1572,7 +1567,7 @@ function node_search_execute($keys = NULL, $conditions = NULL) {
     $extra = module_invoke_all('node_search_result', $node, $item->langcode);
 
     $language = language_load($item->langcode);
-    $uri = $node->uri();
+    $uri = entity_uri('node', $node);
     $results[] = array(
       'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE, 'language' => $language))),
       'type' => check_plain(node_type_get_name($node)),
@@ -1768,12 +1763,15 @@ function _node_revision_access(Node $node, $op = 'view', $account = NULL, $langc
       return $access[$cid] = FALSE;
     }
 
+    $node_current_revision = node_load($node->nid);
+    $is_current_revision = $node_current_revision->vid == $node->vid;
+
     // There should be at least two revisions. If the vid of the given node
     // and the vid of the current revision differ, then we already have two
     // different revisions so there is no need for a separate database check.
     // Also, if you try to revert to or delete the current revision, that's
     // not good.
-    if ($node->isCurrentRevision() && (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() == 1 || $op == 'update' || $op == 'delete')) {
+    if ($is_current_revision && (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() == 1 || $op == 'update' || $op == 'delete')) {
       $access[$cid] = FALSE;
     }
     elseif (user_access('administer nodes', $account)) {
@@ -1782,7 +1780,7 @@ function _node_revision_access(Node $node, $op = 'view', $account = NULL, $langc
     else {
       // First check the access to the current revision and finally, if the
       // node passed in is not the current revision then access to that, too.
-      $access[$cid] = node_access($op, node_load($node->nid), $account, $langcode) && ($node->isCurrentRevision() || node_access($op, $node, $account, $langcode));
+      $access[$cid] = node_access($op, $node_current_revision, $account, $langcode) && ($is_current_revision || node_access($op, $node, $account, $langcode));
     }
   }
 
@@ -1959,27 +1957,30 @@ function node_menu() {
     'type' => MENU_LOCAL_TASK,
     'file' => 'node.pages.inc',
   );
-  $items['node/%node/revisions/%node_revision/view'] = array(
+  $items['node/%node/revisions/%/view'] = array(
     'title' => 'Revisions',
+    'load arguments' => array(3),
     'page callback' => 'node_show',
-    'page arguments' => array(3, TRUE),
+    'page arguments' => array(1, TRUE),
     'access callback' => '_node_revision_access',
-    'access arguments' => array(3),
+    'access arguments' => array(1),
   );
-  $items['node/%node/revisions/%node_revision/revert'] = array(
+  $items['node/%node/revisions/%/revert'] = array(
     'title' => 'Revert to earlier revision',
+    'load arguments' => array(3),
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('node_revision_revert_confirm', 3),
+    'page arguments' => array('node_revision_revert_confirm', 1),
     'access callback' => '_node_revision_access',
-    'access arguments' => array(3, 'update'),
+    'access arguments' => array(1, 'update'),
     'file' => 'node.pages.inc',
   );
-  $items['node/%node/revisions/%node_revision/delete'] = array(
+  $items['node/%node/revisions/%/delete'] = array(
     'title' => 'Delete earlier revision',
+    'load arguments' => array(3),
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('node_revision_delete_confirm', 3),
+    'page arguments' => array('node_revision_delete_confirm', 1),
     'access callback' => '_node_revision_access',
-    'access arguments' => array(3, 'delete'),
+    'access arguments' => array(1, 'delete'),
     'file' => 'node.pages.inc',
   );
   return $items;
@@ -2565,7 +2566,7 @@ function node_page_view(Node $node) {
   // of the active trail, and the link name becomes the page title.
   // Thus, we must explicitly set the page title to be the node title.
   drupal_set_title($node->label());
-  $uri = $node->uri();
+  $uri = entity_uri('node', $node);
   // Set the node path as the canonical URL to prevent duplicate content.
   drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE);
   // Set the non-aliased path as a default shortlink.
@@ -3480,7 +3481,7 @@ function node_access_rebuild($batch_mode = FALSE) {
       // Rebuild newest nodes first so that recent content becomes available quickly.
       $nids = db_query("SELECT nid FROM {node} ORDER BY nid DESC")->fetchCol();
       foreach ($nids as $nid) {
-        $node = node_load($nid, TRUE);
+        $node = node_load($nid, NULL, TRUE);
         // To preserve database integrity, only acquire grants if the node
         // loads successfully.
         if (!empty($node)) {
@@ -3528,7 +3529,7 @@ function _node_access_rebuild_batch_operation(&$context) {
   // Process the next 20 nodes.
   $limit = 20;
   $nids = db_query_range("SELECT nid FROM {node} WHERE nid > :nid ORDER BY nid ASC", 0, $limit, array(':nid' => $context['sandbox']['current_node']))->fetchCol();
-  $nodes = node_load_multiple($nids, TRUE);
+  $nodes = node_load_multiple($nids, array(), TRUE);
   foreach ($nodes as $nid => $node) {
     // To preserve database integrity, only acquire grants if the node
     // loads successfully.
@@ -3978,8 +3979,8 @@ function node_modules_disabled($modules) {
 /**
  * Implements hook_file_download_access().
  */
-function node_file_download_access($field, EntityInterface $entity, File $file) {
-  if ($entity->entityType() == 'node') {
+function node_file_download_access($field, $entity_type, $entity) {
+  if ($entity_type == 'node') {
     return node_access('view', $entity);
   }
 }
diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module
index bfad466..f541d10 100644
--- a/core/modules/node/tests/modules/node_test/node_test.module
+++ b/core/modules/node/tests/modules/node_test/node_test.module
@@ -151,13 +151,3 @@ function node_test_node_update(Node $node) {
     }
   }
 }
-
-/**
- * Implements hook_entity_view_mode_alter().
- */
-function node_test_entity_view_mode_alter(&$view_mode, Drupal\entity\EntityInterface $entity, $context) {
-  // Only alter the view mode if we are on the test callback.
-  if ($change_view_mode = variable_get('node_test_change_view_mode', '')) {
-    $view_mode = $change_view_mode;
-  }
-}
diff --git a/core/modules/overlay/overlay-parent.js b/core/modules/overlay/overlay-parent.js
index e8fb4d4..214e164 100644
--- a/core/modules/overlay/overlay-parent.js
+++ b/core/modules/overlay/overlay-parent.js
@@ -949,7 +949,7 @@ Drupal.overlay._restoreTabindex = function () {
   $element.attr('tabindex', tabindex);
 };
 
-$.extend(Drupal.theme, {
+$.extend({
   /**
    * Theme function to create the overlay iframe element.
    */
diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php
index 7d0fddf..ea3e7dc 100644
--- a/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php
+++ b/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php
@@ -64,7 +64,7 @@ class PollTokenReplaceTest extends PollTestBase {
     $this->drupalPost('node/' . $poll_nid, $edit, t('Vote'));
     $this->drupalLogout();
 
-    $poll = node_load($poll_nid, TRUE);
+    $poll = node_load($poll_nid, NULL, TRUE);
 
     // Generate and test sanitized tokens.
     $tests = array();
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index a61760c..fe2bd00 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -598,7 +598,7 @@ function rdf_preprocess_field(&$variables) {
  */
 function rdf_preprocess_user_profile(&$variables) {
   $account = $variables['elements']['#account'];
-  $uri = $account->uri();
+  $uri = entity_uri('user', $account);
 
   // Adds RDFa markup to the user profile page. Fields displayed in this page
   // will automatically describe the user.
@@ -695,7 +695,7 @@ function rdf_preprocess_comment(&$variables) {
     // the URI of the resource described within the HTML element, while the
     // typeof attribute indicates its RDF type (e.g., sioc:Post, foaf:Document,
     // and so on.)
-    $uri = $comment->uri();
+    $uri = entity_uri('comment', $comment);
     $variables['attributes']['about'] = url($uri['path'], $uri['options']);
     $variables['attributes']['typeof'] = $comment->rdf_mapping['rdftype'];
   }
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
index 8df2e99..59e5a27 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
@@ -89,7 +89,7 @@ class SearchCommentTest extends SearchTestBase {
       'search_block_form' => "'" . $edit_comment['subject'] . "'",
     );
     $this->drupalPost('', $edit, t('Search'));
-    $node2 = node_load($node->nid, TRUE);
+    $node2 = node_load($node->nid, NULL, TRUE);
     $this->assertText($node2->label(), t('Node found in search results.'));
     $this->assertText($edit_comment['subject'], t('Comment subject found in search results.'));
 
diff --git a/core/modules/search/search.api.php b/core/modules/search/search.api.php
index 4c24475..40ac0d5 100644
--- a/core/modules/search/search.api.php
+++ b/core/modules/search/search.api.php
@@ -236,7 +236,7 @@ function hook_search_execute($keys = NULL, $conditions = NULL) {
     $extra = module_invoke_all('node_search_result', $node, $item->langcode);
 
     $language = language_load($item->langcode);
-    $uri = $node->uri();
+    $uri = entity_uri('node', $node);
     $results[] = array(
       'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE, 'language' => $language))),
       'type' => check_plain(node_type_get_name($node)),
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index fedd32d..f58e1de 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -761,7 +761,7 @@ abstract class TestBase {
     }
 
     // Delete temporary files directory.
-    file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10), array($this, 'filePreDeleteCallback'));
+    file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10));
 
     // Restore original database connection.
     Database::removeConnection('default');
@@ -939,14 +939,4 @@ abstract class TestBase {
     }
     return $all_permutations;
   }
-
-  /**
-   * Ensures test files are deletable within file_unmanaged_delete_recursive().
-   *
-   * Some tests chmod generated files to be read only. During tearDown() and
-   * other cleanup operations, these files need to get deleted too.
-   */
-  public static function filePreDeleteCallback($path) {
-    chmod($path, 0700);
-  }
 }
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 25139e6..bb2aef8 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\simpletest;
 
-use Drupal\Core\DrupalKernel;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\ConnectionNotDefinedException;
 use PDO;
@@ -145,11 +144,6 @@ abstract class WebTestBase extends TestBase {
   protected $redirect_count;
 
   /**
-   * The kernel used in this test.
-   */
-  protected $kernel;
-
-  /**
    * Constructor for Drupal\simpletest\WebTestBase.
    */
   function __construct($test_id = NULL) {
@@ -163,16 +157,13 @@ abstract class WebTestBase extends TestBase {
    * @param $title
    *   A node title, usually generated by $this->randomName().
    * @param $reset
-   *   (optional) Whether to reset the entity cache.
+   *   (optional) Whether to reset the internal node_load() cache.
    *
    * @return
    *   A node entity matching $title.
    */
   function drupalGetNodeByTitle($title, $reset = FALSE) {
-    if ($reset) {
-      entity_get_controller('node')->resetCache();
-    }
-    $nodes = entity_load_multiple_by_properties('node', array('title' => $title));
+    $nodes = node_load_multiple(array(), array('title' => $title), $reset);
     // Load the first node returned from the database.
     $returned_node = reset($nodes);
     return $returned_node;
@@ -665,18 +656,6 @@ abstract class WebTestBase extends TestBase {
       module_enable(array($this->profile), FALSE);
     }
 
-    // Create a new DrupalKernel for testing purposes, now that all required
-    // modules have been enabled. This also stores a new dependency injection
-    // container in drupal_container(). Drupal\simpletest\TestBase::tearDown()
-    // restores the original container.
-    // @see Drupal\Core\DrupalKernel::initializeContainer()
-    $this->kernel = new DrupalKernel('testing', FALSE);
-    // Booting the kernel is necessary to initialize the new DIC. While
-    // normally the kernel gets booted on demand in
-    // Symfony\Component\HttpKernel\handle(), this kernel needs manual booting
-    // as it is not used to handle a request.
-    $this->kernel->boot();
-
     // Reset/rebuild all data structures after enabling the modules.
     $this->resetAll();
 
@@ -787,10 +766,6 @@ abstract class WebTestBase extends TestBase {
     if (!$this->setupDatabasePrefix) {
       return FALSE;
     }
-    // Destroy the testing kernel.
-    if (isset($this->kernel)) {
-      $this->kernel->shutdown();
-    }
     // Remove all prefixed tables.
     $connection_info = Database::getConnectionInfo('default');
     $tables = db_find_tables($connection_info['default']['prefix']['default'] . '%');
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index d31a2e3..4138916 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -507,7 +507,7 @@ function simpletest_clean_temporary_directories() {
     foreach ($files as $file) {
       $path = 'public://simpletest/' . $file;
       if (is_dir($path) && (is_numeric($file) || strpos($file, 'config_simpletest') !== FALSE)) {
-        file_unmanaged_delete_recursive($path, array('Drupal\simpletest\TestBase', 'filePreDeleteCallback'));
+        file_unmanaged_delete_recursive($path);
         $count++;
       }
     }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Bundle/BundleTest.php b/core/modules/system/lib/Drupal/system/Tests/Bundle/BundleTest.php
index 3177687..4aeea00 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Bundle/BundleTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Bundle/BundleTest.php
@@ -33,7 +33,12 @@ class BundleTest extends WebTestBase {
    * Test that services provided by module bundles get registered to the DIC.
    */
   function testBundleRegistration() {
-    $this->assertTrue(drupal_container()->has('bundle_test_class'), t('The bundle_test_class service has been registered to the DIC'));
+    // The page callback at /bundle_test checks
+    // drupal_container()->has('bundle_test_class')
+    // and if this returns TRUE it outputs a message to this effect. We just
+    // need to check that the message appears on the page.
+    $this->drupalGet('bundle_test');
+    $this->assertText(t('The service with id bundle_test_class is available in the DIC'), t('The bundle_test_class service has been registered to the DIC'));
     // The event subscriber method in the test class calls drupal_set_message with
     // a message saying it has fired. This will fire on every page request so it
     // should show up on the front page.
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php b/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php
index 62033a9..e3cbd14 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php
@@ -31,7 +31,7 @@ class LoadTest extends FileHookTestBase {
    * Try to load a non-existent file by URI.
    */
   function testLoadMissingFilepath() {
-    $files = entity_load_multiple_by_properties('file', array('uri' => 'foobar://misc/druplicon.png'));
+    $files = file_load_multiple(array(), array('uri' => 'foobar://misc/druplicon.png'));
     $this->assertFalse(reset($files), t("Try to load a file that doesn't exist in the database fails."));
     $this->assertFileHooksCalled(array());
   }
@@ -40,7 +40,7 @@ class LoadTest extends FileHookTestBase {
    * Try to load a non-existent file by status.
    */
   function testLoadInvalidStatus() {
-    $files = entity_load_multiple_by_properties('file', array('status' => -99));
+    $files = file_load_multiple(array(), array('status' => -99));
     $this->assertFalse(reset($files), t("Trying to load a file with an invalid status fails."));
     $this->assertFileHooksCalled(array());
   }
@@ -72,7 +72,7 @@ class LoadTest extends FileHookTestBase {
 
     // Load by path.
     file_test_reset();
-    $by_path_files = entity_load_multiple_by_properties('file', array('uri' => $file->uri));
+    $by_path_files = file_load_multiple(array(), array('uri' => $file->uri));
     $this->assertFileHookCalled('load');
     $this->assertEqual(1, count($by_path_files), t('file_load_multiple() returned an array of the correct size.'));
     $by_path_file = reset($by_path_files);
@@ -81,7 +81,7 @@ class LoadTest extends FileHookTestBase {
 
     // Load by fid.
     file_test_reset();
-    $by_fid_files = file_load_multiple(array($file->fid));
+    $by_fid_files = file_load_multiple(array($file->fid), array());
     $this->assertFileHookCalled('load');
     $this->assertEqual(1, count($by_fid_files), t('file_load_multiple() returned an array of the correct size.'));
     $by_fid_file = reset($by_fid_files);
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/SaveUploadTest.php b/core/modules/system/lib/Drupal/system/Tests/File/SaveUploadTest.php
index f5391b7..2cccaec 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/SaveUploadTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/SaveUploadTest.php
@@ -113,6 +113,9 @@ class SaveUploadTest extends FileHookTestBase {
     $this->assertResponse(200, t('Received a 200 response for posted test file.'));
     $this->assertRaw(t('You WIN!'));
     $this->assertTrue(is_file('temporary://' . $dir . '/' . trim(drupal_basename($image3_realpath))));
+
+    // Check that file_load_multiple() with no arguments returns FALSE.
+    $this->assertFalse(file_load_multiple(), t('No files were loaded.'));
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php
deleted file mode 100644
index df103c8..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\Form\LanguageSelectElementTest.
- */
-
-namespace Drupal\system\Tests\Form;
-
-use Drupal\simpletest\WebTestBase;
-use Drupal\Core\Language\Language;
-
-/**
- * Functional tests for the language select form element.
- */
-class LanguageSelectElementTest extends WebTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('form_test', 'language');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Language select form element',
-      'description' => 'Checks that the language select form element prints and submits the right options.',
-      'group' => 'Form API',
-    );
-  }
-
-  /**
-   * Tests that the options printed by the language select element are correct.
-   */
-  function testLanguageSelectElementOptions() {
-    // Add some languages.
-    $language = (object) array(
-      'langcode' => 'aaa',
-      'name' => $this->randomName(),
-    );
-    language_save($language);
-
-    $language = (object) array(
-      'langcode' => 'bbb',
-      'name' => $this->randomName(),
-    );
-    language_save($language);
-
-    $this->drupalGet('form-test/language_select');
-    // Check that the language fields were rendered on the page.
-    $ids = array('edit-languages-all' => LANGUAGE_ALL,
-                 'edit-languages-configurable' => LANGUAGE_CONFIGURABLE,
-                 'edit-languages-locked' => LANGUAGE_LOCKED,
-                 'edit-languages-config-and-locked' => LANGUAGE_CONFIGURABLE | LANGUAGE_LOCKED);
-    foreach ($ids as $id => $flags) {
-      $this->assertField($id, t('The @id field was found on the page.', array('@id' => $id)));
-      $options = array();
-      foreach (language_list($flags) as $langcode => $language) {
-        $options[$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : $language->name;
-      }
-      $this->_testLanguageSelectElementOptions($id, $options);
-    }
-
-    // Test that the #options were not altered by #languages.
-    $this->assertField('edit-language-custom-options', t('The @id field was found on the page.', array('@id' => 'edit-language-custom-options')));
-    $this->_testLanguageSelectElementOptions('edit-language-custom-options', array('opt1' => 'First option', 'opt2' => 'Second option', 'opt3' => 'Third option'));
-  }
-
-  /**
-   * Tests the case when the language select elements should not be printed.
-   *
-   * This happens when the language module is disabled.
-   */
-  function testHiddenLanguageSelectElement() {
-    // Disable the language module, so that the language select field will not
-    // be rendered.
-    module_disable(array('language'));
-    $this->drupalGet('form-test/language_select');
-    // Check that the language fields were rendered on the page.
-    $ids = array('edit-languages-all', 'edit-languages-configurable', 'edit-languages-locked', 'edit-languages-config-and-locked');
-    foreach ($ids as $id) {
-      $this->assertNoField($id, t('The @id field was not found on the page.', array('@id' => $id)));
-    }
-
-    // Check that the submitted values were the default values of the language
-    // field elements.
-    $edit = array();
-    $this->drupalPost(NULL, $edit, t('Submit'));
-    $values = drupal_json_decode($this->drupalGetContent());
-    $this->assertEqual($values['languages_all'], 'xx');
-    $this->assertEqual($values['languages_configurable'], 'en');
-    $this->assertEqual($values['languages_locked'], LANGUAGE_NOT_SPECIFIED);
-    $this->assertEqual($values['languages_config_and_locked'], 'dummy_value');
-    $this->assertEqual($values['language_custom_options'], 'opt2');
-  }
-
-  /**
-   * Helper function to check the options of a language select form element.
-   *
-   * @param string $id
-   *   The id of the language select element to check.
-   *
-   * @param array $options
-   *   An array with options to compare with.
-   */
-  protected function _testLanguageSelectElementOptions($id, $options) {
-    // Check that the options in the language field are exactly the same,
-    // including the order, as the languages sent as a parameter.
-    $elements = $this->xpath("//select[@id='" . $id . "']");
-    $count = 0;
-    foreach ($elements[0]->option as $option) {
-      $count++;
-      $option_title = current($options);
-      $this->assertEqual((string) $option, $option_title);
-      next($options);
-    }
-    $this->assertEqual($count, count($options), t('The number of languages and the number of options shown by the language element are the same: @languages languages, @number options', array('@languages' => count($options), '@number' => $count)));
-  }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
index 1396fda..fedbafd 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
@@ -308,7 +308,7 @@ class BreadcrumbTest extends MenuTestBase {
     // the breadcrumb based on taxonomy term hierarchy.
     $parent_tid = 0;
     foreach ($tags as $name => $null) {
-      $terms = entity_load_multiple_by_properties('taxonomy_term', array('name' => $name));
+      $terms = taxonomy_term_load_multiple(FALSE, array('name' => $name));
       $term = reset($terms);
       $tags[$name]['term'] = $term;
       if ($parent_tid) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/FileStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/PhpStorage/FileStorageTest.php
deleted file mode 100644
index 6280cc4..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/FileStorageTest.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\PhpStorage\FileStorageTest.
- */
-
-namespace Drupal\system\Tests\PhpStorage;
-
-/**
- * Tests the simple file storage.
- */
-class FileStorageTest extends PhpStorageTestBase {
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Simple file storage',
-      'description' => 'Tests the FileStorage implementation.',
-      'group' => 'PHP Storage',
-    );
-  }
-
-  function setUp() {
-    global $conf;
-    parent::setUp();
-    $conf['php_storage']['simpletest'] = array(
-      'class' => 'Drupal\Component\PhpStorage\FileStorage',
-      'directory' => DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php',
-    );
-    $conf['php_storage']['readonly'] = array(
-      'class' => 'Drupal\Component\PhpStorage\FileReadOnlyStorage',
-      'directory' => DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php',
-      // Let this read from the bin where the other instance is writing.
-      'bin' => 'simpletest',
-    );
-  }
-
-  /**
-   * Tests basic load/save/delete operations.
-   */
-  function testCRUD() {
-    $php = drupal_php_storage('simpletest');
-    $this->assertIdentical(get_class($php), 'Drupal\Component\PhpStorage\FileStorage');
-    $this->assertCRUD($php);
-  }
-
-  /**
-   * Tests writing with one class and reading with another.
-   */
-  function testReadOnly() {
-    $php = drupal_php_storage('simpletest');
-    $name = $this->randomName() . '/' . $this->randomName() . '.php';
-
-    // Find a global that doesn't exist.
-    do {
-      $random = mt_rand(10000, 100000);
-    } while (isset($GLOBALS[$random]));
-
-    // Write out a PHP file and ensure it's successfully loaded.
-    $code = "<?php\n\$GLOBALS[$random] = TRUE;";
-    $success = $php->save($name, $code);
-    $this->assertIdentical($success, TRUE);
-    $php_read = drupal_php_storage('readonly');
-    $php_read->load($name);
-    $this->assertTrue($GLOBALS[$random]);
-
-    // If the file was successfully loaded, it must also exist, but ensure the
-    // exists() method returns that correctly.
-    $this->assertIdentical($php_read->exists($name), TRUE);
-    // Saving and deleting should always fail.
-    $this->assertFalse($php_read->save($name, $code));
-    $this->assertFalse($php_read->delete($name));
-  }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFastFileStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFastFileStorageTest.php
deleted file mode 100644
index 0c77f7f..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFastFileStorageTest.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\PhpStorage\MTimeProtectedFileStorageTest.
- */
-
-namespace Drupal\system\Tests\PhpStorage;
-
-/**
- * Tests the directory mtime based PHP loader implementation.
- */
-class MTimeProtectedFastFileStorageTest extends MTimeProtectedFileStorageTest {
-
-  /**
-   * The expected test results for the security test.
-   *
-   * The first iteration does not change the directory mtime so this class will
-   * include the hacked file on the first try but the second test will change
-   * the directory mtime and so on the second try the file will not be included.
-   */
-  protected $expected = array(TRUE, FALSE);
-
-  /**
-   * Test this class.
-   */
-  protected $storageClass = 'Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage';
-
-  public static function getInfo() {
-    return array(
-      'name' => 'MTime protected fast file storage',
-      'description' => 'Tests the MTimeProtectedFastFileStorage implementation.',
-      'group' => 'PHP Storage',
-    );
-  }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFileStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFileStorageTest.php
deleted file mode 100644
index a0649cb..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFileStorageTest.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\PhpStorage\MTimeProtectedFileStorageTest.
- */
-
-namespace Drupal\system\Tests\PhpStorage;
-
-/**
- * Tests the directory mtime based PHP loader implementation.
- */
-class MTimeProtectedFileStorageTest extends PhpStorageTestBase {
-
-  /**
-   * The expected test results for the security test.
-   *
-   * The default implementation protects against even the filemtime change so
-   * both iterations will return FALSE.
-   */
-  protected $expected = array(FALSE, FALSE);
-
-  protected $storageClass = 'Drupal\Component\PhpStorage\MTimeProtectedFileStorage';
-
-  public static function getInfo() {
-    return array(
-      'name' => 'MTime protected file storage',
-      'description' => 'Tests the MTimeProtectedFileStorage implementation.',
-      'group' => 'PHP Storage',
-    );
-  }
-
-  function setUp() {
-    global $conf;
-    parent::setUp();
-    $this->secret = $this->randomName();
-    $conf['php_storage']['simpletest'] = array(
-      'class' => $this->storageClass,
-      'directory' => DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php',
-      'secret' => $this->secret,
-    );
-  }
-
-  /**
-   * Tests basic load/save/delete operations.
-   */
-  function testCRUD() {
-    $php = drupal_php_storage('simpletest');
-    $this->assertIdentical(get_class($php), $this->storageClass);
-    $this->assertCRUD($php);
-  }
-
-  /**
-   * Tests the security of the MTimeProtectedFileStorage implementation.
-   *
-   * We test two attacks: first changes the file mtime, then the directory
-   * mtime too.
-   */
-  function testSecurity() {
-    $php = drupal_php_storage('simpletest');
-    $name = 'simpletest.php';
-    $php->save($name, '<?php');
-    $expected_root_directory = DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php/simpletest';
-    $expected_directory = $expected_root_directory . '/' . $name;
-    $directory_mtime = filemtime($expected_directory);
-    $expected_filename = $expected_directory . '/' . hash_hmac('sha256', $name, $this->secret . $directory_mtime) . '.php';
-
-    // Ensure the file exists and that it and the containing directory have
-    // minimal permissions. fileperms() can return high bits unrelated to
-    // permissions, so mask with 0777.
-    $this->assertTrue(file_exists($expected_filename));
-    $this->assertIdentical(fileperms($expected_filename) & 0777, 0400);
-    $this->assertIdentical(fileperms($expected_directory) & 0777, 0100);
-
-    // Ensure the root directory for the bin has a .htaccess file denying web
-    // access.
-    $this->assertIdentical(file_get_contents($expected_root_directory . '/.htaccess'), "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nDeny from all\nOptions None\nOptions +FollowSymLinks");
-
-    // Ensure that if the file is replaced with an untrusted one (due to another
-    // script's file upload vulnerability), it does not get loaded. Since mtime
-    // granularity is 1 second, we cannot prevent an attack that happens within
-    // a second of the initial save().
-    sleep(1);
-    for ($i = 0; $i < 2; $i++) {
-      drupal_static_reset('drupal_php_storage');
-      $php = drupal_php_storage('simpletest');
-      $GLOBALS['hacked'] = FALSE;
-      $untrusted_code = "<?php\n" . '$GLOBALS["hacked"] = TRUE;';
-      chmod($expected_directory, 0700);
-      chmod($expected_filename, 0700);
-      if ($i) {
-        // Now try to write the file in such a way that the directory mtime
-        // changes and invalidates the hash.
-        file_put_contents($expected_filename . '.tmp', $untrusted_code);
-        rename($expected_filename . '.tmp', $expected_filename);
-      }
-      else {
-        // On the first try do not change the directory mtime but the filemtime
-        // is now larger than the directory mtime.
-        file_put_contents($expected_filename, $untrusted_code);
-      }
-      chmod($expected_filename, 0400);
-      chmod($expected_directory, 0100);
-      $this->assertIdentical(file_get_contents($expected_filename), $untrusted_code);
-      $this->assertIdentical($php->exists($name), $this->expected[$i]);
-      $this->assertIdentical($php->load($name), $this->expected[$i]);
-      $this->assertIdentical($GLOBALS['hacked'], $this->expected[$i]);
-    }
-  }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/PhpStorageTestBase.php b/core/modules/system/lib/Drupal/system/Tests/PhpStorage/PhpStorageTestBase.php
deleted file mode 100644
index 9eb3b51..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/PhpStorageTestBase.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\system\Tests\PhpStorage\PhpStorageTestBase.
- */
-
-namespace Drupal\system\Tests\PhpStorage;
-
-use Drupal\simpletest\UnitTestBase;
-
-/**
- * Base test for PHP storage controllers.
- */
-abstract class PhpStorageTestBase extends UnitTestBase {
-
-  /**
-   * Assert that a PHP storage controller's load/save/delete operations work.
-   */
-  public function assertCRUD($php) {
-    $name = $this->randomName() . '/' . $this->randomName() . '.php';
-
-    // Find a global that doesn't exist.
-    do {
-      $random = mt_rand(10000, 100000);
-    } while (isset($GLOBALS[$random]));
-
-    // Write out a PHP file and ensure it's successfully loaded.
-    $code = "<?php\n\$GLOBALS[$random] = TRUE;";
-    $success = $php->save($name, $code);
-    $this->assertIdentical($success, TRUE);
-    $php->load($name);
-    $this->assertTrue($GLOBALS[$random]);
-
-    // If the file was successfully loaded, it must also exist, but ensure the
-    // exists() method returns that correctly.
-    $this->assertIdentical($php->exists($name), TRUE);
-
-    // Delete the file, and then ensure exists() returns FALSE.
-    $success = $php->delete($name);
-    $this->assertIdentical($success, TRUE);
-    $this->assertIdentical($php->exists($name), FALSE);
-
-    // Ensure delete() can be called on a non-existing file. It should return
-    // FALSE, but not trigger errors.
-    $this->assertIdentical($php->delete($name), FALSE);
-  }
-}
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index de7241f..3c434ae 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -504,10 +504,6 @@ function system_element_info() {
     '#theme' => 'select',
     '#theme_wrappers' => array('form_element'),
   );
-  $types['language_select'] = array(
-    '#input' => TRUE,
-    '#default_value' => LANGUAGE_NOT_SPECIFIED,
-  );
   $types['weight'] = array(
     '#input' => TRUE,
     '#delta' => 10,
@@ -2205,7 +2201,7 @@ function system_add_module_assets() {
  * Implements hook_custom_theme().
  */
 function system_custom_theme() {
-  if (drupal_container()->isScopeActive('request')) {
+  if (drupal_container()->has('request')) {
     $request = drupal_container()->get('request');
     $path = $request->attributes->get('system_path');
     if (user_access('view the administration theme') && path_is_admin($path)) {
diff --git a/core/modules/system/tests/modules/bundle_test/bundle_test.module b/core/modules/system/tests/modules/bundle_test/bundle_test.module
index b3d9bbc..5f30b8f 100644
--- a/core/modules/system/tests/modules/bundle_test/bundle_test.module
+++ b/core/modules/system/tests/modules/bundle_test/bundle_test.module
@@ -1 +1,26 @@
 <?php
+
+/**
+ * Implements hook_menu().
+ */
+function bundle_test_menu() {
+  $items['bundle_test'] = array(
+    'type' => MENU_CALLBACK,
+    'title' => t('Bundle test callback'),
+    'page callback' => 'bundle_test_callback',
+    'access callback' => TRUE,
+  );
+  return $items;
+}
+
+/**
+ * Simple callback for testing that the bundle_test_class service exists in the
+ * DIC.
+ */
+function bundle_test_callback() {
+  if (drupal_container()->has('bundle_test_class')) {
+    return t('The service with id bundle_test_class is available in the DIC');
+  }
+  return t('Service not found');
+}
+
diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
index dea57f7..44fc0eb 100644
--- a/core/modules/system/tests/modules/form_test/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -133,12 +133,6 @@ function form_test_menu() {
     'page arguments' => array('form_test_select'),
     'access callback' => TRUE,
   );
-  $items['form-test/language_select'] = array(
-    'title' => t('Language Select'),
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('form_test_language_select'),
-    'access callback' => TRUE,
-  );
   $items['form-test/placeholder-text'] = array(
     'title' => 'Placeholder',
     'page callback' => 'drupal_get_form',
@@ -1230,42 +1224,6 @@ function form_test_select($form, &$form_state) {
 }
 
 /**
- * Builds a form to test the language select form element.
- */
-function form_test_language_select() {
-  $form['#submit'] = array('_form_test_submit_values_json');
-
-  $form['languages_all'] = array(
-    '#type' => 'language_select',
-    '#languages' => LANGUAGE_ALL,
-    '#default_value' => 'xx',
-  );
-  $form['languages_configurable'] = array(
-    '#type' => 'language_select',
-    '#languages' => LANGUAGE_CONFIGURABLE,
-    '#default_value' => 'en',
-  );
-  $form['languages_locked'] = array(
-    '#type' => 'language_select',
-    '#languages' => LANGUAGE_LOCKED,
-  );
-  $form['languages_config_and_locked'] = array(
-    '#type' => 'language_select',
-    '#languages' => LANGUAGE_CONFIGURABLE | LANGUAGE_LOCKED,
-    '#default_value' => 'dummy_value',
-  );
-  $form['language_custom_options'] = array(
-    '#type' => 'language_select',
-    '#languages' => LANGUAGE_CONFIGURABLE | LANGUAGE_LOCKED,
-    '#options' => array('opt1' => 'First option', 'opt2' => 'Second option', 'opt3' => 'Third option'),
-    '#default_value' => 'opt2',
-  );
-
-  $form['submit'] = array('#type' => 'submit', '#value' => 'Submit');
-  return $form;
-}
-
-/**
  * Builds a form to test #type 'number' and 'range' validation.
  *
  * @param $element
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
index dfa1c3f..f8c2592 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
@@ -42,13 +42,6 @@ class TermFormController extends EntityFormController {
       '#weight' => 0,
     );
 
-    $form['langcode'] = array(
-      '#type' => 'language_select',
-      '#title' => t('Language'),
-      '#languages' => LANGUAGE_ALL,
-      '#default_value' => $term->langcode,
-    );
-
     $form['vocabulary_machine_name'] = array(
       '#type' => 'value',
       '#value' => isset($term->vocabulary_machine_name) ? $term->vocabulary_machine_name : $vocabulary->name,
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
index 961ebf0..442e203 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
@@ -43,11 +43,20 @@ class TermStorageController extends DatabaseStorageController {
   /**
    * Overrides Drupal\entity\DatabaseStorageController::buildQuery().
    */
-  protected function buildQuery($ids, $revision_id = FALSE) {
-    $query = parent::buildQuery($ids, $revision_id);
+  protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
+    $query = parent::buildQuery($ids, $conditions, $revision_id);
     $query->addTag('translatable');
     $query->addTag('term_access');
-
+    // When name is passed as a condition use LIKE.
+    if (isset($conditions['name'])) {
+      $query_conditions = &$query->conditions();
+      foreach ($query_conditions as $key => $condition) {
+        if (is_array($condition) && $condition['field'] == 'base.name') {
+          $query_conditions[$key]['operator'] = 'LIKE';
+          $query_conditions[$key]['value'] = db_like($query_conditions[$key]['value']);
+        }
+      }
+    }
     // Add the machine name field from the {taxonomy_vocabulary} table.
     $query->innerJoin('taxonomy_vocabulary', 'v', 'base.vid = v.vid');
     $query->addField('v', 'machine_name', 'vocabulary_machine_name');
@@ -55,14 +64,18 @@ class TermStorageController extends DatabaseStorageController {
   }
 
   /**
-   * Overrides Drupal\entity\DatabaseStorageController::buildPropertyQuery().
+   * Overrides Drupal\entity\DatabaseStorageController::cacheGet().
    */
-  protected function buildPropertyQuery(\Drupal\entity\EntityFieldQuery $entity_query, array $values) {
-    if (isset($values['name'])) {
-      $entity_query->propertyCondition('name', $values['name'], 'LIKE');
-      unset($values['name']);
+  protected function cacheGet($ids, $conditions = array()) {
+    $terms = parent::cacheGet($ids, $conditions);
+    // Name matching is case insensitive, note that with some collations
+    // LOWER() and drupal_strtolower() may return different results.
+    foreach ($terms as $term) {
+      if (isset($conditions['name']) && drupal_strtolower($conditions['name'] != drupal_strtolower($term->name))) {
+        unset($terms[$term->tid]);
+      }
     }
-    parent::buildPropertyQuery($entity_query, $values);
+    return $terms;
   }
 
   /**
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php
index 657e9b4..6f4e296 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php
@@ -41,7 +41,7 @@ class LoadMultipleTest extends TaxonomyTestBase {
       $this->createTerm($vocabulary);
     }
     // Load the terms from the vocabulary.
-    $terms = entity_load_multiple_by_properties('taxonomy_term', array('vid' => $vocabulary->vid));
+    $terms = taxonomy_term_load_multiple(FALSE, array('vid' => $vocabulary->vid));
     $count = count($terms);
     $this->assertEqual($count, 5, format_string('Correct number of terms were loaded. !count terms.', array('!count' => $count)));
 
@@ -50,20 +50,24 @@ class LoadMultipleTest extends TaxonomyTestBase {
     $this->assertEqual($count, count($terms2), 'Five terms were loaded by tid.');
     $this->assertEqual($terms, $terms2, 'Both arrays contain the same terms.');
 
+    // Load the terms by tid, with a condition on vid.
+    $terms3 = taxonomy_term_load_multiple(array_keys($terms2), array('vid' => $vocabulary->vid));
+    $this->assertEqual($terms2, $terms3, 'Same terms found when limiting load to vocabulary.');
+
     // Remove one term from the array, then delete it.
-    $deleted = array_shift($terms2);
+    $deleted = array_shift($terms3);
     taxonomy_term_delete($deleted->tid);
     $deleted_term = taxonomy_term_load($deleted->tid);
     $this->assertFalse($deleted_term);
 
     // Load terms from the vocabulary by vid.
-    $terms3 = entity_load_multiple_by_properties('taxonomy_term', array('vid' => $vocabulary->vid));
-    $this->assertEqual(count($terms3), 4, 'Correct number of terms were loaded.');
-    $this->assertFalse(isset($terms3[$deleted->tid]));
+    $terms4 = taxonomy_term_load_multiple(FALSE, array('vid' => $vocabulary->vid));
+    $this->assertEqual(count($terms4), 4, 'Correct number of terms were loaded.');
+    $this->assertFalse(isset($terms4[$deleted->tid]));
 
     // Create a single term and load it by name.
     $term = $this->createTerm($vocabulary);
-    $loaded_terms = entity_load_multiple_by_properties('taxonomy_term', array('name' => $term->name));
+    $loaded_terms = taxonomy_term_load_multiple(array(), array('name' => $term->name));
     $this->assertEqual(count($loaded_terms), 1, 'One term was loaded.');
     $loaded_term = reset($loaded_terms);
     $this->assertEqual($term->tid, $loaded_term->tid, 'Term loaded by name successfully.');
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php
deleted file mode 100644
index 75bcbce..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\taxonomy\Tests\TermLanguageTest.
- */
-
-namespace Drupal\taxonomy\Tests;
-
-/**
- * Tests for the language feature on taxonomy terms.
- */
-class TermLanguageTest extends TaxonomyTestBase {
-
-  public static $modules = array('language');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Taxonomy term language',
-      'description' => 'Tests the language functionality for the taxonomy terms.',
-      'group' => 'Taxonomy',
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    // Create an administrative user.
-    $this->admin_user = $this->drupalCreateUser(array('administer taxonomy'));
-    $this->drupalLogin($this->admin_user);
-
-    // Create a vocabulary to which the terms will be assigned.
-    $this->vocabulary = $this->createVocabulary();
-  }
-
-  function testTermLanguage() {
-    // Add first some custom languages.
-    $language = (object) array(
-      'langcode' => 'aa',
-      'name' => $this->randomName(),
-    );
-    language_save($language);
-
-    $language = (object) array(
-      'langcode' => 'bb',
-      'name' => $this->randomName(),
-    );
-    language_save($language);
-
-    // Add a term.
-    $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/add');
-    // Check that we have the language selector.
-    $this->assertField('edit-langcode', t('The language selector field was found on the page'));
-    // Submit the term.
-    $edit = array(
-      'name' => $this->randomName(),
-      'langcode' => 'aa',
-    );
-    $this->drupalPost(NULL, $edit, t('Save'));
-    $terms = taxonomy_term_load_multiple_by_name($edit['name']);
-    $term = reset($terms);
-    $this->assertEqual($term->langcode, $edit['langcode']);
-
-    // Check if on the edit page the language is correct.
-    $this->drupalGet('taxonomy/term/' . $term->tid . '/edit');
-    $this->assertOptionSelected('edit-langcode', $edit['langcode'], t('The term language was correctly selected.'));
-
-    // Change the language of the term.
-    $edit['langcode'] = 'bb';
-    $this->drupalPost('taxonomy/term/' . $term->tid . '/edit', $edit, t('Save'));
-
-    // Check again that on the edit page the language is correct.
-    $this->drupalGet('taxonomy/term/' . $term->tid . '/edit');
-    $this->assertOptionSelected('edit-langcode', $edit['langcode'], t('The term language was correctly selected.'));
-  }
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermUnitTest.php
index 22f9dcb..303771c 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermUnitTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermUnitTest.php
@@ -25,7 +25,7 @@ class TermUnitTest extends TaxonomyTestBase {
     $valid_term = $this->createTerm($vocabulary);
     // Delete a valid term.
     taxonomy_term_delete($valid_term->tid);
-    $terms = entity_load_multiple_by_properties('taxonomy_term', array('vid' => $vocabulary->vid));
+    $terms = taxonomy_term_load_multiple(array(), array('vid' => $vocabulary->vid));
     $this->assertTrue(empty($terms), 'Vocabulary is empty after deletion');
 
     // Delete an invalid term. Should not throw any notices.
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyLanguageTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyLanguageTest.php
deleted file mode 100644
index 41dfa69..0000000
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyLanguageTest.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\taxonomy\Tests\VocabularyLanguageTest.
- */
-
-namespace Drupal\taxonomy\Tests;
-
-/**
- * Tests for the language feature on vocabularies.
- */
-class VocabularyLanguageTest extends TaxonomyTestBase {
-
-  public static $modules = array('language');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Vocabulary language',
-      'description' => 'Tests the language functionality for vocabularies.',
-      'group' => 'Taxonomy',
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    // Create an administrative user.
-    $this->admin_user = $this->drupalCreateUser(array('administer taxonomy'));
-    $this->drupalLogin($this->admin_user);
-  }
-
-  function testVocabularyLanguage() {
-    // Add first some custom languages.
-    $language = (object) array(
-      'langcode' => 'aa',
-      'name' => $this->randomName(),
-    );
-    language_save($language);
-
-    $language = (object) array(
-      'langcode' => 'bb',
-      'name' => $this->randomName(),
-    );
-    language_save($language);
-
-    $this->drupalGet('admin/structure/taxonomy/add');
-    // Check that we have the language selector available.
-    $this->assertField('edit-langcode', t('The language selector field was found on the page'));
-
-    // Create the vocabulary.
-    $machine_name = drupal_strtolower($this->randomName());
-    $edit['name'] = $this->randomName();
-    $edit['description'] = $this->randomName();
-    $edit['langcode'] = 'aa';
-    $edit['machine_name'] = $machine_name;
-    $this->drupalPost(NULL, $edit, t('Save'));
-
-    // Check the language on the edit page.
-    $this->drupalGet('admin/structure/taxonomy/' . $machine_name . '/edit');
-    $this->assertOptionSelected('edit-langcode', $edit['langcode'], t('The vocabulary language was correctly selected.'));
-
-    // Change the language and save again.
-    $edit['langcode'] = 'bb';
-    $this->drupalPost(NULL, $edit, t('Save'));
-
-    // Check again the language on the edit page.
-    $this->drupalGet('admin/structure/taxonomy/' . $machine_name . '/edit');
-    $this->assertOptionSelected('edit-langcode', $edit['langcode'], t('The vocabulary language was correctly selected.'));
-  }
-}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
index 6197fdb..daed3f7 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
@@ -85,7 +85,7 @@ class VocabularyTest extends TaxonomyTestBase {
       $this->createVocabulary();
     }
     // Get all vocabularies and change their weights.
-    $vocabularies = taxonomy_vocabulary_load_multiple();
+    $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
     $edit = array();
     foreach ($vocabularies as $key => $vocabulary) {
       $vocabulary->weight = -$vocabulary->weight;
@@ -96,7 +96,7 @@ class VocabularyTest extends TaxonomyTestBase {
     $this->drupalPost('admin/structure/taxonomy', $edit, t('Save'));
 
     // Load the vocabularies from the database.
-    $new_vocabularies = taxonomy_vocabulary_load_multiple();
+    $new_vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
 
     // Check that the weights are saved in the database correctly.
     foreach ($vocabularies as $key => $vocabulary) {
@@ -109,12 +109,12 @@ class VocabularyTest extends TaxonomyTestBase {
    */
   function testTaxonomyAdminNoVocabularies() {
     // Delete all vocabularies.
-    $vocabularies = taxonomy_vocabulary_load_multiple();
+    $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
     foreach ($vocabularies as $key => $vocabulary) {
       taxonomy_vocabulary_delete($key);
     }
     // Confirm that no vocabularies are found in the database.
-    $this->assertFalse(taxonomy_vocabulary_load_multiple(), 'No vocabularies found in the database.');
+    $this->assertFalse(taxonomy_vocabulary_load_multiple(FALSE), 'No vocabularies found in the database.');
     $this->drupalGet('admin/structure/taxonomy');
     // Check the default message for no vocabularies.
     $this->assertText(t('No vocabularies available.'), 'No vocabularies were found.');
@@ -133,7 +133,7 @@ class VocabularyTest extends TaxonomyTestBase {
     $this->assertText(t('Created new vocabulary'), 'New vocabulary was created.');
 
     // Check the created vocabulary.
-    $vocabularies = taxonomy_vocabulary_load_multiple();
+    $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
     $vid = $vocabularies[count($vocabularies) - 1]->vid;
     entity_get_controller('taxonomy_vocabulary')->resetCache();
     $vocabulary = taxonomy_vocabulary_load($vid);
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php
index 9080ef2..9ac781a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php
@@ -41,7 +41,7 @@ class VocabularyUnitTest extends TaxonomyTestBase {
    */
   function testTaxonomyVocabularyLoadReturnFalse() {
     // Load a vocabulary that doesn't exist.
-    $vocabularies = taxonomy_vocabulary_load_multiple();
+    $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
     $vid = count($vocabularies) + 1;
     $vocabulary = taxonomy_vocabulary_load($vid);
     // This should not return an object because no such vocabulary exists.
@@ -61,7 +61,7 @@ class VocabularyUnitTest extends TaxonomyTestBase {
    */
   function testTaxonomyVocabularyDeleteWithTerms() {
     // Delete any existing vocabularies.
-    foreach (taxonomy_vocabulary_load_multiple() as $vocabulary) {
+    foreach (taxonomy_vocabulary_load_multiple(FALSE) as $vocabulary) {
       taxonomy_vocabulary_delete($vocabulary->vid);
     }
 
@@ -111,7 +111,7 @@ class VocabularyUnitTest extends TaxonomyTestBase {
 
     // Delete the vocabulary.
     taxonomy_vocabulary_delete($this->vocabulary->vid);
-    $vocabularies = taxonomy_vocabulary_load_multiple();
+    $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
     $this->assertTrue(!isset($vocabularies[$this->vocabulary->vid]), 'The vocabulary was deleted.');
   }
 
@@ -121,7 +121,7 @@ class VocabularyUnitTest extends TaxonomyTestBase {
   function testTaxonomyVocabularyLoadMultiple() {
 
     // Delete any existing vocabularies.
-    foreach (taxonomy_vocabulary_load_multiple() as $vocabulary) {
+    foreach (taxonomy_vocabulary_load_multiple(FALSE) as $vocabulary) {
       taxonomy_vocabulary_delete($vocabulary->vid);
     }
 
@@ -141,9 +141,9 @@ class VocabularyUnitTest extends TaxonomyTestBase {
     $names = taxonomy_vocabulary_get_names();
     $this->assertEqual($names[$vocabulary1->machine_name]->name, $vocabulary1->name, 'Vocabulary 1 name found.');
 
-    // Fetch all of the vocabularies using taxonomy_vocabulary_load_multiple().
+    // Fetch all of the vocabularies using taxonomy_vocabulary_load_multiple(FALSE).
     // Confirm that the vocabularies are ordered by weight.
-    $vocabularies = taxonomy_vocabulary_load_multiple();
+    $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
     $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary1->vid, 'Vocabulary was found in the vocabularies array.');
     $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary2->vid, 'Vocabulary was found in the vocabularies array.');
     $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary3->vid, 'Vocabulary was found in the vocabularies array.');
@@ -156,7 +156,7 @@ class VocabularyUnitTest extends TaxonomyTestBase {
     $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary1->vid, 'Vocabulary loaded successfully by ID.');
 
     // Fetch vocabulary 1 by name.
-    $vocabulary = current(entity_load_multiple_by_properties('taxonomy_vocabulary', array('name' => $vocabulary1->name)));
+    $vocabulary = current(taxonomy_vocabulary_load_multiple(array(), array('name' => $vocabulary1->name)));
     $this->assertEqual($vocabulary->vid, $vocabulary1->vid, 'Vocabulary loaded successfully by name.');
 
     // Fetch vocabulary 1 by name and ID.
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php
index 667041e..1a1f882 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php
@@ -44,12 +44,6 @@ class VocabularyFormController extends EntityFormController {
       '#title' => t('Description'),
       '#default_value' => $vocabulary->description,
     );
-    $form['langcode'] = array(
-      '#type' => 'language_select',
-      '#title' => t('Language'),
-      '#languages' => LANGUAGE_ALL,
-      '#default_value' => $vocabulary->langcode,
-    );
     // Set the hierarchy to "multiple parents" by default. This simplifies the
     // vocabulary form and standardizes the term form.
     $form['hierarchy'] = array(
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php
index 8f4ef5b..a5ad5c3 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php
@@ -18,8 +18,8 @@ class VocabularyStorageController extends DatabaseStorageController {
   /**
    * Overrides Drupal\entity\DatabaseStorageController::buildQuery().
    */
-  protected function buildQuery($ids, $revision_id = FALSE) {
-    $query = parent::buildQuery($ids, $revision_id);
+  protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
+    $query = parent::buildQuery($ids, $conditions, $revision_id);
     $query->addTag('translatable');
     $query->orderBy('base.weight');
     $query->orderBy('base.name');
diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc
index 163c0e7..0065bbd 100644
--- a/core/modules/taxonomy/taxonomy.admin.inc
+++ b/core/modules/taxonomy/taxonomy.admin.inc
@@ -16,7 +16,7 @@ use Drupal\taxonomy\Vocabulary;
  * @see theme_taxonomy_overview_vocabularies()
  */
 function taxonomy_overview_vocabularies($form) {
-  $vocabularies = taxonomy_vocabulary_load_multiple();
+  $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
   $form['#tree'] = TRUE;
   foreach ($vocabularies as $vocabulary) {
     $form[$vocabulary->vid]['#vocabulary'] = $vocabulary;
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index a772e02..a5bdcf7 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -89,7 +89,7 @@ function taxonomy_permission() {
       'title' => t('Administer vocabularies and terms'),
     ),
   );
-  foreach (taxonomy_vocabulary_load_multiple() as $vocabulary) {
+  foreach (taxonomy_vocabulary_load_multiple(FALSE) as $vocabulary) {
     $permissions += array(
       'edit terms in ' . $vocabulary->vid => array(
         'title' => t('Edit terms in %vocabulary', array('%vocabulary' => $vocabulary->name)),
@@ -587,10 +587,6 @@ function taxonomy_term_view(Term $term, $view_mode = 'full', $langcode = NULL) {
     $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode;
   }
 
-  // Allow modules to change the view mode.
-  $context = array('langcode' => $langcode);
-  drupal_alter('entity_view_mode', $view_mode, $term, $context);
-
   field_attach_prepare_view('taxonomy_term', array($term->tid => $term), $view_mode, $langcode);
   entity_prepare_view('taxonomy_term', array($term->tid => $term), $langcode);
 
@@ -629,7 +625,7 @@ function template_preprocess_taxonomy_term(&$variables) {
   $variables['term'] = $variables['elements']['#term'];
   $term = $variables['term'];
 
-  $uri = $term->uri();
+  $uri = entity_uri('taxonomy_term', $term);
   $variables['term_url']  = url($uri['path'], $uri['options']);
   $variables['term_name'] = check_plain($term->name);
   $variables['page']      = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term);
@@ -924,18 +920,18 @@ function taxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $load_entities
  *   An array of matching term objects.
  */
 function taxonomy_term_load_multiple_by_name($name, $vocabulary = NULL) {
-  $values = array('name' => trim($name));
+  $conditions = array('name' => trim($name));
   if (isset($vocabulary)) {
     $vocabularies = taxonomy_vocabulary_get_names();
     if (isset($vocabularies[$vocabulary])){
-      $values['vid'] = $vocabularies[$vocabulary]->vid;
+      $conditions['vid'] = $vocabularies[$vocabulary]->vid;
     }
     else {
       // Return an empty array when filtering by a non-existing vocabulary.
       return array();
     }
   }
-  return entity_load_multiple_by_properties('taxonomy_term', $values);
+  return taxonomy_term_load_multiple(array(), $conditions);
 }
 
 /**
@@ -948,15 +944,23 @@ function taxonomy_term_load_multiple_by_name($name, $vocabulary = NULL) {
  * @see entity_load_multiple()
  * @see Drupal\entity\EntityFieldQuery
  *
- * @param array $tids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ * @param array|bool $tids
+ *   An array of taxonomy term IDs, or FALSE to load all terms.
+ * @param array $conditions
+ *   (deprecated) An associative array of conditions on the {taxonomy_term}
+ *   table, where the keys are the database fields and the values are the
+ *   values those fields must have. Instead, it is preferable to use
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  *
  * @return array
  *   An array of taxonomy term entities, indexed by tid. When no results are
  *   found, an empty array is returned.
+ *
+ * @todo Remove $conditions in Drupal 8.
  */
-function taxonomy_term_load_multiple(array $tids = NULL) {
-  return entity_load_multiple('taxonomy_term', $tids);
+function taxonomy_term_load_multiple($tids = array(), array $conditions = array()) {
+  return entity_load_multiple('taxonomy_term', $tids, $conditions);
 }
 
 /**
@@ -968,14 +972,16 @@ function taxonomy_term_load_multiple(array $tids = NULL) {
  *
  * @see entity_load_multiple()
  *
- * @param array $vids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ * @param array|bool $vids
+ *  An array of taxonomy vocabulary IDs, or FALSE to load all vocabularies.
+ * @param array $conditions
+ *  An array of conditions to add to the query.
  *
  * @return array
  *  An array of vocabulary objects, indexed by vid.
  */
-function taxonomy_vocabulary_load_multiple(array $vids = NULL) {
-  return entity_load_multiple('taxonomy_vocabulary', $vids);
+function taxonomy_vocabulary_load_multiple($vids = array(), array $conditions = array()) {
+  return entity_load_multiple('taxonomy_vocabulary', $vids, $conditions);
 }
 
 /**
@@ -1007,7 +1013,7 @@ function taxonomy_vocabulary_load($vid) {
  * @see taxonomy_vocabulary_load()
  */
 function taxonomy_vocabulary_machine_name_load($name) {
-  $result = entity_load_multiple_by_properties('taxonomy_vocabulary', array('machine_name' => $name));
+  $result = entity_load_multiple('taxonomy_vocabulary', FALSE, array('machine_name' => $name));
   return reset($result);
 }
 
@@ -1234,7 +1240,7 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,
         }
         else {
           $term = $item['taxonomy_term'];
-          $uri = $term->uri();
+          $uri = entity_uri('taxonomy_term', $term);
           $element[$delta] = array(
             '#type' => 'link',
             '#title' => $term->label(),
@@ -1408,7 +1414,7 @@ function taxonomy_autocomplete_validate($element, &$form_state) {
     foreach ($typed_terms as $typed_term) {
       // See if the term exists in the chosen vocabulary and return the tid;
       // otherwise, create a new 'autocreate' term for insert/update.
-      if ($possibilities = entity_load_multiple_by_properties('taxonomy_term', array('name' => trim($typed_term), 'vid' => array_keys($vocabularies)))) {
+      if ($possibilities = taxonomy_term_load_multiple(array(), array('name' => trim($typed_term), 'vid' => array_keys($vocabularies)))) {
         $term = array_pop($possibilities);
       }
       else {
@@ -1438,7 +1444,7 @@ function taxonomy_field_widget_error($element, $error, $form, &$form_state) {
  */
 function taxonomy_field_settings_form($field, $instance, $has_data) {
   // Get proper values for 'allowed_values_function', which is a core setting.
-  $vocabularies = taxonomy_vocabulary_load_multiple();
+  $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
   $options = array();
   foreach ($vocabularies as $vocabulary) {
     $options[$vocabulary->machine_name] = $vocabulary->name;
diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc
index c7847b3..24d7bc8 100644
--- a/core/modules/taxonomy/taxonomy.tokens.inc
+++ b/core/modules/taxonomy/taxonomy.tokens.inc
@@ -110,7 +110,7 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
           break;
 
         case 'url':
-          $uri = $term->uri();
+          $uri = entity_uri('taxonomy_term', $term);
           $replacements[$original] = url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE)));
           break;
 
diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php
index 31ca843..31acf0d 100644
--- a/core/modules/user/lib/Drupal/user/AccountFormController.php
+++ b/core/modules/user/lib/Drupal/user/AccountFormController.php
@@ -203,26 +203,45 @@ abstract class AccountFormController extends EntityFormController {
 
     $form['#validate'][] = 'user_validate_picture';
 
-    $user_preferred_language = $register ? $language_interface : user_preferred_language($account);
-
-    // Is default the interface language?
-    include_once DRUPAL_ROOT . '/core/includes/language.inc';
-    $interface_language_is_default = language_negotiation_method_get_first(LANGUAGE_TYPE_INTERFACE) != LANGUAGE_NEGOTIATION_DEFAULT;
-    $form['language'] = array(
-      '#type' => language_multilingual() ? 'fieldset' : 'container',
-      '#title' => t('Language settings'),
-      // Display language selector when either creating a user on the admin
-      // interface or editing a user account.
-      '#access' => !$register || user_access('administer users'),
-    );
+    if (module_exists('language') && language_multilingual()) {
+      $languages = language_list();
 
-    $form['language']['preferred_langcode'] = array(
-      '#type' => 'language_select',
-      '#title' => t('Language'),
-      '#languages' => LANGUAGE_CONFIGURABLE,
-      '#default_value' => $user_preferred_language->langcode,
-      '#description' => $interface_language_is_default ? t("This account's preferred language for e-mails and site presentation.") : t("This account's preferred language for e-mails."),
-    );
+      // If the user is being created, we set the user language to the page language.
+      $user_preferred_language = $register ? $language_interface : user_preferred_language($account);
+
+      $names = array();
+      foreach ($languages as $langcode => $item) {
+        $names[$langcode] = $item->name;
+      }
+
+      // Is default the interface language?
+      $interface_language_is_default = language_negotiation_method_get_first(LANGUAGE_TYPE_INTERFACE) != LANGUAGE_NEGOTIATION_DEFAULT;
+      $form['language'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Language settings'),
+        // Display language selector when either creating a user on the admin
+        // interface or editing a user account.
+        '#access' => !$register || user_access('administer users'),
+      );
+
+      $form['language']['preferred_langcode'] = array(
+        '#type' => (count($names) <= 5 ? 'radios' : 'select'),
+        '#title' => t('Language'),
+        '#default_value' => $user_preferred_language->langcode,
+        '#options' => $names,
+        '#description' => $interface_language_is_default ? t("This account's preferred language for e-mails and site presentation.") : t("This account's preferred language for e-mails."),
+      );
+    }
+    else {
+      $form['language'] = array(
+        '#type' => 'container',
+      );
+
+      $form['language']['preferred_langcode'] = array(
+        '#type' => 'value',
+        '#value' => language_default()->langcode,
+      );
+    }
 
     // User entities contain both a langcode property (for identifying the
     // language of the entity data) and a preferred_langcode property (see
diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php
index 84134b7..9c88aec 100644
--- a/core/modules/user/lib/Drupal/user/RegisterFormController.php
+++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php
@@ -116,7 +116,7 @@ class RegisterFormController extends AccountFormController {
     $account->password = $pass;
 
     // New administrative account without notification.
-    $uri = $account->uri();
+    $uri = entity_uri('user', $account);
     if ($admin && !$notify) {
       drupal_set_message(t('Created a new user account for <a href="@url">%name</a>. No e-mail has been sent.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name)));
     }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
index 68c9e94..ca6c423 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
@@ -58,7 +58,7 @@ class UserCancelTest extends WebTestBase {
     $this->assertTrue($account->status == 1, t('User account was not canceled.'));
 
     // Confirm user's content has not been altered.
-    $test_node = node_load($node->nid, TRUE);
+    $test_node = node_load($node->nid, NULL, TRUE);
     $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), t('Node of the user has not been altered.'));
   }
 
@@ -135,11 +135,11 @@ class UserCancelTest extends WebTestBase {
     $bogus_timestamp = $timestamp - 86400 - 60;
     $this->drupalGet("user/$account->uid/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
     $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), t('Expired cancel account request rejected.'));
-    $account = user_load($account->uid, TRUE);
-    $this->assertTrue($account->status, t('User account was not canceled.'));
+    $accounts = user_load_multiple(array($account->uid), array('status' => 1));
+    $this->assertTrue(reset($accounts), t('User account was not canceled.'));
 
     // Confirm user's content has not been altered.
-    $test_node = node_load($node->nid, TRUE);
+    $test_node = node_load($node->nid, NULL, TRUE);
     $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), t('Node of the user has not been altered.'));
   }
 
@@ -213,9 +213,9 @@ class UserCancelTest extends WebTestBase {
     $this->assertTrue($account->status == 0, t('User has been blocked.'));
 
     // Confirm user's content has been unpublished.
-    $test_node = node_load($node->nid, TRUE);
+    $test_node = node_load($node->nid, NULL, TRUE);
     $this->assertTrue($test_node->status == 0, t('Node of the user has been unpublished.'));
-    $test_node = node_revision_load($node->vid);
+    $test_node = node_load($node->nid, $node->vid, TRUE);
     $this->assertTrue($test_node->status == 0, t('Node revision of the user has been unpublished.'));
 
     // Confirm user is logged out.
@@ -262,11 +262,11 @@ class UserCancelTest extends WebTestBase {
     $this->assertFalse(user_load($account->uid, TRUE), t('User is not found in the database.'));
 
     // Confirm that user's content has been attributed to anonymous user.
-    $test_node = node_load($node->nid, TRUE);
+    $test_node = node_load($node->nid, NULL, TRUE);
     $this->assertTrue(($test_node->uid == 0 && $test_node->status == 1), t('Node of the user has been attributed to anonymous user.'));
-    $test_node = node_revision_load($revision, TRUE);
+    $test_node = node_load($revision_node->nid, $revision, TRUE);
     $this->assertTrue(($test_node->revision_uid == 0 && $test_node->status == 1), t('Node revision of the user has been attributed to anonymous user.'));
-    $test_node = node_load($revision_node->nid, TRUE);
+    $test_node = node_load($revision_node->nid, NULL, TRUE);
     $this->assertTrue(($test_node->uid != 0 && $test_node->status == 1), t("Current revision of the user's node was not attributed to anonymous user."));
 
     // Confirm that user is logged out.
@@ -297,7 +297,7 @@ class UserCancelTest extends WebTestBase {
     $this->drupalPost('comment/reply/' . $node->nid, $edit, t('Preview'));
     $this->drupalPost(NULL, array(), t('Save'));
     $this->assertText(t('Your comment has been posted.'));
-    $comments = entity_load_multiple_by_properties('comment', array('subject' => $edit['subject']));
+    $comments = comment_load_multiple(FALSE, array('subject' => $edit['subject']));
     $comment = reset($comments);
     $this->assertTrue($comment->cid, t('Comment found.'));
 
@@ -326,9 +326,9 @@ class UserCancelTest extends WebTestBase {
     $this->assertFalse(user_load($account->uid, TRUE), t('User is not found in the database.'));
 
     // Confirm that user's content has been deleted.
-    $this->assertFalse(node_load($node->nid, TRUE), t('Node of the user has been deleted.'));
-    $this->assertFalse(node_revision_load($revision), t('Node revision of the user has been deleted.'));
-    $this->assertTrue(node_load($revision_node->nid, TRUE), t("Current revision of the user's node was not deleted."));
+    $this->assertFalse(node_load($node->nid, NULL, TRUE), t('Node of the user has been deleted.'));
+    $this->assertFalse(node_load($node->nid, $revision, TRUE), t('Node revision of the user has been deleted.'));
+    $this->assertTrue(node_load($revision_node->nid, NULL, TRUE), t("Current revision of the user's node was not deleted."));
     $this->assertFalse(comment_load($comment->cid), t('Comment of the user has been deleted.'));
 
     // Confirm that user is logged out.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
index a631620..6d74849 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
@@ -52,7 +52,7 @@ class UserEntityCallbacksTest extends WebTestBase {
    * Test URI callback.
    */
   function testUriCallback() {
-    $uri = $this->account->uri();
+    $uri = entity_uri('user', $this->account);
     $this->assertEqual('user/' . $this->account->uid, $uri['path'], t('Correct user URI.'));
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
index 37ffef7..b90d26d 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
@@ -62,7 +62,7 @@ class UserLanguageCreationTest extends WebTestBase {
     // Check if the language selector is available on admin/people/create and
     // set to the currently active language.
     $this->drupalGet($langcode . '/admin/people/create');
-    $this->assertOptionSelected("edit-preferred-langcode", $langcode, t('Global language set in the language selector.'));
+    $this->assertFieldChecked("edit-preferred-langcode-$langcode", t('Global language set in the language selector.'));
 
     // Create a user with the admin/people/create form and check if the correct
     // language is set.
@@ -104,7 +104,7 @@ class UserLanguageCreationTest extends WebTestBase {
 
     $this->drupalLogin($admin_user);
     $this->drupalGet($user_edit);
-    $this->assertOptionSelected("edit-preferred-langcode", $langcode, t('Language selector is accessible and correct language is selected.'));
+    $this->assertFieldChecked("edit-preferred-langcode-$langcode", t('Language selector is accessible and correct language is selected.'));
 
     // Set pass_raw so we can login the new user.
     $user->pass_raw = $this->randomName(10);
@@ -117,6 +117,6 @@ class UserLanguageCreationTest extends WebTestBase {
 
     $this->drupalLogin($user);
     $this->drupalGet($user_edit);
-    $this->assertOptionSelected("edit-preferred-langcode", $langcode, t('Language selector is accessible and correct language is selected.'));
+    $this->assertFieldChecked("edit-preferred-langcode-$langcode", t('Language selector is accessible and correct language is selected.'));
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
index f0155b6..08dc9f5 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
@@ -71,7 +71,8 @@ class UserLanguageTest extends WebTestBase {
     // Ensure form was submitted successfully.
     $this->assertText(t('The changes have been saved.'), t('Changes were saved.'));
     // Check if language was changed.
-    $this->assertOptionSelected('edit-preferred-langcode', $langcode, t('Default language successfully updated.'));
+    $elements = $this->xpath('//input[@id=:id]', array(':id' => 'edit-preferred-langcode-' . $langcode));
+    $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), t('Default language successfully updated.'));
 
     $this->drupalLogout();
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
index fb13f52..bfa21d0 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
@@ -42,7 +42,7 @@ class UserRegistrationTest extends WebTestBase {
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
     $this->drupalPost('user/register', $edit, t('Create new account'));
     $this->assertText(t('A welcome message with further instructions has been sent to your e-mail address.'), t('User registered successfully.'));
-    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
+    $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
     $new_user = reset($accounts);
     $this->assertTrue($new_user->status, t('New account is active after registration.'));
 
@@ -52,8 +52,7 @@ class UserRegistrationTest extends WebTestBase {
     $edit['name'] = $name = $this->randomName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
     $this->drupalPost('user/register', $edit, t('Create new account'));
-    entity_get_controller('user')->resetCache();
-    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
+    $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
     $new_user = reset($accounts);
     $this->assertFalse($new_user->status, t('New account is blocked until approved by an administrator.'));
   }
@@ -78,8 +77,7 @@ class UserRegistrationTest extends WebTestBase {
     $edit['pass[pass1]'] = $new_pass = $this->randomName();
     $edit['pass[pass2]'] = $new_pass;
     $this->drupalPost('user/register', $edit, t('Create new account'));
-    entity_get_controller('user')->resetCache();
-    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
+    $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
     $new_user = reset($accounts);
     $this->assertText(t('Registration successful. You are now logged in.'), t('Users are logged in after registering.'));
     $this->drupalLogout();
@@ -103,7 +101,7 @@ class UserRegistrationTest extends WebTestBase {
     $this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), t('User cannot login yet.'));
 
     // Activate the new account.
-    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
+    $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
     $new_user = reset($accounts);
     $admin_user = $this->drupalCreateUser(array('administer users'));
     $this->drupalLogin($admin_user);
@@ -167,7 +165,7 @@ class UserRegistrationTest extends WebTestBase {
     $this->drupalPost(NULL, $edit, t('Create new account'));
 
     // Check user fields.
-    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
+    $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
     $new_user = reset($accounts);
     $this->assertEqual($new_user->name, $name, t('Username matches.'));
     $this->assertEqual($new_user->mail, $mail, t('E-mail address matches.'));
@@ -231,7 +229,7 @@ class UserRegistrationTest extends WebTestBase {
     $edit['test_user_field[und][0][value]'] = $value;
     $this->drupalPost(NULL, $edit, t('Create new account'));
     // Check user fields.
-    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
+    $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
     $new_user = reset($accounts);
     $this->assertEqual($new_user->test_user_field[LANGUAGE_NOT_SPECIFIED][0]['value'], $value, t('The field value was correclty saved.'));
 
@@ -259,7 +257,7 @@ class UserRegistrationTest extends WebTestBase {
       $edit['mail'] = $mail = $edit['name'] . '@example.com';
       $this->drupalPost(NULL, $edit, t('Create new account'));
       // Check user fields.
-      $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
+      $accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
       $new_user = reset($accounts);
       $this->assertEqual($new_user->test_user_field[LANGUAGE_NOT_SPECIFIED][0]['value'], $value, t('@js : The field value was correclty saved.', array('@js' => $js)));
       $this->assertEqual($new_user->test_user_field[LANGUAGE_NOT_SPECIFIED][1]['value'], $value + 1, t('@js : The field value was correclty saved.', array('@js' => $js)));
diff --git a/core/modules/user/lib/Drupal/user/UserStorageController.php b/core/modules/user/lib/Drupal/user/UserStorageController.php
index 3e2ac68..bde430c 100644
--- a/core/modules/user/lib/Drupal/user/UserStorageController.php
+++ b/core/modules/user/lib/Drupal/user/UserStorageController.php
@@ -22,7 +22,7 @@ class UserStorageController extends DatabaseStorageController {
   /**
    * Overrides Drupal\entity\DatabaseStorageController::attachLoad().
    */
-  function attachLoad(&$queried_users, $load_revision = FALSE) {
+  function attachLoad(&$queried_users, $revision_id = FALSE) {
     // Build an array of user picture IDs so that these can be fetched later.
     $picture_fids = array();
     foreach ($queried_users as $key => $record) {
@@ -56,7 +56,7 @@ class UserStorageController extends DatabaseStorageController {
     }
     // Call the default attachLoad() method. This will add fields and call
     // hook_user_load().
-    parent::attachLoad($queried_users, $load_revision);
+    parent::attachLoad($queried_users, $revision_id);
   }
 
   /**
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 44cb266..535a579 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -2,7 +2,6 @@
 
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\File\File;
-use Drupal\entity\EntityInterface;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 
 /**
@@ -278,8 +277,14 @@ function user_external_load($authname) {
  * from the database. Users are loaded into memory and will not require
  * database access if loaded again during the same page request.
  *
- * @param array $uids
- *   (optional) An array of entity IDs. If omitted, all entities are loaded.
+ * @param array|bool $uids
+ *   An array of user IDs, or FALSE to load all users.
+ * @param array $conditions
+ *   (deprecated) An associative array of conditions on the {users}
+ *   table, where the keys are the database fields and the values are the
+ *   values those fields must have. Instead, it is preferable to use
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  * @param bool $reset
  *   A boolean indicating that the internal cache should be reset. Use this if
  *   loading a user object which has been altered during the page request.
@@ -292,9 +297,11 @@ function user_external_load($authname) {
  * @see user_load_by_mail()
  * @see user_load_by_name()
  * @see Drupal\entity\EntityFieldQuery
+ *
+ * @todo Remove $conditions in Drupal 8.
  */
-function user_load_multiple(array $uids = NULL, $reset = FALSE) {
-  return entity_load_multiple('user', $uids, $reset);
+function user_load_multiple($uids = array(), array $conditions = array(), $reset = FALSE) {
+  return entity_load_multiple('user', $uids, $conditions, $reset);
 }
 
 /**
@@ -337,7 +344,7 @@ function user_load($uid, $reset = FALSE) {
  * @see user_load_multiple()
  */
 function user_load_by_mail($mail) {
-  $users = entity_load_multiple_by_properties('user', array('mail' => $mail));
+  $users = entity_load_multiple('user', FALSE, array('mail' => $mail));
   return reset($users);
 }
 
@@ -353,7 +360,7 @@ function user_load_by_mail($mail) {
  * @see user_load_multiple()
  */
 function user_load_by_name($name) {
-  $users = entity_load_multiple_by_properties('user', array('name' => $name));
+  $users = entity_load_multiple('user', FALSE, array('name' => $name));
   return reset($users);
 }
 
@@ -1997,7 +2004,7 @@ function user_delete($uid) {
  */
 function user_delete_multiple(array $uids) {
   if (!empty($uids)) {
-    $accounts = user_load_multiple($uids);
+    $accounts = user_load_multiple($uids, array());
 
     $transaction = db_transaction();
     try {
@@ -2115,10 +2122,6 @@ function user_build_content($account, $view_mode = 'full', $langcode = NULL) {
   // Remove previously built content, if exists.
   $account->content = array();
 
-  // Allow modules to change the view mode.
-  $context = array('langcode' => $langcode);
-  drupal_alter('entity_view_mode', $view_mode, $account, $context);
-
   // Build fields content.
   field_attach_prepare_view('user', array($account->uid => $account), $view_mode, $langcode);
   entity_prepare_view('user', array($account->uid => $account), $langcode);
@@ -3288,8 +3291,8 @@ function user_rdf_mapping() {
 /**
  * Implements hook_file_download_access().
  */
-function user_file_download_access($field, EntityInterface $entity, File $file) {
-  if ($entity->entityType() == 'user') {
+function user_file_download_access($field, $entity_type, $entity) {
+  if ($entity_type == 'user') {
     return user_view_access($entity);
   }
 }
diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc
index e1f7088..9121c44 100644
--- a/core/modules/user/user.pages.inc
+++ b/core/modules/user/user.pages.inc
@@ -61,11 +61,11 @@ function user_pass() {
 function user_pass_validate($form, &$form_state) {
   $name = trim($form_state['values']['name']);
   // Try to load by email.
-  $users = entity_load_multiple_by_properties('user', array('mail' => $name, 'status' => '1'));
+  $users = user_load_multiple(array(), array('mail' => $name, 'status' => '1'));
   $account = reset($users);
   if (!$account) {
     // No success, try to load by name.
-    $users = entity_load_multiple_by_properties('user', array('name' => $name, 'status' => '1'));
+    $users = user_load_multiple(array(), array('name' => $name, 'status' => '1'));
     $account = reset($users);
   }
   if (isset($account->uid)) {
@@ -122,9 +122,9 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
     // 86400 seconds.
     $timeout = variable_get('user_password_reset_timeout', 86400);
     $current = REQUEST_TIME;
-    $account = user_load($uid);
-    // Verify that the user exists and is active.
-    if ($timestamp <= $current && $account && $account->status) {
+    // Some redundant checks for extra security ?
+    $users = user_load_multiple(array($uid), array('status' => '1'));
+    if ($timestamp <= $current && $account = reset($users)) {
       // No time out for first time login.
       if ($account->login && $current - $timestamp > $timeout) {
         drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));
diff --git a/core/themes/seven/page.tpl.php b/core/themes/seven/page.tpl.php
index ef24b9e..c04a187 100644
--- a/core/themes/seven/page.tpl.php
+++ b/core/themes/seven/page.tpl.php
@@ -28,7 +28,7 @@
 
   <div id="page">
     <?php if ($secondary_local_tasks): ?>
-      <div class="tabs-secondary clearfix"><?php print render($secondary_local_tasks); ?></div>
+      <div class="tabs-secondary clearfix"><ul class="tabs secondary"><?php print render($secondary_local_tasks); ?></ul></div>
     <?php endif; ?>
 
     <div id="content" class="clearfix">
diff --git a/core/themes/seven/style-rtl.css b/core/themes/seven/style-rtl.css
index 7070720..e98c968 100644
--- a/core/themes/seven/style-rtl.css
+++ b/core/themes/seven/style-rtl.css
@@ -35,6 +35,19 @@ ol {
   padding: 20px 20px 0 20px;
 }
 
+#branding div.block {
+  float: left;
+  padding-left: 0;
+  padding-right: 10px;
+}
+#branding div.block form div.form-item {
+  float: right;
+}
+#branding div.block form input.form-text {
+  margin-left: 10px;
+  margin-right: 0;
+}
+
 /**
  * Help.
  */
@@ -76,6 +89,9 @@ ul.primary {
   margin-left: 40px;
   margin-right: 40px;
 }
+#secondary-links ul.links li {
+  padding: 0 0 10px 10px;
+}
 ul.links li,
 ul.inline li {
   padding-left: 1em;
diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css
index f1e7321..8d7164b 100644
--- a/core/themes/seven/style.css
+++ b/core/themes/seven/style.css
@@ -187,6 +187,30 @@ pre {
   font-size: 0.846em;
   padding-bottom: 5px;
 }
+#branding div.block {
+  position: relative;
+  float: right; /* LTR */
+  width: 240px;
+  padding-left: 10px; /* LTR */
+  background: #333;
+}
+#branding div.block form label {
+  display: none;
+}
+#branding div.block form div.form-item {
+  float: left; /* LTR */
+  border: 0;
+  margin: 0;
+  padding: 0;
+}
+#branding div.block form input.form-text {
+  width: 140px;
+  margin-right: 10px; /* LTR */
+}
+#branding div.block form input.form-submit {
+  text-align: center;
+  width: 80px;
+}
 
 /**
  * Help.
@@ -324,6 +348,24 @@ ul.secondary li.active a.active {
   position: relative;
   color: #333;
 }
+#secondary-links ul.links li {
+  padding: 0 10px 10px 0; /* LTR */
+}
+#secondary-links ul.links li a {
+  font-size: 0.923em;
+  background: #777;
+  color: #fff;
+  text-align: center;
+  padding: 5px;
+  height: 55px;
+  width: 80px;
+  overflow: hidden;
+  -moz-border-radius: 5px;
+  border-radius: 5px;
+}
+#secondary-links ul.links li a:hover {
+  background: #999;
+}
 ul.links li,
 ul.inline li {
   padding-right: 1em; /* LTR */
@@ -331,6 +373,10 @@ ul.inline li {
 ul.inline li {
   display: inline;
 }
+#secondary-links ul.links li.active-trail a,
+#secondary-links ul.links li a.active {
+  background: #333;
+}
 ul.admin-list li {
   position: relative;
   padding-left: 30px; /* LTR */
