Selaa lähdekoodia

updated modules
views friendly_register serial address_field i18n

Bachir Soussi Chiadmi 9 vuotta sitten
vanhempi
commit
706c96d663
58 muutettua tiedostoa jossa 584 lisäystä ja 367 poistoa
  1. 4 2
      sites/all/modules/contrib/fields/addressfield/addressfield.address_formats.inc
  2. 1 1
      sites/all/modules/contrib/fields/addressfield/addressfield.devel_generate.inc
  3. 3 3
      sites/all/modules/contrib/fields/addressfield/addressfield.info
  4. 1 1
      sites/all/modules/contrib/fields/addressfield/addressfield.install
  5. 16 8
      sites/all/modules/contrib/fields/addressfield/addressfield.module
  6. 3 3
      sites/all/modules/contrib/fields/addressfield/example/addressfield_example.info
  7. 12 9
      sites/all/modules/contrib/fields/addressfield/plugins/format/address.inc
  8. 4 2
      sites/all/modules/contrib/fields/addressfield/plugins/format/name-full.inc
  9. 1 1
      sites/all/modules/contrib/fields/addressfield/plugins/format/name-oneline.inc
  10. 1 1
      sites/all/modules/contrib/fields/addressfield/plugins/format/organisation.inc
  11. 91 93
      sites/all/modules/contrib/fields/serial/serial.inc
  12. 3 3
      sites/all/modules/contrib/fields/serial/serial.info
  13. 15 30
      sites/all/modules/contrib/fields/serial/serial.install
  14. 28 76
      sites/all/modules/contrib/fields/serial/serial.module
  15. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n.info
  16. 1 0
      sites/all/modules/contrib/localisation/i18n/i18n.test
  17. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info
  18. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info
  19. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info
  20. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info
  21. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info
  22. 2 2
      sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module
  23. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info
  24. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info
  25. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info
  26. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info
  27. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info
  28. 8 4
      sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.install
  29. 22 0
      sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.test
  30. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info
  31. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info
  32. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info
  33. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info
  34. 2 2
      sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module
  35. 3 3
      sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info
  36. 3 3
      sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info
  37. 10 2
      sites/all/modules/contrib/users/friendly_register/README.txt
  38. 38 0
      sites/all/modules/contrib/users/friendly_register/friendly_register.api.php
  39. 3 3
      sites/all/modules/contrib/users/friendly_register/friendly_register.info
  40. 52 3
      sites/all/modules/contrib/users/friendly_register/friendly_register.module
  41. 6 4
      sites/all/modules/contrib/users/friendly_register/js/friendly_register.js
  42. 21 7
      sites/all/modules/contrib/views/views/drush/views.drush.inc
  43. 1 1
      sites/all/modules/contrib/views/views/handlers/views_handler_field.inc
  44. 8 10
      sites/all/modules/contrib/views/views/handlers/views_handler_filter_date.inc
  45. 22 10
      sites/all/modules/contrib/views/views/includes/cache.inc
  46. 1 1
      sites/all/modules/contrib/views/views/modules/comment/views_plugin_row_comment_rss.inc
  47. 1 1
      sites/all/modules/contrib/views/views/modules/node/views_plugin_row_node_rss.inc
  48. 34 2
      sites/all/modules/contrib/views/views/plugins/views_plugin_cache.inc
  49. 1 1
      sites/all/modules/contrib/views/views/plugins/views_plugin_display.inc
  50. 2 0
      sites/all/modules/contrib/views/views/plugins/views_plugin_display_attachment.inc
  51. 4 0
      sites/all/modules/contrib/views/views/plugins/views_plugin_query_default.inc
  52. 31 0
      sites/all/modules/contrib/views/views/tests/handlers/views_handler_filter_date.test
  53. 46 20
      sites/all/modules/contrib/views/views/tests/views_groupby.test
  54. 24 0
      sites/all/modules/contrib/views/views/tests/views_module.test
  55. 3 3
      sites/all/modules/contrib/views/views/tests/views_test.info
  56. 1 1
      sites/all/modules/contrib/views/views/views.api.php
  57. 3 3
      sites/all/modules/contrib/views/views/views.info
  58. 3 3
      sites/all/modules/contrib/views/views/views_ui.info

+ 4 - 2
sites/all/modules/contrib/fields/addressfield/addressfield.address_formats.inc

@@ -42,7 +42,7 @@ function addressfield_get_address_format($country_code) {
   $countries_with_optional_postal_code = array(
     'AC', 'AD', 'AL', 'AZ', 'BA', 'BB', 'BD', 'BG', 'BH', 'BM', 'BN', 'BT',
     'CR', 'CY', 'CZ', 'DO', 'DZ', 'EC', 'EH', 'ET', 'FO', 'GE', 'GN', 'GT',
-    'GW', 'HR', 'HT', 'HU', 'IL', 'IS', 'JO', 'KE', 'KG', 'KH', 'KW', 'LA',
+    'GW', 'HR', 'HT', 'IL', 'IS', 'JO', 'KE', 'KG', 'KH', 'KW', 'LA',
     'LA', 'LB', 'LK', 'LR', 'LS',  'MA', 'MC', 'MD', 'ME', 'MG', 'MK', 'MM',
     'MT', 'MU', 'MV', 'NE', 'NP', 'OM', 'PK', 'PY', 'RO', 'RS', 'SA', 'SI',
     'SK', 'SN', 'SZ', 'TA', 'TJ', 'TM', 'TN', 'VA', 'VC', 'VG', 'XK', 'ZM',
@@ -57,7 +57,7 @@ function addressfield_get_address_format($country_code) {
   // postal code in 'used_fields' and 'required_fields'.
   $countries_with_required_postal_code = array(
     'AT', 'AX', 'BE', 'BL', 'CH', 'DE', 'DK', 'FI', 'FK', 'FR', 'GF', 'GG',
-    'GL', 'GP', 'GR', 'GS', 'IM', 'IO', 'JE', 'LI', 'LU', 'MF', 'MQ', 'NC',
+    'GL', 'GP', 'GR', 'GS', 'HU', 'IM', 'IO', 'JE', 'LI', 'LU', 'MF', 'MQ', 'NC',
     'NL', 'NO', 'PL', 'PM', 'PN', 'PT', 'RE', 'SE', 'SH', 'SJ', 'TC', 'WF',
     'YT',
   );
@@ -245,6 +245,7 @@ function addressfield_get_address_format($country_code) {
     'used_fields' => array('locality', 'administrative_area', 'postal_code'),
     'required_fields' => array('locality', 'administrative_area', 'postal_code'),
     'administrative_area_label' => t('Region', array(), array('context' => 'Territory of a country')),
+    'render_administrative_area_value' => TRUE,
   );
   $address_formats['LT'] = array(
     'used_fields' => array('locality', 'administrative_area', 'postal_code'),
@@ -343,6 +344,7 @@ function addressfield_get_address_format($country_code) {
   $address_formats['RU'] = array(
     'used_fields' => array('locality', 'administrative_area', 'postal_code'),
     'required_fields' => array('locality', 'postal_code'),
+    'render_administrative_area_value' => TRUE,
   );
   $address_formats['SC'] = array(
     'used_fields' => array('locality', 'administrative_area'),

+ 1 - 1
sites/all/modules/contrib/fields/addressfield/addressfield.devel_generate.inc

@@ -23,7 +23,7 @@ function addressfield_devel_generate($object, $field, $instance, $bundle) {
  */
 function _addressfield_devel_generate($object, $field, $instance, $bundle) {
   // Set default value
-  $object_field = addressfield_default_values();
+  $object_field = addressfield_default_values($field, $instance);
   $addresses = _addressfield_sample_addresses();
   $object_field = array_merge($object_field, $addresses[array_rand($addresses)]);
   unset($object_field['data']);

+ 3 - 3
sites/all/modules/contrib/fields/addressfield/addressfield.info

@@ -9,9 +9,9 @@ files[] = addressfield.migrate.inc
 files[] = views/addressfield_views_handler_field_country.inc
 files[] = views/addressfield_views_handler_filter_country.inc
 
-; Information added by Drupal.org packaging script on 2015-01-16
-version = "7.x-1.0"
+; Information added by Drupal.org packaging script on 2015-04-23
+version = "7.x-1.1"
 core = "7.x"
 project = "addressfield"
-datestamp = "1421426885"
+datestamp = "1429819382"
 

+ 1 - 1
sites/all/modules/contrib/fields/addressfield/addressfield.install

@@ -203,7 +203,7 @@ function addressfield_update_7001() {
         // previously selected default country.
         $default_country = '';
         if (!empty($instance['required']) && !empty($instance['default_value'])) {
-          $default_country = $instance['default_value']['country'];
+          $default_country = $instance['default_value'][0]['country'];
         }
 
         $instance['widget']['settings']['default_country'] = $default_country;

+ 16 - 8
sites/all/modules/contrib/fields/addressfield/addressfield.module

@@ -298,10 +298,9 @@ function addressfield_theme() {
 function theme_addressfield_container($variables) {
   $element = $variables['element'];
   $element['#children'] = trim($element['#children']);
-  // Remove the autocomplete attributes because the W3C validator complains.
-  // They are only used on forms anyway.
+  // Remove the autocomplete attribute because the W3C validator complains.
+  // It's only used on forms anyway.
   unset($element['#attributes']['autocomplete']);
-  unset($element['#attributes']['x-autocompletetype']);
 
   if (strlen($element['#children']) > 0) {
     $output = '<' . $element['#tag'] . drupal_attributes($element['#attributes']) . '>';
@@ -375,9 +374,15 @@ function addressfield_field_info() {
 function addressfield_default_values($field, $instance, array $address = array()) {
   $available_countries = _addressfield_country_options_list($field, $instance);
   $default_country = $instance['widget']['settings']['default_country'];
-  // If the default country is not in the list of available countries,
-  // fallback to the first country in the list.
-  if ($default_country && !isset($available_countries[$default_country])) {
+  // Resolve the special site_default option.
+  if ($default_country == 'site_default') {
+    $default_country = variable_get('site_default_country', '');
+  }
+  // Fallback to the first country in the list if the default country is not
+  // available, or is empty even though the field is required.
+  $not_available = $default_country && !isset($available_countries[$default_country]);
+  $empty_but_required = empty($default_country) && !empty($instance['required']);
+  if ($not_available || $empty_but_required) {
     $default_country = key($available_countries);
   }
 
@@ -458,7 +463,10 @@ function addressfield_field_widget_info() {
     'field types' => array('addressfield'),
     'settings' => array(
       'available_countries' => array(),
-      'default_country' => '',
+      // Can't use variable_get('site_default_country') here because it would
+      // set the value in stone. Instead, the site_default option allows the
+      // default country to always reflect the current site setting.
+      'default_country' => 'site_default',
       'format_handlers' => array('address'),
     ),
   );
@@ -487,7 +495,7 @@ function addressfield_field_widget_settings_form($field, $instance) {
     $form['default_country'] = array(
       '#type' => 'select',
       '#title' => t('Default country'),
-      '#options' => _addressfield_country_options_list(),
+      '#options' => array('site_default' => t('- Site default -')) + _addressfield_country_options_list(),
       '#default_value' => $settings['default_country'],
       '#empty_value' => '',
     );

+ 3 - 3
sites/all/modules/contrib/fields/addressfield/example/addressfield_example.info

@@ -7,9 +7,9 @@ hidden = TRUE
 dependencies[] = ctools
 dependencies[] = addressfield
 
-; Information added by Drupal.org packaging script on 2015-01-16
-version = "7.x-1.0"
+; Information added by Drupal.org packaging script on 2015-04-23
+version = "7.x-1.1"
 core = "7.x"
 project = "addressfield"
-datestamp = "1421426885"
+datestamp = "1429819382"
 

+ 12 - 9
sites/all/modules/contrib/fields/addressfield/plugins/format/address.inc

@@ -38,10 +38,10 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
     '#tag' => 'div',
     '#attributes' => array(
       'class' => array('thoroughfare'),
-      'x-autocompletetype' => 'address-line1',
       'autocomplete' => 'address-line1',
     ),
     '#size' => 30,
+    '#maxlength' => 255,
     '#required' => TRUE,
   );
   $format['street_block']['premise'] = array(
@@ -49,10 +49,10 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
     '#tag' => 'div',
     '#attributes' => array(
       'class' => array('premise'),
-      'x-autocompletetype' => 'address-line2',
       'autocomplete' => 'address-line2',
     ),
     '#size' => 30,
+    '#maxlength' => 255,
   );
   $format['locality_block'] = array(
     '#type' => 'addressfield_container',
@@ -60,6 +60,7 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
       'class' => array('addressfield-container-inline', 'locality-block', 'country-' . $address['country']),
     ),
     '#weight' => 50,
+    '#maxlength' => 255,
   );
   $format['locality_block']['#attached']['css'][] = drupal_get_path('module', 'addressfield') . '/addressfield.css';
   $format['locality_block']['postal_code'] = array(
@@ -67,9 +68,9 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
     '#required' => in_array('postal_code', $address_format['required_fields']),
     '#access' => in_array('postal_code', $address_format['used_fields']),
     '#size' => 10,
+    '#maxlength' => 255,
     '#attributes' => array(
       'class' => array('postal-code'),
-      'x-autocompletetype' => 'postal-code',
       'autocomplete' => 'postal-code',
     ),
   );
@@ -78,9 +79,11 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
     '#required' => in_array('dependent_locality', $address_format['required_fields']),
     '#access' => in_array('dependent_locality', $address_format['used_fields']),
     '#size' => 25,
+    '#maxlength' => 255,
     '#tag' => 'div',
     '#attributes' => array(
-      'class' => array('dependent-locality')
+      'class' => array('dependent-locality'),
+      'autocomplete' => '"address-level3',
     ),
     // Most formats place this field in its own row.
     '#suffix' => $clearfix,
@@ -90,11 +93,11 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
     '#required' => in_array('locality', $address_format['required_fields']),
     '#access' => in_array('locality', $address_format['used_fields']),
     '#size' => 30,
+    '#maxlength' => 255,
     '#prefix' => ' ',
     '#attributes' => array(
       'class' => array('locality'),
-      'x-autocompletetype' => 'locality',
-      'autocomplete' => 'locality',
+      'autocomplete' => '"address-level2',
     ),
   );
   $format['locality_block']['administrative_area'] = array(
@@ -103,12 +106,12 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
     '#access' => in_array('administrative_area', $address_format['used_fields']),
     '#empty_value' => '',
     '#size' => 10,
+    '#maxlength' => 255,
     '#prefix' => ' ',
     '#render_option_value' => $address_format['render_administrative_area_value'],
     '#attributes' => array(
       'class' => array('state'),
-      'x-autocompletetype' => 'region',
-      'autocomplete' => 'region',
+      'autocomplete' => 'address-level1',
     ),
   );
   $format['country'] = array(
@@ -118,7 +121,6 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
     '#required' => TRUE,
     '#attributes' => array(
       'class' => array('country'),
-      'x-autocompletetype' => 'country',
       'autocomplete' => 'country',
     ),
     '#weight' => 100,
@@ -166,6 +168,7 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
       '#tag' => NULL,
       '#attributes' => array('class' => array('premise')),
       '#size' => 20,
+      '#maxlength' => 255,
       '#prefix' => ', ',
     );
     $format['locality_block']['locality']['#suffix'] = ' - ';

+ 4 - 2
sites/all/modules/contrib/fields/addressfield/plugins/format/name-full.inc

@@ -28,24 +28,26 @@ function addressfield_format_name_full_generate(&$format, $address) {
     // until one is selected.
     '#access' => !empty($address['country']),
   );
+  // Maxlength is set to 127 so that the name_line still can be created without
+  // exceeding the char limit from the database.
   $format['name_block']['first_name'] = array(
     '#title' => t('First name'),
     '#size' => 30,
+    '#maxlength' => 127,
     '#required' => TRUE,
     '#attributes' => array(
       'class' => array('first-name'),
-      'x-autocompletetype' => 'given-name',
       'autocomplete' => 'given-name',
     ),
   );
   $format['name_block']['last_name'] = array(
     '#title' => t('Last name'),
     '#size' => 30,
+    '#maxlength' => 127,
     '#required' => TRUE,
     '#prefix' => ' ',
     '#attributes' => array(
       'class' => array('last-name'),
-      'x-autocompletetype' => 'family-name',
       'autocomplete' => 'family-name',
     ),
   );

+ 1 - 1
sites/all/modules/contrib/fields/addressfield/plugins/format/name-oneline.inc

@@ -31,10 +31,10 @@ function addressfield_format_name_oneline_generate(&$format, $address) {
     '#tag' => 'div',
     '#attributes' => array(
       'class' => array('name-block'),
-      'x-autocompletetype' => 'name',
       'autocomplete' => 'name',
     ),
     '#size' => 30,
+    '#maxlength' => 255,
     '#required' => TRUE,
   );
 }

+ 1 - 1
sites/all/modules/contrib/fields/addressfield/plugins/format/organisation.inc

@@ -29,9 +29,9 @@ function addressfield_format_organisation_generate(&$format, $address) {
   $format['organisation_block']['organisation_name'] = array(
     '#title' => t('Company'),
     '#size' => 30,
+    '#maxlength' => 255,
     '#attributes' => array(
       'class' => array('organisation-name'),
-      'x-autocompletetype' => 'organization',
       'autocomplete' => 'organization',
     ),
   );

+ 91 - 93
sites/all/modules/contrib/fields/serial/serial.inc

@@ -1,5 +1,4 @@
 <?php
-
 /**
  * @file
  * Internal functions for the Serial module.
@@ -16,94 +15,94 @@
 /**
  * Creates an assistant serial table for a new created field.
  *
- * @param $field
- *   a serial field
- * @param $instance
- *   a new instance of that serial field
+ * @param array $field
+ *   Serial field.
+ * @param array $instance
+ *   New instance of that serial field.
  */
-function _serial_create_table($field, $instance) {
+function _serial_create_table(array $field, array $instance) {
   $table = _serial_get_field_table_name($field, $instance);
-  $schema = _serial_get_table_schema();
-  db_create_table($table, $schema);
+
+  if (!db_table_exists($table)) {
+    db_create_table($table, _serial_get_table_schema());
+  }
 }
 
 /**
  * Drops an assistant serial table for a deleted field.
  *
- * @param $field
- *   a serial field
- * @param $instance
- *   a deleted instance of that serial field
+ * @param array $field
+ *   Serial field.
+ * @param array $instance
+ *   Deleted instance of that serial field.
  */
-function _serial_drop_table($field, $instance) {
-  $table = _serial_get_field_table_name($field, $instance);
-  db_drop_table($table);
+function _serial_drop_table(array $field, array $instance) {
+  db_drop_table(_serial_get_field_table_name($field, $instance));
 }
 
 /**
  * Renames serial table(s) when a content type us renamed.
  *
- * @param $old_type
- *   an old node type machine name
- * @param $new_type
- *   a new node type machine name
+ * @param string $old_type
+ *   An old node type machine name.
+ * @param string $new_type
+ *   A new node type machine name.
  */
 function _serial_rename_tables($old_type, $new_type) {
-
   // Build the query to find all affected tables.
-  $query = db_select('field_config', 'f')->fields('f', array('field_name'));
-  $table_joined_alias = $query->join(
-      'field_config_instance', 'i',
-      '(f.field_name = i.field_name) AND ' .
-      '(f.type = :field_type) AND (i.bundle = :bundle_type)',
-      array(':field_type' => 'serial', ':bundle_type' => $new_type)
-  );
+  $query = db_select('field_config', 'f')
+    ->fields('f', array('field_name'));
 
-  // Add an access check and execute it.
-  $result = $query->addTag('node_access')->execute();
+  $query->join(
+    'field_config_instance',
+    'i',
+    "f.field_name = i.field_name AND f.type = 'serial' AND i.bundle = '$new_type'"
+  );
 
   // Rename each affected table.
-  foreach ($result as $record) {
-    $old_table = _serial_get_table_name($old_type, $record->field_name);
-    $new_table = _serial_get_table_name($new_type, $record->field_name);
-    db_rename_table($old_table, $new_table);
+  foreach ($query->addTag('node_access')->execute() as $record) {
+    db_rename_table(
+      _serial_get_table_name($old_type, $record->field_name),
+      _serial_get_table_name($new_type, $record->field_name)
+    );
   }
 }
 
 /**
  * Gets the name of the assistant table for a specific field.
  *
- * @param $field
- *   a serial field
- * @param $instance
- *   an instance of that serial field
- * @return
- *   the name of the assistant table of the specified field instance.
+ * @param array $field
+ *   Serial field.
+ * @param array $instance
+ *   An instance of that serial field.
+ *
+ * @return string
+ *   The name of the assistant table of the specified field instance.
  */
-function _serial_get_field_table_name($field, $instance) {
+function _serial_get_field_table_name(array $field, array $instance) {
   return _serial_get_table_name($instance['bundle'], $field['field_name']);
 }
 
 /**
  * Gets the name of the assistant table for a specific field.
  *
- * @param $bundle
- *   the name of the entity type that contains the field
- * @param $field_name
- *   the name of the field
- * @return
+ * @param string $bundle
+ *   The name of the entity type that contains the field.
+ * @param string $field_name
+ *   The name of the field.
+ *
+ * @return string
  *   the name of the assistant table of the specified field.
  */
 function _serial_get_table_name($bundle, $field_name) {
-  return db_escape_table( // be on the safe side
-    'serial_' . $bundle . '_' . $field_name);
+  return db_escape_table('serial_' . $bundle . '_' . $field_name);
 }
 
 /**
  * Gets the schema of the assistant tables for generating serial values.
  *
- * @return
- *   the assistant table schema.
+ * @return array
+ *   Assistant table schema.
  */
 function _serial_get_table_schema() {
   return array(
@@ -131,28 +130,24 @@ function _serial_get_table_schema() {
 /**
  * Generates a unique serial value (unique per node type).
  *
- * @param $nid
- *   id of the node for which to generate a serial value
- * @param $bundle
- *   a containing bundle (e.g. content type)
- * @param $field_name
- *   the field name
- * @param $delete
- *   indicates if temporary records should be deleted
- * @return
+ * @param string $bundle
+ *   Containing bundle (e.g. content type).
+ * @param string $field_name
+ *   The field name.
+ * @param bool $delete
+ *   Indicates if temporary records should be deleted.
+ *
+ * @return int
  *   the unique serial value number.
  */
 function _serial_generate_value($bundle, $field_name, $delete = TRUE) {
-
   // Get the name of the relevant table.
   $table = _serial_get_table_name($bundle, $field_name);
 
   // Insert a temporary record to get a new unique serial value.
   $uniqid = uniqid('', TRUE);
   $sid = db_insert($table)
-    ->fields(array(
-      'uniqid' => $uniqid,
-    ))
+    ->fields(array('uniqid' => $uniqid))
     ->execute();
 
   // If there's a reason why it's come back undefined, reset it.
@@ -160,9 +155,9 @@ function _serial_generate_value($bundle, $field_name, $delete = TRUE) {
 
   // Delete the temporary record.
   if ($delete && ($sid % 10) == 0) {
-  db_delete($table)
-    ->condition('uniqid', $uniqid, '=')
-    ->execute();
+    db_delete($table)
+      ->condition('uniqid', $uniqid)
+      ->execute();
   }
 
   // Return the new unique serial value.
@@ -172,46 +167,49 @@ function _serial_generate_value($bundle, $field_name, $delete = TRUE) {
 /**
  * Initializes the value of a new serial field in existing nodes.
  *
- * @param $bundle
- *   a containing bundle (e.g. content type)
- * @param $field_name
- *   the field name
- * @return
- *   the number of existing nodes that have been initialized.
+ * @todo Currently works only for nodes - should support comments and users.
+ *
+ * @param string $bundle
+ *   Containing bundle (e.g. content type).
+ * @param string $field_name
+ *   The field name.
+ *
+ * @return int
+ *   Number of existing nodes that have been initialized.
  */
 function _serial_init_old_nodes($bundle, $field_name) {
-  // Retrieve all the node ids of that type:
-  $query = "SELECT nid FROM {node} WHERE type = :type ORDER BY nid";
-    // TODO: Currently works only for nodes - should support comments and users.
-  $result = db_query($query, array('type' => $bundle));
-
-  // Allocate a serial number for every old node:
-  $count = 0;
-  foreach ($result as $node) {
-    $nid = $node->nid;
-    $node = node_load($nid);
-    $sid = _serial_generate_value($bundle, $field_name, FALSE);
-    $node->{$field_name} = array('und' => array(array('value' => $sid)));
+  $nodes = node_load_multiple(array(), array('type' => $bundle));
+
+  // Allocate a serial number for every old node.
+  foreach ($nodes as $node) {
+    $node->{$field_name} = array(
+      LANGUAGE_NONE => array(
+        array(
+          'value' => _serial_generate_value($bundle, $field_name, FALSE),
+        ),
+      ),
+    );
+
     node_save($node);
-    $count++;
   }
 
-  // Return the number of existing nodes that have been initialized:
-  return $count;
+  // Return the number of existing nodes that have been initialized.
+  return count($nodes);
 }
 
 /**
  * Retrieves all the managed serial fields.
  *
- * @return result set containing pairs of (node type name, field name).
+ * @return array
+ *   Pairs of node type name, field name.
  */
 function _serial_get_all_fields() {
   $query = db_select('field_config', 'f');
   $query->join('field_config_instance', 'i', 'i.field_name = f.field_name');
-  $query->fields('i', array('bundle', 'field_name'))
-        ->condition('f.type', 'serial', '=')
-        ->condition('i.deleted', 0, '=');
-  $result = $query->execute();
-  return $result->fetchAll();
-}
 
+  return $query->fields('i', array('bundle', 'field_name'))
+    ->condition('f.type', 'serial')
+    ->condition('i.deleted', 0)
+    ->execute()
+    ->fetchAll();
+}

+ 3 - 3
sites/all/modules/contrib/fields/serial/serial.info

@@ -6,9 +6,9 @@ dependencies[] = field
 files[] = serial.module
 
 
-; Information added by drupal.org packaging script on 2013-10-15
-version = "7.x-1.3"
+; Information added by Drupal.org packaging script on 2015-05-19
+version = "7.x-1.4"
 core = "7.x"
 project = "serial"
-datestamp = "1381844527"
+datestamp = "1432026177"
 

+ 15 - 30
sites/all/modules/contrib/fields/serial/serial.install

@@ -1,24 +1,15 @@
 <?php
-
 /**
  * @file
  * Install, update and uninstall functions for the Serial module.
  */
 
-/**
- * Implements hook_uninstall().
- */
-function serial_uninstall() {
-  /*
-   * Schema tables are now dropped automatically.  However, if any work needs
-   * to be done before this, do it here.
-   */
-}
-
 /**
  * Implements hook_field_schema().
  */
 function serial_field_schema($field) {
+  $columns = array();
+
   switch ($field['type']) {
     case 'serial':
       $columns['value'] = array(
@@ -31,9 +22,8 @@ function serial_field_schema($field) {
       );
       break;
   }
-  return array(
-    'columns' => $columns
-  );
+
+  return array('columns' => $columns);
 }
 
 /**
@@ -42,45 +32,40 @@ function serial_field_schema($field) {
 function serial_schema() {
   // Get the standard schema:
   module_load_include('inc', 'serial');
-  $table_schema = _serial_get_table_schema();
 
-  // Build the schema by iteration over all the serial field instances:
+  $table_schema = _serial_get_table_schema();
   $schema = array();
-  $result = _serial_get_all_fields();
-  foreach ($result as $field) {
-    $table = _serial_get_table_name($field->bundle, $field->field_name);
-    $schema[$table] = $table_schema;
+
+  foreach (_serial_get_all_fields() as $field) {
+    $schema[_serial_get_table_name($field->bundle, $field->field_name)] = $table_schema;
   }
 
-  // Return the schema of all the assistant tables (one per serial field instance):
+  // Return the schema of all the assistant tables (one per field instance).
   return $schema;
 }
 
 /**
  * Upgrade path.
  *
- * Switches from nids to uniqid.
+ * Switches from nids to uniqids.
  */
 function serial_update_7130() {
-  // Get the new field schema.
   module_load_include('inc', 'serial');
+
   $table_schema = _serial_get_table_schema();
-  $uniqid_schema = $table_schema['fields']['uniqid'];
 
   // Update the schema of old assistant tables.
-  $result = _serial_get_all_fields();
-  foreach ($result as $field) {
+  foreach (_serial_get_all_fields() as $field) {
     // Empty the table.
     $table = _serial_get_table_name($field->bundle, $field->field_name);
     db_delete($table)->execute();
 
-    // Drop nid field and key
+    // Drop nid field and key.
     db_drop_field($table, 'nid');
     db_drop_unique_key($table, 'nid');
 
-    // Add uniqid field and key
-    db_add_field($table, 'uniqid', $uniqid_schema);
+    // Add uniqid field and key.
+    db_add_field($table, 'uniqid', $table_schema['fields']['uniqid']);
     db_add_unique_key($table, 'uniqid', array('uniqid'));
   }
 }
-

+ 28 - 76
sites/all/modules/contrib/fields/serial/serial.module

@@ -1,14 +1,9 @@
 <?php
-
 /**
  * @file
  * The Serial module main file.
  */
 
-//==================//
-// Field Definition //
-//==================//
-
 /**
  * Implements hook_field_info().
  */
@@ -17,6 +12,9 @@ function serial_field_info() {
     'serial' => array(
       'label' => t('Serial'),
       'description' => t('Auto increment serial field type.'),
+      // The "property_type" should be defined for accessing the
+      // field by entity metadata wrapper.
+      'property_type' => 'serial',
       'default_widget' => 'serial',
       'default_formatter' => 'serial_formatter_default',
     ),
@@ -28,18 +26,19 @@ function serial_field_info() {
  */
 function serial_field_create_instance($instance) {
   $field = field_read_field($instance['field_name']);
-  if ($field['type'] == 'serial') {
+
+  if ('serial' == $field['type']) {
     // Create the assistant table:
     module_load_include('inc', 'serial');
     _serial_create_table($field, $instance);
 
-    // Set serial values for old objects
+    // Set serial values for old objects.
     $old_count = _serial_init_old_nodes($instance['bundle'], $field['field_name']);
-    if ($old_count) {
-      drupal_set_message(
-        t('Serial values have been automatically set for %count existing nodes.',
-          array('%count' => $old_count))
-      );
+
+    if ($old_count > 0) {
+      drupal_set_message(t('Serial values have been automatically set for %count existing nodes.', array(
+        '%count' => $old_count,
+      )));
     }
   }
 }
@@ -49,8 +48,9 @@ function serial_field_create_instance($instance) {
  */
 function serial_field_delete_instance($instance) {
   $field = field_read_field($instance['field_name']);
-  if ($field['type'] == 'serial') {
-    // Drop the assistant table:
+
+  if ('serial' == $field['type']) {
+    // Drop the assistant table.
     module_load_include('inc', 'serial');
     _serial_drop_table($field, $instance);
   }
@@ -60,18 +60,12 @@ function serial_field_delete_instance($instance) {
  * Implements hook_form_alter().
  */
 function serial_form_alter(&$form, $form_state, $form_id) {
+  if ('field_ui_field_settings_form' == $form_id && 'serial' == $form['field']['type']['#value']) {
+    drupal_set_message(t('Serial field %field has been created.', array(
+      '%field' => $form['field']['field_name']['#value'],
+    )));
 
-  if ($form_id == 'field_ui_field_settings_form' && $form['field']['type']['#value'] == 'serial') {
-    // Show messages:
-    $field_name = $form['field']['field_name']['#value'];
-    drupal_set_message(
-      t('Serial field %field has been created.',
-        array('%field' => $field_name))
-    );
-
-    // Go back to Managed Fields:
-    $type = $form['#bundle'];
-    drupal_goto("admin/structure/types/manage/$type/fields");
+    drupal_goto("admin/structure/types/manage/{$form['#bundle']}/fields");
   }
 }
 
@@ -79,19 +73,19 @@ function serial_form_alter(&$form, $form_state, $form_id) {
  * Implements hook_field_presave().
  */
 function serial_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
-  module_load_include('inc', 'serial');
   if (empty($items)) {
-    $sid = _serial_generate_value($instance['bundle'], $field['field_name']);
-    $items = array(array('value' => $sid));
+    module_load_include('inc', 'serial');
+
+    $items = array(array('value' => _serial_generate_value($instance['bundle'], $field['field_name'])));
   }
 }
 
-
 /**
  * Implements hook_field_is_empty().
  */
 function serial_field_is_empty($item, $field) {
-  return FALSE; // never should be treated as empty
+  // Never should be treated as empty.
+  return FALSE;
 }
 
 /**
@@ -116,39 +110,6 @@ function serial_node_type_update($info) {
   }
 }
 
-// Tokens for fields are currently not supported - http://drupal.org/node/691078.
-
-///**
-// * Implements hook_token_info().
-// */
-//function serial_token_info() {
-//  $type = array(
-//    'name' => t('Nodes'),
-//    'description' => t('Tokens related to individual nodes.'),
-//    'needs-data' => 'node',
-//  );
-//  $node['serial'] = array(
-//    'name' => t("Serial Field"),
-//    'description' =>  t('Serial field value (unique per node type)'),
-//    'needs-data' => 'node',
-//  );
-//  return array(
-//    'types' => array('node' => $type),
-//    'tokens' => array('node' => $node),
-//  );
-//}
-//
-///**
-// * Implements hook_tokens().
-// */
-//function serial_tokens($type, $tokens, $data, $options) {
-//  // TODO
-//}
-
-//=================//
-// Field Formatter //
-//=================//
-
 /**
  * Implements hook_field_formatter_info().
  */
@@ -157,7 +118,7 @@ function serial_field_formatter_info() {
     'serial_formatter_default' => array(
       'label' => t('Default'),
       'field types' => array('serial'),
-    )
+    ),
   );
 }
 
@@ -172,21 +133,17 @@ function serial_field_formatter_view($entity_type, $entity, $field, $instance, $
     $element[$delta] = array(
       '#markup' => theme('serial_formatter_default', array(
         'serial_id' => $item['value'],
-      ))
+      )),
     );
   }
+
   return $element;
 }
 
-/**
- * Theme Functions
- */
-
 /**
  * Implements hook_theme().
  */
 function serial_theme() {
-
   // Register the theme for the default formatter.
   return array(
     'serial_formatter_default' => array(
@@ -204,10 +161,6 @@ function theme_serial_formatter_default($variables) {
   return $variables['serial_id'];
 }
 
-//==============//
-// Field Widget //
-//==============//
-
 /**
  * Implements hook_field_widget_info().
  */
@@ -228,7 +181,6 @@ function serial_field_widget(&$form, &$form_state, $field, $instance, $items, $d
     'value' => array(
       '#type' => 'hidden',
       '#default_value' => $items[$delta]['value'],
-    )
+    ),
   );
 }
-

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n.info

@@ -8,9 +8,9 @@ files[] = i18n_object.inc
 files[] = i18n.test
 configure = admin/config/regional/i18n
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 1 - 0
sites/all/modules/contrib/localisation/i18n/i18n.test

@@ -362,6 +362,7 @@ class Drupali18nTestCase extends DrupalWebTestCase {
   function resetCaches() {
     drupal_static_reset('locale_url_outbound_alter');
     drupal_static_reset('language_list');
+    drupal_language_initialize();
   }
 
   /**

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info

@@ -8,9 +8,9 @@ files[] = i18n_block.inc
 files[] = i18n_block.test
 
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info

@@ -5,9 +5,9 @@ dependencies[] = i18n_string
 package = Multilingual - Internationalization
 core = 7.x
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info

@@ -6,9 +6,9 @@ package = Multilingual - Internationalization
 core = 7.x
 files[] = i18n_field.inc
 files[] = i18n_field.test
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info

@@ -7,9 +7,9 @@ package = Multilingual - Internationalization
 core = 7.x
 files[] = i18n_forum.test
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info

@@ -10,9 +10,9 @@ core = 7.x
 files[] = i18n_menu.inc
 files[] = i18n_menu.test
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 2 - 2
sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module

@@ -588,7 +588,7 @@ function _i18n_menu_link_localizable_properties($link) {
     // If the title callback is 't' and the link title matches the router title
     // it will be localized by core, not by i18n_menu.
     if (!$router ||
-        (empty($router['title_callback']) || $router['title_callback'] != 't') ||
+        (empty($router['title_callback']) || ($router['title_callback'] != 't' || !empty($link['customized']))) ||
         (empty($router['title']) || $router['title'] != $link['link_title'])
     ) {
       $props[] = 'title';
@@ -597,7 +597,7 @@ function _i18n_menu_link_localizable_properties($link) {
   if (!empty($link['options']['attributes']['title'])) {
     // If the description matches the router description, it will be localized
     // by core.
-    if (!$router || empty($router['description']) || $router['description'] != $link['options']['attributes']['title']) {
+    if (!$router || empty($router['description']) || ($router['description'] != $link['options']['attributes']['title']) || !empty($link['customized'])) {
       $props[] = 'description';
     }
   }

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info

@@ -9,9 +9,9 @@ configure = admin/config/regional/i18n/node
 files[]=i18n_node.test
 files[]=i18n_node.variable.inc
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info

@@ -6,9 +6,9 @@ core = 7.x
 
 files[] = i18n_path.inc
 files[] = i18n_path.test
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_redirect/i18n_redirect.info

@@ -4,9 +4,9 @@ dependencies[] = i18n
 package = Multilingual - Internationalization
 core = 7.x
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_select/i18n_select.info

@@ -6,9 +6,9 @@ core = 7.x
 configure = admin/config/regional/i18n/select
 files[] = i18n_select.test
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.info

@@ -10,9 +10,9 @@ files[] = i18n_string.inc
 files[] = i18n_string.test
 configure = admin/config/regional/i18n/strings
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 8 - 4
sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.install

@@ -29,7 +29,9 @@ function i18n_string_install() {
     i18n_string_update_7001();
   }
   // Create new index in {locales_source}, performance improvement in sites with i18n.
-  db_add_index('locales_source', 'textgroup_context', array('textgroup', 'context'));
+  if (!db_index_exists('locales_source', 'textgroup_context')) {
+    db_add_index('locales_source', 'textgroup_context', array('textgroup', array('context', 50)));
+  }
 }
 
 /**
@@ -106,7 +108,7 @@ function i18n_string_schema() {
     ),
     'primary key' => array('lid'),
     'indexes' => array(
-      'group_context' => array('textgroup', 'context'),
+      'group_context' => array('textgroup', array('context', 50)),
     ),
   );
   return $schema;
@@ -238,7 +240,9 @@ function i18n_string_update_7001() {
  *  Create new index in {locales_source}, performance improvement in sites with i18n.
  */
 function i18n_string_update_7002() {
-  db_add_index('locales_source', 'textgroup_context', array('textgroup', 'context'));
+  if (!db_index_exists('locales_source', 'textgroup_context')) {
+    db_add_index('locales_source', 'textgroup_context', array('textgroup', array('context', 50)));
+  }
 }
 
 
@@ -269,4 +273,4 @@ function i18n_string_update_7002() {
  * Node type
  *  nodetype:type:[type]:[property] -> node:type:[type]:[property]
  *  Property names: title -> title_label
- */
+ */

+ 22 - 0
sites/all/modules/contrib/localisation/i18n/i18n_string/i18n_string.test

@@ -53,6 +53,28 @@ class i18nStringTestCase extends Drupali18nTestCase {
         $this->assertEqual($translation, $translations[$key][$language->language], "The right $language->name ($language->language) translation has been retrieved for $name, $translation");
       }
     }
+
+    // Test that regular strings can be translated. Use 'Built-in interface' as
+    // filter, and translate first one.
+    $search = array(
+      'language' => 'all',
+      'translation' => 'all',
+      'group' => 'default',
+      'string' => '',
+    );
+    $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
+    $this->clickLink(t('edit'));
+    // Just add a random translation.
+    $translation = $this->randomString();
+    $edit = array();
+    foreach ($this->getOtherLanguages() as $language) {
+      $langcode = $language->language;
+      $edit["translations[$langcode]"] = $translation;
+    }
+    $this->drupalPost(NULL, $edit, t('Save translations'));
+    $this->assertText(t('The string has been saved.'), t('The string has been saved.'));
+    $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
+
   }
 
   /**

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_sync/i18n_sync.info

@@ -10,9 +10,9 @@ files[] = i18n_sync.install
 files[] = i18n_sync.module.inc
 files[] = i18n_sync.node.inc
 files[] = i18n_sync.test
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_taxonomy/i18n_taxonomy.info

@@ -11,9 +11,9 @@ files[] = i18n_taxonomy.pages.inc
 files[] = i18n_taxonomy.admin.inc
 files[] = i18n_taxonomy.test
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_translation/i18n_translation.info

@@ -6,9 +6,9 @@ core = 7.x
 
 files[] = i18n_translation.inc
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.info

@@ -4,9 +4,9 @@ core = 7.x
 package = Multilingual - Internationalization
 dependencies[] = i18n_variable
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 2 - 2
sites/all/modules/contrib/localisation/i18n/i18n_user/i18n_user.module

@@ -54,7 +54,7 @@ function i18n_user_user_mail_tokens(&$replacements, $data, $options) {
  */
 function i18n_user_user_pass_reset_url($account) {
   $timestamp = REQUEST_TIME;
-  return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE, 'language' => i18n_language($account->language)));
+  return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), array('absolute' => TRUE, 'language' => i18n_language($account->language)));
 }
 
 /**
@@ -65,5 +65,5 @@ function i18n_user_user_pass_reset_url($account) {
  */
 function i18n_user_user_cancel_url($account) {
   $timestamp = REQUEST_TIME;
-  return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE, 'language' => i18n_language($account->language)));
+  return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), array('absolute' => TRUE, 'language' => i18n_language($account->language)));
 }

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/i18n_variable/i18n_variable.info

@@ -10,9 +10,9 @@ configure = admin/config/regional/i18n/variable
 files[] = i18n_variable.class.inc
 files[] = i18n_variable.test
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 3 - 3
sites/all/modules/contrib/localisation/i18n/tests/i18n_test.info

@@ -7,9 +7,9 @@ package = Testing
 core = 6.x
 hidden = TRUE
 
-; Information added by Drupal.org packaging script on 2015-01-26
-version = "7.x-1.12"
+; Information added by Drupal.org packaging script on 2015-05-07
+version = "7.x-1.13"
 core = "7.x"
 project = "i18n"
-datestamp = "1422286982"
+datestamp = "1430999922"
 

+ 10 - 2
sites/all/modules/contrib/users/friendly_register/README.txt

@@ -16,10 +16,18 @@ links to the login or reset password pages.
 
 Installation
 ------------
-* Install this module into the appropriate modules directory.
-* Enable this module.
+* Install this module into the appropriate modules directory and enable it.
+  See: https://drupal.org/node/895232 for more information.
 * Make sure you have cron running on a regular basis (at least once per 24 hours)
 
+Verification
+------------
+* On your site, log out.
+* Try to create an account using a pre-existing user name or email address.
+* If the module is working, an immediate error message should appear below that
+  field stating either the user name is unavailable or that the email is
+  already registered.
+
 Permissions
 -----------
 There is only one permission for this module and it is completely optional. Set

+ 38 - 0
sites/all/modules/contrib/users/friendly_register/friendly_register.api.php

@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @file
+ * Hooks provided by the friendly_register module.
+ */
+
+/**
+ * @addtogroup hooks
+ * @{
+ */
+
+/**
+ * Allows you to provide your own validation routines for email addresses
+ * beyond the valid_email_address() call.
+ *
+ * @param string $address
+ *
+ * @return bool
+ */
+function hook_validate_email_address($address) {
+  return TRUE;
+}
+
+/**
+ * Allows you to provide your own validation routines for the user name.
+ *
+ * @param string $username
+ *
+ * @return bool
+ */
+function hook_validate_user_name($username) {
+  return TRUE;
+}
+
+/**
+ * @} End of "addtogroup hooks".
+ */

+ 3 - 3
sites/all/modules/contrib/users/friendly_register/friendly_register.info

@@ -2,9 +2,9 @@ name = Friendly Register
 description = "Allows for users to see if a username or email is available before submitting the registration form."
 core = 7.x
 
-; Information added by drupal.org packaging script on 2013-10-20
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2015-05-06
+version = "7.x-1.2"
 core = "7.x"
 project = "friendly_register"
-datestamp = "1382296452"
+datestamp = "1430918950"
 

+ 52 - 3
sites/all/modules/contrib/users/friendly_register/friendly_register.module

@@ -85,9 +85,19 @@ function friendly_register_load_resources() {
   drupal_add_css($path . '/css/friendly_register.css');
 }
 
+/**
+ * JSON callback to check the email address.
+ *
+ * @param $address
+ */
 function friendly_register_check_email($address) {
+  $email_is_valid = TRUE;
+  $all_email_checks = module_invoke_all('validate_email_address', $address);
+  foreach ($all_email_checks as $check) {
+    $email_is_valid = $check && $email_is_valid;
+  }
   // Check if it is a valid email address. No need to check if it is not
-  if (valid_email_address($address)) {
+  if ($email_is_valid) {
     drupal_json_output(_friendly_register_check_field('mail', $address));
   }
   else {
@@ -97,10 +107,44 @@ function friendly_register_check_email($address) {
   }
 }
 
+/**
+ * Implements hook_validate_email_address().
+ *
+ * @param string $address
+ *
+ * @return bool
+ */
+function friendly_register_validate_email_address($address) {
+  return valid_email_address($address);
+}
+
+/**
+ * JSON callback to check the username.
+ *
+ * @param string $username
+ */
 function friendly_register_check_user($username) {
-  drupal_json_output(_friendly_register_check_field('name', $username));
+  $user_is_valid = TRUE;
+  $all_user_checks = module_invoke_all('validate_user_name', $username);
+  foreach ($all_user_checks as $check) {
+    $user_is_valid = $check && $user_is_valid;
+  }
+  if ($user_is_valid) {
+    drupal_json_output(_friendly_register_check_field('name', $username));
+  }
+  else {
+    drupal_json_output(array('available' => 'invalid'));
+  }
 }
 
+/**
+ * Checks the value of a field on the user table.
+ *
+ * @param string $field_name
+ * @param string $value
+ *
+ * @return array
+ */
 function _friendly_register_check_field($field_name, $value) {
   if (_friendly_register_check_flood()) {
     $result = db_query("SELECT uid FROM {users} WHERE " . $field_name . " = :value", array(':value' => $value))->fetchField();
@@ -111,6 +155,11 @@ function _friendly_register_check_field($field_name, $value) {
   }
 }
 
+/**
+ * Checks to see if the user has too many requests (flood).
+ *
+ * @return bool
+ */
 function _friendly_register_check_flood() {
   if (user_access('ignore flood')) {
     return TRUE;
@@ -120,7 +169,7 @@ function _friendly_register_check_flood() {
     $q = 'SELECT hits FROM {friendly_register_flood} WHERE ip = :ip';
     $hits = db_query($q, array(':ip' => $ip))->fetchField();
     if ($hits == NULL) {
-      $id = db_insert('friendly_register_flood')
+      db_insert('friendly_register_flood')
         ->fields(array(
             'ip' => $ip,
             'hits' => 1,

+ 6 - 4
sites/all/modules/contrib/users/friendly_register/js/friendly_register.js

@@ -6,7 +6,7 @@
   Drupal.friendly_register.timeout = null;
 
   Drupal.friendly_register.checkUserName = function (userName) {
-    $.getJSON(userName.ajaxPath + userName.oldValue, function(data) {
+    $.getJSON(userName.ajaxPath + encodeURIComponent(userName.oldValue), function(data) {
       if (!data.flood) {
         var message;
         var cssclass;
@@ -19,6 +19,7 @@
         }
         $('#edit-name-check').remove();
         userName.field.after('<div id="edit-name-check" class="' + cssclass + '"><span class="text">' + message + '</span></div>');
+        Drupal.attachBehaviors();
       } else {
         Drupal.friendly_register.flood = true;
         $('#edit-name-check').remove();
@@ -28,7 +29,7 @@
   };
 
   Drupal.friendly_register.checkEmail = function (email) {
-    $.getJSON(email.ajaxPath + email.oldValue, function(data) {
+    $.getJSON(email.ajaxPath + encodeURIComponent(email.oldValue), function(data) {
       if (!data.flood) {
         if (data.available == 'incomplete') {
           $('#edit-mail-check').remove();
@@ -44,6 +45,7 @@
         }
         $('#edit-mail-check').remove();
         email.field.after('<div id="edit-mail-check" class="' + cssclass + '"><span class="text">' + message + '</span></div>');
+        Drupal.attachBehaviors();
       } else {
         Drupal.friendly_register.flood = true;
         $('#edit-mail-check').remove();
@@ -71,7 +73,7 @@
       email.avail = Drupal.t('This email address has not been used.');
       email.notAvail = Drupal.t('This email address is already in use, please <a href="@login">try logging in</a> with that email address or <a href="@reset">resetting your password</a>.', {'@login': loginURL, '@reset': resetURL});
 
-      userName.field.focus(function () {
+      userName.field.once('friendly-register').focus(function () {
         if (Drupal.friendly_register.flood) {
           return;
         }
@@ -92,7 +94,7 @@
         }
       });
 
-      email.field.focus(function () {
+      email.field.once('friendly-register').focus(function () {
         if (Drupal.friendly_register.flood) {
           return;
         }

+ 21 - 7
sites/all/modules/contrib/views/views/drush/views.drush.inc

@@ -42,10 +42,14 @@ function views_drush_command() {
     ),
     'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
     'aliases' => array('vr'),
+    'options' => array(
+      'all' => 'If provided, all views will be reverted.',
+    ),
     'examples' => array(
       'drush vr archive' => 'Reverts the "archive" view.',
       'drush rln archive frontpage' => 'Reverts the "archive" and "frontpage" view.',
       'drush vr' => 'Will present you with a list of overridden views to choose from, and an option to revert all overridden views.',
+      'drush vr --all' => 'Will revert all overridden views.',
     ),
   );
   $items['views-dev'] = array(
@@ -126,15 +130,21 @@ function views_revert_views() {
     }
   }
 
-  // Return early if there are no overridden views in the system.
+  // If there are no overridden views in the system, report it.
   if (empty($overridden)) {
-    return drush_set_error(dt('There are no overridden views in the system.'));
+    drush_log(dt('There are no overridden views in the system.'), 'ok');
   }
 
-  // If the user specified in the command the views to be overridden.
-  if (!empty($viewnames)) {
+  // If the user provided the "--all" option, revert all views.
+  if (drush_get_option('all')) {
+    $i = views_revert_allviews($views);
+  }
+
+  // If the user specified a list of views on the CLI, revert those.
+  elseif (!empty($viewnames)) {
     foreach ($viewnames as $key => $viewname) {
       $is_overridden = key_exists($viewname, $overridden);
+
       // Check if the provided view name is in the system
       if ($viewname && !key_exists($viewname, $views)) {
         drush_set_error(dt("'@viewname' view is not present in the system.", array('@viewname' => $viewname)));
@@ -144,18 +154,22 @@ function views_revert_views() {
         drush_set_error(dt("The view specified '@viewname' is not overridden.", array('@viewname' => $viewname)));
       }
       // If the view is overriden, revert it.
-      elseif ($is_overridden){
+      elseif ($is_overridden) {
         views_revert_view($views[$viewname]);
         $i++;
       }
       // We should never get here but well...
       else {
-        drush_set_error(dt("The view specified '@viewname' is not provided in code, and thus cannot be reverted.", array('@viewname' => $viewname)));
+        drush_set_error(dt(
+          "The view specified '@viewname' is not provided in code, and thus cannot be reverted.",
+          array('@viewname' => $viewname)
+        ));
       }
     }
   }
 
-  // The user did not specify any views in the command, prompt the user
+  // The user neither selected the "--all" option, nor provided a list of views to revert.
+  // Prompt the user.
   else {
     // list of choices for the user
     $overridden['all'] = dt('Revert all overridden views'); // add a choice at the end

+ 1 - 1
sites/all/modules/contrib/views/views/handlers/views_handler_field.inc

@@ -372,7 +372,7 @@ class views_handler_field extends views_handler {
    *   Optional name of the field where the value is stored.
    */
   function get_value($values, $field = NULL) {
-    $alias = isset($field) && isset($this->aliases[$field]) ? $this->aliases[$field] : $this->field_alias;
+    $alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
     if (isset($values->{$alias})) {
       return $values->{$alias};
     }

+ 8 - 10
sites/all/modules/contrib/views/views/handlers/views_handler_filter_date.inc

@@ -158,13 +158,11 @@ class views_handler_filter_date extends views_handler_filter_numeric {
   }
 
   function op_between($field) {
-    $a = intval(strtotime($this->value['min'], 0));
-    $b = intval(strtotime($this->value['max'], 0));
+    // Use the substitutions to ensure a consistent timestamp.
+    $query_substitutions = views_views_query_substitutions($this->view);
+    $a = intval(strtotime($this->value['min'], $query_substitutions['***CURRENT_TIME***']));
+    $b = intval(strtotime($this->value['max'], $query_substitutions['***CURRENT_TIME***']));
 
-    if ($this->value['type'] == 'offset') {
-      $a = '***CURRENT_TIME***' . sprintf('%+d', $a); // keep sign
-      $b = '***CURRENT_TIME***' . sprintf('%+d', $b); // keep sign
-    }
     // This is safe because we are manually scrubbing the values.
     // It is necessary to do it this way because $a and $b are formulas when using an offset.
     $operator = strtoupper($this->operator);
@@ -172,10 +170,10 @@ class views_handler_filter_date extends views_handler_filter_numeric {
   }
 
   function op_simple($field) {
-    $value = intval(strtotime($this->value['value'], 0));
-    if (!empty($this->value['type']) && $this->value['type'] == 'offset') {
-      $value = '***CURRENT_TIME***' . sprintf('%+d', $value); // keep sign
-    }
+    // Use the substitutions to ensure a consistent timestamp.
+    $query_substitutions = views_views_query_substitutions($this->view);
+    $value = intval(strtotime($this->value['value'], $query_substitutions['***CURRENT_TIME***']));
+
     // This is safe because we are manually scrubbing the value.
     // It is necessary to do it this way because $value is a formula when using an offset.
     $this->query->add_where_expression($this->options['group'], "$field $this->operator $value");

+ 22 - 10
sites/all/modules/contrib/views/views/includes/cache.inc

@@ -67,12 +67,11 @@ function _views_fetch_data($table = NULL, $move = TRUE, $reset = FALSE) {
   }
   else {
     if (!$fully_loaded) {
-      $data = views_cache_get('views_data', TRUE);
-      if (!empty($data->data)) {
+      if ($data = views_cache_get('views_data', TRUE)) {
         $cache = $data->data;
       }
-
-      if (empty($cache)) {
+      else {
+        // No cache entry, rebuild.
         $cache = _views_fetch_data_build();
       }
       $fully_loaded = TRUE;
@@ -127,12 +126,25 @@ function _views_data_process_entity_types(&$data) {
 function _views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) {
   static $cache = NULL;
   if (!isset($cache) || $reset) {
-    $start = microtime(TRUE);
-    views_include('plugins');
-    views_include_handlers();
-
-    $cache = views_discover_plugins();
-
+    // Load necessary code once.
+    if (!isset($cache)) {
+      views_include('plugins');
+      views_include_handlers();
+    }
+    // Because plugin data contains translated strings, and as such can be
+    // expensive to build, the results are cached per language.
+    global $language;
+    $cache_key = 'views:plugin_data:' . $language->language;
+    if (!$reset) {
+      if ($cache = cache_get($cache_key)) {
+        $cache = $cache->data;
+      }
+    }
+    // If not available in the cache, build it and cache it.
+    if (!$cache) {
+      $cache = views_discover_plugins();
+      cache_set($cache_key, $cache);
+    }
   }
 
   if (!$type && !$plugin) {

+ 1 - 1
sites/all/modules/contrib/views/views/modules/comment/views_plugin_row_comment_rss.inc

@@ -107,7 +107,7 @@ class views_plugin_row_comment_rss extends views_plugin_row {
       ),
       array(
         'key' => 'dc:creator',
-        'value' => $comment->name,
+        'value' => format_username($comment),
       ),
       array(
         'key' => 'guid',

+ 1 - 1
sites/all/modules/contrib/views/views/modules/node/views_plugin_row_node_rss.inc

@@ -117,7 +117,7 @@ class views_plugin_row_node_rss extends views_plugin_row {
       ),
       array(
         'key' => 'dc:creator',
-        'value' => $node->name,
+        'value' => format_username($node),
       ),
       array(
         'key' => 'guid',

+ 34 - 2
sites/all/modules/contrib/views/views/plugins/views_plugin_cache.inc

@@ -206,14 +206,14 @@ class views_plugin_cache extends views_plugin {
     // Slightly less simple for CSS:
     $css = drupal_add_css();
     $css_start = isset($this->storage['css']) ? $this->storage['css'] : array();
-    $this->storage['css'] = $array_mapping_func($css, $css_start);
+    $this->storage['css'] = $this->assetDiff($css, $css_start, $array_mapping_func);
 
     // Get javascript after/before views renders.
     $js = drupal_add_js();
     $js_start = isset($this->storage['js']) ? $this->storage['js'] : array();
     // If there are any differences between the old and the new javascript then
     // store them to be added later.
-    $this->storage['js'] = $array_mapping_func($js, $js_start);
+    $this->storage['js'] = $this->assetDiff($js, $js_start, $array_mapping_func);
 
     // Special case the settings key and get the difference of the data.
     $settings = isset($js['settings']['data']) ? $js['settings']['data'] : array();
@@ -224,6 +224,38 @@ class views_plugin_cache extends views_plugin {
     $this->storage['headers'] = $array_mapping_func(drupal_get_http_header(), $this->storage['headers']);
   }
 
+  /**
+   * Computes the differences between two JS/CSS asset arrays.
+   *
+   * @param array $assets
+   *   The current asset array.
+   * @param array $start_assets
+   *   The original asset array.
+   * @param string $diff_function
+   *   The function that should be used for computing the diff.
+   *
+   * @return array
+   *   A CSS or JS asset array that contains all entries that are new/different
+   *   in $assets.
+   */
+  protected function assetDiff(array $assets, array $start_assets, $diff_function) {
+    $diff = $diff_function($assets, $start_assets);
+
+    // Cleanup the resulting array since drupal_array_diff_assoc_recursive() can
+    // leave half populated arrays behind.
+    foreach ($diff as $key => $entry) {
+      // If only the weight was different we can remove this entry.
+      if (count($entry) == 1 && isset($entry['weight'])) {
+        unset($diff[$key]);
+      }
+      // If there are other differences we override with the latest entry.
+      elseif ($entry != $assets[$key]) {
+        $diff[$key] = $assets[$key];
+      }
+    }
+    return $diff;
+  }
+
   /**
    * Restore out of band data saved to cache. Copied from Panels.
    */

+ 1 - 1
sites/all/modules/contrib/views/views/plugins/views_plugin_display.inc

@@ -2140,7 +2140,7 @@ class views_plugin_display extends views_plugin {
           '#default_value' => $pager['type'],
         );
 
-        $pager_plugin = views_fetch_plugin_data('pager', $pager['type'], array($this->view->base_table));
+        $pager_plugin = views_fetch_plugin_data('pager', $pager['type']);
         if (!empty($pager_plugin['uses options'])) {
           $form['markup'] = array(
             '#prefix' => '<div class="form-item description">',

+ 2 - 0
sites/all/modules/contrib/views/views/plugins/views_plugin_display_attachment.inc

@@ -227,6 +227,8 @@ class views_plugin_display_attachment extends views_plugin_display {
 
     $args = $this->get_option('inherit_arguments') ? $this->view->args : array();
     $view->set_arguments($args);
+    $exposed_input = $this->get_option('inherit_exposed_filters') ? $this->view->exposed_input : array();
+    $view->set_exposed_input($exposed_input);
     $view->set_display($this->display->id);
     if ($this->get_option('inherit_pager')) {
       $view->display_handler->use_pager = $this->view->display[$display_id]->handler->use_pager();

+ 4 - 0
sites/all/modules/contrib/views/views/plugins/views_plugin_query_default.inc

@@ -1322,6 +1322,10 @@ class views_plugin_query_default extends views_plugin_query {
     if (count($this->having)) {
       $this->has_aggregate = TRUE;
     }
+    elseif (!$this->has_aggregate) {
+      // Allow 'GROUP BY' even no aggregation function has been set.
+      $this->has_aggregate = $this->view->display_handler->get_option('group_by');
+    }
     if ($this->has_aggregate && (!empty($this->groupby) || !empty($non_aggregates))) {
       $groupby = array_unique(array_merge($this->groupby, $non_aggregates));
       foreach ($groupby as $field) {

+ 31 - 0
sites/all/modules/contrib/views/views/tests/handlers/views_handler_filter_date.test

@@ -50,6 +50,21 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
     $this->assertIdenticalResultset($view, $expected_result, $this->map);
     $view->destroy();
 
+    // Test "first day of" type of relative dates for simple operator.
+    $view->set_display('default');
+    $view->init_handlers();
+    $view->filter['created']->operator = '<';
+    $view->filter['created']->value['type'] = 'offset';
+    $view->filter['created']->value['value'] = 'last day of January 1970';
+    $view->execute_display('default');
+    $expected_result = array(
+      array('nid' => $this->nodes[0]->nid),
+      array('nid' => $this->nodes[1]->nid),
+      array('nid' => $this->nodes[2]->nid),
+    );
+    $this->assertIdenticalResultset($view, $expected_result, $this->map);
+    $view->destroy();
+
     // Test offset for between operator.
     $view->set_display('default');
     $view->init_handlers();
@@ -63,6 +78,22 @@ class ViewsHandlerFilterDateTest extends ViewsSqlTest {
     );
     $this->assertIdenticalResultset($view, $expected_result, $this->map);
     $view->destroy();
+
+    // Test "first day of" type of relative dates for between operator.
+    $view->set_display('default');
+    $view->init_handlers();
+    $view->filter['created']->operator = 'between';
+    $view->filter['created']->value['type'] = 'offset';
+    $view->filter['created']->value['max'] = 'last day of January 1970';
+    $view->filter['created']->value['min'] = 'first day of January 1970';
+    $view->execute_display('default');
+    $expected_result = array(
+      array('nid' => $this->nodes[0]->nid),
+      array('nid' => $this->nodes[1]->nid),
+      array('nid' => $this->nodes[2]->nid),
+    );
+    $this->assertIdenticalResultset($view, $expected_result, $this->map);
+    $view->destroy();
   }
 
 

+ 46 - 20
sites/all/modules/contrib/views/views/tests/views_groupby.test

@@ -108,11 +108,14 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
   }
 
   /**
-   * @param $group_by
-   *   Which group_by function should be used, for example sum or count.
+   * @param string|null $group_by
+   *   (optional) Which group_by function should be used, for example sum or
+   *   count. If omitted, the aggregation is tested with no group function.
+   * @param array|null $values
+   *   (optional) Expected values.
    */
-  function GroupByTestHelper($group_by, $values) {
-    // Create 2 nodes of type1 and 3 nodes of type2
+  function GroupByTestHelper($group_by = NULL, $values = NULL) {
+    // Create 4 nodes of type1 and 3 nodes of type2
     $type1 = $this->drupalCreateContentType();
     $type2 = $this->drupalCreateContentType();
 
@@ -136,6 +139,19 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
     $output = $view->execute_display();
 
     $this->assertEqual(count($view->result), 2, 'Make sure the count of items is right.');
+
+    $results = array();
+    // There's no need for a function in order to have aggregation.
+    if (empty($group_by)) {
+      $types = array($type1->type, $type2->type);
+      $results = array_map(function ($item) { return $item->node_type; }, $view->result);
+      sort($types);
+      sort($results);
+      $this->assertIdentical($results, $types);
+      // Exit here with no aggregation function.
+      return;
+    }
+
     // Group by nodetype to identify the right count.
     foreach ($view->result as $item) {
       $results[$item->node_type] = $item->nid;
@@ -144,7 +160,7 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
     $this->assertEqual($results[$type2->type], $values[1]);
   }
 
-  function viewsGroupByViewHelper($group_by) {
+  function viewsGroupByViewHelper($group_by = NULL) {
     $view = new view;
     $view->name = 'group_by_count';
     $view->description = '';
@@ -164,21 +180,27 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
     $handler->display->display_options['pager']['type'] = 'some';
     $handler->display->display_options['style_plugin'] = 'default';
     $handler->display->display_options['row_plugin'] = 'fields';
-    /* Field: Content: Nid */
-    $handler->display->display_options['fields']['nid']['id'] = 'nid';
-    $handler->display->display_options['fields']['nid']['table'] = 'node';
-    $handler->display->display_options['fields']['nid']['field'] = 'nid';
-    $handler->display->display_options['fields']['nid']['group_type'] = $group_by;
-    $handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
-    $handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
-    $handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
-    $handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
-    $handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
-    $handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
-    $handler->display->display_options['fields']['nid']['alter']['html'] = 0;
-    $handler->display->display_options['fields']['nid']['hide_empty'] = 0;
-    $handler->display->display_options['fields']['nid']['empty_zero'] = 0;
-    $handler->display->display_options['fields']['nid']['link_to_node'] = 0;
+
+    // The test view has 2 fields ('nid' and 'type'). Don't add 'nid' when
+    // having no aggregation function. We just want to aggregate on node type.
+    if (!empty($group_by)) {
+      /* Field: Content: Nid */
+      $handler->display->display_options['fields']['nid']['id'] = 'nid';
+      $handler->display->display_options['fields']['nid']['table'] = 'node';
+      $handler->display->display_options['fields']['nid']['field'] = 'nid';
+      $handler->display->display_options['fields']['nid']['group_type'] = $group_by;
+      $handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
+      $handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
+      $handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
+      $handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
+      $handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
+      $handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
+      $handler->display->display_options['fields']['nid']['alter']['html'] = 0;
+      $handler->display->display_options['fields']['nid']['hide_empty'] = 0;
+      $handler->display->display_options['fields']['nid']['empty_zero'] = 0;
+      $handler->display->display_options['fields']['nid']['link_to_node'] = 0;
+    }
+
     /* Field: Content: Type */
     $handler->display->display_options['fields']['type']['id'] = 'type';
     $handler->display->display_options['fields']['type']['table'] = 'node';
@@ -218,6 +240,10 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
     $this->GroupByTestHelper('max', array(4, 7));
   }
 
+  function testGroupByNone() {
+    $this->GroupByTestHelper();
+  }
+
   public function testGroupByCountOnlyFilters() {
     // Check if GROUP BY and HAVING are included when a view
     // Doesn't display SUM, COUNT, MAX... functions in SELECT statment

+ 24 - 0
sites/all/modules/contrib/views/views/tests/views_module.test

@@ -194,6 +194,30 @@ class ViewsModuleTest extends ViewsSqlTest {
     $this->assertEqual(variable_get('views_test_views_data_count', 0), 1, 'Views data rebuilt once');
     $this->assertFalse(drupal_static('_views_fetch_data_fully_loaded'), 'Views data is not fully loaded');
 
+
+    // Test if the cache consistency is ensured. There was an issue where
+    // calling _views_fetch_data() first with a table would prevent the function
+    // from properly rebuilt a missing the general cache entry.
+    // See https://www.drupal.org/node/2475669 for details.
+    // Make sure we start with a empty cache.
+    $this->resetStaticViewsDataCache();
+    cache_clear_all('*', 'cache_views', TRUE);
+
+    // Prime the static cache of _views_fetch_data() by calling it with a table
+    // first.
+    views_fetch_data('views_test');
+    // Now remove the general cache.
+    cache_clear_all('views_data:en', 'cache_views');
+    // Reset the static cache to see if fetches from the persistent cache
+    // properly rebuild the static cache.
+    $this->resetStaticViewsDataCache();
+    // Prime the static cache of _views_fetch_data() by calling it with a table
+    // first.
+    views_fetch_data('views_test');
+    // Fetch the general cache, which was deleted, an see if it is rebuild
+    // properly.
+    views_fetch_data();
+    $this->assertTrue(cache_get('views_data:en', 'cache_views'), 'Cache for all tables was properly rebuild.');
   }
 
   /**

+ 3 - 3
sites/all/modules/contrib/views/views/tests/views_test.info

@@ -5,9 +5,9 @@ core = 7.x
 dependencies[] = views
 hidden = TRUE
 
-; Information added by Drupal.org packaging script on 2015-02-11
-version = "7.x-3.10"
+; Information added by Drupal.org packaging script on 2015-04-29
+version = "7.x-3.11"
 core = "7.x"
 project = "views"
-datestamp = "1423648085"
+datestamp = "1430321048"
 

+ 1 - 1
sites/all/modules/contrib/views/views/views.api.php

@@ -1075,7 +1075,7 @@ function hook_views_query_alter(&$view, &$query) {
     // Traverse through the 'where' part of the query.
     foreach ($query->where as &$condition_group) {
       foreach ($condition_group['conditions'] as &$condition) {
-        // If this is the part of the query filtering on title, chang the
+        // If this is the part of the query filtering on title, change the
         // condition to filter on node ID.
         if ($condition['field'] == 'node.title') {
           $condition = array(

+ 3 - 3
sites/all/modules/contrib/views/views/views.info

@@ -318,9 +318,9 @@ files[] = tests/views_cache.test
 files[] = tests/views_view.test
 files[] = tests/views_ui.test
 
-; Information added by Drupal.org packaging script on 2015-02-11
-version = "7.x-3.10"
+; Information added by Drupal.org packaging script on 2015-04-29
+version = "7.x-3.11"
 core = "7.x"
 project = "views"
-datestamp = "1423648085"
+datestamp = "1430321048"
 

+ 3 - 3
sites/all/modules/contrib/views/views/views_ui.info

@@ -7,9 +7,9 @@ dependencies[] = views
 files[] = views_ui.module
 files[] = plugins/views_wizard/views_ui_base_views_wizard.class.php
 
-; Information added by Drupal.org packaging script on 2015-02-11
-version = "7.x-3.10"
+; Information added by Drupal.org packaging script on 2015-04-29
+version = "7.x-3.11"
 core = "7.x"
 project = "views"
-datestamp = "1423648085"
+datestamp = "1430321048"