commit cfceb79204571c983218b61e5bce1821155a2adc
Author: Assos Assos <assos+forge@centrale-marseille.fr>
Date:   Wed Sep 18 23:34:04 2019 +0200

    Weekly update of contrib modules

diff --git a/drupal7/sites/all/modules/acl/CHANGELOG.txt b/drupal7/sites/all/modules/acl/CHANGELOG.txt
index 27bd1f71..80fb18b2 100644
--- a/drupal7/sites/all/modules/acl/CHANGELOG.txt
+++ b/drupal7/sites/all/modules/acl/CHANGELOG.txt
@@ -5,6 +5,17 @@ CHANGELOG for ACL for Drupal 7
 acl 7.x-1.x-dev:
 
 
+acl 7.x-1.2 (2019-09-14):
+  Enhancement:
+    - #3080658 by salvis: Add acl_edit_form_get_user_list() function.
+    - #3068936 by salvis: Implement acl_get_usernames($acl_id).
+  Fixes:
+    - #1147226 by Sutharsan: Document hook_enabled().
+    - #1815158 by salvis: Fix PDO error under PostgreSQL & MS SQL Server.
+    - #2580207 by mccrodp: Add missing acl_remove_all_users() function.
+    - #2612464 by heykarthikwithu, salvis: Remove of unused variables in the code base.
+
+
 acl 7.x-1.1 (2015-08-27):
   Enhancements:
     - Improve minor coding nits (no functional changes).
@@ -14,7 +25,6 @@ acl 7.x-1.1 (2015-08-27):
     - Enable the tests (no functional change).
     - #1397828: Improve documentation of acl_edit_form() (no functional change).
 
-
 acl 7.x-1.0 (2011-11-26):
   Enhancements:
     - Add acl_node_add_acl_record() function to support extending the {acl_node} table.
diff --git a/drupal7/sites/all/modules/acl/acl.admin.inc b/drupal7/sites/all/modules/acl/acl.admin.inc
index a21ec37c..5314c678 100644
--- a/drupal7/sites/all/modules/acl/acl.admin.inc
+++ b/drupal7/sites/all/modules/acl/acl.admin.inc
@@ -5,6 +5,19 @@
  * Implementations of administration functions for the acl module.
  */
 
+/**
+ * Implementation of acl_get_usernames().
+ */
+function _acl_get_usernames($acl_id) {
+  $users = array();
+  $result = db_query("SELECT u.uid, u.name FROM {users} u LEFT JOIN {acl_user} aclu ON aclu.uid = u.uid WHERE acl_id = :acl_id", array(
+    'acl_id' => $acl_id));
+  foreach ($result as $user) {
+    $users[$user->uid] = _acl_format_username($user);
+  }
+  return $users;
+}
+
 /**
  * Implementation of acl_edit_form().
  */
@@ -17,11 +30,7 @@ function _acl_edit_form($acl_id, $label = NULL, $new_acl = FALSE) {
     ))->fetchAssoc())) {
       return array();
     }
-    $result = db_query("SELECT u.uid, u.name FROM {users} u LEFT JOIN {acl_user} aclu ON aclu.uid = u.uid WHERE acl_id = :acl_id", array(
-      'acl_id' => $acl_id));
-    foreach ($result as $user) {
-      $users[$user->uid] = $user->name;
-    }
+    $users = _acl_get_usernames($acl_id);
   }
   if (!isset($label)) {
     $label = (isset($record['name']) ? $record['name'] : (isset($record['number']) ? $record['number'] : $acl_id));
@@ -81,8 +90,7 @@ function _acl_edit_form_after_build($form, &$form_state) {
   // We can't use the form values because it's the entire structure
   // and we have no clue where our values actually are. That's
   // ok tho cause #value still works for us.
-  $user_list = unserialize($form['user_list']['#value']);
-  $button_name = 'acl_' . $form['acl_id']['#value'];
+  $user_list = acl_edit_form_get_user_list($form);
 
   if (isset($form_state['triggering_element']) && $form_state['triggering_element']['#value'] == $form['delete_button']['#value']) {
     $deletions = $form['deletions']['#value'];
@@ -99,7 +107,7 @@ function _acl_edit_form_after_build($form, &$form_state) {
       form_error($form['add'], t("Invalid user specified."));
     }
     else {
-      $user_list[$user->uid] = $user->name;
+      $user_list[$user->uid] = _acl_format_username($user);
       $form['add']['#value'] = NULL;
     }
   }
@@ -125,7 +133,7 @@ function _acl_edit_form_after_build($form, &$form_state) {
  * The module that embedded our form must call this function!
  */
 function acl_save_form($form, $priority = NULL) {
-  $users = unserialize($form['user_list']);
+  $users = acl_edit_form_get_user_list($form);
   db_delete('acl_user')
     ->condition('acl_id', $form['acl_id'])
     ->execute();
@@ -147,3 +155,22 @@ function acl_save_form($form, $priority = NULL) {
   }
 }
 
+/**
+ * Decode and return the list of users.
+ *
+ * @param array $form
+ *   The ACL form or form_state array.
+ * @param bool $get_default
+ *   (optional) In the case of a form array, whether to return the
+ *   '#default_value' (or the '#value').
+ *
+ * @return array
+ *   An array of $uid => $username.
+ */
+function acl_edit_form_get_user_list($form, $get_default = FALSE) {
+  if (is_array($form['user_list'])) {
+    return unserialize($form['user_list'][$get_default ? '#default_value' : '#value']);
+  }
+  return unserialize($form['user_list']);
+}
+
diff --git a/drupal7/sites/all/modules/acl/acl.api.php b/drupal7/sites/all/modules/acl/acl.api.php
index 0b54fa20..b1b9a564 100644
--- a/drupal7/sites/all/modules/acl/acl.api.php
+++ b/drupal7/sites/all/modules/acl/acl.api.php
@@ -15,3 +15,24 @@ function hook_acl_explain($acl_id, $name, $number, $users = NULL) {
   return "ACL (id=$acl_id) grants access to $name/$number to the listed user(s).";
 }
 
+/**
+ * Inform ACL module that the client module is enabled.
+ *
+ * ACL will not return its NA records for your module if your module does not
+ * confirm that it's active.
+ *
+ * If you use the example below, you can disable ACL on hook_disable using:
+ * @code
+ * function MYMODULE_disable() {
+ *   MYMODULE_enabled(FALSE);
+ * }
+ * @endcode
+ */
+function hook_enabled($set = NULL) {
+  static $enabled = TRUE; // not drupal_static!
+
+  if ($set !== NULL) {
+    $enabled = $set;
+  }
+  return $enabled;
+}
diff --git a/drupal7/sites/all/modules/acl/acl.info b/drupal7/sites/all/modules/acl/acl.info
index 91d0cf03..f6b0082b 100644
--- a/drupal7/sites/all/modules/acl/acl.info
+++ b/drupal7/sites/all/modules/acl/acl.info
@@ -5,9 +5,8 @@ package = Access control
 
 files[] = tests/acl.test
 
-; Information added by Drupal.org packaging script on 2015-08-26
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2019-09-14
+version = "7.x-1.2"
 core = "7.x"
 project = "acl"
-datestamp = "1440633240"
-
+datestamp = "1568440086"
diff --git a/drupal7/sites/all/modules/acl/acl.module b/drupal7/sites/all/modules/acl/acl.module
index 56811061..a788ae9a 100644
--- a/drupal7/sites/all/modules/acl/acl.module
+++ b/drupal7/sites/all/modules/acl/acl.module
@@ -87,6 +87,15 @@ function acl_remove_user($acl_id, $uid) {
     ->execute();
 }
 
+/**
+ * Remove all users from an ACL.
+ */
+function acl_remove_all_users($acl_id) {
+  db_delete('acl_user')
+    ->condition('acl_id', $acl_id)
+    ->execute();
+}
+
 /**
  * Provide a form to edit the ACL that can be embedded in other forms.
  *
@@ -112,9 +121,12 @@ function acl_add_nodes($subselect, $acl_id, $view, $update, $delete, $priority =
   $subselect->addExpression((int) $update, 'grant_update');
   $subselect->addExpression((int) $delete, 'grant_delete');
   $subselect->addExpression($priority, 'priority');
-  db_insert('acl_node')
-    ->from($subselect)
-    ->execute();
+  $query = db_insert('acl_node')
+    ->fields(array('nid', 'acl_id', 'grant_view', 'grant_update', 'grant_delete', 'priority'));
+  foreach ($subselect->execute()->fetchAll(PDO::FETCH_ASSOC) as $record) {
+    $query->values($record);
+  }
+  $query->execute();
 }
 
 /**
@@ -241,6 +253,14 @@ function acl_get_uids($acl_id) {
   return $uids;
 }
 
+/**
+ * Get the user names of an ACL.
+ */
+function acl_get_usernames($acl_id) {
+  _acl_module_load_include('admin.inc');
+  return _acl_get_usernames($acl_id);
+}
+
 /**
  * Implements hook_node_access_records().
  */
@@ -308,7 +328,7 @@ function _acl_module_load_include($type) {
   static $loaded = array();
 
   if (!isset($loaded[$type])) {
-    $path = module_load_include($type, 'acl');
+    module_load_include($type, 'acl');
     $loaded[$type] = drupal_get_path('module', 'acl') . "/acl.$type";
   }
   return $loaded[$type];
@@ -335,7 +355,7 @@ function acl_node_access_explain($row) {
         $acl->tag = $acl->name . '-' . $acl->number;
       }
       foreach (user_load_multiple(acl_get_uids($row->gid)) as $account) {
-        $usernames[] = theme('username', array('account' => $account));
+        $usernames[] = _acl_format_username($account);
       }
       if (isset($usernames)) {
         $usernames = implode(', ', $usernames);
@@ -373,3 +393,10 @@ function _acl_get_explanation($text, $acl_id, $module, $name, $number, $username
   return $text;
 }
 
+/**
+ * Helper function to format a user name.
+ */
+function _acl_format_username($account) {
+  return check_plain(format_username($account));
+}
+
diff --git a/drupal7/sites/all/modules/acl/tests/acl_node_test.info b/drupal7/sites/all/modules/acl/tests/acl_node_test.info
index 1dadbb63..53b024e3 100644
--- a/drupal7/sites/all/modules/acl/tests/acl_node_test.info
+++ b/drupal7/sites/all/modules/acl/tests/acl_node_test.info
@@ -8,9 +8,8 @@ hidden = TRUE
 
 files[] = acl_node_test.module
 
-; Information added by Drupal.org packaging script on 2015-08-26
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2019-09-14
+version = "7.x-1.2"
 core = "7.x"
 project = "acl"
-datestamp = "1440633240"
-
+datestamp = "1568440086"
