Commit 29cde71a authored by Christian Wach's avatar Christian Wach

Merge remote-tracking branch 'remotes/upstream/master'

parents b51d2f49 2ea958b8

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -2,7 +2,7 @@
/*
Plugin Name: CiviCRM
Description: CiviCRM - Growing and Sustaining Relationships
Version: 5.30.1
Version: 5.31.1
Requires at least: 4.9
Requires PHP: 7.1
Author: CiviCRM LLC
......@@ -56,7 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
// Set version here: when it changes, will force JS to reload
define( 'CIVICRM_PLUGIN_VERSION', '5.30.1' );
define( 'CIVICRM_PLUGIN_VERSION', '5.31.1' );
// Store reference to this file
if (!defined('CIVICRM_PLUGIN_FILE')) {
......
......@@ -204,36 +204,29 @@ SELECT acl.*
protected static function getGroupACLRoles($contact_id) {
$contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
$rule = new CRM_ACL_BAO_ACL();
$aclRole = 'civicrm_acl_role';
$aclER = CRM_ACL_DAO_EntityRole::getTableName();
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
$query = " SELECT acl.*
FROM civicrm_acl acl
INNER JOIN civicrm_option_group og
ON og.name = 'acl_role'
INNER JOIN civicrm_option_value ov
ON acl.entity_table = '$aclRole'
ON acl.entity_table = 'civicrm_acl_role'
AND ov.option_group_id = og.id
AND acl.entity_id = ov.value
AND ov.is_active = 1
INNER JOIN $aclER
ON $aclER.acl_role_id = acl.entity_id
AND $aclER.is_active = 1
INNER JOIN $c2g
ON $aclER.entity_id = $c2g.group_id
AND $aclER.entity_table = 'civicrm_group'
WHERE acl.entity_table = '$aclRole'
INNER JOIN civicrm_acl_entity_role acl_entity_role
ON acl_entity_role.acl_role_id = acl.entity_id
AND acl_entity_role.is_active = 1
INNER JOIN civicrm_group_contact group_contact
ON acl_entity_role.entity_id = group_contact.group_id
AND acl_entity_role.entity_table = 'civicrm_group'
WHERE acl.entity_table = 'civicrm_acl_role'
AND acl.is_active = 1
AND $c2g.contact_id = $contact_id
AND $c2g.status = 'Added'";
AND group_contact.contact_id = $contact_id
AND group_contact.status = 'Added'";
$results = [];
$rule->query($query);
$rule = CRM_Core_DAO::executeQuery($query);
while ($rule->fetch()) {
$results[$rule->id] = $rule->toArray();
......@@ -254,7 +247,7 @@ SELECT acl.*
AND acl.entity_table = 'civicrm_acl_role'
";
$rule->query($query);
$rule = CRM_Core_DAO::executeQuery($query);
while ($rule->fetch()) {
$results[$rule->id] = $rule->toArray();
}
......@@ -484,10 +477,10 @@ SELECT g.*
$aclKeys = array_keys($acls);
$aclKeys = implode(',', $aclKeys);
$cacheKey = CRM_Utils_Cache::cleanKey("$tableName-$aclKeys");
$cacheKey = CRM_Utils_Cache::cleanKey("$type-$tableName-$aclKeys");
$cache = CRM_Utils_Cache::singleton();
$ids = $cache->get($cacheKey);
if (!$ids) {
if (!is_array($ids)) {
$ids = [];
$query = "
SELECT a.operation, a.object_id
......
......@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/ACL/ACL.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:f75eaa0ee87675c14a224ec22b2c30a7)
* (GenCodeChecksum:54e8c75c28c9dd74192f60bbcf1605f6)
*/
/**
......@@ -117,9 +117,12 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
/**
* Returns localized title of this entity.
*
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getEntityTitle() {
return ts('ACLs');
public static function getEntityTitle($plural = FALSE) {
return $plural ? ts('ACLs') : ts('ACL');
}
/**
......
......@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/ACL/ACLCache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:cbf36d56ce734a5f7ceeb2071b68ebf8)
* (GenCodeChecksum:7faa5879056a56b463304bd81829afda)
*/
/**
......@@ -68,9 +68,12 @@ class CRM_ACL_DAO_ACLCache extends CRM_Core_DAO {
/**
* Returns localized title of this entity.
*
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getEntityTitle() {
return ts('ACLCaches');
public static function getEntityTitle($plural = FALSE) {
return $plural ? ts('ACLCaches') : ts('ACLCache');
}
/**
......@@ -82,7 +85,6 @@ class CRM_ACL_DAO_ACLCache extends CRM_Core_DAO {
public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'acl_id', 'civicrm_acl', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
}
......@@ -120,7 +122,6 @@ class CRM_ACL_DAO_ACLCache extends CRM_Core_DAO {