diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 33cf9e20c09b1028d2cc3f8551a6a74d4d08d30f..32642d01f323086ea03ac93418f8b626251ceafe 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,4 +1,27 @@
 
+Drupal 7.8, 2011-08-31
+----------------------
+- Fixed critical upgrade path issue with multilingual sites, leading to lost
+  content.
+- Numerous fixes to upgrade path, preventing fatal errors due to incorrect
+  dependencies.
+- Fixed issue with saving files on hosts with open_basedir restrictions.
+- Fixed Update manger error when used with Overlay.
+- Fixed RTL support in Seven administration theme and Overlay.
+- Fixes to nested transaction support.
+- Introduced performance pattern to reduce Drupal core's RAM usage.
+- Added support for HTML 5 tags to filter_xss_admin().
+- Added exception handling to cron.
+- Added new hook hook_field_widget_form_alter() for contribtued modules.
+- element_validate_*() functions now available to contrib.
+- Added new maintainers for several subsystems.
+- Numerous testing system improvements.
+- Numerous markup and CSS fixes.
+- Numerous poll module fixes.
+- Numerous notice/warning fixes.
+- Numerous documentation fixes.
+- Numerous token fixes.
+
 Drupal 7.7, 2011-07-27
 ----------------------
 - Fixed VERSION string.
diff --git a/MAINTAINERS.txt b/MAINTAINERS.txt
index 97f2d631ce4a1590f4b34d0592b3d2171ee66727..09d7cb78aecb141934cf98ae2d11b570c69dd8f1 100644
--- a/MAINTAINERS.txt
+++ b/MAINTAINERS.txt
@@ -54,7 +54,7 @@ Database system
     - Károly Négyesi 'chx' <http://drupal.org/user/9446>
 
 Database update system
-- ?
+- Károly Négyesi 'chx' <http://drupal.org/user/9446>
 
 Entity system
 - Nathaniel Catchpole 'catch' <http://drupal.org/user/35733>
@@ -190,7 +190,7 @@ Filter module
 - Daniel F. Kudwien 'sun' <http://drupal.org/user/54136>
 
 Forum module
-- ?
+- Lee Rowlands 'larowlan' <http://drupal.org/user/395439>
 
 Help module
 - ?
@@ -237,6 +237,7 @@ Search module
 
 Shortcut module
 - David Rothstein 'David_Rothstein' <http://drupal.org/user/124982>
+- Kristof De Jaeger 'swentel' <http://drupal.org/user/107403>
 
 Simpletest module
 - Jimmy Berry 'boombatower' <http://drupal.org/user/214218>
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 33ce1d40e005fb21486cd31cc2eb087b485f7c97..4c69ee94d51d00b898549fcf2ce67f936a51717f 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -8,7 +8,7 @@
 /**
  * The current system version.
  */
-define('VERSION', '7.7');
+define('VERSION', '7.8');
 
 /**
  * Core API compatibility.
@@ -225,6 +225,195 @@ define('REGISTRY_WRITE_LOOKUP_CACHE', 2);
  */
 define('DRUPAL_PHP_FUNCTION_PATTERN', '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*');
 
+/**
+ * Provides a caching wrapper to be used in place of large array structures.
+ *
+ * This class should be extended by systems that need to cache large amounts
+ * of data and have it represented as an array to calling functions. These
+ * arrays can become very large, so ArrayAccess is used to allow different
+ * strategies to be used for caching internally (lazy loading, building caches
+ * over time etc.). This can dramatically reduce the amount of data that needs
+ * to be loaded from cache backends on each request, and memory usage from
+ * static caches of that same data.
+ *
+ * Note that array_* functions do not work with ArrayAccess. Systems using
+ * DrupalCacheArray should use this only internally. If providing API functions
+ * that return the full array, this can be cached separately or returned
+ * directly. However since DrupalCacheArray holds partial content by design, it
+ * should be a normal PHP array or otherwise contain the full structure.
+ *
+ * Note also that due to limitations in PHP prior to 5.3.4, it is impossible to
+ * write directly to the contents of nested arrays contained in this object.
+ * Only writes to the top-level array elements are possible. So if you
+ * previously had set $object['foo'] = array(1, 2, 'bar' => 'baz'), but later
+ * want to change the value of 'bar' from 'baz' to 'foobar', you cannot do so
+ * a targeted write like $object['foo']['bar'] = 'foobar'. Instead, you must
+ * overwrite the entire top-level 'foo' array with the entire set of new
+ * values: $object['foo'] = array(1, 2, 'bar' => 'foobar'). Due to this same
+ * limitation, attempts to create references to any contained data, nested or
+ * otherwise, will fail silently. So $var = &$object['foo'] will not throw an
+ * error, and $var will be populated with the contents of $object['foo'], but
+ * that data will be passed by value, not reference. For more information on
+ * the PHP limitation, see the note in the official PHP documentation at·
+ * http://php.net/manual/en/arrayaccess.offsetget.php on
+ * ArrayAccess::offsetGet().
+ *
+ * By default, the class accounts for caches where calling functions might
+ * request keys in the array that won't exist even after a cache rebuild. This
+ * prevents situations where a cache rebuild would be triggered over and over
+ * due to a 'missing' item. These cases are stored internally as a value of
+ * NULL. This means that the offsetGet() and offsetExists() methods
+ * must be overridden if caching an array where the top level values can
+ * legitimately be NULL, and where $object->offsetExists() needs to correctly
+ * return (equivalent to array_key_exists() vs. isset()). This should not
+ * be necessary in the majority of cases.
+ *
+ * Classes extending this class must override at least the
+ * resolveCacheMiss() method to have a working implementation.
+ *
+ * offsetSet() is not overridden by this class by default. In practice this
+ * means that assigning an offset via arrayAccess will only apply while the
+ * object is in scope and will not be written back to the persistent cache.
+ * This follows a similar pattern to static vs. persistent caching in
+ * procedural code. Extending classes may wish to alter this behaviour, for
+ * example by overriding offsetSet() and adding an automatic call to persist().
+ *
+ * @see SchemaCache
+ */
+abstract class DrupalCacheArray implements ArrayAccess {
+
+  /**
+   * A cid to pass to cache_set() and cache_get().
+   */
+  private $cid;
+
+  /**
+   * A bin to pass to cache_set() and cache_get().
+   */
+  private $bin;
+
+  /**
+   * An array of keys to add to the cache at the end of the request.
+   */
+  protected $keysToPersist = array();
+
+  /**
+   * Storage for the data itself.
+   */
+  protected $storage = array();
+
+  /**
+   * Constructor.
+   *
+   * @param $cid
+   *   The cid for the array being cached.
+   * @param $bin
+   *   The bin to cache the array.
+   */
+  public function __construct($cid, $bin) {
+    $this->cid = $cid;
+    $this->bin = $bin;
+
+    if ($cached = cache_get($this->cid, $this->bin)) {
+     $this->storage = $cached->data;
+    }
+  }
+
+  public function offsetExists($offset) {
+    return $this->offsetGet($offset) !== NULL;
+  }
+
+  public function offsetGet($offset) {
+    if (isset($this->storage[$offset]) || array_key_exists($offset, $this->storage)) {
+      return $this->storage[$offset];
+    }
+    else {
+      return $this->resolveCacheMiss($offset);
+    }
+  }
+
+  public function offsetSet($offset, $value) {
+    $this->storage[$offset] = $value;
+  }
+
+  public function offsetUnset($offset) {
+    unset($this->storage[$offset]);
+  }
+
+  /**
+   * Flags an offset value to be written to the persistent cache.
+   *
+   * If a value is assigned to a cache object with offsetSet(), by default it
+   * will not be written to the persistent cache unless it is flagged with this
+   * method. This allows items to be cached for the duration of a request,
+   * without necessarily writing back to the persistent cache at the end.
+   *
+   * @param $offset
+   *   The array offset that was request.
+   * @param $persist
+   *   Optional boolean to specify whether the offset should be persisted or
+   *   not, defaults to TRUE. When called with $persist = FALSE the offset will
+   *   be unflagged so that it will not written at the end of the request.
+   */
+  protected function persist($offset, $persist = TRUE) {
+    $this->keysToPersist[$offset] = $persist;
+  }
+
+  /**
+   * Resolves a cache miss.
+   *
+   * When an offset is not found in the object, this is treated as a cache
+   * miss. This method allows classes implementing the interface to look up
+   * the actual value and allow it to be cached.
+   *
+   * @param $offset
+   *   The offset that was requested.
+   *
+   * @return
+   *   The value of the offset, or NULL if no value was found.
+   */
+  abstract protected function resolveCacheMiss($offset);
+
+  /**
+   * Immediately write a value to the persistent cache.
+   *
+   * @param $cid
+   *   The cache ID.
+   * @param $bin
+   *   The cache bin.
+   * @param $data
+   *   The data to write to the persistent cache.
+   * @param $lock
+   *   Whether to acquire a lock before writing to cache.
+   */
+  protected function set($cid, $data, $bin, $lock = TRUE) {
+    // Lock cache writes to help avoid stampedes.
+    // To implement locking for cache misses, override __construct().
+    $lock_name = $cid . ':' . $bin;
+    if (!$lock || lock_acquire($lock_name)) {
+      if ($cached = cache_get($cid, $bin)) {
+        $data = $cached->data + $data;
+      }
+      cache_set($cid, $data, $bin);
+      if ($lock) {
+        lock_release($lock_name);
+      }
+    }
+  }
+
+  public function __destruct() {
+    $data = array();
+    foreach ($this->keysToPersist as $offset => $persist) {
+      if ($persist) {
+        $data[$offset] = $this->storage[$offset];
+      }
+    }
+    if (!empty($data)) {
+      $this->set($this->cid, $data, $this->bin);
+    }
+  }
+}
+
 /**
  * Start the timer with the specified name. If you start and stop the same
  * timer multiple times, the measured intervals will be accumulated.
@@ -2556,6 +2745,55 @@ function ip_address() {
  *   If true, the schema will be rebuilt instead of retrieved from the cache.
  */
 function drupal_get_schema($table = NULL, $rebuild = FALSE) {
+  static $schema;
+
+  if ($rebuild || !isset($table)) {
+    $schema = drupal_get_complete_schema($rebuild);
+  }
+  elseif (!isset($schema)) {
+    $schema = new SchemaCache();
+  }
+
+  if (!isset($table)) {
+    return $schema;
+  }
+  if (isset($schema[$table])) {
+    return $schema[$table];
+  }
+  else {
+    return FALSE;
+  }
+}
+
+/**
+ * Extends DrupalCacheArray to allow for dynamic building of the schema cache.
+ */
+class SchemaCache extends DrupalCacheArray {
+
+  public function __construct() {
+    // Cache by request method.
+    parent::__construct('schema:runtime:' . $_SERVER['REQUEST_METHOD'] == 'GET', 'cache');
+  }
+
+  protected function resolveCacheMiss($offset) {
+    $complete_schema = drupal_get_complete_schema();
+    $value = isset($complete_schema[$offset]) ? $complete_schema[$offset] :  NULL;
+    $this->storage[$offset] = $value;
+    $this->persist($offset);
+    return $value;
+  }
+}
+
+/**
+ * Get the whole database schema.
+ *
+ * The returned schema will include any modifications made by any
+ * module that implements hook_schema_alter().
+ *
+ * @param $rebuild
+ *   If true, the schema will be rebuilt instead of retrieved from the cache.
+ */
+function drupal_get_complete_schema($rebuild = FALSE) {
   static $schema = array();
 
   if (empty($schema) || $rebuild) {
@@ -2597,18 +2835,13 @@ function drupal_get_schema($table = NULL, $rebuild = FALSE) {
       if (!empty($schema) && (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL)) {
         cache_set('schema', $schema);
       }
+      if ($rebuild) {
+        cache_clear_all('schema:', 'cache', TRUE);
+      }
     }
   }
 
-  if (!isset($table)) {
-    return $schema;
-  }
-  elseif (isset($schema[$table])) {
-    return $schema[$table];
-  }
-  else {
-    return FALSE;
-  }
+  return $schema;
 }
 
 /**
diff --git a/includes/common.inc b/includes/common.inc
index 7b0b9e7618d109e1aaea49a75151b2963f614e80..1846c5b8c36a2f16cadd16654ebe4a8d8727f3a3 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -89,7 +89,7 @@ define('JS_THEME', 100);
  * Error code indicating that the request made by drupal_http_request() exceeded
  * the specified timeout.
  */
-define('HTTP_REQUEST_TIMEOUT', 1);
+define('HTTP_REQUEST_TIMEOUT', -1);
 
 /**
  * Constants defining cache granularity for blocks and renderable arrays.
@@ -1296,7 +1296,7 @@ function check_url($uri) {
  * for scripts and styles.
  */
 function filter_xss_admin($string) {
-  return filter_xss($string, array('a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins', 'kbd', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'));
+  return filter_xss($string, array('a', 'abbr', 'acronym', 'address', 'article', 'aside', 'b', 'bdi', 'bdo', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'command', 'dd', 'del', 'details', 'dfn', 'div', 'dl', 'dt', 'em', 'figcaption', 'figure', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i', 'img', 'ins', 'kbd', 'li', 'mark', 'menu', 'meter', 'nav', 'ol', 'output', 'p', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'small', 'span', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'time', 'tr', 'tt', 'u', 'ul', 'var', 'wbr'));
 }
 
 /**
@@ -2748,13 +2748,14 @@ function drupal_add_html_head_link($attributes, $header = FALSE) {
  * @param $data
  *   (optional) The stylesheet data to be added, depending on what is passed
  *   through to the $options['type'] parameter:
- *   - 'file': The path to the CSS file relative to the base_path(), e.g.,
- *     "modules/devel/devel.css". Note that Modules should always prefix the
- *     names of their CSS files with the module name; for example,
- *     system-menus.css rather than simply menus.css. Themes can override
- *     module-supplied CSS files based on their filenames, and this prefixing
- *     helps prevent confusing name collisions for theme developers. See
- *     drupal_get_css() where the overrides are performed. Also, if the
+ *   - 'file': The path to the CSS file relative to the base_path(), or a
+ *     stream wrapper URI. For example: "modules/devel/devel.css" or
+ *     "public://generated_css/stylesheet_1.css". Note that Modules should
+ *     always prefix the names of their CSS files with the module name; for
+ *     example, system-menus.css rather than simply menus.css. Themes can
+ *     override module-supplied CSS files based on their filenames, and this
+ *     prefixing helps prevent confusing name collisions for theme developers.
+ *     See drupal_get_css() where the overrides are performed. Also, if the
  *     direction of the current language is right-to-left (Hebrew, Arabic,
  *     etc.), the function will also look for an RTL CSS file and append it to
  *     the list. The name of this file should have an '-rtl.css' suffix.  For
@@ -4422,6 +4423,8 @@ function drupal_process_attached($elements, $group = JS_DEFAULT, $dependency_che
  * The following states may be applied to an element:
  * - enabled
  * - disabled
+ * - required
+ * - optional
  * - visible
  * - invisible
  * - checked
@@ -4430,26 +4433,22 @@ function drupal_process_attached($elements, $group = JS_DEFAULT, $dependency_che
  * - collapsed
  *
  * The following states may be used in remote conditions:
- * - enabled
- * - disabled
- * - visible
- * - invisible
+ * - empty
+ * - filled
  * - checked
  * - unchecked
+ * - expanded
+ * - collapsed
  * - value
  *
- * The following states exist for both states and remote conditions, but are not
- * fully implemented and may not change anything on the element:
- * - required
- * - optional
+ * The following states exist for both elements and remote conditions, but are
+ * not fully implemented and may not change anything on the element:
  * - relevant
  * - irrelevant
  * - valid
  * - invalid
  * - touched
  * - untouched
- * - filled
- * - empty
  * - readwrite
  * - readonly
  *
@@ -5044,7 +5043,15 @@ function drupal_cron_run() {
     drupal_register_shutdown_function('drupal_cron_cleanup');
 
     // Iterate through the modules calling their cron handlers (if any):
-    module_invoke_all('cron');
+    foreach (module_implements('cron') as $module) {
+      // Do not let an exception thrown by one module disturb another.
+      try {
+        module_invoke($module, 'cron');
+      }
+      catch (Exception $e) {
+        watchdog_exception('cron', $e);
+      }
+    }
 
     // Record cron time
     variable_set('cron_last', REQUEST_TIME);
@@ -7141,7 +7148,7 @@ function drupal_flush_all_caches() {
 
   // Don't clear cache_form - in-progress form submissions may break.
   // Ordered so clearing the page cache will always be the last action.
-  $core = array('cache', 'cache_filter', 'cache_bootstrap', 'cache_page');
+  $core = array('cache', 'cache_path', 'cache_filter', 'cache_bootstrap', 'cache_page');
   $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
   foreach ($cache_tables as $table) {
     cache_clear_all('*', $table, TRUE);
@@ -7374,12 +7381,24 @@ function entity_info_cache_clear() {
  */
 function entity_extract_ids($entity_type, $entity) {
   $info = entity_get_info($entity_type);
+
   // Objects being created might not have id/vid yet.
   $id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL;
   $vid = ($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL;
-  // If no bundle key provided, then we assume a single bundle, named after the
-  // entity type.
-  $bundle = $info['entity keys']['bundle'] ? $entity->{$info['entity keys']['bundle']} : $entity_type;
+
+  if (!empty($info['entity keys']['bundle'])) {
+    // Explicitly fail for malformed entities missing the bundle property.
+    if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
+      throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' => $entity_type)));
+    }
+    $bundle = $entity->{$info['entity keys']['bundle']};
+  }
+  else {
+    // The entity type provides no bundle key: assume a single bundle, named
+    // after the entity type.
+    $bundle = $entity_type;
+  }
+
   return array($id, $vid, $bundle);
 }
 
diff --git a/includes/database/database.inc b/includes/database/database.inc
index e08f9074f396fbb7ca3bfdb2da9e0ab29ec7f854..610861429d1b0a102269dc1b3925ed71cfc293c4 100644
--- a/includes/database/database.inc
+++ b/includes/database/database.inc
@@ -1022,7 +1022,9 @@ abstract class DatabaseConnection extends PDO {
     }
 
     // We need to find the point we're rolling back to, all other savepoints
-    // before are no longer needed.
+    // before are no longer needed. If we rolled back other active savepoints,
+    // we need to throw an exception.
+    $rolled_back_other_active_savepoints = FALSE;
     while ($savepoint = array_pop($this->transactionLayers)) {
       if ($savepoint == $savepoint_name) {
         // If it is the last the transaction in the stack, then it is not a
@@ -1032,10 +1034,20 @@ abstract class DatabaseConnection extends PDO {
           break;
         }
         $this->query('ROLLBACK TO SAVEPOINT ' . $savepoint);
+        $this->popCommittableTransactions();
+        if ($rolled_back_other_active_savepoints) {
+          throw new DatabaseTransactionOutOfOrderException();
+        }
         return;
       }
+      else {
+        $rolled_back_other_active_savepoints = TRUE;
+      }
     }
     parent::rollBack();
+    if ($rolled_back_other_active_savepoints) {
+      throw new DatabaseTransactionOutOfOrderException();
+    }
   }
 
   /**
@@ -1084,15 +1096,28 @@ abstract class DatabaseConnection extends PDO {
     if (!$this->supportsTransactions()) {
       return;
     }
-    if (!$this->inTransaction()) {
+    if (!isset($this->transactionLayers[$name])) {
       throw new DatabaseTransactionNoActiveException();
     }
 
-    // Commit everything since SAVEPOINT $name.
-    while($savepoint = array_pop($this->transactionLayers)) {
-      if ($savepoint != $name) continue;
+    // Mark this layer as committable.
+    $this->transactionLayers[$name] = FALSE;
+    $this->popCommittableTransactions();
+  }
+
+  /**
+   * Internal function: commit all the transaction layers that can commit.
+   */
+  protected function popCommittableTransactions() {
+    // Commit all the committable layers.
+    foreach (array_reverse($this->transactionLayers) as $name => $active) {
+      // Stop once we found an active transaction.
+      if ($active) {
+        break;
+      }
 
       // If there are no more layers left then we should commit.
+      unset($this->transactionLayers[$name]);
       if (empty($this->transactionLayers)) {
         if (!parent::commit()) {
           throw new DatabaseTransactionCommitFailedException();
@@ -1100,7 +1125,6 @@ abstract class DatabaseConnection extends PDO {
       }
       else {
         $this->query('RELEASE SAVEPOINT ' . $name);
-        break;
       }
     }
   }
@@ -1744,6 +1768,11 @@ class DatabaseTransactionCommitFailedException extends Exception { }
  */
 class DatabaseTransactionExplicitCommitNotAllowedException extends Exception { }
 
+/**
+ * Exception thrown when a rollback() resulted in other active transactions being rolled-back.
+ */
+class DatabaseTransactionOutOfOrderException extends Exception { }
+
 /**
  * Exception thrown for merge queries that do not make semantic sense.
  *
@@ -1839,7 +1868,7 @@ class DatabaseTransaction {
 
   public function __destruct() {
     // If we rolled back then the transaction would have already been popped.
-    if ($this->connection->inTransaction() && !$this->rolledBack) {
+    if (!$this->rolledBack) {
       $this->connection->popTransaction($this->name);
     }
   }
diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc
index 157cbfa567ebd05f484caa7ea65fd51866099d5b..0d9158789bbadd196172444fd7b7fa8ed4b661ae 100644
--- a/includes/database/mysql/database.inc
+++ b/includes/database/mysql/database.inc
@@ -137,21 +137,16 @@ class DatabaseConnection_mysql extends DatabaseConnection {
   /**
    * Overridden to work around issues to MySQL not supporting transactional DDL.
    */
-  public function popTransaction($name) {
-    if (!$this->supportsTransactions()) {
-      return;
-    }
-    if (!$this->inTransaction()) {
-      throw new DatabaseTransactionNoActiveException();
-    }
-
-    // Commit everything since SAVEPOINT $name.
-    while ($savepoint = array_pop($this->transactionLayers)) {
-      if ($savepoint != $name) {
-        continue;
+  protected function popCommittableTransactions() {
+    // Commit all the committable layers.
+    foreach (array_reverse($this->transactionLayers) as $name => $active) {
+      // Stop once we found an active transaction.
+      if ($active) {
+        break;
       }
 
       // If there are no more layers left then we should commit.
+      unset($this->transactionLayers[$name]);
       if (empty($this->transactionLayers)) {
         if (!PDO::commit()) {
           throw new DatabaseTransactionCommitFailedException();
@@ -173,13 +168,12 @@ class DatabaseConnection_mysql extends DatabaseConnection {
           if ($e->errorInfo[1] == '1305') {
             // If one SAVEPOINT was released automatically, then all were.
             // Therefore, we keep just the topmost transaction.
-            $this->transactionLayers = array('drupal_transaction');
+            $this->transactionLayers = array('drupal_transaction' => 'drupal_transaction');
           }
           else {
             throw $e;
           }
         }
-        break;
       }
     }
   }
diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc
index 98b954ffdc029ee3e64de5eeb3ea6a20e430aa6b..39b4e9b6960c0476404c736bc4b45ea27424e938 100644
--- a/includes/database/pgsql/database.inc
+++ b/includes/database/pgsql/database.inc
@@ -145,10 +145,9 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
     if (!isset($specials)) {
       $specials = array(
         // In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE
-        // statements, we need to use ILIKE instead. Use backslash for escaping
-        // wildcard characters.
-        'LIKE' => array('operator' => 'ILIKE', 'postfix' => ' ESCAPE ' . $this->quote("\\")),
-        'NOT LIKE' => array('operator' => 'NOT ILIKE', 'postfix' => ' ESCAPE ' . $this->quote("\\")),
+        // statements, we need to use ILIKE instead.
+        'LIKE' => array('operator' => 'ILIKE'),
+        'NOT LIKE' => array('operator' => 'NOT ILIKE'),
       );
     }
 
diff --git a/includes/database/query.inc b/includes/database/query.inc
index 23b652f9b4b439114d677db0ddd5f0a75414814a..c7363f2381cd9a0d64da3f74d79d69aea9033d03 100644
--- a/includes/database/query.inc
+++ b/includes/database/query.inc
@@ -142,7 +142,15 @@ interface QueryConditionInterface {
    *   The query this condition belongs to. If not given, the current query is
    *   used.
    */
-  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder = NULL);
+  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder);
+
+  /**
+   * Check whether a condition has been previously compiled.
+   *
+   * @return
+   *   TRUE if the condition has been previously compiled.
+   */
+  public function compiled();
 }
 
 
@@ -238,13 +246,18 @@ interface QueryAlterableInterface {
  */
 interface QueryPlaceholderInterface {
 
+  /**
+   * Returns a unique identifier for this object.
+   */
+  public function uniqueIdentifier();
+
   /**
    * Returns the next placeholder ID for the query.
    *
    * @return
    *   The next available placeholder ID as an integer.
    */
-  function nextPlaceholder();
+  public function nextPlaceholder();
 }
 
 /**
@@ -283,6 +296,11 @@ abstract class Query implements QueryPlaceholderInterface {
    */
   protected $queryOptions;
 
+  /**
+   * A unique identifier for this query object.
+   */
+  protected $uniqueIdentifier;
+
   /**
    * The placeholder counter.
    */
@@ -304,6 +322,8 @@ abstract class Query implements QueryPlaceholderInterface {
    *   Array of query options.
    */
   public function __construct(DatabaseConnection $connection, $options) {
+    $this->uniqueIdentifier = uniqid('', TRUE);
+
     $this->connection = $connection;
     $this->connectionKey = $this->connection->getKey();
     $this->connectionTarget = $this->connection->getTarget();
@@ -321,12 +341,19 @@ abstract class Query implements QueryPlaceholderInterface {
   }
 
   /**
-  * Implements the magic __wakeup function to reconnect to the database.
+   * Implements the magic __wakeup function to reconnect to the database.
    */
   public function __wakeup() {
     $this->connection = Database::getConnection($this->connectionTarget, $this->connectionKey);
   }
 
+  /**
+   * Implements the magic __clone function.
+   */
+  public function __clone() {
+    $this->uniqueIdentifier = uniqid('', TRUE);
+  }
+
   /**
    * Runs the query against the database.
    */
@@ -343,6 +370,13 @@ abstract class Query implements QueryPlaceholderInterface {
    */
   abstract public function __toString();
 
+  /**
+   * Returns a unique identifier for this object.
+   */
+  public function uniqueIdentifier() {
+    return $this->uniqueIdentifier;
+  }
+
   /**
    * Gets the next placeholder value for this query object.
    *
@@ -790,8 +824,15 @@ class DeleteQuery extends Query implements QueryConditionInterface {
   /**
    * Implements QueryConditionInterface::compile().
    */
-  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder = NULL) {
-    return $this->condition->compile($connection, isset($queryPlaceholder) ? $queryPlaceholder : $this);
+  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder) {
+    return $this->condition->compile($connection, $queryPlaceholder);
+  }
+
+  /**
+   * Implements QueryConditionInterface::compiled().
+   */
+  public function compiled() {
+    return $this->condition->compiled();
   }
 
   /**
@@ -864,8 +905,15 @@ class TruncateQuery extends Query {
   /**
    * Implements QueryConditionInterface::compile().
    */
-  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder = NULL) {
-    return $this->condition->compile($connection, isset($queryPlaceholder) ? $queryPlaceholder : $this);
+  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder) {
+    return $this->condition->compile($connection, $queryPlaceholder);
+  }
+
+  /**
+   * Implements QueryConditionInterface::compiled().
+   */
+  public function compiled() {
+    return $this->condition->compiled();
   }
 
   /**
@@ -1025,8 +1073,15 @@ class UpdateQuery extends Query implements QueryConditionInterface {
   /**
    * Implements QueryConditionInterface::compile().
    */
-  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder = NULL) {
-    return $this->condition->compile($connection, isset($queryPlaceholder) ? $queryPlaceholder : $this);
+  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder) {
+    return $this->condition->compile($connection, $queryPlaceholder);
+  }
+
+  /**
+   * Implements QueryConditionInterface::compiled().
+   */
+  public function compiled() {
+    return $this->condition->compiled();
   }
 
   /**
@@ -1510,8 +1565,15 @@ class MergeQuery extends Query implements QueryConditionInterface {
   /**
    * Implements QueryConditionInterface::compile().
    */
-  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder = NULL) {
-    return $this->condition->compile($connection, isset($queryPlaceholder) ? $queryPlaceholder : $this);
+  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder) {
+    return $this->condition->compile($connection, $queryPlaceholder);
+  }
+
+  /**
+   * Implements QueryConditionInterface::compiled().
+   */
+  public function compiled() {
+    return $this->condition->compiled();
   }
 
   /**
@@ -1608,6 +1670,11 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
    */
   protected $changed = TRUE;
 
+  /**
+   * The identifier of the query placeholder this condition has been compiled against.
+   */
+  protected $queryPlaceholderIdentifier;
+
   /**
    * Constructs a DataBaseCondition object.
    *
@@ -1718,8 +1785,12 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
   /**
    * Implements QueryConditionInterface::compile().
    */
-  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder = NULL) {
-    if ($this->changed) {
+  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder) {
+    // Re-compile if this condition changed or if we are compiled against a
+    // different query placeholder object.
+    if ($this->changed || isset($this->queryPlaceholderIdentifier) && ($this->queryPlaceholderIdentifier != $queryPlaceholder->uniqueIdentifier())) {
+      $this->queryPlaceholderIdentifier = $queryPlaceholder->uniqueIdentifier();
+
       $condition_fragments = array();
       $arguments = array();
 
@@ -1791,6 +1862,13 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
     }
   }
 
+  /**
+   * Implements QueryConditionInterface::compiled().
+   */
+  public function compiled() {
+    return !$this->changed;
+  }
+
   /**
    * Implements PHP magic __toString method to convert the conditions to string.
    *
diff --git a/includes/database/schema.inc b/includes/database/schema.inc
index de1b2f5b9b863cba5a8b01ca5bc6cc5c67db34b8..e2a1c4caaded993750002ec24152a43dbbebfdb3 100644
--- a/includes/database/schema.inc
+++ b/includes/database/schema.inc
@@ -176,10 +176,33 @@ abstract class DatabaseSchema implements QueryPlaceholderInterface {
    */
   protected $defaultSchema = 'public';
 
+  /**
+   * A unique identifier for this query object.
+   */
+  protected $uniqueIdentifier;
+
   public function __construct($connection) {
+    $this->uniqueIdentifier = uniqid('', TRUE);
     $this->connection = $connection;
   }
 
+  /**
+   * Implements the magic __clone function.
+   */
+  public function __clone() {
+    $this->uniqueIdentifier = uniqid('', TRUE);
+  }
+
+  /**
+   * Implements QueryPlaceHolderInterface::uniqueIdentifier().
+   */
+  public function uniqueIdentifier() {
+    return $this->uniqueIdentifier;
+  }
+
+  /**
+   * Implements QueryPlaceHolderInterface::nextPlaceholder().
+   */
   public function nextPlaceholder() {
     return $this->placeholder++;
   }
diff --git a/includes/database/select.inc b/includes/database/select.inc
index 53be20adc6e83794c9dd585b705f3b8b525e9461..9b587aebea4ccb7681771cc86b4c46c42b4d58c1 100644
--- a/includes/database/select.inc
+++ b/includes/database/select.inc
@@ -548,18 +548,32 @@ class SelectQueryExtender implements SelectQueryInterface {
    */
   protected $connection;
 
+  /**
+   * A unique identifier for this query object.
+   */
+  protected $uniqueIdentifier;
+
   /**
    * The placeholder counter.
    */
   protected $placeholder = 0;
 
   public function __construct(SelectQueryInterface $query, DatabaseConnection $connection) {
+    $this->uniqueIdentifier = uniqid('', TRUE);
     $this->query = $query;
     $this->connection = $connection;
   }
 
-  /* Implementations of QueryPlaceholderInterface. */
+  /**
+   * Implements QueryPlaceholderInterface::uniqueIdentifier().
+   */
+  public function uniqueIdentifier() {
+    return $this->uniqueIdentifier;
+  }
 
+  /**
+   * Implements QueryPlaceholderInterface::nextPlaceholder().
+   */
   public function nextPlaceholder() {
     return $this->placeholder++;
   }
@@ -612,8 +626,12 @@ class SelectQueryExtender implements SelectQueryInterface {
     return $this;
   }
 
-  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder = NULL) {
-    return $this->condition->compile($connection, isset($queryPlaceholder) ? $queryPlaceholder : $this);
+  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder) {
+    return $this->query->compile($connection, $queryPlaceholder);
+  }
+
+  public function compiled() {
+    return $this->query->compiled();
   }
 
   /* Implementations of QueryConditionInterface for the HAVING clause. */
@@ -824,6 +842,8 @@ class SelectQueryExtender implements SelectQueryInterface {
   }
 
   public function __clone() {
+    $this->uniqueIdentifier = uniqid('', TRUE);
+
     // We need to deep-clone the query we're wrapping, which in turn may
     // deep-clone other objects.  Exciting!
     $this->query = clone($this->query);
@@ -1013,7 +1033,35 @@ class SelectQuery extends Query implements SelectQueryInterface {
   }
 
   public function arguments() {
-    return $this->where->arguments();
+    if (!$this->compiled()) {
+      return NULL;
+    }
+
+    $args = $this->where->arguments() + $this->having->arguments();
+
+    foreach ($this->tables as $table) {
+      if ($table['arguments']) {
+        $args += $table['arguments'];
+      }
+      // If this table is a subquery, grab its arguments recursively.
+      if ($table['table'] instanceof SelectQueryInterface) {
+        $args += $table['table']->arguments();
+      }
+    }
+
+    foreach ($this->expressions as $expression) {
+      if ($expression['arguments']) {
+        $args += $expression['arguments'];
+      }
+    }
+
+    // If there are any dependent queries to UNION,
+    // incorporate their arguments recursively.
+    foreach ($this->union as $union) {
+      $args += $union['query']->arguments();
+    }
+
+    return $args;
   }
 
   public function where($snippet, $args = array()) {
@@ -1041,8 +1089,44 @@ class SelectQuery extends Query implements SelectQueryInterface {
     return $this;
   }
   
-  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder = NULL) {
-    return $this->where->compile($connection, isset($queryPlaceholder) ? $queryPlaceholder : $this);
+  public function compile(DatabaseConnection $connection, QueryPlaceholderInterface $queryPlaceholder) {
+    $this->where->compile($connection, $queryPlaceholder);
+    $this->having->compile($connection, $queryPlaceholder);
+
+    foreach ($this->tables as $table) {
+      // If this table is a subquery, compile it recursively.
+      if ($table['table'] instanceof SelectQueryInterface) {
+        $table['table']->compile($connection, $queryPlaceholder);
+      }
+    }
+
+    // If there are any dependent queries to UNION, compile it recursively.
+    foreach ($this->union as $union) {
+      $union['query']->compile($connection, $queryPlaceholder);
+    }
+  }
+
+  public function compiled() {
+    if (!$this->where->compiled() || !$this->having->compiled()) {
+      return FALSE;
+    }
+
+    foreach ($this->tables as $table) {
+      // If this table is a subquery, check its status recursively.
+      if ($table['table'] instanceof SelectQueryInterface) {
+        if (!$table['table']->compiled()) {
+          return FALSE;
+        }
+      }
+    }
+
+    foreach ($this->union as $union) {
+      if (!$union['query']->compiled()) {
+        return FALSE;
+      }
+    }
+
+    return TRUE;
   }
 
   /* Implementations of QueryConditionInterface for the HAVING clause. */
@@ -1136,33 +1220,8 @@ class SelectQuery extends Query implements SelectQueryInterface {
     if (!isset($queryPlaceholder)) {
       $queryPlaceholder = $this;
     }
-    $this->where->compile($this->connection, $queryPlaceholder);
-    $this->having->compile($this->connection, $queryPlaceholder);
-    $args = $this->where->arguments() + $this->having->arguments();
-
-    foreach ($this->tables as $table) {
-      if ($table['arguments']) {
-        $args += $table['arguments'];
-      }
-      // If this table is a subquery, grab its arguments recursively.
-      if ($table['table'] instanceof SelectQueryInterface) {
-        $args += $table['table']->getArguments($queryPlaceholder);
-      }
-    }
-
-    foreach ($this->expressions as $expression) {
-      if ($expression['arguments']) {
-        $args += $expression['arguments'];
-      }
-    }
-
-    // If there are any dependent queries to UNION,
-    // incorporate their arguments recursively.
-    foreach ($this->union as $union) {
-      $args += $union['query']->getArguments($queryPlaceholder);
-    }
-
-    return $args;
+    $this->compile($this->connection, $queryPlaceholder);
+    return $this->arguments();
   }
 
   /**
@@ -1439,6 +1498,14 @@ class SelectQuery extends Query implements SelectQueryInterface {
   }
 
   public function __toString() {
+    // For convenience, we compile the query ourselves if the caller forgot
+    // to do it. This allows constructs like "(string) $query" to work. When
+    // the query will be executed, it will be recompiled using the proper
+    // placeholder generator anyway.
+    if (!$this->compiled()) {
+      $this->compile($this->connection, $this);
+    }
+
     // Create a sanitized comment string to prepend to the query.
     $comments = $this->connection->makeComment($this->comments);
 
@@ -1496,14 +1563,6 @@ class SelectQuery extends Query implements SelectQueryInterface {
 
     // WHERE
     if (count($this->where)) {
-      // The following line will not generate placeholders correctly if there
-      // is a subquery. Fortunately, it is also called from getArguments() first
-      // so it's not a problem in practice... unless you try to call __toString()
-      // before calling getArguments().  That is a problem that we will have to
-      // fix in Drupal 8, because it requires more refactoring than we are
-      // able to do in Drupal 7.
-      // @todo Move away from __toString() For SelectQuery compilation at least.
-      $this->where->compile($this->connection, $this);
       // There is an implicit string cast on $this->condition.
       $query .= "\nWHERE " . $this->where;
     }
@@ -1515,7 +1574,6 @@ class SelectQuery extends Query implements SelectQueryInterface {
 
     // HAVING
     if (count($this->having)) {
-      $this->having->compile($this->connection, $this);
       // There is an implicit string cast on $this->having.
       $query .= "\nHAVING " . $this->having;
     }
diff --git a/includes/database/sqlite/schema.inc b/includes/database/sqlite/schema.inc
index 840ba6b5d4ae4f635ee79140dbe09ae30861cc6f..3c8cd3f554a170219677f4c5b2f17b75c2f8e84c 100644
--- a/includes/database/sqlite/schema.inc
+++ b/includes/database/sqlite/schema.inc
@@ -196,6 +196,7 @@ class DatabaseSchema_sqlite extends DatabaseSchema {
     // $map does not use drupal_static as its value never changes.
     static $map = array(
       'varchar:normal'  => 'VARCHAR',
+      'char:normal'     => 'CHAR',
 
       'text:tiny'       => 'TEXT',
       'text:small'      => 'TEXT',
diff --git a/includes/entity.inc b/includes/entity.inc
index f363c31137248e7f413e96ebe6970d8bd7d83885..67225bc7e5850cbec9b64ecf56a7fa67f68e9966 100644
--- a/includes/entity.inc
+++ b/includes/entity.inc
@@ -628,8 +628,6 @@ class EntityFieldQuery {
   /**
    * Adds a condition on field values.
    *
-   * @param $type
-   *   The condition array the given conditions should be added to.
    * @param $field
    *   Either a field name or a field array.
    * @param $column
@@ -1327,3 +1325,8 @@ class EntityFieldQuery {
   }
 
 }
+
+/**
+ * Exception thrown when a malformed entity is passed.
+ */
+class EntityMalformedException extends Exception { }
diff --git a/includes/file.inc b/includes/file.inc
index 19420ca37e1edbedebd53f19ab132414e984104e..4fb56e8a4a516a044087c4db15abaaa7d2dc50f4 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -906,7 +906,7 @@ function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXIST
   file_ensure_htaccess();
   // Perform the copy operation.
   if (!@copy($source, $destination)) {
-    watchdog('file', 'The specified file %file could not be copied to %destination.', array('%file' => $source, '%destination' => $destination), WATCHDOG_ERR);
+    watchdog('file', 'The specified file %file could not be copied to %destination.', array('%file' => $source, '%destination' => $destination), WATCHDOG_ERROR);
     return FALSE;
   }
 
@@ -1538,7 +1538,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
   // directory. This overcomes open_basedir restrictions for future file
   // operations.
   $file->uri = $file->destination;
-  if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->uri)) {
+  if (!drupal_move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->uri)) {
     form_set_error($source, t('File upload error. Could not move uploaded file.'));
     watchdog('file', 'Upload error. Could not move uploaded file %file to destination %destination.', array('%file' => $file->filename, '%destination' => $file->uri));
     return FALSE;
@@ -1565,6 +1565,42 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
   return FALSE;
 }
 
+/**
+ * Moves an uploaded file to a new location.
+ *
+ * PHP's move_uploaded_file() does not properly support streams if safe_mode
+ * or open_basedir are enabled, so this function fills that gap.
+ *
+ * Compatibility: normal paths and stream wrappers.
+ * @see http://drupal.org/node/515192
+ *
+ * @param $filename
+ *   The filename of the uploaded file.
+ * @param $uri
+ *   A string containing the destination URI of the file.
+ *
+ * @return
+ *   TRUE on success, or FALSE on failure.
+ *
+ * @see move_uploaded_file()
+ * @ingroup php_wrappers
+ */
+function drupal_move_uploaded_file($filename, $uri) {
+  $result = @move_uploaded_file($filename, $uri);
+  // PHP's move_uploaded_file() does not properly support streams if safe_mode
+  // or open_basedir are enabled so if the move failed, try finding a real path
+  // and retry the move operation.
+  if (!$result) {
+    if ($realpath = drupal_realpath($uri)) {
+      $result = move_uploaded_file($filename, $realpath);
+    }
+    else {
+      $result = move_uploaded_file($filename, $uri);
+    }
+  }
+
+  return $result;
+}
 
 /**
  * Check that a file meets the criteria specified by the validators.
@@ -1902,10 +1938,11 @@ function file_transfer($uri, $headers) {
  * Menu handler for private file transfers.
  *
  * Call modules that implement hook_file_download() to find out if a file is
- * accessible and what headers it should be transferred with. If a module
- * returns -1 drupal_access_denied() will be returned. If one or more modules
- * returned headers the download will start with the returned headers. If no
- * modules respond drupal_not_found() will be returned.
+ * accessible and what headers it should be transferred with. If one or more
+ * modules returned headers the download will start with the returned headers.
+ * If a module returns -1 drupal_access_denied() will be returned. If the file
+ * exists but no modules responded drupal_access_denied() will be returned.
+ * If the file does not exist drupal_not_found() will be returned.
  *
  * @see hook_file_download()
  */
@@ -1934,6 +1971,7 @@ function file_download() {
     if (count($headers)) {
       file_transfer($uri, $headers);
     }
+    return drupal_access_denied();
   }
   return drupal_not_found();
 }
diff --git a/includes/file.mimetypes.inc b/includes/file.mimetypes.inc
index cda03fb92b374f6612a353e13b1ec10d697a7b99..8509433bee6fd303a8af7adb34aab3eb7b39545d 100644
--- a/includes/file.mimetypes.inc
+++ b/includes/file.mimetypes.inc
@@ -407,7 +407,6 @@ function file_default_mimetype_mapping() {
       'doc' => 14,
       'bin' => 15,
       'oda' => 16,
-      'ogg' => 17,
       'ogx' => 17,
       'pdf' => 18,
       'key' => 19,
@@ -629,6 +628,7 @@ function file_default_mimetype_mapping() {
       'm4a' => 188,
       'mp3' => 188,
       'mp2' => 188,
+      'ogg' => 189,
       'oga' => 189,
       'spx' => 189,
       'sid' => 190,
diff --git a/includes/form.inc b/includes/form.inc
index 8ee0a5a52f94f95bdb8855e05ec9e4ffddd1559c..df1b2f73bc400519a8e8f76d899e6a2dbdf02b9a 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -4003,6 +4003,36 @@ function _form_set_class(&$element, $class = array()) {
   }
 }
 
+/**
+ * Helper form element validator: integer.
+ */
+function element_validate_integer($element, &$form_state) {
+  $value = $element['#value'];
+  if ($value !== '' && (!is_numeric($value) || intval($value) != $value)) {
+    form_error($element, t('%name must be an integer.', array('%name' => $element['#title'])));
+  }
+}
+
+/**
+ * Helper form element validator: integer > 0.
+ */
+function element_validate_integer_positive($element, &$form_state) {
+  $value = $element['#value'];
+  if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value <= 0)) {
+    form_error($element, t('%name must be a positive integer.', array('%name' => $element['#title'])));
+  }
+}
+
+/**
+ * Helper form element validator: number.
+ */
+function element_validate_number($element, &$form_state) {
+  $value = $element['#value'];
+  if ($value != '' && !is_numeric($value)) {
+    form_error($element, t('%name must be a number.', array('%name' => $element['#title'])));
+  }
+}
+
 /**
  * @} End of "defgroup form_api".
  */
@@ -4033,8 +4063,9 @@ function _form_set_class(&$element, $class = array()) {
  *   'file' => 'path_to_file_containing_myfunctions',
  * );
  * batch_set($batch);
- * // only needed if not inside a form _submit handler :
- * batch_process();
+ * // Only needed if not inside a form _submit handler.
+ * // Setting redirect in batch_process.
+ * batch_process('node/1');
  * @endcode
  *
  * Note: if the batch 'title', 'init_message', 'progress_message', or
diff --git a/includes/lock.inc b/includes/lock.inc
index 42f1906f2572d4a1aa20c7029ca1588d75b978d9..7dd8db30a16343bf380464d1d877eea518f896a0 100644
--- a/includes/lock.inc
+++ b/includes/lock.inc
@@ -74,7 +74,10 @@ function lock_initialize() {
  * Helper function to get this request's unique id.
  */
 function _lock_id() {
-  $lock_id = &drupal_static(__FUNCTION__);
+  // Do not use drupal_static(). This identifier refers to the current
+  // client request, and must not be changed under any circumstances
+  // else the shutdown handler may fail to release our locks.
+  static $lock_id;
 
   if (!isset($lock_id)) {
     // Assign a unique id.
diff --git a/includes/menu.inc b/includes/menu.inc
index 5582c452e87cc358333f56cb98365663c1e5595f..a32fa1310ebe166eb497d1f4abdc648be5004a46 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -2340,7 +2340,7 @@ function menu_set_active_trail($new_trail = NULL) {
  *   menu link ('node/5' if it exists, or fallback to 'node/%').
  *
  * @return
- *   A fully translated menu link, or NULL if not matching menu link was
+ *   A fully translated menu link, or NULL if no matching menu link was
  *   found. The most specific menu link ('node/5' preferred over 'node/%') in
  *   the most preferred menu (as defined by menu_get_active_menu_names()) is
  *   returned.
diff --git a/includes/pager.inc b/includes/pager.inc
index 146033f1b407895d9a36d660fc2dcc19a8d91fb9..7a3a7be30c0b7b56e3237910edb98c0f09c88f11 100644
--- a/includes/pager.inc
+++ b/includes/pager.inc
@@ -154,7 +154,7 @@ class PagerDefault extends SelectQueryExtender {
    * Note that no collision detection is done when setting an element ID
    * explicitly, so it is possible for two pagers to end up using the same ID
    * if both are set explicitly.
-   * 
+   *
    * @param $element
    */
   public function element($element) {
@@ -574,13 +574,20 @@ function theme_pager_last($variables) {
  *
  * @param $variables
  *   An associative array containing:
+ *   - text: The link text. Also used to figure out the title attribute of the
+ *     link, if it is not provided in $variables['attributes']['title']; in
+ *     this case, $variables['text'] must be one of the standard pager link
+ *     text strings that would be generated by the pager theme functions, such
+ *     as a number or t('« first').
  *   - page_new: The first result to display on the linked page.
  *   - element: An optional integer to distinguish between multiple pagers on
  *     one page.
  *   - parameters: An associative array of query string parameters to append to
  *     the pager link.
- *   - attributes: An associative array of HTML attributes to apply to a pager
- *     anchor tag.
+ *   - attributes: An associative array of HTML attributes to apply to the
+ *     pager link.
+ *
+ * @see theme_pager()
  *
  * @ingroup themeable
  */
diff --git a/includes/stream_wrappers.inc b/includes/stream_wrappers.inc
index 3c88f3d8f73200090107618f55c7795a5ceff54b..9a9b06171a92c73228df7c33c067a4c9e47b4237 100644
--- a/includes/stream_wrappers.inc
+++ b/includes/stream_wrappers.inc
@@ -401,7 +401,7 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface
     $this->handle = ($options & STREAM_REPORT_ERRORS) ? fopen($path, $mode) : @fopen($path, $mode);
 
     if ((bool) $this->handle && $options & STREAM_USE_PATH) {
-      $opened_url = $path;
+      $opened_path = $path;
     }
 
     return (bool) $this->handle;
diff --git a/includes/theme.inc b/includes/theme.inc
index 3ae50006aa31fdb28c826e670121a665d41f5ef4..6c2b6406903af92effbfd9c27c482d1f10572d7a 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -1820,6 +1820,7 @@ function theme_item_list($variables) {
     foreach ($items as $i => $item) {
       $attributes = array();
       $children = array();
+      $data = '';
       if (is_array($item)) {
         foreach ($item as $key => $value) {
           if ($key == 'data') {
@@ -2482,7 +2483,6 @@ function template_preprocess_maintenance_page(&$variables) {
   $variables['site_slogan']       = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : '');
   $variables['tabs']              = '';
   $variables['title']             = drupal_get_title();
-  $variables['closure']           = '';
 
   // Compile a list of classes that are going to be applied to the body element.
   $variables['classes_array'][] = 'in-maintenance';
diff --git a/includes/update.inc b/includes/update.inc
index 192aa1aab0c5a7948de5098d0d92c9aa616e4e2b..08c945a4f8b206d36c684646f52101208301ed9b 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -180,6 +180,14 @@ function update_prepare_d7_bootstrap() {
       $_COOKIE[session_name()] = $sid;
       session_id($sid);
     }
+
+    // Upgrading from D6 to D7.{0,1,2,3,4,8,...} is different than upgrading
+    // from D6 to D7.{5,6,7} which should be considered broken. To be able to
+    // properly handle this difference in node_update_7012 we need to keep track
+    // of whether a D6 > D7 upgrade or a D7 > D7 update is running.
+    // Since variable_set() is not available here, the D6 status is being saved
+    // in a local variable to be able to store it later.
+    $update_d6 = TRUE;
   }
 
   // Create the registry tables.
@@ -304,6 +312,11 @@ function update_prepare_d7_bootstrap() {
     // Set the timezone for this request only.
     $GLOBALS['conf']['date_default_timezone'] = 'UTC';
   }
+
+  // This allows update functions to tell if an upgrade from D6 is running.
+  if (!empty($update_d6)) {
+    variable_set('update_d6', TRUE);
+  }
 }
 
 /**
@@ -357,6 +370,12 @@ function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas, $moved_deltas) {
             ))
             ->fetchField();
           if ($block_exists) {
+            // Delete any existing blocks with the new module+delta.
+            db_delete($table)
+              ->condition('module', $module)
+              ->condition('delta', $new_delta)
+              ->execute();
+            // Rename the old block to the new module+delta.
             db_update($table)
               ->fields(array('delta' => $new_delta))
               ->condition('module', $module)
@@ -374,6 +393,12 @@ function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas, $moved_deltas) {
             ))
             ->fetchField();
           if ($block_exists) {
+            // Delete any existing blocks with the new module+delta.
+            db_delete($table)
+              ->condition('module', $new_module)
+              ->condition('delta', $delta)
+              ->execute();
+            // Rename the old block to the new module+delta.
             db_update($table)
               ->fields(array('module' => $new_module))
               ->condition('module', $old_module)
@@ -1071,6 +1096,10 @@ function update_batch($start, $redirect = NULL, $url = NULL, $batch = array(), $
  * @see update_batch()
  */
 function update_finished($success, $results, $operations) {
+  // Remove the D6 upgrade flag variable so that subsequent update runs do not
+  // get the wrong context.
+  variable_del('update_d6');
+
   // Clear the caches in case the data has been updated.
   drupal_flush_all_caches();
 
diff --git a/misc/tabledrag.js b/misc/tabledrag.js
index b566168c354d786b96135d0c20e95b0b0d27dbec..41fd47b6e0902d6114e01a4550576b0bbb12f4ba 100644
--- a/misc/tabledrag.js
+++ b/misc/tabledrag.js
@@ -131,31 +131,28 @@ Drupal.tableDrag.prototype.initColumns = function () {
     }
 
     // Mark the column containing this field so it can be hidden.
-    if (hidden && cell[0] && cell.css('display') != 'none') {
+    if (hidden && cell[0]) {
       // Add 1 to our indexes. The nth-child selector is 1 based, not 0 based.
       // Match immediate children of the parent element to allow nesting.
       var columnIndex = $('> td', cell.parent()).index(cell.get(0)) + 1;
-      var headerIndex = $('> td:not(:hidden)', cell.parent()).index(cell.get(0)) + 1;
-      $('> thead > tr, > tbody > tr, > tr', this.table).each(function (){
-        var row = $(this);
-        var parentTag = row.parent().get(0).tagName.toLowerCase();
-        var index = (parentTag == 'thead') ? headerIndex : columnIndex;
-
-        // Adjust the index to take into account colspans.
-        row.children().each(function (n) {
-          if (n < index) {
-            index -= (this.colSpan && this.colSpan > 1) ? this.colSpan - 1 : 0;
+      $('> thead > tr, > tbody > tr, > tr', this.table).each(function () {
+        // Get the columnIndex and adjust for any colspans in this row.
+        var index = columnIndex;
+        var cells = $(this).children();
+        cells.each(function (n) {
+          if (n < index && this.colSpan && this.colSpan > 1) {
+            index -= this.colSpan - 1;
           }
         });
         if (index > 0) {
-          cell = row.children(':nth-child(' + index + ')');
-          if (cell[0].colSpan > 1) {
+          cell = cells.filter(':nth-child(' + index + ')');
+          if (cell[0].colSpan && cell[0].colSpan > 1) {
             // If this cell has a colspan, mark it so we can reduce the colspan.
-            $(cell[0]).addClass('tabledrag-has-colspan');
+            cell.addClass('tabledrag-has-colspan');
           }
           else {
             // Mark this cell so we can hide it.
-            $(cell[0]).addClass('tabledrag-hide');
+            cell.addClass('tabledrag-hide');
           }
         }
       });
diff --git a/modules/aggregator/aggregator.info b/modules/aggregator/aggregator.info
index c8330219cc4ca33fe48863868c89c0ac4c28f916..b2d5abd95a676fdcf295ce9f8ded2e03ac6b4748 100644
--- a/modules/aggregator/aggregator.info
+++ b/modules/aggregator/aggregator.info
@@ -7,8 +7,8 @@ files[] = aggregator.test
 configure = admin/config/services/aggregator/settings
 stylesheets[all][] = aggregator.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 1e1686af8bf2a671c4a674f3c12777bf0a41d784..eafb61ed3083ce68d78573c74b83b172fca48fa0 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -283,7 +283,7 @@ function _aggregator_category_title($category) {
  *   otherwise.
  */
 function _aggregator_has_categories() {
-  return user_access('access news feeds') && db_query('SELECT COUNT(*) FROM {aggregator_category}')->fetchField();
+  return user_access('access news feeds') && (bool) db_query_range('SELECT 1 FROM {aggregator_category}', 0, 1)->fetchField();
 }
 
 /**
diff --git a/modules/aggregator/tests/aggregator_test.info b/modules/aggregator/tests/aggregator_test.info
index dbbda05bad521c4bbb10245b73d86c711f5de177..a7577825829ed798f442e7ea9ab6542e0ca23592 100644
--- a/modules/aggregator/tests/aggregator_test.info
+++ b/modules/aggregator/tests/aggregator_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/block/block.info b/modules/block/block.info
index d6594b49a625065ea6359d96b1f18f943ebde1aa..e1a3a4b990c42a9ced9f2933962faca22f2f8dad 100644
--- a/modules/block/block.info
+++ b/modules/block/block.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = block.test
 configure = admin/structure/block
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/block/block.install b/modules/block/block.install
index c45b076bf75f75407e8866c2ecd21975c0ca9941..b2ab477d90932ca2cf104bd09116102329858b13 100644
--- a/modules/block/block.install
+++ b/modules/block/block.install
@@ -190,16 +190,12 @@ function block_install() {
  * Implements hook_update_dependencies().
  */
 function block_update_dependencies() {
-  // Block update 7005 needs to query the list of existing text formats and
-  // therefore must run after filter_update_7000().
+  // block_update_7005() needs to query the {filter_format} table to get a list
+  // of existing text formats, so it must run after filter_update_7000(), which
+  // creates that table.
   $dependencies['block'][7005] = array(
     'filter' => 7000,
   );
-  // Ensure that format columns are only changed after Filter module has changed
-  // the primary records.
-  $dependencies['block'][7007] = array(
-    'filter' => 7010,
-  );
 
   return $dependencies;
 }
diff --git a/modules/block/block.module b/modules/block/block.module
index b2a3f05225bc9896c7de329b633629f0ed78adde..4f498d3c684572b7e0959481301794d51be65586 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -761,6 +761,12 @@ function block_block_list_alter(&$blocks) {
     else {
       $enabled = TRUE;
     }
+
+    // Limited visibility blocks must list at least one page.
+    if ($block->visibility == BLOCK_VISIBILITY_LISTED && empty($block->pages)) {
+      $enabled = FALSE;
+    }
+
     if (!$enabled) {
       unset($blocks[$key]);
       continue;
diff --git a/modules/block/block.test b/modules/block/block.test
index 022bf383031d7556d491ae9b6e87e0767a2e54f1..03f3048b4eb619cb548e1d1e2d8e9251c9a77b0f 100644
--- a/modules/block/block.test
+++ b/modules/block/block.test
@@ -192,6 +192,49 @@ class BlockTestCase extends DrupalWebTestCase {
     $this->assertNoText($title, t('Block was not displayed to anonymous users.'));
   }
 
+  /**
+   * Test block visibility when using "pages" restriction but leaving 
+   * "pages" textarea empty
+   */
+  function testBlockVisibilityListedEmpty() {
+    $block = array();
+
+    // Create a random title for the block
+    $title = $this->randomName(8);
+
+    // Create the custom block
+    $custom_block = array();
+    $custom_block['info'] = $this->randomName(8);
+    $custom_block['title'] = $title;
+    $custom_block['body[value]'] = $this->randomName(32);
+    $this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
+
+    $bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();
+    $block['module'] = 'block';
+    $block['delta'] = $bid;
+    $block['title'] = $title;
+
+    // Move block to the first sidebar.
+    $this->moveBlockToRegion($block, $this->regions[1]);
+
+    // Set the block to be hidden on any user path, and to be shown only to
+    // authenticated users.
+    $edit = array();
+    $edit['visibility'] = BLOCK_VISIBILITY_LISTED;
+    $this->drupalPost('admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', $edit, t('Save block'));
+
+    $this->drupalGet('');
+    $this->assertNoText($title, t('Block was not displayed according to block visibility rules.'));
+
+    $this->drupalGet('user');
+    $this->assertNoText($title, t('Block was not displayed according to block visibility rules regardless of path case.'));
+
+    // Confirm that the block is not displayed to anonymous users.
+    $this->drupalLogout();
+    $this->drupalGet('');
+    $this->assertNoText($title, t('Block was not displayed to anonymous users.'));
+  }
+
   /**
    * Test user customization of block visibility.
    */
diff --git a/modules/block/tests/block_test.info b/modules/block/tests/block_test.info
index deb418460f25dcc7bdc115fb5a1e5719070d7030..9225e0c81e24a7d01d39b85c0c1a8fa5654aca76 100644
--- a/modules/block/tests/block_test.info
+++ b/modules/block/tests/block_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/blog/blog.info b/modules/blog/blog.info
index a70e7ba081be851ca57713638d9c81a1af90d331..433ea6c2996b45b57f5fd9c23574b5d453125c44 100644
--- a/modules/blog/blog.info
+++ b/modules/blog/blog.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 files[] = blog.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/book/book.info b/modules/book/book.info
index 08857e37070424ff890668cfe8f67abc37e4671d..0b1e0643edc61f47022a4aca74ee4c7fde8e445d 100644
--- a/modules/book/book.info
+++ b/modules/book/book.info
@@ -7,8 +7,8 @@ files[] = book.test
 configure = admin/content/book/settings
 stylesheets[all][] = book.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/color/color.info b/modules/color/color.info
index bbd87fc1dc70de18697839daef058491014b7731..5e89d15442805210c84b1c2e9b3c0f0c26b82d44 100644
--- a/modules/color/color.info
+++ b/modules/color/color.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 files[] = color.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/color/color.module b/modules/color/color.module
index fbc00f1395107889fea12f7847ad289cc2450f46..be25c2d751fc3650547f071fc1e259eee0c56e1f 100644
--- a/modules/color/color.module
+++ b/modules/color/color.module
@@ -314,7 +314,11 @@ function color_scheme_form_submit($form, &$form_state) {
     // We need at least a copy of the source and a target buffer of the same
     // size (both at 32bpp).
     $required = $width * $height * 8;
-    $usage = memory_get_usage();
+    // We intend to prevent color scheme changes if there isn't enough memory
+    // available.  memory_get_usage(TRUE) returns a more accurate number than
+    // memory_get_usage(), therefore we won't inadvertently reject a color
+    // scheme change based on a faulty memory calculation.
+    $usage = memory_get_usage(TRUE);
     $limit = parse_size(ini_get('memory_limit'));
     if ($usage + $required > $limit) {
       drupal_set_message(t('There is not enough memory available to PHP to change this theme\'s color scheme. You need at least %size more. Check the <a href="@url">PHP documentation</a> for more information.', array('%size' => format_size($usage + $required - $limit), '@url' => 'http://www.php.net/manual/ini.core.php#ini.sect.resource-limits')), 'error');
diff --git a/modules/comment/comment.info b/modules/comment/comment.info
index acc4291d6fe21a8010235fe65659e20273097060..d4654cea6493df8f242bb5ddc546a22f82530b9f 100644
--- a/modules/comment/comment.info
+++ b/modules/comment/comment.info
@@ -9,8 +9,8 @@ files[] = comment.test
 configure = admin/content/comment
 stylesheets[all][] = comment.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/comment/comment.install b/modules/comment/comment.install
index 120467fd0594d0d7e3e88e7658655dae6ef987f2..cda3c308d5f485f4225ae5db08c012bffe61eb40 100644
--- a/modules/comment/comment.install
+++ b/modules/comment/comment.install
@@ -83,14 +83,16 @@ function comment_modules_enabled($modules) {
  * Implements hook_update_dependencies().
  */
 function comment_update_dependencies() {
-  // Comment update 7005 creates the comment body field and therefore must run
-  // after text module has been enabled and entities have been updated.
+  // comment_update_7005() creates the comment body field and therefore must
+  // run after all Field modules have been enabled, which happens in
+  // system_update_7027().
   $dependencies['comment'][7005] = array(
-    'system' => 7021,
+    'system' => 7027,
   );
 
-  // Comment update 7006 needs to query the list of existing text formats and
-  // therefore must run after filter_update_7000().
+  // comment_update_7006() needs to query the {filter_format} table to get a
+  // list of existing text formats, so it must run after filter_update_7000(),
+  // which creates that table.
   $dependencies['comment'][7006] = array(
     'filter' => 7000,
   );
diff --git a/modules/contact/contact.info b/modules/contact/contact.info
index 5f0c59f16de7dcc9e91de24139f6365f1e44ada4..b495d537bccf2bb6a16853597864052734fbe104 100644
--- a/modules/contact/contact.info
+++ b/modules/contact/contact.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = contact.test
 configure = admin/structure/contact
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/contact/contact.install b/modules/contact/contact.install
index 6e8ec70534ea39adcce8a27842e1edbcdaff02cf..f6015581b78b6e206a79fc7d54f24046f6a60981 100644
--- a/modules/contact/contact.install
+++ b/modules/contact/contact.install
@@ -88,6 +88,25 @@ function contact_uninstall() {
   variable_del('contact_threshold_window');
 }
 
+/**
+ * Implements hook_update_dependencies().
+ */
+function contact_update_dependencies() {
+  // contact_update_7001() relies on the {role_permission} table being updated
+  // to the new format and filled with data.
+  $dependencies['contact'][7001] = array(
+    'system' => 7007,
+  );
+
+  // contact_update_7002() relies on the {role_permission} table having the
+  // module field, which is created in user_update_7006().
+  $dependencies['contact'][7002] = array(
+    'user' => 7006,
+  );
+
+  return $dependencies;
+}
+
 /**
  * @addtogroup updates-6.x-to-7.x
  * @{
diff --git a/modules/contextual/contextual.info b/modules/contextual/contextual.info
index e059ffa088e38ab9758843c2fda39f38ac45d93a..e07c458d8ac24dc37d5d6ffeb1e779e00f962191 100644
--- a/modules/contextual/contextual.info
+++ b/modules/contextual/contextual.info
@@ -4,8 +4,8 @@ package = Core
 version = VERSION
 core = 7.x
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/dashboard/dashboard.info b/modules/dashboard/dashboard.info
index e8d7ae673887eb90c082f0514fadfee9c3ecd00b..47b3e729b00eeecfa60c2197bbaa29da5824a090 100644
--- a/modules/dashboard/dashboard.info
+++ b/modules/dashboard/dashboard.info
@@ -7,8 +7,8 @@ files[] = dashboard.test
 dependencies[] = block
 configure = admin/dashboard/customize
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/dblog/dblog.info b/modules/dblog/dblog.info
index a369f3258c8e6d1d93bdee15253feaa80d81bc28..d56ea691d8fd51cdb4f21f85786725f383b97bf1 100644
--- a/modules/dblog/dblog.info
+++ b/modules/dblog/dblog.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 files[] = dblog.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index 3287dd555e0b36b9975cd63d5f5f1102c2174cdb..88f9231ac8ce711cee6e21b17a52c2859e40a0ed 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -74,8 +74,8 @@ function hook_field_extra_fields() {
 function hook_field_extra_fields_alter(&$info) {
   // Force node title to always be at the top of the list by default.
   foreach (node_type_get_types() as $bundle) {
-    if (isset($info['node'][$bundle]['title'])) {
-      $info['node'][$bundle]['title']['weight'] = -20;
+    if (isset($info['node'][$bundle->type]['title'])) {
+      $info['node'][$bundle->type]['title']['weight'] = -20;
     }
   }
 }
@@ -675,10 +675,6 @@ function hook_field_is_empty($item, $field) {
  * Widget hooks are typically called by the Field Attach API during the
  * creation of the field form structure with field_attach_form().
  *
- * @see hook_field_widget_info_alter()
- * @see hook_field_widget_form()
- * @see hook_field_widget_error()
- *
  * @return
  *   An array describing the widget types implemented by the module.
  *   The keys are widget type names. To avoid name clashes, widget type
@@ -704,6 +700,12 @@ function hook_field_is_empty($item, $field) {
  *       - FIELD_BEHAVIOR_DEFAULT: (default) If the widget accepts default
  *         values.
  *       - FIELD_BEHAVIOR_NONE: if the widget does not support default values.
+ *
+ * @see hook_field_widget_info_alter()
+ * @see hook_field_widget_form()
+ * @see hook_field_widget_form_alter()
+ * @see hook_field_widget_WIDGET_TYPE_form_alter()
+ * @see hook_field_widget_error()
  */
 function hook_field_widget_info() {
     return array(
@@ -783,8 +785,8 @@ function hook_field_widget_info_alter(&$info) {
  * properties from $field and $instance and set them as ad-hoc
  * $element['#custom'] properties, for later use by its element callbacks.
  *
- * @see field_widget_field()
- * @see field_widget_instance()
+ * Other modules may alter the form element provided by this function using
+ * hook_field_widget_form_alter().
  *
  * @param $form
  *   The form structure where widgets are being attached to. This might be a
@@ -826,6 +828,11 @@ function hook_field_widget_info_alter(&$info) {
  *
  * @return
  *   The form elements for a single widget for this field.
+ *
+ * @see field_widget_field()
+ * @see field_widget_instance()
+ * @see hook_field_widget_form_alter()
+ * @see hook_field_widget_WIDGET_TYPE_form_alter()
  */
 function hook_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
   $element += array(
@@ -835,6 +842,69 @@ function hook_field_widget_form(&$form, &$form_state, $field, $instance, $langco
   return $element;
 }
 
+/**
+ * Alter forms for field widgets provided by other modules.
+ *
+ * @param $element
+ *   The field widget form element as constructed by hook_field_widget_form().
+ * @param $form_state
+ *   An associative array containing the current state of the form.
+ * @param $context
+ *   An associative array containing the following key-value pairs, matching the
+ *   arguments received by hook_field_widget_form():
+ *   - "form": The form structure where widgets are being attached to. This
+ *     might be a full form structure, or a sub-element of a larger form.
+ *   - "field": The field structure.
+ *   - "instance": The field instance structure.
+ *   - "langcode": The language associated with $items.
+ *   - "items": Array of default values for this field.
+ *   - "delta": The order of this item in the array of subelements (0, 1, 2,
+ *     etc).
+ *
+ * @see hook_field_widget_form()
+ * @see hook_field_widget_WIDGET_TYPE_form_alter
+ */
+function hook_field_widget_form_alter(&$element, &$form_state, $context) {
+  // Add a css class to widget form elements for all fields of type mytype.
+  if ($context['field']['type'] == 'mytype') {
+    // Be sure not to overwrite existing attributes.
+    $element['#attributes']['class'][] = 'myclass';
+  }
+}
+
+/**
+ * Alter widget forms for a specific widget provided by another module.
+ *
+ * Modules can implement hook_field_widget_WIDGET_TYPE_form_alter() to modify a
+ * specific widget form, rather than using hook_field_widget_form_alter() and
+ * checking the widget type.
+ *
+ * @param $element
+ *   The field widget form element as constructed by hook_field_widget_form().
+ * @param $form_state
+ *   An associative array containing the current state of the form.
+ * @param $context
+ *   An associative array containing the following key-value pairs, matching the
+ *   arguments received by hook_field_widget_form():
+ *   - "form": The form structure where widgets are being attached to. This
+ *     might be a full form structure, or a sub-element of a larger form.
+ *   - "field": The field structure.
+ *   - "instance": The field instance structure.
+ *   - "langcode": The language associated with $items.
+ *   - "items": Array of default values for this field.
+ *   - "delta": The order of this item in the array of subelements (0, 1, 2,
+ *     etc).
+ *
+ * @see hook_field_widget_form()
+ * @see hook_field_widget_form_alter()
+ */
+function hook_field_widget_WIDGET_TYPE_form_alter(&$element, &$form_state, $context) {
+  // Code here will only act on widgets of type WIDGET_TYPE.  For example,
+  // hook_field_widget_mymodule_autocomplete_form_alter() will only act on
+  // widgets of type 'mymodule_autocomplete'.
+  $element['#autocomplete_path'] = 'mymodule/autocomplete_path';
+}
+
 /**
  * Flag a field-level validation error.
  *
diff --git a/modules/field/field.default.inc b/modules/field/field.default.inc
index a10d1387f8cb8a0ec14901f782603406ddedcb0b..cb49bdb85efb65200e93a980d2a58a6c32f787a1 100644
--- a/modules/field/field.default.inc
+++ b/modules/field/field.default.inc
@@ -168,17 +168,16 @@ function field_default_prepare_view($entity_type, $entities, $field, $instances,
 }
 
 /**
- * Builds a renderable array for field values.
+ * Builds a renderable array for one field on one entity instance.
  *
  * @param $entity_type
  *   The type of $entity; e.g. 'node' or 'user'.
- * @param $entities
- *   An array of entities being displayed, keyed by entity id.
+ * @param $entity
+ *   A single object of type $entity_type.
  * @param $field
  *   The field structure for the operation.
- * @param $instances
- *   Array of instance structures for $field for each entity, keyed by entity
- *   id.
+ * @param $instance
+ *   An array containing each field on $entity's bundle.
  * @param $langcode
  *   The language associated to $items.
  * @param $items
diff --git a/modules/field/field.form.inc b/modules/field/field.form.inc
index 66d93e96320d31a2305c8dac55e433b21fc0b495..80c1daca6b5bdc0ad1fb9403ce0c1584fdf4e8fb 100644
--- a/modules/field/field.form.inc
+++ b/modules/field/field.form.inc
@@ -76,6 +76,17 @@ function field_default_form($entity_type, $entity, $field, $instance, $langcode,
           '#delta' => $delta,
         );
         if ($element = $function($form, $form_state, $field, $instance, $langcode, $items, $delta, $element)) {
+          // Allow modules to alter the field widget form element.
+          $context = array(
+            'form' => $form,
+            'field' => $field,
+            'instance' => $instance,
+            'langcode' => $langcode,
+            'items' => $items,
+            'delta' => $delta,
+          );
+          drupal_alter(array('field_widget_form', 'field_widget_' . $instance['widget']['type'] . '_form'), $element, $form_state, $context);
+
           // If we're processing a specific delta value for a field where the
           // field module handles multiples, set the delta in the result.
           // For fields that handle their own processing, we can't make
@@ -193,6 +204,18 @@ function field_multiple_value_form($field, $instance, $langcode, $items, &$form,
             '#weight' => 100,
           );
         }
+
+        // Allow modules to alter the field widget form element.
+        $context = array(
+          'form' => $form,
+          'field' => $field,
+          'instance' => $instance,
+          'langcode' => $langcode,
+          'items' => $items,
+          'delta' => $delta,
+        );
+        drupal_alter(array('field_widget_form', 'field_widget_' . $instance['widget']['type'] . '_form'), $element, $form_state, $context);
+
         $field_elements[$delta] = $element;
       }
     }
diff --git a/modules/field/field.info b/modules/field/field.info
index 661d18413ee845ee4a0ca4540f0dafe535ba68a8..faeb72aa7e806d6ceb9aa1077d750f43f009404c 100644
--- a/modules/field/field.info
+++ b/modules/field/field.info
@@ -10,8 +10,8 @@ dependencies[] = field_sql_storage
 required = TRUE
 stylesheets[all][] = theme/field.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field/field.module b/modules/field/field.module
index af9e8c8355a9cfae4abda4454be0aa1c581866fa..d99fcd0d65f53e1fda28fe8b5cc757742d390f6e 100644
--- a/modules/field/field.module
+++ b/modules/field/field.module
@@ -305,13 +305,6 @@ define('FIELD_LOAD_REVISION', 'FIELD_LOAD_REVISION');
  */
 class FieldUpdateForbiddenException extends FieldException {}
 
-/**
- * Implements hook_flush_caches().
- */
-function field_flush_caches() {
-  return array('cache_field');
-}
-
 /**
  * Implements hook_help().
  */
@@ -370,6 +363,7 @@ function field_theme() {
  * Purges some deleted Field API data, if any exists.
  */
 function field_cron() {
+  field_sync_field_status();
   $limit = variable_get('field_purge_batch_size', 10);
   field_purge_batch($limit);
 }
@@ -386,45 +380,84 @@ function field_modules_uninstalled($modules) {
 }
 
 /**
- * Implements hook_modules_enabled().
+ * Implements hook_system_info_alter().
+ *
+ * Goes through a list of all modules that provide a field type, and makes them
+ * required if there are any active fields of that type.
  */
-function field_modules_enabled($modules) {
-  foreach ($modules as $module) {
-    field_associate_fields($module);
+function field_system_info_alter(&$info, $file, $type) {
+  if ($type == 'module' && module_hook($file->name, 'field_info')) {
+    $fields = field_read_fields(array('module' => $file->name), array('include_deleted' => TRUE));
+    if ($fields) {
+      $info['required'] = TRUE;
+
+      // Provide an explanation message (only mention pending deletions if there
+      // remains no actual, non-deleted fields)
+      $non_deleted = FALSE;
+      foreach ($fields as $field) {
+        if (empty($field['deleted'])) {
+          $non_deleted = TRUE;
+          break;
+        }
+      }
+      if ($non_deleted) {
+        if (module_exists('field_ui')) {
+          $explanation = t('Field type(s) in use - see !link', array('!link' => l(t('Field list'), 'admin/reports/fields')));
+        }
+        else {
+          $explanation = t('Fields type(s) in use');
+        }
+      }
+      else {
+        $explanation = t('Fields pending deletion');
+      }
+      $info['explanation'] = $explanation;
+    }
   }
-  field_cache_clear();
 }
 
 /**
- * Implements hook_modules_disabled().
+ * Implements hook_flush_caches().
  */
-function field_modules_disabled($modules) {
-  // Track fields whose field type is being disabled.
+function field_flush_caches() {
+  field_sync_field_status();
+  return array('cache_field');
+}
+
+/**
+ * Refreshes the 'active' and 'storage_active' columns for fields.
+ */
+function field_sync_field_status() {
+  // Refresh the 'active' and 'storage_active' columns according to the current
+  // set of enabled modules.
+  $all_modules = system_rebuild_module_data();
+  $modules = array();
+  foreach ($all_modules as $module_name => $module) {
+    if ($module->status) {
+      $modules[] = $module_name;
+      field_associate_fields($module_name);
+    }
+  }
   db_update('field_config')
     ->fields(array('active' => 0))
-    ->condition('module', $modules, 'IN')
+    ->condition('module', $modules, 'NOT IN')
     ->execute();
-
-  // Track fields whose storage backend is being disabled.
   db_update('field_config')
     ->fields(array('storage_active' => 0))
-    ->condition('storage_module', $modules, 'IN')
+    ->condition('storage_module', $modules, 'NOT IN')
     ->execute();
-
-  field_cache_clear();
 }
 
 /**
  * Allows a module to update the database for fields and columns it controls.
  *
- * @param string $module
+ * @param $module
  *   The name of the module to update on.
  */
 function field_associate_fields($module) {
   // Associate field types.
-  $field_types =(array) module_invoke($module, 'field_info');
+  $field_types = (array) module_invoke($module, 'field_info');
   foreach ($field_types as $name => $field_info) {
-    watchdog('field', 'Updating field type %type with module %module.', array('%type' => $name, '%module' => $module));
     db_update('field_config')
       ->fields(array('module' => $module, 'active' => 1))
       ->condition('type', $name)
@@ -433,7 +466,6 @@ function field_associate_fields($module) {
   // Associate storage backends.
   $storage_types = (array) module_invoke($module, 'field_storage_info');
   foreach ($storage_types as $name => $storage_info) {
-    watchdog('field', 'Updating field storage %type with module %module.', array('%type' => $name, '%module' => $module));
     db_update('field_config')
       ->fields(array('storage_module' => $module, 'storage_active' => 1))
       ->condition('storage_type', $name)
@@ -1176,31 +1208,37 @@ function theme_field($variables) {
 }
 
 /**
- * Helper form element validator: integer.
+ * DEPRECATED: Helper form element validator: integer.
+ *
+ * Use element_validate_integer() instead.
+ *
+ * @deprecated
+ * @see element_validate_integer()
  */
 function _element_validate_integer($element, &$form_state) {
-  $value = $element['#value'];
-  if ($value !== '' && (!is_numeric($value) || intval($value) != $value)) {
-    form_error($element, t('%name must be an integer.', array('%name' => $element['#title'])));
-  }
+  element_validate_integer($element, $form_state);
 }
 
 /**
- * Helper form element validator: integer > 0.
+ * DEPRECATED: Helper form element validator: integer > 0.
+ *
+ * Use element_validate_integer_positive() instead.
+ *
+ * @deprecated
+ * @see element_validate_number_positive()
  */
 function _element_validate_integer_positive($element, &$form_state) {
-  $value = $element['#value'];
-  if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value <= 0)) {
-    form_error($element, t('%name must be a positive integer.', array('%name' => $element['#title'])));
-  }
+  element_validate_integer_positive($element, $form_state);
 }
 
 /**
- * Helper form element validator: number.
+ * DEPRECATED: Helper form element validator: number.
+ *
+ * Use element_validate_number() instead.
+ *
+ * @deprecated
+ * @see element_validate_number()
  */
 function _element_validate_number($element, &$form_state) {
-  $value = $element['#value'];
-  if ($value != '' && !is_numeric($value)) {
-    form_error($element, t('%name must be a number.', array('%name' => $element['#title'])));
-  }
+  element_validate_number($element, $form_state);
 }
diff --git a/modules/field/modules/field_sql_storage/field_sql_storage.info b/modules/field/modules/field_sql_storage/field_sql_storage.info
index 95e8bb71bfc0368aff80d0d3f614823cdebd8cea..537bc675a0e48f987860839566953e67e0a2bbc3 100644
--- a/modules/field/modules/field_sql_storage/field_sql_storage.info
+++ b/modules/field/modules/field_sql_storage/field_sql_storage.info
@@ -7,8 +7,8 @@ dependencies[] = field
 files[] = field_sql_storage.test
 required = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field/modules/list/list.info b/modules/field/modules/list/list.info
index 2905a0a14ccc8bf932b62d098309f9486bbb8d45..9431ee62fcfb406941260725ef2ae4262f6c128c 100644
--- a/modules/field/modules/list/list.info
+++ b/modules/field/modules/list/list.info
@@ -7,8 +7,8 @@ dependencies[] = field
 dependencies[] = options
 files[] = tests/list.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field/modules/list/tests/list_test.info b/modules/field/modules/list/tests/list_test.info
index 52d03ff3b9e7d38c430ccde31e8ad999cbe5916b..86bec875a1507bde5104a63d829df8bbd3628577 100644
--- a/modules/field/modules/list/tests/list_test.info
+++ b/modules/field/modules/list/tests/list_test.info
@@ -5,8 +5,8 @@ package = Testing
 version = VERSION
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field/modules/number/number.info b/modules/field/modules/number/number.info
index 248010337d74e33292c3bd16d44242b96911c0bb..a716f1363e37e3c74faf6d3938dbb0ed2830d187 100644
--- a/modules/field/modules/number/number.info
+++ b/modules/field/modules/number/number.info
@@ -6,8 +6,8 @@ core = 7.x
 dependencies[] = field
 files[] = number.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field/modules/number/number.module b/modules/field/modules/number/number.module
index 3c8132cb31e404d9fa4432be3cc6675bd007fbbd..fd536730836f5821123e4f682a466de40f15558b 100644
--- a/modules/field/modules/number/number.module
+++ b/modules/field/modules/number/number.module
@@ -98,14 +98,14 @@ function number_field_instance_settings_form($field, $instance) {
     '#title' => t('Minimum'),
     '#default_value' => $settings['min'],
     '#description' => t('The minimum value that should be allowed in this field. Leave blank for no minimum.'),
-    '#element_validate' => array('_element_validate_number'),
+    '#element_validate' => array('element_validate_number'),
   );
   $form['max'] = array(
     '#type' => 'textfield',
     '#title' => t('Maximum'),
     '#default_value' => $settings['max'],
     '#description' => t('The maximum value that should be allowed in this field. Leave blank for no maximum.'),
-    '#element_validate' => array('_element_validate_number'),
+    '#element_validate' => array('element_validate_number'),
   );
   $form['prefix'] = array(
     '#type' => 'textfield',
diff --git a/modules/field/modules/options/options.info b/modules/field/modules/options/options.info
index fa1b32f36bed0d2aaf344192e3053a269a730b81..ccd8ae50bf5a8b58871ac1fc24901f0dc5922c51 100644
--- a/modules/field/modules/options/options.info
+++ b/modules/field/modules/options/options.info
@@ -6,8 +6,8 @@ core = 7.x
 dependencies[] = field
 files[] = options.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field/modules/text/text.info b/modules/field/modules/text/text.info
index ce426a0c4e4a20e19bd21414dcb164035609bf14..e8cb4238fed01c20ed0af5c356acfbca3c3a347f 100644
--- a/modules/field/modules/text/text.info
+++ b/modules/field/modules/text/text.info
@@ -7,8 +7,8 @@ dependencies[] = field
 files[] = text.test
 required = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field/modules/text/text.install b/modules/field/modules/text/text.install
index b9bd25f19932640b6e9d6bb878af5c78b43fd208..61be748ac4055f30b7fff2aca8fb9ed70ab699a2 100644
--- a/modules/field/modules/text/text.install
+++ b/modules/field/modules/text/text.install
@@ -66,19 +66,6 @@ function text_field_schema($field) {
   );
 }
 
-/**
- * Implements hook_update_dependencies().
- */
-function text_update_dependencies() {
-  // Ensure that format columns are only changed after Filter module has changed
-  // the primary records.
-  $dependencies['text'][7000] = array(
-    'filter' => 7010,
-  );
-
-  return $dependencies;
-}
-
 /**
  * Change text field 'format' columns into varchar.
  */
diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module
index 89c605cf2c046eb48d448e20d27a63ef88a8583f..d73814faaafa007f2f13499616ecd17edcf24b7f 100644
--- a/modules/field/modules/text/text.module
+++ b/modules/field/modules/text/text.module
@@ -71,7 +71,7 @@ function text_field_settings_form($field, $instance, $has_data) {
       '#default_value' => $settings['max_length'],
       '#required' => TRUE,
       '#description' => t('The maximum length of the field in characters.'),
-      '#element_validate' => array('_element_validate_integer_positive'),
+      '#element_validate' => array('element_validate_integer_positive'),
       // @todo: If $has_data, add a validate handler that only allows
       // max_length to increase.
       '#disabled' => $has_data,
@@ -227,7 +227,7 @@ function text_field_formatter_settings_form($field, $instance, $view_mode, $form
       '#type' => 'textfield',
       '#size' => 10,
       '#default_value' => $settings['trim_length'],
-      '#element_validate' => array('_element_validate_integer_positive'),
+      '#element_validate' => array('element_validate_integer_positive'),
       '#required' => TRUE,
     );
   }
@@ -480,7 +480,7 @@ function text_field_widget_settings_form($field, $instance) {
       '#title' => t('Size of textfield'),
       '#default_value' => $settings['size'],
       '#required' => TRUE,
-      '#element_validate' => array('_element_validate_integer_positive'),
+      '#element_validate' => array('element_validate_integer_positive'),
     );
   }
   else {
@@ -489,7 +489,7 @@ function text_field_widget_settings_form($field, $instance) {
       '#title' => t('Rows'),
       '#default_value' => $settings['rows'],
       '#required' => TRUE,
-      '#element_validate' => array('_element_validate_integer_positive'),
+      '#element_validate' => array('element_validate_integer_positive'),
     );
   }
 
diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test
index ebb1c9f9194f5ed3e14afc60a118b2ce1e62ce9c..669fc37cf44104ca07fe06a2ae6e9a5fa34f9ac2 100644
--- a/modules/field/tests/field.test
+++ b/modules/field/tests/field.test
@@ -2356,6 +2356,7 @@ class FieldCrudTestCase extends FieldTestCase {
     $this->assertTrue($field_definition <= $field, t('The field was properly read.'));
 
     module_disable($modules, FALSE);
+    drupal_flush_all_caches();
 
     $fields = field_read_fields(array('field_name' => $field_name), array('include_inactive' => TRUE));
     $this->assertTrue(isset($fields[$field_name]) && $field_definition < $field, t('The field is properly read when explicitly fetching inactive fields.'));
@@ -2368,6 +2369,7 @@ class FieldCrudTestCase extends FieldTestCase {
 
       $module = array_shift($modules);
       module_enable(array($module), FALSE);
+      drupal_flush_all_caches();
     }
 
     // Check that the field is active again after all modules have been
diff --git a/modules/field/tests/field_test.info b/modules/field/tests/field_test.info
index 349814aeab35faa2e0e096768754e9e5ed23f6b9..1b9d5617b2ee90b87cd01cd95db96f16554f2c6e 100644
--- a/modules/field/tests/field_test.info
+++ b/modules/field/tests/field_test.info
@@ -6,8 +6,8 @@ files[] = field_test.entity.inc
 version = VERSION
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc
index b594faca3d81ac98b22b55dcda2d8959c165ff6e..828d64ca865d44a0806f4ff129edde7ad598548b 100644
--- a/modules/field_ui/field_ui.admin.inc
+++ b/modules/field_ui/field_ui.admin.inc
@@ -12,17 +12,27 @@ function field_ui_fields_list() {
   $instances = field_info_instances();
   $field_types = field_info_field_types();
   $bundles = field_info_bundles();
+
+  $modules = system_rebuild_module_data();
+
   $header = array(t('Field name'), t('Field type'), t('Used in'));
   $rows = array();
   foreach ($instances as $entity_type => $type_bundles) {
     foreach ($type_bundles as $bundle => $bundle_instances) {
       foreach ($bundle_instances as $field_name => $instance) {
         $field = field_info_field($field_name);
+
+        // Initialize the row if we encounter the field for the first time.
+        if (!isset($rows[$field_name])) {
+          $rows[$field_name]['class'] = $field['locked'] ? array('menu-disabled') : array('');
+          $rows[$field_name]['data'][0] = $field['locked'] ? t('@field_name (Locked)', array('@field_name' => $field_name)) : $field_name;
+          $module_name = $field_types[$field['type']]['module'];
+          $rows[$field_name]['data'][1] = $field_types[$field['type']]['label'] . ' ' . t('(module: !module)', array('!module' => $modules[$module_name]->info['name']));
+        }
+
+        // Add the current instance.
         $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle);
-        $rows[$field_name]['data'][0] = $field['locked'] ? t('@field_name (Locked)', array('@field_name' => $field_name)) : $field_name;
-        $rows[$field_name]['data'][1] = $field_types[$field['type']]['label'];
         $rows[$field_name]['data'][2][] = $admin_path ? l($bundles[$entity_type][$bundle]['label'], $admin_path . '/fields') : $bundles[$entity_type][$bundle]['label'];
-        $rows[$field_name]['class'] = $field['locked'] ? array('menu-disabled') : array('');
       }
     }
   }
@@ -1717,6 +1727,14 @@ function field_ui_field_delete_form_submit($form, &$form_state) {
 
   $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle);
   $form_state['redirect'] = field_ui_get_destinations(array($admin_path . '/fields'));
+
+  // Fields are purged on cron. However field module prevents disabling modules
+  // when field types they provided are used in a field until it is fully
+  // purged. In the case that a field has minimal or no content, a single call
+  // to field_purge_batch() will remove it from the system. Call this with a
+  // low batch limit to avoid administrators having to wait for cron runs when
+  // removing instances that meet this criteria.
+  field_purge_batch(10);
 }
 
 /**
diff --git a/modules/field_ui/field_ui.api.php b/modules/field_ui/field_ui.api.php
index e07a9373df33fa1fb86e13facadbee2b1a5fdf78..b6446520a549b516ecb376fd12abac10206bb441 100644
--- a/modules/field_ui/field_ui.api.php
+++ b/modules/field_ui/field_ui.api.php
@@ -42,7 +42,7 @@ function hook_field_settings_form($field, $instance, $has_data) {
     '#title' => t('Maximum length'),
     '#default_value' => $settings['max_length'],
     '#required' => FALSE,
-    '#element_validate' => array('_element_validate_integer_positive'),
+    '#element_validate' => array('element_validate_integer_positive'),
     '#description' => t('The maximum length of the field in characters. Leave blank for an unlimited size.'),
   );
   return $form;
@@ -113,7 +113,7 @@ function hook_field_widget_settings_form($field, $instance) {
       '#type' => 'textfield',
       '#title' => t('Size of textfield'),
       '#default_value' => $settings['size'],
-      '#element_validate' => array('_element_validate_integer_positive'),
+      '#element_validate' => array('element_validate_integer_positive'),
       '#required' => TRUE,
     );
   }
@@ -122,7 +122,7 @@ function hook_field_widget_settings_form($field, $instance) {
       '#type' => 'textfield',
       '#title' => t('Rows'),
       '#default_value' => $settings['rows'],
-      '#element_validate' => array('_element_validate_integer_positive'),
+      '#element_validate' => array('element_validate_integer_positive'),
       '#required' => TRUE,
     );
   }
@@ -160,7 +160,7 @@ function hook_field_formatter_settings_form($field, $instance, $view_mode, $form
       '#type' => 'textfield',
       '#size' => 20,
       '#default_value' => $settings['trim_length'],
-      '#element_validate' => array('_element_validate_integer_positive'),
+      '#element_validate' => array('element_validate_integer_positive'),
       '#required' => TRUE,
     );
   }
diff --git a/modules/field_ui/field_ui.info b/modules/field_ui/field_ui.info
index bf5f535e72f5d038ec822614e71fcbdeb3609312..1c494d2a3b01eab847ee90622fd80cc9674690d4 100644
--- a/modules/field_ui/field_ui.info
+++ b/modules/field_ui/field_ui.info
@@ -6,8 +6,8 @@ core = 7.x
 dependencies[] = field
 files[] = field_ui.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/file/file.info b/modules/file/file.info
index d91af6a1c9e0a5d4bfbaf7c156debc4a6b302bdf..bbfe41cd43c2e0a947f12d62eb21ccdd68c72fb9 100644
--- a/modules/file/file.info
+++ b/modules/file/file.info
@@ -6,8 +6,8 @@ core = 7.x
 dependencies[] = field
 files[] = tests/file.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test
index 0e5f97d84bb39b273e475a8ab023f791e3460b59..ef250eff9fb25df1a251a6696793e0b8212f5f03 100644
--- a/modules/file/tests/file.test
+++ b/modules/file/tests/file.test
@@ -1104,6 +1104,6 @@ class FilePrivateTestCase extends FileFieldTestCase {
     $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
     $this->drupalLogOut();
     $this->drupalGet(file_create_url($node_file->uri));
-    $this->assertNoResponse(200, t('Confirmed that access is denied for the file without the needed permission.'));
+    $this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.'));
   }
 }
diff --git a/modules/file/tests/file_module_test.info b/modules/file/tests/file_module_test.info
index a51ea6900f3d6b8688dd445c6ce32136d1811e02..f23164393c7018d9cf8480907ce115ca7bfd1375 100644
--- a/modules/file/tests/file_module_test.info
+++ b/modules/file/tests/file_module_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/filter/filter.info b/modules/filter/filter.info
index 33fe235d424ebed17585b5a7a07aa87498c72de3..aa47cb5de8970d42b735c54d7d5e2628a034721b 100644
--- a/modules/filter/filter.info
+++ b/modules/filter/filter.info
@@ -7,8 +7,8 @@ files[] = filter.test
 required = TRUE
 configure = admin/config/content/formats
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/filter/filter.install b/modules/filter/filter.install
index 84512cd589f404b61d4903e7dc4af8d7e13fd188..19fd8aa18297a18294e2294fae3b139607d07814 100644
--- a/modules/filter/filter.install
+++ b/modules/filter/filter.install
@@ -152,8 +152,9 @@ function filter_install() {
  * Implements hook_update_dependencies().
  */
 function filter_update_dependencies() {
-  // Filter update 7007 migrates permissions and therefore needs to run after
-  // the {role} table is properly set up.
+  // filter_update_7005() migrates role permissions and therefore must run
+  // after the {role} and {role_permission} tables are properly set up, which
+  // happens in user_update_7007().
   $dependencies['filter'][7005] = array(
     'user' => 7007,
   );
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 66fadcba74f2d8650c4da08f76929ef9d0feb7e8..9e1481207cdcdee02bd04fb43df9accb1712085e 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -671,7 +671,8 @@ function filter_list_format($format_id) {
 
   if (!isset($filters[$format_id])) {
     $format_filters = array();
-    foreach ($filters['all'][$format_id] as $name => $filter) {
+    $filter_map = isset($filters['all'][$format_id]) ? $filters['all'][$format_id] : array();
+    foreach ($filter_map as $name => $filter) {
       if (isset($filter_info[$name])) {
         $filter->title = $filter_info[$name]['title'];
         // Unpack stored filter settings.
@@ -759,9 +760,12 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE)
     }
   }
 
-  // Store in cache with a minimum expiration time of 1 day.
+  // Cache the filtered text. This cache is infinitely valid. It becomes
+  // obsolete when $text changes (which leads to a new $cache_id). It is
+  // automatically flushed when the text format is updated.
+  // @see filter_format_save()
   if ($cache) {
-    cache_set($cache_id, $text, 'cache_filter', REQUEST_TIME + (60 * 60 * 24));
+    cache_set($cache_id, $text, 'cache_filter');
   }
 
   return $text;
diff --git a/modules/forum/forum-list.tpl.php b/modules/forum/forum-list.tpl.php
index bc0935f888234303ebc034fa2dc6ba88ee52b5c0..257cea947d944a61b381070f7c52166407eb0665 100644
--- a/modules/forum/forum-list.tpl.php
+++ b/modules/forum/forum-list.tpl.php
@@ -15,6 +15,8 @@
  *   FALSE if the forum can contain only topics.
  * - $forum->depth: How deep the forum is in the current hierarchy.
  * - $forum->zebra: 'even' or 'odd' string used for row class.
+ * - $forum->icon_class: 'default' or 'new' string used for forum icon class.
+ * - $forum->icon_title: Text alternative for the forum icon.
  * - $forum->name: The name of the forum.
  * - $forum->link: The URL to link to this forum.
  * - $forum->description: The description of this forum.
@@ -48,6 +50,9 @@
                * left-margin for indenting.
                */ ?>
         <?php print str_repeat('<div class="indent">', $forum->depth); ?>
+          <div class="icon forum-status-<?php print $forum->icon_class; ?>" title="<?php print $forum->icon_title; ?>">
+            <span class="element-invisible"><?php print $forum->icon_title; ?></span>
+          </div>
           <div class="name"><a href="<?php print $forum->link; ?>"><?php print $forum->name; ?></a></div>
           <?php if ($forum->description): ?>
             <div class="description"><?php print $forum->description; ?></div>
diff --git a/modules/forum/forum-rtl.css b/modules/forum/forum-rtl.css
index d31c9e7f372effc98e105a292391979a28ce300e..81dd4d39606a7a2dbc443f0fa484f4835804c18c 100644
--- a/modules/forum/forum-rtl.css
+++ b/modules/forum/forum-rtl.css
@@ -1,8 +1,7 @@
 
-#forum tr td.forum {
-  padding-left: 0.5em;
-  padding-right: 25px;
-  background-position: 98% 2px;
+#forum td.forum .icon {
+  float: right;
+  margin: 0 0 0 9px;
 }
 .forum-topic-navigation {
   padding: 1em 3em 0 0;
diff --git a/modules/forum/forum.css b/modules/forum/forum.css
index 3f3ed98481ce779676bbf7dc6a7d44964afc7fed..4a67c8bcdab26b8e7209491389684ca911389cc4 100644
--- a/modules/forum/forum.css
+++ b/modules/forum/forum.css
@@ -11,15 +11,19 @@
 #forum td.pager {
   white-space: nowrap;
 }
-#forum tr td.forum {
-  padding-left: 25px; /* LTR */
-  background-position: 2px 2px; /* LTR */
-  background-image: url(../../misc/forum-default.png);
+
+#forum td.forum .icon {
+  background-image: url(../../misc/forum-icons.png);
   background-repeat: no-repeat;
+  float: left; /* LTR */
+  height: 24px;
+  margin: 0 9px 0 0; /* LTR */
+  width: 24px;
 }
-#forum tr.new-topics td.forum {
-  background-image: url(../../misc/forum-new.png);
+#forum td.forum .forum-status-new {
+  background-position: -24px 0;
 }
+
 #forum div.indent {
   margin-left: 20px;
 }
diff --git a/modules/forum/forum.info b/modules/forum/forum.info
index 85e7daca610f4a5f83a2b0cf402ecc833e03ef35..f0049e39e7c6189c112efdd38124c9184ff52f42 100644
--- a/modules/forum/forum.info
+++ b/modules/forum/forum.info
@@ -9,8 +9,8 @@ files[] = forum.test
 configure = admin/structure/forum
 stylesheets[all][] = forum.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/forum/forum.install b/modules/forum/forum.install
index 60c40879371dd3a5ad4fa9ae5b2d6e7d7757dccf..1bed2e34ce1b973279beb0dc295a59e631035918 100644
--- a/modules/forum/forum.install
+++ b/modules/forum/forum.install
@@ -113,6 +113,11 @@ function forum_uninstall() {
   variable_del('forum_block_num_active');
   variable_del('forum_block_num_new');
   variable_del('node_options_forum');
+
+  field_delete_field('taxonomy_forums');
+  // Purge field data now to allow taxonomy module to be uninstalled
+  // if this is the only field remaining.
+  field_purge_batch(10);
 }
 
 /**
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index c58b5c905e9b7ca8675160ce0f4365de8e58699d..5bb43925bc55a9f10bb2f989053f9cb00d4b63fd 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -370,7 +370,7 @@ function forum_node_update($node) {
     }
     // If the node has a shadow forum topic, update the record for this
     // revision.
-    if ($node->shadow) {
+    if (!empty($node->shadow)) {
       db_delete('forum')
         ->condition('nid', $node->nid)
         ->condition('vid', $node->vid)
@@ -1064,11 +1064,15 @@ function template_preprocess_forum_list(&$variables) {
     $variables['forums'][$id]->new_url = '';
     $variables['forums'][$id]->new_topics = 0;
     $variables['forums'][$id]->old_topics = $forum->num_topics;
+    $variables['forums'][$id]->icon_class = 'default';
+    $variables['forums'][$id]->icon_title = t('No new posts');
     if ($user->uid) {
       $variables['forums'][$id]->new_topics = _forum_topics_unread($forum->tid, $user->uid);
       if ($variables['forums'][$id]->new_topics) {
         $variables['forums'][$id]->new_text = format_plural($variables['forums'][$id]->new_topics, '1 new', '@count new');
         $variables['forums'][$id]->new_url = url("forum/$forum->tid", array('fragment' => 'new'));
+        $variables['forums'][$id]->icon_class = 'new';
+        $variables['forums'][$id]->icon_title = t('New posts');
       }
       $variables['forums'][$id]->old_topics = $forum->num_topics - $variables['forums'][$id]->new_topics;
     }
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index 1dc45c6fdf61b4d13b81acd5b4ec41afdb268532..c7c3d9c1b8c2e2327273874a1ed0d55f671afe34 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -31,6 +31,7 @@ class ForumTestCase extends DrupalWebTestCase {
     // Create users.
     $this->admin_user = $this->drupalCreateUser(array(
       'access administration pages',
+      'administer modules',
       'administer blocks',
       'administer forums',
       'administer menu',
@@ -51,6 +52,30 @@ class ForumTestCase extends DrupalWebTestCase {
     $this->web_user = $this->drupalCreateUser(array());
   }
 
+  /**
+   * Tests disabling and re-enabling forum.
+   */
+  function testEnableForumField() {
+    $this->drupalLogin($this->admin_user);
+
+    // Disable the forum module.
+    $edit = array();
+    $edit['modules[Core][forum][enable]'] = FALSE;
+    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
+    $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
+    module_list(TRUE);
+    $this->assertFalse(module_exists('forum'), t('Forum module is not enabled.'));
+
+    // Attempt to re-enable the forum module and ensure it does not try to
+    // recreate the taxonomy_forums field.
+    $edit = array();
+    $edit['modules[Core][forum][enable]'] = 'forum';
+    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
+    $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
+    module_list(TRUE);
+    $this->assertTrue(module_exists('forum'), t('Forum module is enabled.'));
+  }
+
   /**
    * Login users, create forum nodes, and test forum functionality through the admin and user interfaces.
    */
diff --git a/modules/help/help.info b/modules/help/help.info
index b6db9d2e2c0449c6f1ae440daad0457d39af06c5..9b61bc5fcef17aa337294ef8f2b657c947be90fd 100644
--- a/modules/help/help.info
+++ b/modules/help/help.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 files[] = help.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/image/image.field.inc b/modules/image/image.field.inc
index 535cde5a08aa092312f92c10d2c521ef7ac51234..e3f81e3afd790b04d069b6aee6da725a33782002 100644
--- a/modules/image/image.field.inc
+++ b/modules/image/image.field.inc
@@ -553,7 +553,7 @@ function theme_image_formatter($variables) {
     $output = theme('image', $image);
   }
 
-  if ($variables['path']) {
+  if (!empty($variables['path']['path'])) {
     $path = $variables['path']['path'];
     $options = $variables['path']['options'];
     // When displaying an image inside a link, the html option must be TRUE.
diff --git a/modules/image/image.info b/modules/image/image.info
index 830c0a1962687c7241decd8bd05af47b67710fcb..421ec641c32ac3551916ffe243af8c04e4f47ace 100644
--- a/modules/image/image.info
+++ b/modules/image/image.info
@@ -7,8 +7,8 @@ dependencies[] = file
 files[] = image.test
 configure = admin/config/media/image-styles
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/image/tests/image_module_test.info b/modules/image/tests/image_module_test.info
index 7d851117ee9aee8291cb8d5286a0f50be7176d13..d2d6bdbee376225155f13ecc0d955c56d9f6ddfd 100644
--- a/modules/image/tests/image_module_test.info
+++ b/modules/image/tests/image_module_test.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = image_module_test.module
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/locale/locale.info b/modules/locale/locale.info
index 6a62bb7fec868f35eea3e35c5f94f3d41c641d3a..d882431f74b66181cad4fc3a02e2dad0425d3d34 100644
--- a/modules/locale/locale.info
+++ b/modules/locale/locale.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = locale.test
 configure = admin/config/regional/language
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/locale/tests/locale_test.info b/modules/locale/tests/locale_test.info
index f966df08d70b61b817afa59d81db7f287beb000a..f0ed78d7370aaefc468566d97dd571b3774554c2 100644
--- a/modules/locale/tests/locale_test.info
+++ b/modules/locale/tests/locale_test.info
@@ -5,8 +5,8 @@ package = Testing
 version = VERSION
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/menu/menu.info b/modules/menu/menu.info
index 88eab9657c2f9a17c451498520068b13f1e0aca9..8447f879d173713c6d5e08b87b11b64ef018550a 100644
--- a/modules/menu/menu.info
+++ b/modules/menu/menu.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = menu.test
 configure = admin/structure/menu
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/menu/menu.install b/modules/menu/menu.install
index 13cb3cb50415e6e96a150490eedee74ef836ee42..3b75ad436ef5c605ae3fdc190b11c9bf84c901f0 100644
--- a/modules/menu/menu.install
+++ b/modules/menu/menu.install
@@ -120,6 +120,8 @@ function menu_update_7001() {
   }
 
   // Rename each menu, and any settings that refer to the old menu name.
+  // - "Primary Links" has become system menu "Main menu".
+  // - "Secondary Links" has become a new custom menu "Secondary menu".
   $rename = array(
     'primary-links' => array('main-menu', 'Main menu'),
     'secondary-links' => array('secondary-menu', 'Secondary menu'),
@@ -160,6 +162,23 @@ function menu_update_7001() {
   }
 }
 
+/**
+ * Rename the primary/secondary menu blocks to match previously renamed menus.
+ */
+function menu_update_7002(&$sandbox) {
+  $renamed_deltas = array(
+    'menu' => array(
+      'primary-links' => 'main-menu',
+      'secondary-links' => 'secondary-menu',
+    ),
+  );
+
+  $moved_deltas = array(
+    'menu' => array('main-menu' => 'system'),
+  );
+
+  update_fix_d7_block_deltas($sandbox, $renamed_deltas, $moved_deltas);
+}
 /**
  * @} End of "defgroup updates-7.x-extra"
  * The next series of updates should start at 8000.
diff --git a/modules/node/node.info b/modules/node/node.info
index bb9b933d9cf31eeac1c4381092262990b2f60aae..ab6119d53be1a3ba212119ed1db99250ca61e4c1 100644
--- a/modules/node/node.info
+++ b/modules/node/node.info
@@ -9,8 +9,8 @@ required = TRUE
 configure = admin/structure/types
 stylesheets[all][] = node.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/node/node.install b/modules/node/node.install
index 2498091fc533896ac2e885235a5d50e6ffc41d8c..a1f77bb0ff0b62e49d8d96494fce99210d038b56 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -447,17 +447,23 @@ function node_install() {
  * Implements hook_update_dependencies().
  */
 function node_update_dependencies() {
-  // Node update 7006 migrates node data to fields and therefore must run after
-  // the Field module has been enabled, but before upgrading field data.
+  // node_update_7006() migrates node data to fields and therefore must run
+  // after all Field modules have been enabled, which happens in
+  // system_update_7027(). It also needs to query the {filter_format} table to
+  // get a list of existing text formats, so it must run after
+  // filter_update_7000(), which creates that table.
   $dependencies['node'][7006] = array(
-    'system' => 7049,
-    // It must also run after filter_update_7000() because it needs to query
-    // the list of existing text formats.
+    'system' => 7027,
     'filter' => 7000,
   );
-  $dependencies['system'][7050] = array(
-    'node' => 7006,
+
+  // node_update_7008() migrates role permissions and therefore must run after
+  // the {role} and {role_permission} tables are properly set up, which happens
+  // in user_update_7007().
+  $dependencies['node'][7008] = array(
+    'user' => 7007,
   );
+
   return $dependencies;
 }
 
@@ -610,6 +616,7 @@ function node_update_7006(&$sandbox) {
       'module' => 'text',
       'cardinality' => 1,
       'entity_types' => array('node'),
+      'translatable' => TRUE,
     );
     _update_7000_field_create_field($body_field);
 
@@ -860,6 +867,38 @@ function node_update_7011() {
   ));
 }
 
+/**
+ * Switches body fields to untranslatable while upgrading from D6 and makes them language neutral.
+ */
+function node_update_7012() {
+  // If we are upgrading from D6, then body fields should be set back to
+  // untranslatable, as D6 did not know about the idea of translating fields,
+  // but only nodes. If a D7 > D7 update is running we need to skip this update,
+  // as it is a valid use case to have translatable body fields in this context.
+  if (variable_get('update_d6', FALSE)) {
+    // Make node bodies untranslatable: field_update_field() cannot be used
+    // throughout the upgrade process and we do not have an update counterpart
+    // for _update_7000_field_create_field(). Hence we are forced to update the
+    // 'field_config' table directly. This is a safe operation since it is
+    // being performed while upgrading from D6. Perfoming the same operation
+    // during a D7 update is highly discouraged.
+    db_update('field_config')
+      ->fields(array('translatable' => 0))
+      ->condition('field_name', 'body')
+      ->execute();
+
+    // Switch field languages to LANGUAGE_NONE, since initially they were
+    // assigned $node->language.
+    foreach (array('field_data_body', 'field_revision_body') as $table) {
+      db_update($table)
+        ->fields(array('language' => LANGUAGE_NONE))
+        ->execute();
+    }
+
+    node_type_cache_reset();
+  }
+}
+
 /**
  * @} End of "addtogroup updates-6.x-to-7.x"
  */
diff --git a/modules/node/node.module b/modules/node/node.module
index 6c32a279900fd6556f092bdf1667f154d7e266d9..6abfcb22e435f08216aa164067760a3f671e2be8 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -2075,6 +2075,15 @@ function node_page_title($node) {
   return $node->title;
 }
 
+/**
+ * Finds the last time a node was changed.
+ *
+ * @param $nid
+ *   The ID of a node.
+ *
+ * @return
+ *   A unix timestamp indicating the last time the node was changed.
+ */
 function node_last_changed($nid) {
   return db_query('SELECT changed FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetch()->changed;
 }
@@ -2785,8 +2794,9 @@ function node_search_validate($form, &$form_state) {
  * hook_node_access() is not called on each node for performance reasons and for
  * proper functioning of the pager system. When adding a node listing to your
  * module, be sure to use a dynamic query created by db_select() and add a tag
- * of "node_access" to ensure that only nodes to which the user has access
- * are retrieved.
+ * of "node_access". This will allow modules dealing with node access to ensure
+ * only nodes to which the user has access are retrieved, through the use of
+ * hook_query_TAG_alter().
  *
  * Note: Even a single module returning NODE_ACCESS_DENY from hook_node_access()
  * will block access to the node. Therefore, implementers should take care to
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index ed1af3e9bfd9d72e227a971b3f441f7fee70946a..019ed3e8cc900c4291502c1f0e268ae3d0b75b06 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -7,7 +7,7 @@
 
 
 /**
- * Menu callback; presents the node editing form, or redirects to delete confirmation.
+ * Menu callback; presents the node editing form.
  */
 function node_page_edit($node) {
   $type_name = node_type_get_name($node);
diff --git a/modules/node/tests/node_access_test.info b/modules/node/tests/node_access_test.info
index 0c4815d302f6816df714f848f5837e58f66371a1..ee4b44ff64be2cde4ae3d39dfa5db702219b85ea 100644
--- a/modules/node/tests/node_access_test.info
+++ b/modules/node/tests/node_access_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/node/tests/node_test.info b/modules/node/tests/node_test.info
index 1499a40ba827ab97d763adbd0f912000392e1769..ce4932f40ad3ea354e302025fbb74fc77aaf69f6 100644
--- a/modules/node/tests/node_test.info
+++ b/modules/node/tests/node_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/node/tests/node_test_exception.info b/modules/node/tests/node_test_exception.info
index c49c0b95ecebcbeab541c0f482f6f6e3a9153883..01ee778c5febc3d631848040c97680700619747f 100644
--- a/modules/node/tests/node_test_exception.info
+++ b/modules/node/tests/node_test_exception.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/openid/openid.info b/modules/openid/openid.info
index 5f3f9152d798a74df510762666e69c8c00d76036..69ac0437d2092a775c6d655ab33cfa8ef9d07de6 100644
--- a/modules/openid/openid.info
+++ b/modules/openid/openid.info
@@ -5,8 +5,8 @@ package = Core
 core = 7.x
 files[] = openid.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/openid/tests/openid_test.info b/modules/openid/tests/openid_test.info
index 8652d3a0ec1be43ff67287e6107a350800491c83..08876947f9dd16db3f505b97f98e2e59a36697be 100644
--- a/modules/openid/tests/openid_test.info
+++ b/modules/openid/tests/openid_test.info
@@ -6,8 +6,8 @@ core = 7.x
 dependencies[] = openid
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/overlay/images/close-rtl.png b/modules/overlay/images/close-rtl.png
new file mode 100644
index 0000000000000000000000000000000000000000..ae05d11140b8236de673cdd06bfffcc7f3553cfa
Binary files /dev/null and b/modules/overlay/images/close-rtl.png differ
diff --git a/modules/overlay/overlay-child-rtl.css b/modules/overlay/overlay-child-rtl.css
new file mode 100644
index 0000000000000000000000000000000000000000..8d90fab2af530fe01ad598160522fdf7114f9bd4
--- /dev/null
+++ b/modules/overlay/overlay-child-rtl.css
@@ -0,0 +1,35 @@
+
+html {
+  direction: rtl;
+}
+
+#overlay-title {
+  float: right;
+  left: auto;
+}
+#overlay {
+  padding: 0.2em;
+  padding-left: 26px;
+}
+#overlay-close-wrapper {
+  left: 0;
+  right: auto;
+}
+#overlay-close,
+#overlay-close:hover {
+  background: transparent url(images/close-rtl.png) no-repeat;
+  -moz-border-radius-topright: 0;
+  -webkit-border-top-right-radius: 0;
+  border-top-right-radius: 0;
+}
+
+/**
+ * Tabs on the overlay.
+ */
+#overlay-tabs {
+  left: 20px;
+  right: auto;
+}
+#overlay-tabs li {
+  margin: 0 -3px 0 O;
+}
diff --git a/modules/overlay/overlay-child.css b/modules/overlay/overlay-child.css
index a832fc8c2a310a74959e84eac9213eb9023159a0..d31952e594d515310b83812dc6f87685b676397e 100644
--- a/modules/overlay/overlay-child.css
+++ b/modules/overlay/overlay-child.css
@@ -17,7 +17,7 @@ html.js body {
   min-width: 700px;
   position: relative;
   padding: .2em;
-  padding-right: 26px;
+  padding-right: 26px; /* LTR */
   width: 88%;
 }
 #overlay-titlebar {
@@ -39,7 +39,7 @@ html.js body {
 }
 #overlay-title {
   color: #fff;
-  float: left;
+  float: left; /* LTR */
   font-size: 20px;
   margin: 0;
   padding: 0.3em 0;
@@ -58,14 +58,14 @@ html.js body {
 
 #overlay-close-wrapper {
   position: absolute;
-  right: 0;
+  right: 0; /* LTR */
 }
 #overlay-close,
 #overlay-close:hover {
-  background: transparent url(images/close.png) no-repeat;
-  -moz-border-radius-topleft: 0;
-  -webkit-border-top-left-radius: 0;
-  border-top-left-radius: 0;
+  background: transparent url(images/close.png) no-repeat; /* LTR */
+  -moz-border-radius-topleft: 0; /* LTR */
+  -webkit-border-top-left-radius: 0; /* LTR */
+  border-top-left-radius: 0; /* LTR */
   display: block;
   height: 26px;
   margin: 0;
@@ -82,13 +82,13 @@ html.js body {
   line-height: 27px;
   margin: -28px 0 0 0;
   position: absolute;
-  right: 20px;
+  right: 20px; /* LTR */
   text-transform: uppercase;
 }
 #overlay-tabs li {
   display: inline;
   list-style: none;
-  margin: 0 0 0 -3px;
+  margin: 0 0 0 -3px; /* LTR */
   padding: 0;
 }
 #overlay-tabs li a,
diff --git a/modules/overlay/overlay-parent.js b/modules/overlay/overlay-parent.js
index 8f11df6694df0951e9e03232080053cdaaded723..f9789f14aff1bef66c31fd02425d99d85a6310e6 100644
--- a/modules/overlay/overlay-parent.js
+++ b/modules/overlay/overlay-parent.js
@@ -346,6 +346,10 @@ Drupal.overlay.setFocusBefore = function ($element, document) {
  *   TRUE if the URL represents an administrative link, FALSE otherwise.
  */
 Drupal.overlay.isAdminLink = function (url) {
+  if (Drupal.overlay.isExternalLink(url)) {
+    return false;
+  }
+
   var path = this.getPath(url);
 
   // Turn the list of administrative paths into a regular expression.
@@ -362,6 +366,20 @@ Drupal.overlay.isAdminLink = function (url) {
   return this.adminPathRegExp.exec(path) && !this.nonAdminPathRegExp.exec(path);
 };
 
+/**
+ * Determine whether a link is external to the site.
+ *
+ * @param url
+ *   The url to be tested.
+ *
+ * @return boolean
+ *   TRUE if the URL is external to the site, FALSE otherwise.
+ */
+Drupal.overlay.isExternalLink = function (url) {
+  var re = RegExp('^((f|ht)tps?:)?//(?!' + window.location.host + ')');
+  return re.test(url);
+};
+
 /**
  * Event handler: resizes overlay according to the size of the parent window.
  *
@@ -413,6 +431,27 @@ Drupal.overlay.eventhandlerAlterDisplacedElements = function (event) {
   // IE6 doesn't support maxWidth, use width instead.
   var maxWidthName = (typeof document.body.style.maxWidth == 'string') ? 'maxWidth' : 'width';
 
+  if (Drupal.overlay.leftSidedScrollbarOffset === undefined && $(document.documentElement).attr('dir') === 'rtl') {
+    // We can't use element.clientLeft to detect whether scrollbars are placed
+    // on the left side of the element when direction is set to "rtl" as most
+    // browsers dont't support it correctly.
+    // http://www.gtalbot.org/BugzillaSection/DocumentAllDHTMLproperties.html
+    // There seems to be absolutely no way to detect whether the scrollbar
+    // is on the left side in Opera; always expect scrollbar to be on the left.
+    if ($.browser.opera) {
+      Drupal.overlay.leftSidedScrollbarOffset = document.documentElement.clientWidth - this.iframeWindow.document.documentElement.clientWidth + this.iframeWindow.document.documentElement.clientLeft;
+    }
+    else if (this.iframeWindow.document.documentElement.clientLeft) {
+      Drupal.overlay.leftSidedScrollbarOffset = this.iframeWindow.document.documentElement.clientLeft;
+    }
+    else {
+      var el1 = $('<div style="direction: rtl; overflow: scroll;"></div>').appendTo(document.body);
+      var el2 = $('<div></div>').appendTo(el1);
+      Drupal.overlay.leftSidedScrollbarOffset = parseInt(el2[0].offsetLeft - el1[0].offsetLeft);
+      el1.remove();
+    }
+  }
+
   // Consider any element that should be visible above the overlay (such as
   // a toolbar).
   $('.overlay-displace-top, .overlay-displace-bottom').each(function () {
@@ -423,6 +462,10 @@ Drupal.overlay.eventhandlerAlterDisplacedElements = function (event) {
       maxWidth -= 1;
     }
 
+    if (Drupal.overlay.leftSidedScrollbarOffset) {
+      $(this).css('left', Drupal.overlay.leftSidedScrollbarOffset);
+    }
+
     // Prevent displaced elements overlapping window's scrollbar.
     var currentMaxWidth = parseInt($(this).css(maxWidthName));
     if ((data.drupalOverlay && data.drupalOverlay.maxWidth) || isNaN(currentMaxWidth) || currentMaxWidth > maxWidth || currentMaxWidth <= 0) {
@@ -435,7 +478,12 @@ Drupal.overlay.eventhandlerAlterDisplacedElements = function (event) {
     var offset = $(this).offset();
     var offsetRight = offset.left + $(this).outerWidth();
     if ((data.drupalOverlay && data.drupalOverlay.clip) || offsetRight > maxWidth) {
-      $(this).css('clip', 'rect(auto, ' + (maxWidth - offset.left) + 'px, ' + (documentHeight - offset.top) + 'px, auto)');
+      if (Drupal.overlay.leftSidedScrollbarOffset) {
+        $(this).css('clip', 'rect(auto, auto, ' + (documentHeight - offset.top) + 'px, ' + (Drupal.overlay.leftSidedScrollbarOffset + 2) + 'px)');
+      }
+      else {
+        $(this).css('clip', 'rect(auto, ' + (maxWidth - offset.left) + 'px, ' + (documentHeight - offset.top) + 'px, auto)');
+      }
       (data.drupalOverlay = data.drupalOverlay || {}).clip = true;
     }
   });
diff --git a/modules/overlay/overlay.info b/modules/overlay/overlay.info
index 85dbaccd7853a45fa3d569a343d832e9835378de..34149bc95ff300643f2a773c822777b99b933441 100644
--- a/modules/overlay/overlay.info
+++ b/modules/overlay/overlay.info
@@ -4,8 +4,8 @@ package = Core
 version = VERSION
 core = 7.x
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/overlay/overlay.module b/modules/overlay/overlay.module
index 44c230b64cb048d4856addb21f89be6a469cd19f..9af18e18e5b359d1f45d16a0974eb9a9785a2dcd 100644
--- a/modules/overlay/overlay.module
+++ b/modules/overlay/overlay.module
@@ -137,8 +137,15 @@ function overlay_init() {
     }
 
     if (isset($_GET['render']) && $_GET['render'] == 'overlay') {
-      // If this page shouldn't be rendered here, redirect to the parent.
-      if (!path_is_admin($current_path)) {
+      // If a previous page requested that we close the overlay, close it and
+      // redirect to the final destination.
+      if (isset($_SESSION['overlay_close_dialog'])) {
+        call_user_func_array('overlay_close_dialog', $_SESSION['overlay_close_dialog']);
+        unset($_SESSION['overlay_close_dialog']);
+      }
+      // If this page shouldn't be rendered inside the overlay, redirect to the
+      // parent.
+      elseif (!path_is_admin($current_path)) {
         overlay_close_dialog($current_path);
       }
 
@@ -226,14 +233,23 @@ function overlay_library() {
 
 /**
  * Implements hook_drupal_goto_alter().
- *
- * If the current page request is inside the overlay, add ?render=overlay to
- * the new path, so that it appears correctly inside the overlay.
- *
- * @see overlay_get_mode()
  */
 function overlay_drupal_goto_alter(&$path, &$options, &$http_response_code) {
   if (overlay_get_mode() == 'child') {
+    // The authorize.php script bootstraps Drupal to a very low level, where
+    // the PHP code that is necessary to close the overlay properly will not be
+    // loaded. Therefore, if we are redirecting to authorize.php inside the
+    // overlay, instead redirect back to the current page with instructions to
+    // close the overlay there before redirecting to the final destination; see
+    // overlay_init().
+    if ($path == system_authorized_get_url() || $path == system_authorized_batch_processing_url()) {
+      $_SESSION['overlay_close_dialog'] = array($path, $options);
+      $path = current_path();
+      $options = drupal_get_query_parameters();
+    }
+
+    // If the current page request is inside the overlay, add ?render=overlay
+    // to the new path, so that it appears correctly inside the overlay.
     if (isset($options['query'])) {
       $options['query'] += array('render' => 'overlay');
     }
diff --git a/modules/path/path.info b/modules/path/path.info
index 8fcdd55c72ed4c8c05a3d56b684d096597c080c1..65875a6fefecca7330784c12ca4e0f52b8ae77c9 100644
--- a/modules/path/path.info
+++ b/modules/path/path.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = path.test
 configure = admin/config/search/path
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/php/php.info b/modules/php/php.info
index 9526982763da52e18375ea9aab9cad67fe8e5b23..d837f15ef1b7310381e3013518b10bcc2876fd84 100644
--- a/modules/php/php.info
+++ b/modules/php/php.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 files[] = php.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/poll/poll.info b/modules/poll/poll.info
index e5e3017cc0c2a509ec70d2bc5ef221daeb0d77fa..0d9de28089df1372e46cc7b842775ce60c01d077 100644
--- a/modules/poll/poll.info
+++ b/modules/poll/poll.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = poll.test
 stylesheets[all][] = poll.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 861969573df542ef4fa88ceffaa496a6ea7bbca9..2737c2bd8dde405730571b4fa4d3ec96dea43559 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -583,7 +583,10 @@ function poll_update($node) {
           'chvotes' => (int) $choice['chvotes'],
           'weight' => $choice['weight'],
         ))
-        ->insertFields(array('nid' => $node->nid))
+        ->insertFields(array(
+           'nid' => $node->nid,
+           'chtext' => $choice['chtext'],
+        ))
         ->execute();
     }
     else {
@@ -591,6 +594,10 @@ function poll_update($node) {
         ->condition('nid', $node->nid)
         ->condition('chid', $key)
         ->execute();
+      db_delete('poll_choice')
+        ->condition('nid', $node->nid)
+        ->condition('chid', $choice['chid'])
+        ->execute();
     }
   }
 }
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index 6fabf956723f3345a7a2347d183c25e4b606f5b9..d7648a6bad29335f094e2b63528fea191aea8f90 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -188,7 +188,7 @@ class PollCreateTestCase extends PollTestCase {
   function testPollCreate() {
     $title = $this->randomName();
     $choices = $this->_generateChoices(7);
-    $this->pollCreate($title, $choices, TRUE);
+    $poll_nid = $this->pollCreate($title, $choices, TRUE);
 
     // Verify poll appears on 'poll' page.
     $this->drupalGet('poll');
@@ -198,6 +198,25 @@ class PollCreateTestCase extends PollTestCase {
     // Click on the poll title to go to node page.
     $this->clickLink($title);
     $this->assertText('Total votes: 0', 'Link to poll correct.');
+
+    // Now add a new option to make sure that when we update the node the
+    // option is displayed.
+    $node = node_load($poll_nid);
+
+    $new_option = $this->randomName();
+
+    $node->choice[] = array(
+      'chid' => '',
+      'chtext' => $new_option,
+      'chvotes' => 0,
+      'weight' => 0,
+    );
+
+    node_save($node);
+
+    $this->drupalGet('poll');
+    $this->clickLink($title);
+    $this->assertText($new_option, 'New option found.');
   }
 
   function testPollClose() {
@@ -727,3 +746,39 @@ class PollExpirationTestCase extends PollTestCase {
     $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), t('Poll has expired.'));
   }
 }
+
+class PollDeleteChoiceTestCase extends PollTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Poll choice deletion',
+      'description' => 'Test the poll choice deletion logic.',
+      'group' => 'Poll',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('poll');
+  }
+
+  function testChoiceRemoval() {
+    // Set up a poll with three choices.
+    $title = $this->randomName();
+    $choices = array('First choice', 'Second choice', 'Third choice');
+    $poll_nid = $this->pollCreate($title, $choices, FALSE);
+    $this->assertTrue($poll_nid, t('Poll for choice deletion logic test created.'));
+
+    // Edit the poll, and try to delete first poll choice.
+    $this->drupalGet("node/$poll_nid/edit");
+    $edit['choice[chid:1][chtext]'] = '';
+    $this->drupalPost(NULL, $edit, t('Save'));
+
+    // Click on the poll title to go to node page.
+    $this->drupalGet('poll');
+    $this->clickLink($title);
+
+    // Check the first poll choice is deleted, while the others remain.
+    $this->assertNoText('First choice', t('First choice removed.'));
+    $this->assertText('Second choice', t('Second choice remains.'));
+    $this->assertText('Third choice', t('Third choice remains.'));
+  }
+}
diff --git a/modules/profile/profile.info b/modules/profile/profile.info
index dc61b8394000112af2fcc9062e84252398fef4ec..1209ee57ff3e2e167aad095b92b6853ef6209c17 100644
--- a/modules/profile/profile.info
+++ b/modules/profile/profile.info
@@ -11,8 +11,8 @@ configure = admin/config/people/profile
 ; See user_system_info_alter().
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/rdf/rdf.info b/modules/rdf/rdf.info
index 416b3838a4e04c28486a9eae4107149403636392..618998cc3aba7c67c65d0c9db8ff10d11986b0bb 100644
--- a/modules/rdf/rdf.info
+++ b/modules/rdf/rdf.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 files[] = rdf.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/rdf/tests/rdf_test.info b/modules/rdf/tests/rdf_test.info
index 00bd9256c00face01c0e3519d1e87fc6dba649e6..137e914381d62948dec1d72afa1127a2b0466449 100644
--- a/modules/rdf/tests/rdf_test.info
+++ b/modules/rdf/tests/rdf_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/search/search.info b/modules/search/search.info
index 249b0bedfd6089f644a6a6f6d59e54af4cb2653d..cd930728e3568e00eb0b7dd4c3bd8470225cb220 100644
--- a/modules/search/search.info
+++ b/modules/search/search.info
@@ -8,8 +8,8 @@ files[] = search.test
 configure = admin/config/search/settings
 stylesheets[all][] = search.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/search/search.test b/modules/search/search.test
index 4d371331195765bdaeee7a64119a365805ccd33f..488a45e804df010291edc57d8291a88baf3fc153 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -1947,3 +1947,46 @@ class SearchLanguageTestCase extends DrupalWebTestCase {
     $this->assertNoText(t('Languages'), t('No languages to choose from.'));
   }
 }
+
+/**
+ * Tests node search with node access control.
+ */
+class SearchNodeAccessTest extends DrupalWebTestCase {
+  public $test_user;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Search and node access',
+      'description' => 'Tests search functionality with node access control.',
+      'group' => 'Search',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('search', 'node_access_test');
+    node_access_rebuild();
+
+    // Create a test user and log in.
+    $this->test_user = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search'));
+    $this->drupalLogin($this->test_user);
+  }
+
+  /**
+   * Tests that search returns results with punctuation in the search phrase.
+   */
+  function testPhraseSearchPunctuation() {
+    $node = $this->drupalCreateNode(array('body' => array(LANGUAGE_NONE => array(array('value' => "The bunny's ears were furry.")))));
+
+    // Update the search index.
+    module_invoke_all('update_index');
+    search_update_totals();
+
+    // Refresh variables after the treatment.
+    $this->refreshVariables();
+
+    // Submit a phrase wrapped in double quotes to include the punctuation.
+    $edit = array('keys' => '"bunny\'s"');
+    $this->drupalPost('search/node', $edit, t('Search'));
+    $this->assertText($node->title);
+  }
+}
diff --git a/modules/search/tests/search_embedded_form.info b/modules/search/tests/search_embedded_form.info
index d2f00ac68336315d45f131cd028bb5b0025eeaa3..596e1f60c58dade350e3320058461d1ea3078db9 100644
--- a/modules/search/tests/search_embedded_form.info
+++ b/modules/search/tests/search_embedded_form.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/search/tests/search_extra_type.info b/modules/search/tests/search_extra_type.info
index 06d86c5a98aa570c5b661e8d04518ae4654d1352..d0188c9b6465119d9c593706a96a48dcb4bf2c6a 100644
--- a/modules/search/tests/search_extra_type.info
+++ b/modules/search/tests/search_extra_type.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/shortcut/shortcut-rtl.css b/modules/shortcut/shortcut-rtl.css
index 4a3792797717a0c982422e85768b5e012be9231f..5dec95701fb50e378c817d15e50a9d4222a72626 100644
--- a/modules/shortcut/shortcut-rtl.css
+++ b/modules/shortcut/shortcut-rtl.css
@@ -28,6 +28,7 @@ div.add-or-remove-shortcuts a span.text {
   padding-right: 10px;
   padding-left: 0;
 }
+div.add-or-remove-shortcuts a:focus span.text,
 div.add-or-remove-shortcuts a:hover span.text {
   -moz-border-radius: 5px 0 0 5px;
   -webkit-border-top-left-radius: 5px;
diff --git a/modules/shortcut/shortcut.info b/modules/shortcut/shortcut.info
index 4eb2dbbd5adc79a17d4ba28153fd7e9963da3438..ae331e869323846cefe497fe691ae5d7eaf7849a 100644
--- a/modules/shortcut/shortcut.info
+++ b/modules/shortcut/shortcut.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = shortcut.test
 configure = admin/config/user-interface/shortcut
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/shortcut/shortcut.module b/modules/shortcut/shortcut.module
index d2ac72b32062f7de07c69ace037de1c744eebe56..8642d9de79939cf4248f4afa1b40409658e80df6 100644
--- a/modules/shortcut/shortcut.module
+++ b/modules/shortcut/shortcut.module
@@ -460,7 +460,7 @@ function shortcut_set_assign_user($shortcut_set, $account) {
  *   to any set.
  */
 function shortcut_set_unassign_user($account) {
-  $deleted = db_delete('shortcut_set')
+  $deleted = db_delete('shortcut_set_users')
     ->condition('uid', $account->uid)
     ->execute();
   return (bool) $deleted;
diff --git a/modules/shortcut/shortcut.test b/modules/shortcut/shortcut.test
index e37e1e5f8e673aef7912e9d236cdd25392ee3aa1..75a5a67bffb877d171a07f74a287341fadd2c260 100644
--- a/modules/shortcut/shortcut.test
+++ b/modules/shortcut/shortcut.test
@@ -312,6 +312,19 @@ class ShortcutSetsTestCase extends ShortcutTestCase {
     $this->assertNotEqual($set->title, $existing_title, t('The shortcut set %title cannot be renamed to %new-title because a shortcut set with that title already exists.', array('%title' => $set->title, '%new-title' => $existing_title)));
   }
 
+  /**
+   * Tests unassigning a shortcut set.
+   */
+  function testShortcutSetUnassign() {
+    $new_set = $this->generateShortcutSet($this->randomName(10));
+
+    shortcut_set_assign_user($new_set, $this->shortcut_user);
+    shortcut_set_unassign_user($this->shortcut_user);
+    $current_set = shortcut_current_displayed_set($this->shortcut_user);
+    $default_set = shortcut_default_set($this->shortcut_user);
+    $this->assertTrue($current_set->set_name == $default_set->set_name, "Successfully unassigned another user's shortcut set.");
+  }
+
   /**
    * Tests deleting a shortcut set.
    */
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 40af4585850f496a906c459079e5368e6f7df2ba..5c39cfc11cd5c580c4f6fee70a8cfa2722122085 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1255,6 +1255,11 @@ class DrupalWebTestCase extends DrupalTestCase {
     $this->originalProfile = drupal_get_profile();
     $clean_url_original = variable_get('clean_url', 0);
 
+    // Set to English to prevent exceptions from utf8_truncate() from t()
+    // during install if the current language is not 'en'.
+    // The following array/object conversion is copied from language_default().
+    $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '');
+
     // Save and clean shutdown callbacks array because it static cached and
     // will be changed by the test run. If we don't, then it will contain
     // callbacks from both environments. So testing environment will try
diff --git a/modules/simpletest/simpletest.info b/modules/simpletest/simpletest.info
index b0273281a260fa1c45d090dc71e28289a7a3672f..2d57b8d5255e8d489cb6f0596332bce702231047 100644
--- a/modules/simpletest/simpletest.info
+++ b/modules/simpletest/simpletest.info
@@ -45,11 +45,12 @@ files[] = tests/upgrade/upgrade.locale.test
 files[] = tests/upgrade/upgrade.menu.test
 files[] = tests/upgrade/upgrade.node.test
 files[] = tests/upgrade/upgrade.taxonomy.test
+files[] = tests/upgrade/upgrade.translatable.test
 files[] = tests/upgrade/upgrade.upload.test
 files[] = tests/upgrade/upgrade.user.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/actions_loop_test.info b/modules/simpletest/tests/actions_loop_test.info
index 1400405870fe4d093c33b2109fd5e035c747e31d..dae440f78289ce582c977558a2589d55f8621d20 100644
--- a/modules/simpletest/tests/actions_loop_test.info
+++ b/modules/simpletest/tests/actions_loop_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/ajax_forms_test.info b/modules/simpletest/tests/ajax_forms_test.info
index 5aecc800559e386ab3f49fbede9fd3de887bff4b..d66147d954c8bb92d3188c654d2861522d54528f 100644
--- a/modules/simpletest/tests/ajax_forms_test.info
+++ b/modules/simpletest/tests/ajax_forms_test.info
@@ -5,8 +5,8 @@ package = Testing
 version = VERSION
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/ajax_test.info b/modules/simpletest/tests/ajax_test.info
index 82d4fa825cf3931385429b606d84831294c7656c..cbcd18b5da49fd262643f6c9fd62c8d40a0e0386 100644
--- a/modules/simpletest/tests/ajax_test.info
+++ b/modules/simpletest/tests/ajax_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/batch_test.info b/modules/simpletest/tests/batch_test.info
index 89e701c8640ddb61704462b445e788681a0d0014..7133259efe8b3dc5c068be941553651db6bda234 100644
--- a/modules/simpletest/tests/batch_test.info
+++ b/modules/simpletest/tests/batch_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/cache.test b/modules/simpletest/tests/cache.test
index 43d1fa122c7326c0c1b9bcca55eefa97986740ac..954f575961dc4ef9cb7f1a5e759daeaca0b0afd8 100644
--- a/modules/simpletest/tests/cache.test
+++ b/modules/simpletest/tests/cache.test
@@ -310,6 +310,27 @@ class CacheClearCase extends CacheTestCase {
                        || $this->checkCacheExists('test_cid_clear3', $this->default_value),
                        t('All cache entries removed when the array exceeded the cache clear threshold.'));
   }
+
+  /**
+   * Test drupal_flush_all_caches().
+   */
+  function testFlushAllCaches() {
+    // Create cache entries for each flushed cache bin.
+    $bins = array('cache', 'cache_filter', 'cache_page', 'cache_boostrap', 'cache_path');
+    $bins = array_merge(module_invoke_all('flush_caches'), $bins);
+    foreach ($bins as $id => $bin) {
+      $id = 'test_cid_clear' . $id;
+      cache_set($id, $this->default_value, $bin);
+    }
+
+    // Remove all caches then make sure that they are cleared.
+    drupal_flush_all_caches();
+
+    foreach ($bins as $id => $bin) {
+      $id = 'test_cid_clear' . $id;
+      $this->assertFalse($this->checkCacheExists($id, $this->default_value, $bin), t('All cache entries removed from @bin.', array('@bin' => $bin)));
+    }
+  }
 }
 
 /**
diff --git a/modules/simpletest/tests/common_test.info b/modules/simpletest/tests/common_test.info
index c11e1baba7bb180531d10e46c0daa720b2b68c95..89fc739e4f4240dff3cd465584e27a6903ea6359 100644
--- a/modules/simpletest/tests/common_test.info
+++ b/modules/simpletest/tests/common_test.info
@@ -7,8 +7,8 @@ stylesheets[all][] = common_test.css
 stylesheets[print][] = common_test.print.css
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/common_test.module b/modules/simpletest/tests/common_test.module
index 9b6178804c9087b7d5144e45a23d6f7d48fc0d87..c400eaed11423b857b50fed0c31160f7c17e416c 100644
--- a/modules/simpletest/tests/common_test.module
+++ b/modules/simpletest/tests/common_test.module
@@ -225,3 +225,16 @@ function common_test_js_and_css_querystring() {
    drupal_add_css('/' . drupal_get_path('module', 'node') . '/node-fake.css?arg1=value1&arg2=value2');
    return '';
 }
+
+/**
+ * Implements hook_cron().
+ *
+ * System module should handle if a module does not catch an exception and keep
+ * cron going.
+ *
+ * @see common_test_cron_helper()
+ *
+ */
+function common_test_cron() {
+  throw new Exception(t('Uncaught exception'));
+}
diff --git a/modules/simpletest/tests/common_test_cron_helper.info b/modules/simpletest/tests/common_test_cron_helper.info
new file mode 100644
index 0000000000000000000000000000000000000000..1fa4696e32106aad9ca46981c4f132fba8c04aaa
--- /dev/null
+++ b/modules/simpletest/tests/common_test_cron_helper.info
@@ -0,0 +1,12 @@
+name = "Common Test Cron Helper"
+description = "Helper module for CronRunTestCase::testCronExceptions()."
+package = Testing
+version = VERSION
+core = 7.x
+hidden = TRUE
+
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
+project = "drupal"
+datestamp = "1314817616"
+
diff --git a/modules/simpletest/tests/common_test_cron_helper.module b/modules/simpletest/tests/common_test_cron_helper.module
new file mode 100644
index 0000000000000000000000000000000000000000..94a2b2c43821ae8e8f41ff6a3a6a81fbc984868e
--- /dev/null
+++ b/modules/simpletest/tests/common_test_cron_helper.module
@@ -0,0 +1,17 @@
+<?php
+/**
+ * @file
+ * Helper module for the testCronExceptions in addition to common_test module.
+ */
+
+/**
+ * Implements hook_cron().
+ *
+ * common_test_cron() throws an exception, but the execution should reach this
+ * function as well.
+ *
+ * @see common_test_cron()
+ */
+function common_test_cron_helper_cron() {
+  variable_set('common_test_cron', 'success');
+}
diff --git a/modules/simpletest/tests/database_test.info b/modules/simpletest/tests/database_test.info
index a6409a2c00ba0c18c4682d16e5296b54f554ad28..be6cd43cdf0185a218091deb3e81235aac5e25ab 100644
--- a/modules/simpletest/tests/database_test.info
+++ b/modules/simpletest/tests/database_test.info
@@ -5,8 +5,8 @@ package = Testing
 version = VERSION
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index 143640d60b3985cb73270c669f092d6653432319..76ca1038e050de0da1c0cbcbf8a914cfc44a4c3b 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -1629,22 +1629,28 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
     $subquery->addField('tt', 'task', 'task');
     $subquery->condition('priority', 1);
 
-    // Create another query that joins against the virtual table resulting
-    // from the subquery.
-    $select = db_select($subquery, 'tt2');
-    $select->join('test', 't', 't.id=tt2.pid');
-    $select->addField('t', 'name');
-
-    $select->condition('task', 'code');
+    for ($i = 0; $i < 2; $i++) {
+      // Create another query that joins against the virtual table resulting
+      // from the subquery.
+      $select = db_select($subquery, 'tt2');
+      $select->join('test', 't', 't.id=tt2.pid');
+      $select->addField('t', 'name');
+      if ($i) {
+        // Use a different number of conditions here to confuse the subquery
+        // placeholder counter, testing http://drupal.org/node/1112854.
+        $select->condition('name', 'John');
+      }
+      $select->condition('task', 'code');
 
-    // The resulting query should be equivalent to:
-    // SELECT t.name
-    // FROM (SELECT tt.pid AS pid, tt.task AS task FROM test_task tt WHERE priority=1) tt
-    //   INNER JOIN test t ON t.id=tt.pid
-    // WHERE tt.task = 'code'
-    $people = $select->execute()->fetchCol();
+      // The resulting query should be equivalent to:
+      // SELECT t.name
+      // FROM (SELECT tt.pid AS pid, tt.task AS task FROM test_task tt WHERE priority=1) tt
+      //   INNER JOIN test t ON t.id=tt.pid
+      // WHERE tt.task = 'code'
+      $people = $select->execute()->fetchCol();
 
-    $this->assertEqual(count($people), 1, t('Returned the correct number of rows.'));
+      $this->assertEqual(count($people), 1, t('Returned the correct number of rows.'));
+    }
   }
 
   /**
@@ -3433,7 +3439,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
       $this->assertIdentical($count, '0', t('Table was successfully created inside a transaction.'));
     }
     catch (Exception $e) {
-      $this->fail($e->getMessage());
+      $this->fail((string) $e);
     }
 
     // If we rollback the transaction, an exception might be thrown.
@@ -3451,6 +3457,163 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
       $this->assertTrue(true, t('Exception thrown on rollback after a DDL statement was executed.'));
     }
   }
+
+  /**
+   * Insert a single row into the testing table.
+   */
+  protected function insertRow($name) {
+    db_insert('test')
+      ->fields(array(
+        'name' => $name,
+      ))
+      ->execute();
+  }
+
+  /**
+   * Start over for a new test.
+   */
+  protected function cleanUp() {
+    db_truncate('test')
+      ->execute();
+  }
+
+  /**
+   * Assert that a given row is present in the test table.
+   *
+   * @param $name
+   *   The name of the row.
+   * @param $message
+   *   The message to log for the assertion.
+   */
+  function assertRowPresent($name, $message = NULL) {
+    if (!isset($message)) {
+      $message = t('Row %name is present.', array('%name' => $name));
+    }
+    $present = (boolean) db_query('SELECT 1 FROM {test} WHERE name = :name', array(':name' => $name))->fetchField();
+    return $this->assertTrue($present, $message);
+  }
+
+  /**
+   * Assert that a given row is absent from the test table.
+   *
+   * @param $name
+   *   The name of the row.
+   * @param $message
+   *   The message to log for the assertion.
+   */
+  function assertRowAbsent($name, $message = NULL) {
+    if (!isset($message)) {
+      $message = t('Row %name is absent.', array('%name' => $name));
+    }
+    $present = (boolean) db_query('SELECT 1 FROM {test} WHERE name = :name', array(':name' => $name))->fetchField();
+    return $this->assertFalse($present, $message);
+  }
+
+  /**
+   * Test transaction stacking and commit / rollback.
+   */
+  function testTransactionStacking() {
+    // This test won't work right if transactions are supported.
+    if (Database::getConnection()->supportsTransactions()) {
+      return;
+    }
+
+    $database = Database::getConnection();
+
+    // Standard case: pop the inner transaction before the outer transaction.
+    $transaction = db_transaction();
+    $this->insertRow('outer');
+    $transaction2 = db_transaction();
+    $this->insertRow('inner');
+    // Pop the inner transaction.
+    unset($transaction2);
+    $this->assertTrue($database->inTransaction(), t('Still in a transaction after popping the inner transaction'));
+    // Pop the outer transaction.
+    unset($transaction);
+    $this->assertFalse($database->inTransaction(), t('Transaction closed after popping the outer transaction'));
+    $this->assertRowPresent('outer');
+    $this->assertRowPresent('inner');
+
+    // Pop the transaction in a different order they have been pushed.
+    $this->cleanUp();
+    $transaction = db_transaction();
+    $this->insertRow('outer');
+    $transaction2 = db_transaction();
+    $this->insertRow('inner');
+    // Pop the outer transaction, nothing should happen.
+    unset($transaction);
+    $this->insertRow('inner-after-outer-commit');
+    $this->assertTrue($database->inTransaction(), t('Still in a transaction after popping the outer transaction'));
+    // Pop the inner transaction, the whole transaction should commit.
+    unset($transaction2);
+    $this->assertFalse($database->inTransaction(), t('Transaction closed after popping the inner transaction'));
+    $this->assertRowPresent('outer');
+    $this->assertRowPresent('inner');
+    $this->assertRowPresent('inner-after-outer-commit');
+
+    // Rollback the inner transaction.
+    $this->cleanUp();
+    $transaction = db_transaction();
+    $this->insertRow('outer');
+    $transaction2 = db_transaction();
+    $this->insertRow('inner');
+    // Now rollback the inner transaction.
+    $transaction2->rollback();
+    unset($transaction2);
+    $this->assertTrue($database->inTransaction(), t('Still in a transaction after popping the outer transaction'));
+    // Pop the outer transaction, it should commit.
+    $this->insertRow('outer-after-inner-rollback');
+    unset($transaction);
+    $this->assertFalse($database->inTransaction(), t('Transaction closed after popping the inner transaction'));
+    $this->assertRowPresent('outer');
+    $this->assertRowAbsent('inner');
+    $this->assertRowPresent('outer-after-inner-rollback');
+
+    // Rollback the inner transaction after committing the outer one.
+    $this->cleanUp();
+    $transaction = db_transaction();
+    $this->insertRow('outer');
+    $transaction2 = db_transaction();
+    $this->insertRow('inner');
+    // Pop the outer transaction, nothing should happen.
+    unset($transaction);
+    $this->assertTrue($database->inTransaction(), t('Still in a transaction after popping the outer transaction'));
+    // Now rollback the inner transaction, it should rollback.
+    $transaction2->rollback();
+    unset($transaction2);
+    $this->assertFalse($database->inTransaction(), t('Transaction closed after popping the inner transaction'));
+    $this->assertRowPresent('outer');
+    $this->assertRowAbsent('inner');
+
+    // Rollback the outer transaction while the inner transaction is active.
+    // In that case, an exception will be triggered because we cannot
+    // ensure that the final result will have any meaning.
+    $this->cleanUp();
+    $transaction = db_transaction();
+    $this->insertRow('outer');
+    $transaction2 = db_transaction();
+    $this->insertRow('inner');
+    // Rollback the outer transaction.
+    try {
+      $transaction->rollback();
+      unset($transaction);
+      $this->fail(t('Rolling back the outer transaction while the inner transaction is active resulted in an exception.'));
+    }
+    catch (Exception $e) {
+      $this->pass(t('Rolling back the outer transaction while the inner transaction is active resulted in an exception.'));
+    }
+    $this->assertFalse($database->inTransaction(), t('No more in a transaction after rolling back the outer transaction'));
+    // Try to commit the inner transaction.
+    try {
+      unset($transaction2);
+      $this->fail(t('Trying to commit the inner transaction resulted in an exception.'));
+    }
+    catch (Exception $e) {
+      $this->pass(t('Trying to commit the inner transaction resulted in an exception.'));
+    }
+    $this->assertRowAbsent('outer');
+    $this->assertRowAbsent('inner');
+  }
 }
 
 
diff --git a/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
index 44be97a8b9476878a4c1c2496a9f7df1315a2abe..acf65afcea3ee21aba368963a6320c6ddfaed51b 100644
--- a/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
+++ b/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
index 255dc9fff1d201326a28d43b52999629284ef03b..bff577544809902722ccfcb9d9d9dcdd28c01038 100644
--- a/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
+++ b/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/entity_cache_test.info b/modules/simpletest/tests/entity_cache_test.info
index f9b884e5509663b627a5a5372921bb556aaacb13..697cd32b958eacced91c7e458375ff6e5c653934 100644
--- a/modules/simpletest/tests/entity_cache_test.info
+++ b/modules/simpletest/tests/entity_cache_test.info
@@ -6,8 +6,8 @@ core = 7.x
 dependencies[] = entity_cache_test_dependency
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/entity_cache_test_dependency.info b/modules/simpletest/tests/entity_cache_test_dependency.info
index ba4aa15f75046e11d2a3824e11f2dc08fe496881..bc349c20c93cdb2bf84fb5e0cc78c84c1deea9da 100644
--- a/modules/simpletest/tests/entity_cache_test_dependency.info
+++ b/modules/simpletest/tests/entity_cache_test_dependency.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/entity_crud_hook_test.info b/modules/simpletest/tests/entity_crud_hook_test.info
index 174cbf3ebd2e9370a1506453c4c836e008e5ec40..4387a8d58d138be44a4bcec0c2d9165f8a8f9d51 100644
--- a/modules/simpletest/tests/entity_crud_hook_test.info
+++ b/modules/simpletest/tests/entity_crud_hook_test.info
@@ -5,8 +5,8 @@ package = Testing
 version = VERSION
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/error_test.info b/modules/simpletest/tests/error_test.info
index 24796d83e55154dd6b9f5dd81869f6fa81f374f2..56298fbc23f7109400025968944e015323ed7f7e 100644
--- a/modules/simpletest/tests/error_test.info
+++ b/modules/simpletest/tests/error_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test
index 9dbe5464fc1e8b754daeabe24fbcaa8cdb46f344..a84208c28dd3225deab387fba3ad4aa2b296f216 100644
--- a/modules/simpletest/tests/file.test
+++ b/modules/simpletest/tests/file.test
@@ -2618,6 +2618,7 @@ class FileMimeTypeTest extends DrupalWebTestCase {
       'foo.file_test_1' => 'madeup/file_test_1',
       'foo.file_test_2' => 'madeup/file_test_2',
       'foo.doc' => 'madeup/doc',
+      'test.ogg' => 'audio/ogg',
     );
 
     // Test using default mappings.
@@ -2656,6 +2657,7 @@ class FileMimeTypeTest extends DrupalWebTestCase {
       'foo.file_test_1' => 'application/octet-stream',
       'foo.file_test_2' => 'application/octet-stream',
       'foo.doc' => 'application/octet-stream',
+      'test.ogg' => 'application/octet-stream',
     );
 
     foreach ($test_case as $input => $expected) {
diff --git a/modules/simpletest/tests/file_test.info b/modules/simpletest/tests/file_test.info
index ee5e07d6abcb8cd83e5e0bb1f69e493ee1c5d928..2577d5c480cbaf46c9878b7b923ee754eec3e96c 100644
--- a/modules/simpletest/tests/file_test.info
+++ b/modules/simpletest/tests/file_test.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = file_test.module
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/filter_test.info b/modules/simpletest/tests/filter_test.info
index 825f82b8a1a8915c25513e9070c1188436128298..da94abe86a63b961e7110d324e788b91866e9101 100644
--- a/modules/simpletest/tests/filter_test.info
+++ b/modules/simpletest/tests/filter_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/form_test.info b/modules/simpletest/tests/form_test.info
index d36a3ae9b4b7fa4b1cab3dfe9f6d516622b2ca09..042ebc5eb0555cc23bf5f5f07554a11155f413dc 100644
--- a/modules/simpletest/tests/form_test.info
+++ b/modules/simpletest/tests/form_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/image_test.info b/modules/simpletest/tests/image_test.info
index a4b405d02bbddf15a64e1937060c90b234db8920..22e34bad3eed2051d2fd04dee33e8de7c65f323e 100644
--- a/modules/simpletest/tests/image_test.info
+++ b/modules/simpletest/tests/image_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/menu_test.info b/modules/simpletest/tests/menu_test.info
index 87728df6765dc77449ce889b48d7426b5b419f3a..9b1ba8e0b33f193a6c8905f2d0ca1decf36f6bc9 100644
--- a/modules/simpletest/tests/menu_test.info
+++ b/modules/simpletest/tests/menu_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/module_test.info b/modules/simpletest/tests/module_test.info
index c7a7aaa30aa295b1f0ec3fb4dfd4c2f8ea6deabb..628b65bfa33c629f9c128d5bd592efa6b3aa7584 100644
--- a/modules/simpletest/tests/module_test.info
+++ b/modules/simpletest/tests/module_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/requirements1_test.info b/modules/simpletest/tests/requirements1_test.info
index f0de5df8d4dc260fa2ede4dc7fa4502b9da5521f..a11c0d581eeb8ef1864c714f135b0e262bd54c71 100644
--- a/modules/simpletest/tests/requirements1_test.info
+++ b/modules/simpletest/tests/requirements1_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/requirements2_test.info b/modules/simpletest/tests/requirements2_test.info
index 4386779ab6b545e7ef79b784756930f50e270180..953e3f6c29e753686093f73a5cd166178f166e30 100644
--- a/modules/simpletest/tests/requirements2_test.info
+++ b/modules/simpletest/tests/requirements2_test.info
@@ -7,8 +7,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/session_test.info b/modules/simpletest/tests/session_test.info
index acdb06f547854a5f6d0e6c200bba1b3b73854d2d..40dd9e3c7f66e9b56d5d2a376635baafd2a8d090 100644
--- a/modules/simpletest/tests/session_test.info
+++ b/modules/simpletest/tests/session_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/system_dependencies_test.info b/modules/simpletest/tests/system_dependencies_test.info
index df4cf74dcac83b709b69454b50944ea664a916d5..ecc9710836b2ddcfd104b55f25175c8bbc5c6ee2 100644
--- a/modules/simpletest/tests/system_dependencies_test.info
+++ b/modules/simpletest/tests/system_dependencies_test.info
@@ -6,8 +6,8 @@ core = 7.x
 hidden = TRUE
 dependencies[] = _missing_dependency
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/system_test.info b/modules/simpletest/tests/system_test.info
index a4d29cd13bb9d01f81b2d28d0592a93df3c270e1..d089a1e1971d14580ce09edeb731bb4c355e2312 100644
--- a/modules/simpletest/tests/system_test.info
+++ b/modules/simpletest/tests/system_test.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = system_test.module
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/taxonomy_test.info b/modules/simpletest/tests/taxonomy_test.info
index e3e66e0ff47abd39dd7139cfefc91bcd77edf41c..c419131e4959478407773ed1afb8d6f3136fa9b0 100644
--- a/modules/simpletest/tests/taxonomy_test.info
+++ b/modules/simpletest/tests/taxonomy_test.info
@@ -6,8 +6,8 @@ core = 7.x
 hidden = TRUE
 dependencies[] = taxonomy
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/theme_test.info b/modules/simpletest/tests/theme_test.info
index bd3a0bf86bdade49042998361f1a32886275b045..b7fbce9751597da0849a888f079035c971451bfc 100644
--- a/modules/simpletest/tests/theme_test.info
+++ b/modules/simpletest/tests/theme_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/update_test_1.info b/modules/simpletest/tests/update_test_1.info
index 808c126e24ccfe1235aa3f8c77018a69ce8a4949..ccb7dde7ec6c09b7a87dcaad051c15349e74da1e 100644
--- a/modules/simpletest/tests/update_test_1.info
+++ b/modules/simpletest/tests/update_test_1.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/update_test_2.info b/modules/simpletest/tests/update_test_2.info
index 808c126e24ccfe1235aa3f8c77018a69ce8a4949..ccb7dde7ec6c09b7a87dcaad051c15349e74da1e 100644
--- a/modules/simpletest/tests/update_test_2.info
+++ b/modules/simpletest/tests/update_test_2.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/update_test_3.info b/modules/simpletest/tests/update_test_3.info
index 808c126e24ccfe1235aa3f8c77018a69ce8a4949..ccb7dde7ec6c09b7a87dcaad051c15349e74da1e 100644
--- a/modules/simpletest/tests/update_test_3.info
+++ b/modules/simpletest/tests/update_test_3.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/upgrade/drupal-6.menu.database.php b/modules/simpletest/tests/upgrade/drupal-6.menu.database.php
index f5c588af7c9aa046698cc9eb9aeb96a4a3cbd5df..8962615fb8a270b3d3793213a21755c9cbd6a9ca 100644
--- a/modules/simpletest/tests/upgrade/drupal-6.menu.database.php
+++ b/modules/simpletest/tests/upgrade/drupal-6.menu.database.php
@@ -127,3 +127,49 @@ db_insert('menu_links')->fields(array(
   'updated' => '0',
 ))
 ->execute();
+db_insert('blocks')->fields(array(
+  'bid',
+  'module',
+  'delta',
+  'theme',
+  'status',
+  'weight',
+  'region',
+  'custom',
+  'throttle',
+  'visibility',
+  'pages',
+  'title',
+  'cache',
+))
+->values(array(
+  'bid' => '4',
+  'module' => 'menu',
+  'delta' => 'primary-links',
+  'theme' => 'garland',
+  'status' => '1',
+  'weight' => '0',
+  'region' => 'left',
+  'custom' => '0',
+  'throttle' => '0',
+  'visibility' => '0',
+  'pages' => '',
+  'title' => 'My Primary Links',
+  'cache' => '-1',
+))
+->values(array(
+  'bid' => '5',
+  'module' => 'menu',
+  'delta' => 'secondary-links',
+  'theme' => 'garland',
+  'status' => '1',
+  'weight' => '0',
+  'region' => 'left',
+  'custom' => '0',
+  'throttle' => '0',
+  'visibility' => '0',
+  'pages' => '',
+  'title' => 'My Secondary Links',
+  'cache' => '-1',
+))
+->execute();
diff --git a/modules/simpletest/tests/upgrade/drupal-6.translatable.database.php b/modules/simpletest/tests/upgrade/drupal-6.translatable.database.php
new file mode 100644
index 0000000000000000000000000000000000000000..516211606d6568a519fd7d7ec7df29bdcf7664af
--- /dev/null
+++ b/modules/simpletest/tests/upgrade/drupal-6.translatable.database.php
@@ -0,0 +1,125 @@
+<?php
+
+/**
+ * Database additions for translatable tests.
+ */
+
+db_insert('node')->fields(array(
+  'nid',
+  'vid',
+  'type',
+  'language',
+  'title',
+  'uid',
+  'status',
+  'created',
+  'changed',
+  'comment',
+  'promote',
+  'moderate',
+  'sticky',
+  'tnid',
+  'translate',
+))
+->values(array(
+  'nid' => '53',
+  'vid' => '63',
+  'type' => 'translatable_page',
+  'language' => 'fr',
+  'title' => 'First translatable page',
+  'uid' => '1',
+  'status' => '1',
+  'created' => '1298363952',
+  'changed' => '1298363952',
+  'comment' => '2',
+  'promote' => '0',
+  'moderate' => '0',
+  'sticky' => '0',
+  'tnid' => '0',
+  'translate' => '0',
+))
+->execute();
+
+db_insert('node_revisions')->fields(array(
+  'nid',
+  'vid',
+  'uid',
+  'title',
+  'body',
+  'teaser',
+  'log',
+  'timestamp',
+  'format',
+))
+->values(array(
+  'nid' => '53',
+  'vid' => '63',
+  'uid' => '1',
+  'title' => 'First translatable page',
+  'body' => 'Body of the first translatable page.',
+  'teaser' => 'Teaser of the first translatable page.',
+  'log' => '',
+  'timestamp' => '1298363952',
+  'format' => '1',
+))
+->execute();
+
+db_insert('node_comment_statistics')->fields(array(
+  'nid',
+  'last_comment_timestamp',
+  'last_comment_name',
+  'last_comment_uid',
+  'comment_count',
+))
+->values(array(
+  'nid' => '53',
+  'last_comment_timestamp' => '1298363952',
+  'last_comment_name' => NULL,
+  'last_comment_uid' => '1',
+  'comment_count' => '0',
+))
+->execute();
+
+db_insert('node_type')->fields(array(
+  'type',
+  'name',
+  'module',
+  'description',
+  'help',
+  'has_title',
+  'title_label',
+  'has_body',
+  'body_label',
+  'min_word_count',
+  'custom',
+  'modified',
+  'locked',
+  'orig_type',
+))
+->values(array(
+  'type' => 'translatable_page',
+  'name' => 'Translatable page',
+  'module' => 'node',
+  'description' => 'A <em>translatable page</em> is like a normal page, but with multilanguage support.',
+  'help' => '',
+  'has_title' => '1',
+  'title_label' => 'Title',
+  'has_body' => '1',
+  'body_label' => 'Body',
+  'min_word_count' => '0',
+  'custom' => '0',
+  'modified' => '0',
+  'locked' => '1',
+  'orig_type' => '',
+))
+->execute();
+
+db_insert('variable')->fields(array(
+  'name',
+  'value',
+))
+->values(array(
+  'name' => 'language_content_type_translatable_page',
+  'value' => 's:1:"1";',
+))
+->execute();
diff --git a/modules/simpletest/tests/upgrade/upgrade.menu.test b/modules/simpletest/tests/upgrade/upgrade.menu.test
index 5a17a1947e7bd7077e341cfa4965ac29f85aa0c8..bf28a5ffb46481f92ff8048d2b28962d0f0164e4 100644
--- a/modules/simpletest/tests/upgrade/upgrade.menu.test
+++ b/modules/simpletest/tests/upgrade/upgrade.menu.test
@@ -74,5 +74,10 @@ class MenuUpgradePathTestCase extends UpgradePathTestCase {
     $this->drupalGet('admin/structure/menu/settings');
     $this->assertOptionSelected('edit-menu-main-links-source', 'secondary-menu');
     $this->assertOptionSelected('edit-menu-secondary-links-source', 'main-menu');
+
+    // Check that both primary/secondary links blocks are visible.
+    $this->drupalGet('node');
+    $this->assertText('My Primary Links', '(Formerly) Primary Links block is still visible');
+    $this->assertText('My Secondary Links', '(Formerly) Secondary Links block is still visible');
   }
 }
diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test
index 8a3da818857fcbfc9410c88ead525f3022b1410b..6aadee379a42fe6d301f915585742fe0ffb7ddee 100644
--- a/modules/simpletest/tests/upgrade/upgrade.test
+++ b/modules/simpletest/tests/upgrade/upgrade.test
@@ -402,5 +402,9 @@ class BasicUpgradePath extends UpgradePathTestCase {
     // Confirm that no {menu_links} entry exists for user/autocomplete.
     $result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
     $this->assertFalse($result, t('No {menu_links} entry exists for user/autocomplete'));
+
+    // Test that the environment after the upgrade is in a consistent status.
+    $update_d6 = variable_get('update_d6', FALSE);
+    $this->assertFalse($update_d6, t('The D6 upgrade flag variable has been correctly disabled.'));
   }
 }
diff --git a/modules/simpletest/tests/upgrade/upgrade.translatable.test b/modules/simpletest/tests/upgrade/upgrade.translatable.test
new file mode 100644
index 0000000000000000000000000000000000000000..c9360f3b3cbc9dd974e3855d4f26c77268b66064
--- /dev/null
+++ b/modules/simpletest/tests/upgrade/upgrade.translatable.test
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * Upgrade test for translatable content types of node.module.
+ */
+class TranslatableUpgradePathTestCase extends UpgradePathTestCase {
+  public static function getInfo() {
+    return array(
+      'name'  => 'Translatable content upgrade path',
+      'description'  => 'Upgrade path tests for the translatable content types of Node module.',
+      'group' => 'Upgrade path',
+    );
+  }
+
+  public function setUp() {
+    // Path to the database dump files.
+    $this->databaseDumpFiles = array(
+      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
+      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.locale.database.php',
+      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.translatable.database.php',
+    );
+    parent::setUp();
+
+    $this->uninstallModulesExcept(array('locale'));
+  }
+
+  /**
+   * Test a successful upgrade (no negotiation).
+   */
+  public function testTranslatableUpgrade() {
+    $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
+
+    // The D6 database contains the english node "First translatable page" with
+    // nid 53.
+    $nid = 53;
+    $title = 'First translatable page';
+    $teaser = 'Teaser of the first translatable page.';
+    $body = 'Body of the first translatable page.';
+
+    // Check whether the node displays properly.
+    $this->drupalGet("node/$nid");
+    $this->assertText($body, t('Translatable node body displays properly'));
+
+    // Retrieve node object, ensure that both the body and the teaser has
+    // survived upgrade properly.
+    $node = $this->drupalGetNodeByTitle($title);
+    $this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
+    $this->assertEqual($node->body[LANGUAGE_NONE][0]['value'], $body, 'Body of the node survived upgrade properly');
+    $this->assertEqual($node->body[LANGUAGE_NONE][0]['summary'], $teaser, 'Teaser of the node survived upgrade properly');
+  }
+}
diff --git a/modules/simpletest/tests/url_alter_test.info b/modules/simpletest/tests/url_alter_test.info
index 2bcfc981d4603ead2040c5114fae815bf6161ec0..a989e3216ccc5d30766b6e58cbd11a9898a626e4 100644
--- a/modules/simpletest/tests/url_alter_test.info
+++ b/modules/simpletest/tests/url_alter_test.info
@@ -5,8 +5,8 @@ package = Testing
 version = VERSION
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/simpletest/tests/xmlrpc_test.info b/modules/simpletest/tests/xmlrpc_test.info
index ac6df954a4e9705bdf3bf6f065ed9e2cfdaeafa7..987935d44c59db686ebb024709657d90a0e0525c 100644
--- a/modules/simpletest/tests/xmlrpc_test.info
+++ b/modules/simpletest/tests/xmlrpc_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/statistics/statistics.info b/modules/statistics/statistics.info
index 02c27eae191b89618dcf1b40b0b01db40e564853..c5d85028e779466080634834f94af9620c45816e 100644
--- a/modules/statistics/statistics.info
+++ b/modules/statistics/statistics.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = statistics.test
 configure = admin/config/system/statistics
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 6b7be8ac4b2cc5e5006a395d054020178041f7bc..69e06f33d26d05453ddc0988bf2621bc20d88bd6 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -80,7 +80,7 @@ function statistics_exit() {
       ->fields(array(
         'title' => strip_tags(drupal_get_title()),
         'path' => $_GET['q'],
-        'url' => $_SERVER['HTTP_REFERER'],
+        'url' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
         'hostname' => ip_address(),
         'uid' => $user->uid,
         'sid' => session_id(),
diff --git a/modules/syslog/syslog.info b/modules/syslog/syslog.info
index 9183fe4ee09ff41cc02164e712de836e6ab39231..d8f37d46656749afc484cfd968b82c60d781d726 100644
--- a/modules/syslog/syslog.info
+++ b/modules/syslog/syslog.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 files[] = syslog.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 0d3a8d7a8140a8a94077f480919a4acf643d791d..46aa9c26738e213f234a7cd9c265ded8e1fe1101 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -799,7 +799,7 @@ function system_modules($form, $form_state = array()) {
     $extra['enabled'] = (bool) $module->status;
     if (!empty($module->info['required'] )) {
       $extra['disabled'] = TRUE;
-      $extra['required_by'][] = $distribution_name;
+      $extra['required_by'][] = $distribution_name . (!empty($module->info['explanation']) ? ' ('. $module->info['explanation'] .')' : '');
     }
 
     // If this module requires other modules, add them to the array.
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 179f1231162d2c03b38aa9ec71dc8aa015d8cb12..ae13d49f8a1412503082d8cef1ee96ab00064e74 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -1016,8 +1016,33 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
  *     return db_query("SELECT * FROM {mymodule_abc} WHERE abc_id = :abc_id", array(':abc_id' => $abc_id))->fetchObject();
  *   }
  * @endcode
- * This 'abc' object will then be passed into the page callback function
- * mymodule_abc_edit() to replace the integer 1 in the page arguments.
+ * This 'abc' object will then be passed into the callback functions defined
+ * for the menu item, such as the page callback function mymodule_abc_edit()
+ * to replace the integer 1 in the argument array.
+ *
+ * You can also define a %wildcard_to_arg() function (for the example menu
+ * entry above this would be 'mymodule_abc_to_arg()'). The _to_arg() function
+ * is invoked to retrieve a value that is used in the path in place of the
+ * wildcard. A good example is user.module, which defines
+ * user_uid_optional_to_arg() (corresponding to the menu entry
+ * 'user/%user_uid_optional'). This function returns the user ID of the
+ * current user.
+ *
+ * The _to_arg() function will get called with three arguments:
+ * - $arg: A string representing whatever argument may have been supplied by
+ *   the caller (this is particularly useful if you want the _to_arg()
+ *   function only supply a (default) value if no other value is specified,
+ *   as in the case of user_uid_optional_to_arg().
+ * - $map: An array of all path fragments (e.g. array('node','123','edit') for
+ *   'node/123/edit').
+ * - $index: An integer indicating which element of $map corresponds to $arg.
+ *
+ * _load() and _to_arg() functions may seem similar at first glance, but they
+ * have different purposes and are called at different times. _load()
+ * functions are called when the menu system is collecting arguments to pass
+ * to the callback functions defined for the menu item. _to_arg() functions
+ * are called when the menu system is generating links to related paths, such
+ * as the tabs for a set of MENU_LOCAL_TASK items.
  *
  * You can also make groups of menu items to be rendered (by default) as tabs
  * on a page. To do that, first create one menu item of type MENU_NORMAL_ITEM,
@@ -2859,7 +2884,7 @@ function hook_requirements($phase) {
       );
     }
 
-    $requirements['cron']['description'] .= ' ' . t('You can <a href="@cron">run cron manually</a>.', array('@cron' => url('admin/logs/status/run-cron')));
+    $requirements['cron']['description'] .= ' ' . $t('You can <a href="@cron">run cron manually</a>.', array('@cron' => url('admin/logs/status/run-cron')));
 
     $requirements['cron']['title'] = $t('Cron maintenance tasks');
   }
diff --git a/modules/system/system.info b/modules/system/system.info
index a3c517cb08bfdead0d496202a0f4478c4df09bad..ad635623476e84c60ca65029515585dc8ff4f5c2 100644
--- a/modules/system/system.info
+++ b/modules/system/system.info
@@ -12,8 +12,8 @@ files[] = system.test
 required = TRUE
 configure = admin/config/system
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/system/system.install b/modules/system/system.install
index e55c7cf3aa7e6d7f8c6fe2e8c0c31dca293a6e46..6cbbb9ed018c543237c6985b94eec687fe902b0d 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -1681,11 +1681,19 @@ function system_update_last_removed() {
  * Implements hook_update_dependencies().
  */
 function system_update_dependencies() {
-  // Update 7053 adds new blocks, so make sure the block tables are updated.
+  // system_update_7053() queries the {block} table, so it must run after
+  // block_update_7002(), which creates that table.
   $dependencies['system'][7053] = array(
     'block' => 7002,
   );
 
+  // system_update_7067() migrates role permissions and therefore must run
+  // after the {role} and {role_permission} tables are properly set up, which
+  // happens in user_update_7007().
+  $dependencies['system'][7067] = array(
+    'user' => 7007,
+  );
+
   return $dependencies;
 }
 
@@ -1866,9 +1874,6 @@ function system_update_7005() {
 
 /**
  * Convert to new method of storing permissions.
- *
- * This update is in system.install rather than user.install so that
- * all modules can use the updated permission scheme during their updates.
  */
 function system_update_7007() {
   // Copy the permissions from the old {permission} table to the new {role_permission} table.
diff --git a/modules/system/system.module b/modules/system/system.module
index 8fc0ffa4309ad01d428f7dfebcf0eeda22099071..922035df32289c4938b39af9f4516093973b374c 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -649,7 +649,7 @@ function system_menu() {
   // Modules.
   $items['admin/modules'] = array(
     'title' => 'Modules',
-    'description' => 'Enable or disable modules.',
+    'description' => 'Extend site functionality.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('system_modules'),
     'access arguments' => array('administer modules'),
@@ -1789,6 +1789,13 @@ function system_authorized_get_url(array $options = array()) {
   return url($base_url . '/authorize.php', $options);
 }
 
+/**
+ * Returns the URL for the authorize.php script when it is processing a batch.
+ */
+function system_authorized_batch_processing_url() {
+  return system_authorized_get_url(array('query' => array('batch' => '1')));
+}
+
 /**
  * Setup and invoke an operation using authorize.php.
  *
@@ -1806,7 +1813,7 @@ function system_authorized_run($callback, $file, $arguments = array(), $page_tit
  */
 function system_authorized_batch_process() {
   $finish_url = system_authorized_get_url();
-  $process_url = system_authorized_get_url(array('query' => array('batch' => '1')));
+  $process_url = system_authorized_batch_processing_url();
   batch_process($finish_url, $process_url);
 }
 
@@ -2997,7 +3004,7 @@ function system_cron() {
     }
   }
 
-  $core = array('cache', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
+  $core = array('cache', 'cache_path', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
   $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
   foreach ($cache_tables as $table) {
     cache_clear_all(NULL, $table);
@@ -3864,7 +3871,7 @@ function system_date_format_save($date_format, $dfid = 0) {
   if (!empty($date_format['locales'])) {
     foreach ($date_format['locales'] as $langcode) {
       // Only proceed if language is enabled.
-      if (in_array($langcode, $languages)) {
+      if (isset($languages[$langcode])) {
         $is_existing = (bool) db_query_range('SELECT 1 FROM {date_format_locale} WHERE type = :type AND language = :language', 0, 1, array(':type' => $date_format['type'], ':language' => $langcode))->fetchField();
         if (!$is_existing) {
           $locale_format['language'] = $langcode;
diff --git a/modules/system/system.test b/modules/system/system.test
index 8a29ce531d8d89cf988df014278fc055a90ea44e..d482afa229ab624c58b11ed44deb888bd38f078b 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -445,39 +445,6 @@ class ModuleDependencyTestCase extends ModuleTestCase {
 
   }
 
-  /**
-   * Tests re-enabling forum with taxonomy disabled.
-   */
-  function testEnableForumTaxonomyFieldDependency() {
-    // Enable the forum module.
-    $edit = array();
-    $edit['modules[Core][forum][enable]'] = 'forum';
-    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
-    $this->assertModules(array('forum'), TRUE);
-
-    // Disable the forum module.
-    $edit = array();
-    $edit['modules[Core][forum][enable]'] = FALSE;
-    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
-    $this->assertModules(array('forum'), FALSE);
-
-    // Disable the taxonomy module.
-    $edit = array();
-    $edit['modules[Core][taxonomy][enable]'] = FALSE;
-    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
-    $this->assertModules(array('taxonomy'), FALSE);
-
-    // Attempt to re-enable the forum module with taxonomy disabled and ensure
-    // forum does not try to recreate the taxonomy_forums field.
-    $edit = array();
-    $edit['modules[Core][forum][enable]'] = 'forum';
-    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
-    $this->assertText(t('Some required modules must be enabled'), t('Dependency required.'));
-    $this->drupalPost(NULL, NULL, t('Continue'));
-    $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
-    $this->assertModules(array('taxonomy', 'forum'), TRUE);
-  }
-
   /**
    * Tests that module dependencies are enabled in the correct order via the
    * UI. Dependencies should be enabled before their dependents.
@@ -516,18 +483,18 @@ class ModuleDependencyTestCase extends ModuleTestCase {
     $this->drupalPost('admin/modules', $edit, t('Save configuration'));
     $this->assertModules(array('forum'), TRUE);
 
-    // Disable forum and taxonomy. Both should now be installed but disabled.
+    // Disable forum and comment. Both should now be installed but disabled.
     $edit = array('modules[Core][forum][enable]' => FALSE);
     $this->drupalPost('admin/modules', $edit, t('Save configuration'));
     $this->assertModules(array('forum'), FALSE);
-    $edit = array('modules[Core][taxonomy][enable]' => FALSE);
+    $edit = array('modules[Core][comment][enable]' => FALSE);
     $this->drupalPost('admin/modules', $edit, t('Save configuration'));
-    $this->assertModules(array('taxonomy'), FALSE);
+    $this->assertModules(array('comment'), FALSE);
 
     // Check that the taxonomy module cannot be uninstalled.
     $this->drupalGet('admin/modules/uninstall');
-    $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="uninstall[taxonomy]"]');
-    $this->assert(count($checkbox) == 1, t('Checkbox for uninstalling the taxonomy module is disabled.'));
+    $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="uninstall[comment]"]');
+    $this->assert(count($checkbox) == 1, t('Checkbox for uninstalling the comment module is disabled.'));
 
     // Uninstall the forum module, and check that taxonomy now can also be
     // uninstalled.
@@ -535,7 +502,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
     $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPost(NULL, NULL, t('Uninstall'));
     $this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
-    $edit = array('uninstall[taxonomy]' => 'taxonomy');
+    $edit = array('uninstall[comment]' => 'comment');
     $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
     $this->drupalPost(NULL, NULL, t('Uninstall'));
     $this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
@@ -728,6 +695,10 @@ class CronRunTestCase extends DrupalWebTestCase {
     );
   }
 
+  function setUp() {
+    parent::setUp(array('common_test', 'common_test_cron_helper'));
+  }
+
   /**
    * Test cron runs.
    */
@@ -832,6 +803,19 @@ class CronRunTestCase extends DrupalWebTestCase {
     $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was correctly ignored.'));
     $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was correctly ignored.'));
   }
+
+  /**
+   * Make sure exceptions thrown on hook_cron() don't affect other modules.
+   */
+  function testCronExceptions() {
+    variable_del('common_test_cron');
+    // The common_test module throws an exception. If it isn't caught, the tests
+    // won't finish successfully.
+    // The common_test_cron_helper module sets the 'common_test_cron' variable.
+    $this->cronRun();
+    $result = variable_get('common_test_cron');
+    $this->assertEqual($result, 'success', t('Cron correctly handles exceptions thrown during hook_cron() invocations.'));
+  }
 }
 
 class AdminMetaTagTestCase extends DrupalWebTestCase {
@@ -1091,7 +1075,7 @@ class DateTimeFunctionalTest extends DrupalWebTestCase {
   }
 
   function setUp() {
-    parent::setUp();
+    parent::setUp(array('locale'));
 
     // Create admin user and log in admin user.
     $this->admin_user = $this->drupalCreateUser(array('administer site configuration'));
@@ -1200,6 +1184,74 @@ class DateTimeFunctionalTest extends DrupalWebTestCase {
     $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.'));
     $this->assertText(t('Removed date format'), 'Custom date format removed successfully.');
   }
+
+  /**
+   * Test if the date formats are stored properly.
+   */
+  function testDateFormatStorage() {
+    $date_format = array(
+      'type' => 'short',
+      'format' => 'dmYHis',
+      'locked' => 0,
+      'is_new' => 1,
+    );
+    system_date_format_save($date_format);
+
+    $format = db_select('date_formats', 'df')
+      ->fields('df', array('format'))
+      ->condition('type', 'short')
+      ->condition('format', 'dmYHis')
+      ->execute()
+      ->fetchField();
+    $this->verbose($format);
+    $this->assertEqual('dmYHis', $format, 'Unlocalized date format resides in general table.');
+
+    $format = db_select('date_format_locale', 'dfl')
+      ->fields('dfl', array('format'))
+      ->condition('type', 'short')
+      ->condition('format', 'dmYHis')
+      ->execute()
+      ->fetchField();
+    $this->assertFalse($format, 'Unlocalized date format resides not in localized table.');
+
+    // Enable German language
+    locale_add_language('de', NULL, NULL, LANGUAGE_LTR, '', '', TRUE, 'en');
+
+    $date_format = array(
+      'type' => 'short',
+      'format' => 'YMDHis',
+      'locales' => array('de', 'tr'),
+      'locked' => 0,
+      'is_new' => 1,
+    );
+    system_date_format_save($date_format);
+
+    $format = db_select('date_format_locale', 'dfl')
+      ->fields('dfl', array('format'))
+      ->condition('type', 'short')
+      ->condition('format', 'YMDHis')
+      ->condition('language', 'de')
+      ->execute()
+      ->fetchField();
+    $this->assertEqual('YMDHis', $format, 'Localized date format resides in localized table.');
+
+    $format = db_select('date_formats', 'df')
+      ->fields('df', array('format'))
+      ->condition('type', 'short')
+      ->condition('format', 'YMDHis')
+      ->execute()
+      ->fetchField();
+    $this->assertEqual('YMDHis', $format, 'Localized date format resides in general table too.');
+
+    $format = db_select('date_format_locale', 'dfl')
+      ->fields('dfl', array('format'))
+      ->condition('type', 'short')
+      ->condition('format', 'YMDHis')
+      ->condition('language', 'tr')
+      ->execute()
+      ->fetchColumn();
+    $this->assertFalse($format, 'Localized date format for disabled language is ignored.');
+  }
 }
 
 class PageTitleFiltering extends DrupalWebTestCase {
diff --git a/modules/system/system.tokens.inc b/modules/system/system.tokens.inc
index 56ddf298804a9a24702864fdfc5a98c07bdd9afa..b612d1057e65ba872d8da7da52f8647cb6407c01 100644
--- a/modules/system/system.tokens.inc
+++ b/modules/system/system.tokens.inc
@@ -98,7 +98,7 @@ function system_token_info() {
   );
   $file['size'] = array(
     'name' => t("File size"),
-    'description' => t("The size of the file, in kilobytes."),
+    'description' => t("The size of the file."),
   );
   $file['url'] = array(
     'name' => t("URL"),
@@ -130,10 +130,13 @@ function system_token_info() {
  */
 function system_tokens($type, $tokens, array $data = array(), array $options = array()) {
   $url_options = array('absolute' => TRUE);
-  if (isset($language)) {
-    $url_options['language'] = $language;
+  if (isset($options['language'])) {
+    $url_options['language'] = $options['language'];
+    $language_code = $options['language']->language;
+  }
+  else {
+    $language_code = NULL;
   }
-  $langcode = (isset($language) ? $language->language : NULL);
   $sanitize = !empty($options['sanitize']);
 
   $replacements = array();
@@ -181,19 +184,19 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
     foreach ($tokens as $name => $original) {
       switch ($name) {
         case 'short':
-          $replacements[$original] = format_date($date, 'short', '', NULL, $langcode);
+          $replacements[$original] = format_date($date, 'short', '', NULL, $language_code);
           break;
 
         case 'medium':
-          $replacements[$original] = format_date($date, 'medium', '', NULL, $langcode);
+          $replacements[$original] = format_date($date, 'medium', '', NULL, $language_code);
           break;
 
         case 'long':
-          $replacements[$original] = format_date($date, 'long', '', NULL, $langcode);
+          $replacements[$original] = format_date($date, 'long', '', NULL, $language_code);
           break;
 
         case 'since':
-          $replacements[$original] = format_interval((REQUEST_TIME - $date), 2, $langcode);
+          $replacements[$original] = format_interval((REQUEST_TIME - $date), 2, $language_code);
           break;
 
         case 'raw':
@@ -204,7 +207,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
 
     if ($created_tokens = token_find_with_prefix($tokens, 'custom')) {
       foreach ($created_tokens as $name => $original) {
-        $replacements[$original] = format_date($date, 'custom', $name, NULL, $langcode);
+        $replacements[$original] = format_date($date, 'custom', $name, NULL, $language_code);
       }
     }
   }
@@ -242,7 +245,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
 
         // These tokens are default variations on the chained tokens handled below.
         case 'timestamp':
-          $replacements[$original] = format_date($file->timestamp, 'medium', '', NULL, $langcode);
+          $replacements[$original] = format_date($file->timestamp, 'medium', '', NULL, $language_code);
           break;
 
         case 'owner':
diff --git a/modules/taxonomy/taxonomy-term.tpl.php b/modules/taxonomy/taxonomy-term.tpl.php
index b515a9be1b2278038cd55d67a8836d52fa6ea6da..b1ff20e3cee7edc0f6bacd2a6ed69ea7c43e8fea 100644
--- a/modules/taxonomy/taxonomy-term.tpl.php
+++ b/modules/taxonomy/taxonomy-term.tpl.php
@@ -12,6 +12,7 @@
  *   hide($content['field_example']) to temporarily suppress the printing of a
  *   given element.
  * - $term_url: Direct url of the current term.
+ * - $term_name: Name of the current term.
  * - $classes: String of classes that can be used to style contextually through
  *   CSS. It can be manipulated through the variable $classes_array from
  *   preprocess functions. The default values can be one or more of the following:
@@ -37,7 +38,7 @@
  * @see template_process()
  */
 ?>
-<div id="taxonomy-term-<?php print $term->tid; ?>" class="<?php print $classes; ?> clearfix">
+<div id="taxonomy-term-<?php print $term->tid; ?>" class="<?php print $classes; ?>">
 
   <?php if (!$page): ?>
     <h2><a href="<?php print $term_url; ?>"><?php print $term_name; ?></a></h2>
diff --git a/modules/taxonomy/taxonomy.info b/modules/taxonomy/taxonomy.info
index 231550d224aaf2201a97b4b34c439c79b1af4648..5f8d55c0f377b9e3af85caba93d4949879d7c3ca 100644
--- a/modules/taxonomy/taxonomy.info
+++ b/modules/taxonomy/taxonomy.info
@@ -8,8 +8,8 @@ files[] = taxonomy.module
 files[] = taxonomy.test
 configure = admin/structure/taxonomy
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install
index 68fbc7804a99922d6b00b432c6c9b7c5b3c48686..f442c95ef175347987efa73bc80e7939b4b35c9d 100644
--- a/modules/taxonomy/taxonomy.install
+++ b/modules/taxonomy/taxonomy.install
@@ -251,26 +251,11 @@ function taxonomy_field_schema($field) {
  * Implements hook_update_dependencies().
  */
 function taxonomy_update_dependencies() {
-  // Taxonomy update 7002 creates comment Field API bundles and therefore must
-  // run after the Field module has been enabled, but before upgrading field
-  // data.
-  $dependencies['taxonomy'][7002] = array(
-    'system' => 7049,
-  );
-  $dependencies['user'][7006] = array(
-    'taxonomy' => 7002,
-  );
-  $dependencies['system'][7050] = array(
-    'taxonomy' => 7002,
-  );
-  // It also must run before nodes are upgraded to use the Field API.
-  $dependencies['node'][7006] = array(
-    'taxonomy' => 7002,
-  );
-  // Ensure that format columns are only changed after Filter module has changed
-  // the primary records.
-  $dependencies['taxonomy'][7009] = array(
-    'filter' => 7010,
+  // taxonomy_update_7004() migrates taxonomy term data to fields and therefore
+  // must run after all Field modules have been enabled, which happens in
+  // system_update_7027().
+  $dependencies['taxonomy'][7004] = array(
+    'system' => 7027,
   );
 
   return $dependencies;
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index dc2847d375523b2eb8ff9156e7ef0c0ff15f4e00..eb81870f998395c64ff8d1a69bb7f145e661478e 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -380,7 +380,26 @@ function taxonomy_admin_vocabulary_title_callback($vocabulary) {
 }
 
 /**
- * Save a vocabulary given a vocabulary object.
+ * Saves a vocabulary.
+ *
+ * @param $vocabulary
+ *   A vocabulary object with the following properties:
+ *   - vid: The ID of the vocabulary.
+ *   - name: The human-readable name of the vocabulary.
+ *   - machine_name: The machine name of the vocabulary.
+ *   - description: (optional) The vocabulary's description.
+ *   - hierarchy: The hierarchy level of the vocabulary.
+ *   - module: (optional) The module altering the vocabulary.
+ *   - weight: (optional) The weight of this vocabulary in relation to other
+ *     vocabularies.
+ *   - original: (optional) The original vocabulary object before any changes
+ *     are applied.
+ *   - old_machine_name: (optional) The original machine name of the
+ *     vocabulary.
+ *
+ * @return
+ *   Status constant indicating whether the vocabulary was inserted (SAVED_NEW)
+ *   or updated(SAVED_UPDATED).
  */
 function taxonomy_vocabulary_save($vocabulary) {
   // Prevent leading and trailing spaces in vocabulary names.
@@ -491,19 +510,22 @@ function taxonomy_taxonomy_vocabulary_update($vocabulary) {
 }
 
 /**
- * Dynamically check and update the hierarchy flag of a vocabulary.
+ * Checks and updates the hierarchy flag of a vocabulary.
  *
  * Checks the current parents of all terms in a vocabulary and updates the
- * vocabularies hierarchy setting to the lowest possible level. A hierarchy with
- * no parents in any of its terms will be given a hierarchy of 0. If terms
- * contain at most a single parent, the vocabulary will be given a hierarchy of
- * 1. If any term contain multiple parents, the vocabulary will be given a
- * hierarchy of 2.
+ * vocabulary's hierarchy setting to the lowest possible level. If no term
+ * has parent terms then the vocabulary will be given a hierarchy of 0.
+ * If any term has a single parent then the vocabulary will be given a
+ * hierarchy of 1. If any term has multiple parents then the vocabulary
+ * will be given a hierarchy of 2.
  *
  * @param $vocabulary
  *   A vocabulary object.
  * @param $changed_term
  *   An array of the term structure that was updated.
+ *
+ * @return
+ *   An integer that represents the level of the vocabulary's hierarchy.
  */
 function taxonomy_check_vocabulary_hierarchy($vocabulary, $changed_term) {
   $tree = taxonomy_get_tree($vocabulary->vid);
@@ -879,7 +901,8 @@ function taxonomy_get_parents_all($tid) {
  *   An optional vocabulary ID to restrict the child search.
  *
  * @return
- *   An array of term objects which are the children of the term $tid.
+ *   An array of term objects that are the children of the term $tid, or an
+ *   empty array when no children exist.
  */
 function taxonomy_get_children($tid, $vid = 0) {
   $children = &drupal_static(__FUNCTION__, array());
@@ -1213,10 +1236,11 @@ function taxonomy_implode_tags($tags, $vid = NULL) {
       if (isset($tag->name)) {
         // Commas and quotes in tag names are special cases, so encode 'em.
         if (strpos($tag->name, ',') !== FALSE || strpos($tag->name, '"') !== FALSE) {
-          $tag->name = '"' . str_replace('"', '""', $tag->name) . '"';
+          $typed_tags[] = '"' . str_replace('"', '""', $tag->name) . '"';
+        }
+        else {
+          $typed_tags[] = $tag->name;
         }
-
-        $typed_tags[] = $tag->name;
       }
     }
   }
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index aa7cc2e44a68943f66c446aa3835274301f65ffa..9a89b9c98ff63924d7d592c7408efe70cdb756d4 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -360,7 +360,6 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase {
     $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
     $this->field = array('field_name' => $this->field_name, 'type' => 'text', 'cardinality' => 4);
     $this->field = field_create_field($this->field);
-    $this->field_id = $this->field['id'];
     $this->instance = array(
       'field_name' => $this->field_name,
       'entity_type' => 'taxonomy_term',
@@ -370,6 +369,7 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase {
     field_create_instance($this->instance);
 
     module_disable(array('taxonomy'));
+    drupal_flush_all_caches();
     require_once DRUPAL_ROOT . '/includes/install.inc';
     drupal_uninstall_modules(array('taxonomy'));
     module_enable(array('taxonomy'));
diff --git a/modules/toolbar/toolbar.info b/modules/toolbar/toolbar.info
index 381d4dd4306576bc7406ad5263fd00b57f712cf1..00c49916f5e5a5ab8d9b3a47c563aed7b9205ef3 100644
--- a/modules/toolbar/toolbar.info
+++ b/modules/toolbar/toolbar.info
@@ -4,8 +4,8 @@ core = 7.x
 package = Core
 version = VERSION
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/tracker/tracker.info b/modules/tracker/tracker.info
index f93264831b74d40bfcf84573c2518db536f58f9b..34c7025b85bd912784ffdffc5a4bfa2f1abaa8b3 100644
--- a/modules/tracker/tracker.info
+++ b/modules/tracker/tracker.info
@@ -6,8 +6,8 @@ version = VERSION
 core = 7.x
 files[] = tracker.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/translation/tests/translation_test.info b/modules/translation/tests/translation_test.info
index 39bda0d08fe840c627b91789cb110544678554f1..deab4ac30003989eed5492cade6b396c096e75e2 100644
--- a/modules/translation/tests/translation_test.info
+++ b/modules/translation/tests/translation_test.info
@@ -5,8 +5,8 @@ package = Testing
 version = VERSION
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/translation/translation.info b/modules/translation/translation.info
index 5ce3c1429e376358f182d42dc2ab9a6ed7798ffd..0902dd584be2a668dd41b50e92013e0cadca697c 100644
--- a/modules/translation/translation.info
+++ b/modules/translation/translation.info
@@ -6,8 +6,8 @@ version = VERSION
 core = 7.x
 files[] = translation.test
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/trigger/tests/trigger_test.info b/modules/trigger/tests/trigger_test.info
index 67fe0749370c3e921a766c63be161b62a5a36796..10df57963124771f790e0a7d5ec09cd55b24f1aa 100644
--- a/modules/trigger/tests/trigger_test.info
+++ b/modules/trigger/tests/trigger_test.info
@@ -4,8 +4,8 @@ package = Testing
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/trigger/trigger.info b/modules/trigger/trigger.info
index 88e1afc10ce45a0fff01ae83d2e5605a9a02a7b8..354d8da63d48b5a69449ed816a2c23ff49eaf4f4 100644
--- a/modules/trigger/trigger.info
+++ b/modules/trigger/trigger.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = trigger.test
 configure = admin/structure/trigger
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/update/tests/aaa_update_test.info b/modules/update/tests/aaa_update_test.info
index d39efaf3ee1b4f8aca72b3af1ba8eb6ee2c6f500..ebe2b6f067272ad97de0d0580385c16225e9d490 100644
--- a/modules/update/tests/aaa_update_test.info
+++ b/modules/update/tests/aaa_update_test.info
@@ -4,8 +4,8 @@ package = Testing
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/update/tests/bbb_update_test.info b/modules/update/tests/bbb_update_test.info
index 2bd0175a4344b8b2cfa92bb03dfafa46e6e8cf83..0c0e9029515b9871d24d12f4d75714f175a7610f 100644
--- a/modules/update/tests/bbb_update_test.info
+++ b/modules/update/tests/bbb_update_test.info
@@ -4,8 +4,8 @@ package = Testing
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/update/tests/ccc_update_test.info b/modules/update/tests/ccc_update_test.info
index f715441e232a837a49bdb24219b526a961d90095..a7bfdea408cae86e81bd35584ec893bfbc23198a 100644
--- a/modules/update/tests/ccc_update_test.info
+++ b/modules/update/tests/ccc_update_test.info
@@ -4,8 +4,8 @@ package = Testing
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/update/tests/update_test.info b/modules/update/tests/update_test.info
index effe5538e9483f4e800a7032ab606c95be5cf636..91ac448cbdf13d1f54914e57f745291cbedbc618 100644
--- a/modules/update/tests/update_test.info
+++ b/modules/update/tests/update_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/update/update.info b/modules/update/update.info
index 51aacf44207851d629f1c15b181414f0b72a42a3..ed0f29c6b8eb54e4d3862de1573da46bb54c7ee5 100644
--- a/modules/update/update.info
+++ b/modules/update/update.info
@@ -6,8 +6,8 @@ core = 7.x
 files[] = update.test
 configure = admin/reports/updates/settings
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/update/update.test b/modules/update/update.test
index f0c214ed6d18e75f4153a666b011cbd16a9119f6..a88f617e6ef1a4b166c0bd422e6612237616f43a 100644
--- a/modules/update/update.test
+++ b/modules/update/update.test
@@ -441,6 +441,11 @@ class UpdateTestContribCase extends UpdateTestHelper {
         'hidden' => FALSE,
       ),
     );
+    // When there are contributed modules in the site's file system, the
+    // total number of attempts made in the test may exceed the default value
+    // of update_max_fetch_attempts. Therefore this variable is set very high
+    // to avoid test failures in those cases.
+    variable_set('update_max_fetch_attempts', 99999);
     variable_set('update_test_system_info', $system_info);
     $xml_mapping = array(
       'drupal' => '0',
diff --git a/modules/user/tests/user_form_test.info b/modules/user/tests/user_form_test.info
index a38e3b88f322c048efbdd402a4e4adb29d2cce7b..4218378809172e7e06f26a98638c46b23d4f0e06 100644
--- a/modules/user/tests/user_form_test.info
+++ b/modules/user/tests/user_form_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc
index 0044b18a451abc7601150ea327f144a6b3e01e1b..4789e7e73131b627a85dcc1e3a30b1815f1cbaf8 100644
--- a/modules/user/user.admin.inc
+++ b/modules/user/user.admin.inc
@@ -841,7 +841,7 @@ function user_admin_roles($form, $form_state) {
     $form['roles'][$rid]['#weight'] = $order;
     $form['roles'][$rid]['weight'] = array(
       '#type' => 'textfield',
-      '#title' => t('Weight for @title', array('@title' => $name['label'])),
+      '#title' => t('Weight for @title', array('@title' => $name)),
       '#title_display' => 'invisible',
       '#size' => 4,
       '#default_value' => $order,
diff --git a/modules/user/user.info b/modules/user/user.info
index 04f0f7b773c56e4ad8a2a1788a4a7ec41051b301..39156ea453007a1e103ad2179a854122274b8b8c 100644
--- a/modules/user/user.info
+++ b/modules/user/user.info
@@ -9,8 +9,8 @@ required = TRUE
 configure = admin/config/people
 stylesheets[all][] = user.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/modules/user/user.install b/modules/user/user.install
index 75fca659014f2d494ce51e9a6962b2e56fe05a01..9d855ea1d0ad09b4d576d4808ef0939d51931540 100644
--- a/modules/user/user.install
+++ b/modules/user/user.install
@@ -340,25 +340,32 @@ function user_install() {
  * Implements hook_update_dependencies().
  */
 function user_update_dependencies() {
-  // Run all the critical user upgrades before everything.
-  $dependencies['system'][7000] = array(
-    'user' => 7008,
-  );
-  // Both user_update_7006() and user_update_7010() need to query the list of
-  // existing text formats and therefore must run after filter_update_7003().
-  // @todo: move user_update_7006 down below in the upgrade process.
+  // user_update_7006() updates data in the {role_permission} table, so it must
+  // run after system_update_7007(), which populates that table.
   $dependencies['user'][7006] = array(
-    'filter' => 7003,
+    'system' => 7007,
+  );
+
+  // user_update_7010() needs to query the {filter_format} table to get a list
+  // of existing text formats, so it must run after filter_update_7000(), which
+  // creates that table.
+  $dependencies['user'][7010] = array(
+    'filter' => 7000,
+  );
+
+  // user_update_7012() uses the file API, which relies on the {file_managed}
+  // table, so it must run after system_update_7034(), which creates that
+  // table.
+  $dependencies['user'][7012] = array(
+    'system' => 7034,
   );
-  // user_update_7013 relies on system_update_7060.
+
+  // user_update_7013() uses the file usage API, which relies on the
+  // {file_usage} table, so it must run after system_update_7059(), which
+  // creates that table.
   $dependencies['user'][7013] = array(
     'system' => 7059,
   );
-  // Ensure that format columns are only changed after Filter module has changed
-  // the primary records.
-  $dependencies['user'][7015] = array(
-    'filter' => 7010,
-  );
 
   return $dependencies;
 }
@@ -591,13 +598,6 @@ function user_update_7006(&$sandbox) {
     // Add a new field for the fid.
     db_add_field('role_permission', 'module', $module_field);
   }
-  $permissions = user_permission_get_modules();
-  foreach ($permissions as $key => $value) {
-    db_update('role_permission')
-      ->fields(array('module' => $value))
-      ->condition('permission', $key)
-      ->execute();
-  }
 }
 
 /**
diff --git a/profiles/minimal/minimal.info b/profiles/minimal/minimal.info
index 29311297ce7a4fe470172fcac6499927e86fbb6a..a3d2163c133a58482c158d2fdc745e4736aaa593 100644
--- a/profiles/minimal/minimal.info
+++ b/profiles/minimal/minimal.info
@@ -6,8 +6,8 @@ dependencies[] = block
 dependencies[] = dblog
 files[] = minimal.profile
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/profiles/standard/standard.info b/profiles/standard/standard.info
index daa49fafefc85a4bbd6076862d408f67c07bf6ec..ad20cc485a7886c8fc6d536c8e22f3b434f059b9 100644
--- a/profiles/standard/standard.info
+++ b/profiles/standard/standard.info
@@ -25,8 +25,8 @@ dependencies[] = file
 dependencies[] = rdf
 files[] = standard.profile
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
index 44be97a8b9476878a4c1c2496a9f7df1315a2abe..acf65afcea3ee21aba368963a6320c6ddfaed51b 100644
--- a/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
+++ b/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
index 85ca1bfde4be4b85259f1760662e344b3672ce2f..0a922240ed934f7da9e1afde8ca59273c8537bd5 100644
--- a/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
+++ b/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info
@@ -8,8 +8,8 @@ version = VERSION
 core = 6.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/profiles/testing/testing.info b/profiles/testing/testing.info
index 6723a1044e118c1be7c227b097391eac7c0d17a8..9fea2e6bdd0f85c5c18ed911b8c6dbd69280ea95 100644
--- a/profiles/testing/testing.info
+++ b/profiles/testing/testing.info
@@ -4,8 +4,8 @@ version = VERSION
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/robots.txt b/robots.txt
index 35ea42dbafa992f3071a43b71ebb9b75fce91cf4..7de84356065bf3931329d6be21063f765d8bfaf0 100644
--- a/robots.txt
+++ b/robots.txt
@@ -30,6 +30,7 @@ Disallow: /CHANGELOG.txt
 Disallow: /cron.php
 Disallow: /INSTALL.mysql.txt
 Disallow: /INSTALL.pgsql.txt
+Disallow: /INSTALL.sqlite.txt
 Disallow: /install.php
 Disallow: /INSTALL.txt
 Disallow: /LICENSE.txt
diff --git a/themes/bartik/bartik.info b/themes/bartik/bartik.info
index ebfd800d78602e167a9d77109c189b109f6ee0a5..56b166e546ed6e842fe91a64da4003a164a90ce8 100644
--- a/themes/bartik/bartik.info
+++ b/themes/bartik/bartik.info
@@ -34,8 +34,8 @@ regions[footer] = Footer
 settings[shortcut_module_link] = 0
 
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/themes/bartik/css/style.css b/themes/bartik/css/style.css
index 39e78051a1af3136955c97a5d1eb69b2972b0c29..4fb8210255b9a40940de73ab4fa7bba7418df9b5 100644
--- a/themes/bartik/css/style.css
+++ b/themes/bartik/css/style.css
@@ -459,10 +459,6 @@ h1#site-name {
 #main-menu {
   clear: both;
 }
-#main-menu-links a {
-  color: #d9d9d9;
-  padding: 0.6em 1em 0.4em;
-}
 #main-menu-links {
   font-size: 0.929em;
   margin: 0;
@@ -1435,9 +1431,6 @@ div.password-suggestions {
 div.vertical-tabs .vertical-tabs-panes fieldset.vertical-tabs-pane {
   padding: 1em;
 }
-#forum tr td.forum {
-  padding-left: 35px;
-}
 #forum .name {
   font-size: 1.083em;
 }
diff --git a/themes/garland/garland.info b/themes/garland/garland.info
index dfcf444fdc420f9c982da269d0b558d450808a56..931ccb5faafb34318fda931815f4ad6bec8f0fc3 100644
--- a/themes/garland/garland.info
+++ b/themes/garland/garland.info
@@ -7,8 +7,8 @@ stylesheets[all][] = style.css
 stylesheets[print][] = print.css
 settings[garland_width] = fluid
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/themes/seven/ie7.css b/themes/seven/ie7.css
new file mode 100644
index 0000000000000000000000000000000000000000..abcdb8a5e0603e361274729e6131bbb9cca5b3c9
--- /dev/null
+++ b/themes/seven/ie7.css
@@ -0,0 +1,23 @@
+
+ul.tabs.primary {
+  padding: 0;
+}
+ul.primary li,
+ul.primary li a,
+ul.primary li.active a {
+  float: none !important;
+  display: inline;
+}
+ul.primary li,
+ul.primary li a,
+ul.primary li a.active,
+ul.primary li a:active,
+ul.primary li a:visited,
+ul.primary li a:hover,
+ul.primary li.active a {
+  zoom: 1;
+  position: relative;
+}
+ul.admin-list li {
+  position: static;
+}
diff --git a/themes/seven/images/list-item-rtl.png b/themes/seven/images/list-item-rtl.png
new file mode 100644
index 0000000000000000000000000000000000000000..aa654f74a0bfd58f2dc5df9bdb244c5b2ec6e76e
Binary files /dev/null and b/themes/seven/images/list-item-rtl.png differ
diff --git a/themes/seven/images/task-item-rtl.png b/themes/seven/images/task-item-rtl.png
new file mode 100644
index 0000000000000000000000000000000000000000..fbf6185835faa6799857b636c3dc6fb0d413b771
Binary files /dev/null and b/themes/seven/images/task-item-rtl.png differ
diff --git a/themes/seven/page.tpl.php b/themes/seven/page.tpl.php
index 85353a7b04c905107da0ef5407d2bde68720ef51..b9d0ad554cd67bc3ef15c4f9c71e2af86a5f490e 100644
--- a/themes/seven/page.tpl.php
+++ b/themes/seven/page.tpl.php
@@ -11,7 +11,9 @@
   </div>
 
   <div id="page">
-    <?php print render($secondary_local_tasks); ?>
+    <?php if ($secondary_local_tasks): ?>
+      <div class="tabs-secondary clearfix"><ul class="tabs secondary"><?php print render($secondary_local_tasks); ?></ul></div>
+    <?php endif; ?>
 
     <div id="content" class="clearfix">
       <div class="element-invisible"><a id="main-content"></a></div>
diff --git a/themes/seven/seven.info b/themes/seven/seven.info
index ac33f5a141f2df4268f0c45ee80f2fa2764cd3fa..133430d59a3e6b85592063ff42ca5878fad81439 100644
--- a/themes/seven/seven.info
+++ b/themes/seven/seven.info
@@ -13,8 +13,8 @@ regions[page_bottom] = Page bottom
 regions[sidebar_first] = First sidebar
 regions_hidden[] = sidebar_first
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/themes/seven/style-rtl.css b/themes/seven/style-rtl.css
index 6328193c17769a3e13bba85eb06f33f097570942..6fb8b6250f88822fd853fc679d6a17458d83dbe1 100644
--- a/themes/seven/style-rtl.css
+++ b/themes/seven/style-rtl.css
@@ -2,23 +2,248 @@
 /**
  * Generic elements.
  */
+dl dd,
+dl dl {
+  margin-right: 20px;
+}
 ul,
 .block ul,
 .item-list ul,
 .item-list ul {
   margin: 0.25em 1.5em 0.25em 0;
 }
+ol {
+  margin: 0.25em 2em 0.25em 0;
+}
 
-/* User login block */
-#user-login-form .openid-links {
+/**
+ * Skip link.
+ */
+#skip-link {
+  right: 50%;
+  margin-right: -5.25em;
+}
+#skip-link a,
+#skip-link a:link,
+#skip-link a:visited {
+  padding: 1px 10px 2px 10px;
+}
+
+/**
+ * Branding.
+ */
+#branding {
+  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;
 }
-#user-login-form .openid-links .user-link {
+
+/**
+ * Help.
+ */
+#help div.more-help-link {
+  text-align: left;
+}
+
+/**
+ * Page title.
+ */
+#branding h1.page-title {
+  float: right;
+}
+
+/**
+ * Tabs.
+ */
+ul.primary li,
+ul.primary li a:link,
+ul.primary li a.active {
+  float: right;
+}
+ul.primary,
+ul.secondary {
+  float: left;
+}
+ul.secondary li {
+ float: none;
+}
+ul.primary {
+ padding-top: 0;
+}
+
+/**
+ * Page layout.
+ */
+#page {
+  padding: 20px 0 40px 0;
+  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;
+  padding-right: 0;
+}
+ul.admin-list li {
+  padding: 9px 30px 0 0;
+  margin-right: 0;
+  background: url(images/list-item-rtl.png) no-repeat right 11px;
+}
+ul.admin-list li a {
+  margin-right: -30px;
   margin-left: 0;
-  margin-right: 1.5em;
+  padding: 0 30px 4px 0;
+}
+ul.admin-list.compact li a {
+  margin-right: 0;
+}
+ul.admin-list li div.description a {
+  margin-right: 0;
 }
 
-/* Sortable tables */
+/**
+ * Tables.
+ */
 table th.active a {
   padding: 0 0 0 25px;
 }
+table th.active img {
+  left: 3px;
+  right: auto;
+}
+/**
+ * Exception for webkit bug with the right border of the last cell
+ * in some tables, since it's webkit only, we can use :last-child
+ */
+tr td:last-child {
+  border-left: 1px solid #bebfb9;
+  border-right: none;
+}
+
+/**
+ * Fieldsets.
+ */
+fieldset {
+  padding: 2.5em 0 0 0;
+}
+fieldset .fieldset-legend {
+  padding-right: 15px;
+  right: 0;
+}
+fieldset .fieldset-wrapper {
+  padding: 0 15px 13px 13px;
+}
+
+/* Filter */
+.filter-wrapper .form-item,
+.filter-wrapper .filter-guidelines,
+.filter-wrapper .filter-help {
+  padding: 2px 0 0 0;
+}
+ul.tips li {
+  margin: 0.25em 1.5em 0.25em 0;
+}
+body div.form-type-radio div.description,
+body div.form-type-checkbox div.description {
+  margin-left: 0;
+  margin-right: 1.5em;
+}
+input.form-submit,
+a.button {
+  margin-left: 1em;
+  margin-right: 0;
+}
+ul.action-links li {
+  float: right;
+  margin: 0 0 0 1em;
+}
+ul.action-links a {
+  padding-left: 0;
+  padding-right: 15px;
+  background-position: right center;
+}
+
+/* admin/content and admin/people */
+dl.multiselect,
+dl.multiselect dt,
+dl.multiselect dd {
+  margin: 0 0 0 10px;
+}
+
+/* Update options. */
+div.admin-options label,
+div.admin-options div.form-item {
+  margin-left: 10px;
+  margin-right: 0;
+  float: right;
+}
+
+/* Maintenance theming */
+body.in-maintenance #sidebar-first {
+  float: right;
+}
+body.in-maintenance #content {
+  float: left;
+  padding-left: 20px;
+  padding-right: 0;
+}
+ol.task-list {
+  margin-right: 0;
+}
+ol.task-list li {
+  padding: 0.5em 20px 0.5em 1em;
+}
+ol.task-list li.active {
+  background: transparent url(images/task-item-rtl.png) no-repeat right 50%;
+  padding: 0.5em 20px 0.5em 1em;
+}
+
+/* Overlay theming */
+.overlay #branding div.breadcrumb {
+  float: right;
+}
+.overlay ul.secondary {
+  margin: -1.4em 0 0.3em 0;
+}
+
+/* Shortcut theming */
+div.add-or-remove-shortcuts {
+  float: none;
+  padding-left: 0;
+  padding-right: 6px;
+}
+
+/* Dashboard */
+#dashboard div.block div.content {
+  padding: 10px 5px 5px 5px;
+}
+#dashboard div.block div.content ul.menu {
+  margin-right: 20px;
+}
+
+/* Recent content block */
+#block-node-recent .more-link {
+  padding: 0 0 5px 5px;
+}
+
+/* User login block */
+#user-login-form .openid-links {
+  margin-right: 0;
+}
+#user-login-form .openid-links .user-link {
+  margin-right: 1.5em;
+}
diff --git a/themes/seven/style.css b/themes/seven/style.css
index 66303c5019cff6eb6c8f46a7665afd8d05a4bbaf..bf40a3d5cce8fbadb3b4b22ae9ac7df470baeaa7 100644
--- a/themes/seven/style.css
+++ b/themes/seven/style.css
@@ -19,7 +19,7 @@ hr {
   padding: 0;
   border: none;
   height: 1px;
-  background: #CCCCCC;
+  background: #cccccc;
 }
 legend {
   font-weight: bold;
@@ -57,7 +57,7 @@ dl {
 }
 dl dd,
 dl dl {
-  margin-left: 20px;
+  margin-left: 20px; /* LTR */
   margin-bottom: 10px;
 }
 blockquote {
@@ -117,7 +117,7 @@ ul.menu li {
 }
 ol {
   list-style-type: decimal;
-  margin: 0.25em 0 0.25em 2em;
+  margin: 0.25em 0 0.25em 2em; /* LTR */
 }
 .item-list ul li.collapsed,
 ul.menu li.collapsed {
@@ -149,8 +149,8 @@ pre {
 #skip-link {
   margin-top: 0;
   position: absolute;
-  left: 50%;
-  margin-left: -5.25em;
+  left: 50%; /* LTR */
+  margin-left: -5.25em; /* LTR */
   width: auto;
   z-index: 50;
 }
@@ -161,7 +161,7 @@ pre {
   background: #444;
   color: #fff;
   font-size: 0.94em;
-  padding: 1px 10px 2px 10px;
+  padding: 1px 10px 2px 10px; /* LTR */
   text-decoration: none;
   -moz-border-radius: 0 0 10px 10px;
   -webkit-border-top-left-radius: 0;
@@ -181,7 +181,7 @@ pre {
  */
 #branding {
   overflow: hidden;
-  padding: 20px 20px 0 20px;
+  padding: 20px 20px 0 20px; /* LTR */
   position: relative;
   background-color: #e0e0d8;
 }
@@ -191,23 +191,23 @@ pre {
 }
 #branding div.block {
   position: relative;
-  float: right;
+  float: right; /* LTR */
   width: 240px;
-  padding-left: 10px;
+  padding-left: 10px; /* LTR */
   background: #333;
 }
 #branding div.block form label {
   display: none;
 }
 #branding div.block form div.form-item {
-  float: left;
+  float: left; /* LTR */
   border: 0;
   margin: 0;
   padding: 0;
 }
 #branding div.block form input.form-text {
   width: 140px;
-  margin-right: 10px;
+  margin-right: 10px; /* LTR */
 }
 #branding div.block form input.form-submit {
   text-align: center;
@@ -225,7 +225,7 @@ pre {
   margin: 0 0 10px;
 }
 #help div.more-help-link {
-  text-align: right;
+  text-align: right; /* LTR */
 }
 
 /**
@@ -241,7 +241,7 @@ pre {
   padding-bottom: 10px;
   font-size: 1.385em;
   font-weight: normal;
-  float: left;
+  float: left; /* LTR */
 }
 
 /**
@@ -255,26 +255,33 @@ pre {
  * Tabs.
  */
 ul.primary {
-  float: right;
+  float: right; /* LTR */
   border-bottom: none;
-  padding: 0.769em 0 5px 8px;
   text-transform: uppercase;
   font-size: 0.923em;
+  height: 2.60em;
+  margin: 0;
+  padding-top: 0;
 }
 ul.primary li {
-  display: inline;
+  float: left; /* LTR */
   list-style: none;
+  margin: 0 2px;
 }
-ul.primary li a,
+ul.primary li a:link,
 ul.primary li a.active,
 ul.primary li a:active,
 ul.primary li a:visited,
 ul.primary li a:hover,
 ul.primary li.active a {
+  display: block;
+  float: left; /* LTR */
+  height: 2.60em;
+  line-height: 2.60em;
+  padding: 0 18px 8px;
   background-color: #a6a7a2;
   color: #000;
   font-weight: bold;
-  padding: 6px 20px;
   border-width: 1px 1px 0 1px;
   border-style: solid;
   border-color: #a6a7a2;
@@ -296,22 +303,25 @@ ul.primary li a:hover {
 ul.primary li.active a:hover {
   color: #000;
 }
-ul.secondary {
-  float: none;
+.tabs-secondary {
   clear: both;
+}
+ul.secondary {
+  float: right; /* LTR */
   font-size: 0.923em;
-  text-align: right;
-  padding: 4px 10px 10px;
+  padding: 0 3px 5px;
   line-height: 1.385em;
   overflow: hidden;
   background-color: #fff;
 }
 ul.secondary li {
-  padding-left: 10px;
+  margin: 0 5px;
+  float: right; /* LTR */
 }
 ul.secondary li a {
   background-color: #ddd;
   color: #000;
+  display: inline-block;
 }
 ul.secondary li a,
 ul.secondary li a:hover,
@@ -328,20 +338,23 @@ ul.secondary li.active a.active {
   color: #fff;
   background: #666;
 }
+#content {
+  clear: left;
+}
 
 /**
  * Page layout.
  */
 #page {
-  padding: 20px 0 40px 0;
-  margin-right: 40px;
-  margin-left: 40px;
+  padding: 20px 0 40px 0; /* LTR */
+  margin-right: 40px; /* LTR */
+  margin-left: 40px; /* LTR */
   background: #fff;
   position: relative;
   color: #333;
 }
 #secondary-links ul.links li {
-  padding: 0 10px 10px 0;
+  padding: 0 10px 10px 0; /* LTR */
 }
 #secondary-links ul.links li a {
   font-size: 0.923em;
@@ -361,7 +374,7 @@ ul.secondary li.active a.active {
 }
 ul.links li,
 ul.inline li {
-  padding-right: 1em;
+  padding-right: 1em; /* LTR */
 }
 ul.inline li {
   display: inline;
@@ -372,12 +385,12 @@ ul.inline li {
 }
 ul.admin-list li {
   position: relative;
-  padding-left: 30px;
+  padding-left: 30px; /* LTR */
   padding-top: 9px;
   border-top: 1px solid #ccc;
-  margin-left: 0;
+  margin-left: 0; /* LTR */
   margin-bottom: 10px;
-  background: url(images/list-item.png) no-repeat 0 11px;
+  background: url(images/list-item.png) no-repeat 0 11px; /* LTR */
   list-style-type: none;
   list-style-image: none;
 }
@@ -402,17 +415,17 @@ ul.admin-list li:last-child {
   border-bottom: none;
 }
 ul.admin-list li a {
-  margin-left: -30px;
-  padding: 0px 0 4px 30px;
+  margin-left: -30px; /* LTR */
+  padding: 0 0 4px 30px; /* LTR */
   min-height: 0;
 }
 ul.admin-list.compact li a {
-  margin-left: 0;
+  margin-left: 0; /* LTR */
   padding: 0;
 }
 ul.admin-list li div.description a {
-  margin-left: 0px;
-  padding: 0px;
+  margin-left: 0; /* LTR */
+  padding: 0;
   min-height: inherit;
 }
 div.submitted {
@@ -473,7 +486,7 @@ table th.active a {
 table th.active img {
   position: absolute;
   top: 3px;
-  right: 3px;
+  right: 3px; /* LTR */
 }
 table td.active {
   background: #e9e9dd;
@@ -510,7 +523,7 @@ table.system-status-report tr.error {
  * in some tables, since it's webkit only, we can use :last-child
  */
 tr td:last-child {
-  border-right: 1px solid #BEBFB9;
+  border-right: 1px solid #bebfb9; /* LTR */
 }
 
 
@@ -534,18 +547,18 @@ tr td:last-child {
  */
 fieldset {
   border: 1px solid #ccc;
-  padding: 2.5em 0 0 0;
+  padding: 2.5em 0 0 0; /* LTR */
   position: relative;
   margin: 1em 0;
 }
 fieldset .fieldset-legend {
   margin-top: 0.5em;
-  padding-left: 15px;
+  padding-left: 15px; /* LTR */
   position: absolute;
   text-transform: uppercase;
 }
 fieldset .fieldset-wrapper {
-  padding: 0 13px 13px 15px;
+  padding: 0 13px 13px 15px; /* LTR */
 }
 fieldset.collapsed {
   background-color: transparent;
@@ -615,7 +628,7 @@ div.teaser-checkbox .form-item,
 .filter-wrapper .filter-guidelines,
 .filter-wrapper .filter-help {
   font-size: 0.923em;
-  padding: 2px 0 0 0;
+  padding: 2px 0 0 0; /* LTR */
 }
 ul.tips,
 div.description,
@@ -626,18 +639,18 @@ div.description,
   color: #666;
 }
 ul.tips li {
-  margin: 0.25em 0 0.25em 1.5em;
+  margin: 0.25em 0 0.25em 1.5em; /* LTR */
 }
 body div.form-type-radio div.description,
 body div.form-type-checkbox div.description {
-  margin-left: 1.5em;
+  margin-left: 1.5em; /* LTR */
 }
 input.form-submit,
 a.button {
   cursor: pointer;
   padding: 4px 17px;
   margin-bottom: 1em;
-  margin-right: 1em;
+  margin-right: 1em; /* LTR */
   color: #5a5a5a;
   text-align: center;
   font-weight: normal;
@@ -645,8 +658,8 @@ a.button {
   font-family: "Lucida Grande", Verdana, sans-serif;
   border: 1px solid #e4e4e4;
   border-bottom: 1px solid #b4b4b4;
-  border-left-color: #D2D2D2;
-  border-right-color: #D2D2D2;
+  border-left-color: #d2d2d2;
+  border-right-color: #d2d2d2;
   background: url(images/buttons.png) 0 0 repeat-x;
   -moz-border-radius: 20px;
   -webkit-border-radius: 20px;
@@ -659,20 +672,11 @@ a.button:active {
   text-decoration: none;
   color: #5a5a5a;
 }
-div.node-form input#edit-submit,
-div.node-form input#edit-submit-1 {
-  border: 1px solid #8eB7cd;
-  border-left-color: #8eB7cd;
-  border-right-color: #8eB7cd;
-  border-bottom-color: #7691a2;
-  background: url(images/buttons.png) 0px -40px repeat-x;
-  color: #133B54;
-}
 input.form-submit:active {
   background: #666;
   color: #fff;
   border-color: #555;
-  text-shadow: #222 0px -1px 0px;
+  text-shadow: #222 0 -1px 0;
 }
 input.form-button-disabled,
 input.form-button-disabled:active {
@@ -707,16 +711,16 @@ html.js input.throbbing {
 }
 ul.action-links {
   margin: 1em 0;
-  padding: 0 20px 0 20px;
+  padding: 0 20px 0 20px; /* LTR */
   list-style-type: none;
   overflow: hidden;
 }
 ul.action-links li {
-  float: left;
-  margin: 0 1em 0 0;
+  float: left; /* LTR */
+  margin: 0 1em 0 0; /* LTR */
 }
 ul.action-links a {
-  padding-left: 15px;
+  padding-left: 15px; /* LTR */
   background: transparent url(images/add.png) no-repeat 0 center;
   line-height: 30px;
 }
@@ -772,7 +776,7 @@ div.admin-panel h3 {
 dl.multiselect,
 dl.multiselect dt,
 dl.multiselect dd {
-  margin: 0 10px 0 0;
+  margin: 0 10px 0 0; /* LTR */
 }
 dl.multiselect select,
 dl.multiselect dd select {
@@ -796,8 +800,8 @@ div.admin-options label {
 }
 div.admin-options label,
 div.admin-options div.form-item {
-  margin-right: 10px;
-  float: left;
+  margin-right: 10px; /* LTR */
+  float: left; /* LTR */
 }
 div.admin-options div.form-item {
   padding: 0;
@@ -811,13 +815,14 @@ div.admin-options div.form-item {
 
 /* Maintenance theming */
 body.in-maintenance #sidebar-first {
-  float: left;
+  float: left; /* LTR */
   width: 200px;
 }
 body.in-maintenance #content {
-  float: right;
+  float: right; /* LTR */
   width: 550px;
-  padding-right: 20px;
+  padding-right: 20px; /* LTR */
+  clear: none;
 }
 body.in-maintenance #page {
   overflow: auto;
@@ -860,7 +865,7 @@ ol.task-list li.active {
 }
 ol.task-list li.done {
   color: #393;
-  background: transparent url(images/task-check.png) no-repeat 0px 50%; /* LTR */
+  background: transparent url(images/task-check.png) no-repeat 0 50%;
   color: green;
 }
 
@@ -879,7 +884,7 @@ ol.task-list li.done {
   padding: 0 20px;
 }
 .overlay #branding div.breadcrumb {
-  float: left;
+  float: left; /* LTR */
   position: relative;
   z-index: 10;
 }
@@ -894,7 +899,8 @@ ol.task-list li.done {
 }
 .overlay ul.secondary {
   background: transparent none;
-  margin: -2.4em 0 0.3em 0;
+  margin: -1.4em 0 0.3em 0; /* LTR */
+  overflow: visible;
 }
 .overlay #content {
   padding: 0;
@@ -905,9 +911,9 @@ h1#overlay-title {
 
 /* Shortcut theming */
 div.add-or-remove-shortcuts {
-  float: left;
+  float: left; /* LTR */
   padding-top: 6px;
-  padding-left: 6px;
+  padding-left: 6px; /* LTR */
 }
 
 /* Dashboard */
@@ -920,10 +926,10 @@ div.add-or-remove-shortcuts {
   padding: 3px 10px;
 }
 #dashboard div.block div.content {
-  padding: 10px 5px 5px 5px;
+  padding: 10px 5px 5px 5px; /* LTR */
 }
 #dashboard div.block div.content ul.menu {
-  margin-left: 20px;
+  margin-left: 20px; /* LTR */
 }
 #dashboard .dashboard-region .block {
   border: #ccc 1px solid;
@@ -960,7 +966,7 @@ div.add-or-remove-shortcuts {
   border: none;
 }
 #block-node-recent .more-link {
-  padding: 0 5px 5px 0;
+  padding: 0 5px 5px 0; /* LTR */
 }
 
 /* User login block */
@@ -988,7 +994,7 @@ div.add-or-remove-shortcuts {
   padding: 0.4em 0.6em;
 }
 .overlay-disable-message-focused #overlay-dismiss-message {
-  background-color: #59A0D8;
+  background-color: #59a0d8;
   color: #fff;
   -moz-border-radius: 8px;
   -webkit-border-radius: 8px;
diff --git a/themes/seven/template.php b/themes/seven/template.php
index 4582749b1d0a29dd98db48f0a8625b965a1036a1..437e9a79f006752a9197ae16ecc44b3573396b9b 100644
--- a/themes/seven/template.php
+++ b/themes/seven/template.php
@@ -17,9 +17,11 @@ function seven_preprocess_maintenance_page(&$vars) {
  */
 function seven_preprocess_html(&$vars) {
   // Add conditional CSS for IE8 and below.
-  drupal_add_css(path_to_theme() . '/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
+  drupal_add_css(path_to_theme() . '/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE));
+  // Add conditional CSS for IE7 and below.
+  drupal_add_css(path_to_theme() . '/ie7.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE));
   // Add conditional CSS for IE6.
-  drupal_add_css(path_to_theme() . '/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
+  drupal_add_css(path_to_theme() . '/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 6', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE));
 }
 
 /**
diff --git a/themes/stark/stark.info b/themes/stark/stark.info
index 013eb235231fbc2310580ff200cb5796b7aa79fb..c8254346418781fe9e9d837f5e258dfa7b093ee5 100644
--- a/themes/stark/stark.info
+++ b/themes/stark/stark.info
@@ -5,8 +5,8 @@ version = VERSION
 core = 7.x
 stylesheets[all][] = layout.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/themes/tests/test_theme/test_theme.info b/themes/tests/test_theme/test_theme.info
index 7af270dfa5902843ecfcfcfe3cacbd2e6832245d..7fedd3fb1389136bb0f480193a3b6c3c5157587a 100644
--- a/themes/tests/test_theme/test_theme.info
+++ b/themes/tests/test_theme/test_theme.info
@@ -15,8 +15,8 @@ hidden = TRUE
 ; file within the theme folder.
 stylesheets[all][] = system.base.css
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/themes/tests/update_test_basetheme/update_test_basetheme.info b/themes/tests/update_test_basetheme/update_test_basetheme.info
index f2e43a2cdea2de49d9084fa60086114e2fe4baee..52aa843c1d38a43ae02b3bdafa2517b3329b6149 100644
--- a/themes/tests/update_test_basetheme/update_test_basetheme.info
+++ b/themes/tests/update_test_basetheme/update_test_basetheme.info
@@ -3,8 +3,8 @@ description = Test theme which acts as a base theme for other test subthemes.
 core = 7.x
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"
 
diff --git a/themes/tests/update_test_subtheme/update_test_subtheme.info b/themes/tests/update_test_subtheme/update_test_subtheme.info
index e5e4c46f42785b671e40bff1b17959f5e264c837..b042cf60d4d0d28922d11c9ed622bdeb009de92e 100644
--- a/themes/tests/update_test_subtheme/update_test_subtheme.info
+++ b/themes/tests/update_test_subtheme/update_test_subtheme.info
@@ -4,8 +4,8 @@ core = 7.x
 base theme = update_test_basetheme
 hidden = TRUE
 
-; Information added by drupal.org packaging script on 2011-07-28
-version = "7.7"
+; Information added by drupal.org packaging script on 2011-08-31
+version = "7.8"
 project = "drupal"
-datestamp = "1311813879"
+datestamp = "1314817616"