Projet

Général

Profil

Révision b08d2851

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/flag/flag.module
598 598
    ),
599 599
  );
600 600

  
601
  // Reset static cache to ensure all flag permissions are available.
602
  drupal_static_reset('flag_get_flags');
601 603
  $flags = flag_get_flags();
602 604
  // Provide flag and unflag permissions for each flag.
603 605
  foreach ($flags as $flag_name => $flag) {
......
1180 1182
function flag_user_account_removal($account) {
1181 1183
  // Remove flags by this user.
1182 1184
  $query = db_select('flagging', 'fc');
1183
  $query->leftJoin('flag_counts', 'c', 'fc.entity_id = c.entity_id AND fc.entity_type = c.entity_type');
1185
  $query->leftJoin('flag_counts', 'c', 'fc.entity_id = c.entity_id AND fc.entity_type = c.entity_type AND fc.fid = c.fid');
1184 1186
  $result = $query
1185 1187
    ->fields('fc', array('fid', 'entity_id'))
1186 1188
    ->fields('c', array('count'))
......
1692 1694
/**
1693 1695
 * Get the count of flags for a particular entity type.
1694 1696
 *
1697
 * When called during a flagging or unflagging (such as from a hook
1698
 * implementation or from Rules), the flagging or unflagging that is in the
1699
 * process of being performed:
1700
 *  - will be included during a flagging operation
1701
 *  - will STILL be included during an unflagging operation. That is, the count
1702
 *    will not yet have been decreased.
1703
 * This is because this queries the {flagging} table, which only has its record
1704
 * deleted at the very end of the unflagging process.
1705
 *
1695 1706
 * @param $flag
1696 1707
 *   The flag.
1697 1708
 * @param $entity_type
......
1723 1734
/**
1724 1735
 * Get the user's flag count.
1725 1736
 *
1737
 * When called during a flagging or unflagging (such as from a hook
1738
 * implementation or from Rules), the flagging or unflagging that is in the
1739
 * process of being performed:
1740
 *  - will be included during a flagging operation
1741
 *  - will STILL be included during an unflagging operation. That is, the count
1742
 *    will not yet have been decreased.
1743
 * This is because this queries the {flagging} table, which only has its record
1744
 * deleted at the very end of the unflagging process.
1745
 *
1726 1746
 * @param $flag
1727 1747
 *   The flag.
1728 1748
 * @param $user
......
1754 1774
/**
1755 1775
 * Get flag counts for all flags on a node.
1756 1776
 *
1777
 * When called during a flagging or unflagging (such as from a hook
1778
 * implementation or from Rules), the count this returns takes into account the
1779
 * the flagging or unflagging that is in the process of being performed.
1780
 *
1757 1781
 * @param $entity_type
1758 1782
 *   The entity type (usually 'node').
1759 1783
 * @param $entity_id
......
1786 1810
/**
1787 1811
 * Get the total count of items flagged within a flag.
1788 1812
 *
1813
 * When called during a flagging or unflagging (such as from a hook
1814
 * implementation or from Rules), the count this returns takes into account the
1815
 * the flagging or unflagging that is in the process of being performed.
1816
 *
1789 1817
 * @param $flag_name
1790 1818
 *   The flag name for which to retrieve a flag count.
1791 1819
 * @param $reset
......
1800 1828
  if (!isset($counts[$flag_name])) {
1801 1829
    $flag = flag_get_flag($flag_name);
1802 1830
    $counts[$flag_name] = db_select('flag_counts', 'fc')
1803
      ->fields('fc', array('flagging_id'))
1831
      ->fields('fc', array('fid'))
1804 1832
      ->condition('fid', $flag->fid)
1805 1833
      ->countQuery()
1806 1834
      ->execute()
......
2014 2042
/**
2015 2043
 * Find what a user has flagged, either a single entity or on the entire site.
2016 2044
 *
2045
 * When called during a flagging or unflagging (such as from a hook
2046
 * implementation or from Rules), the flagging or unflagging that is in the
2047
 * process of being performed:
2048
 *  - will be included during a flagging operation
2049
 *  - will STILL be included during an unflagging operation. That is, the count
2050
 *    will not yet have been decreased.
2051
 * This is because this queries the {flagging} table, which only has its record
2052
 * deleted at the very end of the unflagging process.
2053
 *
2017 2054
 * @param $entity_type
2018 2055
 *   The type of entity that will be retrieved. Usually 'node'.
2019 2056
 * @param $entity_id
......
2089 2126
/**
2090 2127
 * Return a list of users who have flagged an entity.
2091 2128
 *
2129
 * When called during a flagging or unflagging (such as from a hook
2130
 * implementation or from Rules), the flagging or unflagging that is in the
2131
 * process of being performed:
2132
 *  - will be included during a flagging operation
2133
 *  - will STILL be included during an unflagging operation. That is, the count
2134
 *    will not yet have been decreased.
2135
 * This is because this queries the {flagging} table, which only has its record
2136
 * deleted at the very end of the unflagging process.
2137
 *
2092 2138
 * @param $entity_type
2093 2139
 *   The type of entity that will be retrieved. Usually 'node'.
2094 2140
 * @param $entity_id
......
2097 2143
 *   (optional) The name of a flag if wanting a list specific to a single flag.
2098 2144
 *
2099 2145
 * @return
2100
 *   If no flag name is given, an array of flagging data, keyed by the user
2101
 *   ID that flagged the entity. Each flagging array is structured as
2102
 *   an array of flag information for each flag, keyed by the flag name. If
2103
 *   a flag name is specified, only the information for that flag is returned.
2146
 *   A nested array of flagging records (i.e. rows from the {flagging} table,
2147
 *   rather than complete Flagging entities). The structure depends on the
2148
 *   presence of the $flag_name parameter:
2149
 *    - if $flag_name is omitted, the array is keyed first by the user ID of
2150
 *      the users that flagged the entity, then by flag name. Each value is
2151
 *      then the flagging record.
2152
 *    - if $flag_name is given, the array is keyed only by user ID. Each value
2153
 *      is the flagging record.
2104 2154
 *   If no flags were found an empty array is returned.
2105 2155
 */
2106 2156
function flag_get_entity_flags($entity_type, $entity_id, $flag_name = NULL) {

Formats disponibles : Unified diff