Skip to content

Commit

Permalink
refs #41568, tidy require_once of core
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed Sep 13, 2024
1 parent bb49545 commit cb6c90b
Show file tree
Hide file tree
Showing 1,069 changed files with 5,098 additions and 5,090 deletions.
6 changes: 3 additions & 3 deletions CRM/ACL/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static function check($str, $contactID = NULL) {
$contactID = 0;
}

require_once 'CRM/ACL/BAO/ACL.php';

return CRM_ACL_BAO_ACL::check($str, $contactID);
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public static function whereClause($type, &$tables, &$whereTables, $contactID =
$contactID = 0;
}

require_once 'CRM/ACL/BAO/ACL.php';

$whereACL = CRM_ACL_BAO_ACL::whereClause($type, $tables, $whereTables, $contactID);
if (!$skipDeleteClause) {
if (CRM_Core_Permission::check('access deleted contacts') and $onlyDeleted) {
Expand Down Expand Up @@ -150,7 +150,7 @@ public static function group($type, $contactID = NULL,
$contactID = 0;
}

require_once 'CRM/ACL/BAO/ACL.php';

return CRM_ACL_BAO_ACL::group($type, $contactID, $tableName, $allGroups, $includedGroups);
}

Expand Down
32 changes: 16 additions & 16 deletions CRM/ACL/BAO/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*/

require_once 'CRM/ACL/DAO/ACL.php';


/**
* Access Control List
Expand Down Expand Up @@ -386,9 +386,9 @@ public static function &getACLs($contact_id = NULL, $group_id = NULL, $aclRoles

$rule = new CRM_ACL_BAO_ACL();

require_once 'CRM/Contact/BAO/Group.php';
require_once 'CRM/Contact/BAO/GroupContact.php';
require_once 'CRM/Contact/BAO/Contact.php';




$acl = self::getTableName();
$contact = CRM_Contact_BAO_Contact::getTableName();
Expand Down Expand Up @@ -448,7 +448,7 @@ public static function &getACLRoles($contact_id = NULL, $group_id = NULL) {

$rule = new CRM_ACL_BAO_ACL();

require_once 'CRM/ACL/DAO/EntityRole.php';

$acl = self::getTableName();
$aclRole = 'civicrm_acl_role';
$aclRoleJoin = CRM_ACL_DAO_EntityRole::getTableName();
Expand Down Expand Up @@ -511,8 +511,8 @@ public static function &getGroupACLs($contact_id, $aclRoles = FALSE) {

$rule = new CRM_ACL_BAO_ACL();

require_once 'CRM/Contact/BAO/GroupContact.php';
require_once 'CRM/Contact/BAO/Group.php';



$acl = self::getTableName();
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
Expand Down Expand Up @@ -561,7 +561,7 @@ public static function &getGroupACLRoles($contact_id) {
$acl = self::getTableName();
$aclRole = 'civicrm_acl_role';

require_once 'CRM/ACL/DAO/EntityRole.php';


$aclER = CRM_ACL_DAO_EntityRole::getTableName();
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
Expand Down Expand Up @@ -661,15 +661,15 @@ static function retrieve(&$params, &$defaults) {
* @static
*/
static function setIsActive($id, $is_active) {
require_once 'CRM/Core/BAO/Cache.php';

// note this also resets any ACL cache
CRM_Core_BAO_Cache::deleteGroup('contact fields');

return CRM_Core_DAO::setFieldValue('CRM_ACL_DAO_ACL', $id, 'is_active', $is_active);
}

static function check($str, $contactID) {
require_once 'CRM/ACL/BAO/Cache.php';


$acls = &CRM_ACL_BAO_Cache::build($contactID);

Expand All @@ -696,7 +696,7 @@ static function check($str, $contactID) {
}

public static function whereClause($type, &$tables, &$whereTables, $contactID = NULL) {
require_once 'CRM/ACL/BAO/Cache.php';


$acls = &CRM_ACL_BAO_Cache::build($contactID);
//CRM_Core_Error::debug( "a: $contactID", $acls );
Expand Down Expand Up @@ -764,7 +764,7 @@ public static function whereClause($type, &$tables, &$whereTables, $contactID =
) &&
$dao->cache_date == NULL
) {
require_once 'CRM/Contact/BAO/GroupContactCache.php';

CRM_Contact_BAO_GroupContactCache::load($dao);
}
}
Expand All @@ -776,7 +776,7 @@ public static function whereClause($type, &$tables, &$whereTables, $contactID =
}

// call the hook to get additional whereClauses
require_once 'CRM/Utils/Hook.php';

CRM_Utils_Hook::aclWhereClause($type, $tables, $whereTables, $contactID, $whereClause);

if (empty($whereClause)) {
Expand All @@ -792,7 +792,7 @@ public static function group($type,
$allGroups = NULL,
$includedGroups = NULL
) {
require_once 'CRM/ACL/BAO/Cache.php';


$acls = &CRM_ACL_BAO_Cache::build($contactID);

Expand Down Expand Up @@ -840,7 +840,7 @@ public static function group($type,
}
}

require_once 'CRM/Utils/Hook.php';

CRM_Utils_Hook::aclGroup($type, $contactID, $tableName, $allGroups, $ids);

return $ids;
Expand Down Expand Up @@ -912,7 +912,7 @@ static function matchType($type, $operation) {
*/
static function del($aclId) {
// delete all entries from the acl cache
require_once 'CRM/ACL/BAO/Cache.php';

CRM_ACL_BAO_Cache::resetCache();

$acl = new CRM_ACL_DAO_ACL();
Expand Down
6 changes: 3 additions & 3 deletions CRM/ACL/BAO/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*/

require_once 'CRM/ACL/DAO/Cache.php';


/**
* Access Control Cache
Expand All @@ -58,7 +58,7 @@ static function &build($id) {
return self::$_cache[$id];
}

require_once 'CRM/ACL/BAO/ACL.php';

self::$_cache[$id] = CRM_ACL_BAO_ACL::getAllByContact($id);
self::store($id, self::$_cache[$id]);
return self::$_cache[$id];
Expand Down Expand Up @@ -120,7 +120,7 @@ static function updateEntry($id) {
self::build($id);

// rebuilds civicrm_acl_contact_cache
require_once "CRM/Contact/BAO/Contact/Permission.php";

CRM_Contact_BAO_Contact_Permission::cache($id, CRM_Core_Permission::VIEW, TRUE);
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/ACL/BAO/EntityRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*/

require_once 'CRM/ACL/DAO/EntityRole.php';


/**
* Access Control EntityRole
Expand Down
4 changes: 2 additions & 2 deletions CRM/ACL/DAO/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* $Id$
*
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';


class CRM_ACL_DAO_ACL extends CRM_Core_DAO
{
/**
Expand Down
4 changes: 2 additions & 2 deletions CRM/ACL/DAO/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* $Id$
*
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';


class CRM_ACL_DAO_Cache extends CRM_Core_DAO
{
/**
Expand Down
4 changes: 2 additions & 2 deletions CRM/ACL/DAO/EntityRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* $Id$
*
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';


class CRM_ACL_DAO_EntityRole extends CRM_Core_DAO
{
/**
Expand Down
14 changes: 7 additions & 7 deletions CRM/ACL/Form/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*/

require_once 'CRM/Admin/Form.php';


/**
*
Expand All @@ -58,7 +58,7 @@ function setDefaultValues() {
$defaults['object_type'] = 1;
}

require_once 'CRM/Core/ShowHideBlocks.php';

$showHide = new CRM_Core_ShowHideBlocks();

if (isset($defaults['object_table'])) {
Expand Down Expand Up @@ -132,7 +132,7 @@ public function buildQuickForm() {

$this->add('text', 'name', ts('Description'), CRM_Core_DAO::getAttribute('CRM_ACL_DAO_ACL', 'name'), TRUE);

require_once 'CRM/ACL/BAO/ACL.php';

$operations = array('' => ts('- select -')) + CRM_ACL_BAO_ACL::operation();
$this->add('select',
'operation',
Expand All @@ -157,7 +157,7 @@ public function buildQuickForm() {
' ', TRUE
);

require_once 'CRM/Core/OptionGroup.php';


$label = ts('Role');
$role = array('-1' => ts('- select role -'),
Expand All @@ -177,7 +177,7 @@ public function buildQuickForm() {
'0' => ts('All Profiles'),
) + CRM_Core_PseudoConstant::ufGroup();

require_once 'CRM/Event/PseudoConstant.php';

$event = array('-1' => ts('- select -'),
'0' => ts('All Events'),
) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
Expand Down Expand Up @@ -269,11 +269,11 @@ static function formRule($params) {
* @return None
*/
public function postProcess() {
require_once 'CRM/Core/BAO/Cache.php';

// note this also resets any ACL cache
CRM_Core_BAO_Cache::deleteGroup('contact fields');

require_once 'CRM/ACL/BAO/ACL.php';


if ($this->_action & CRM_Core_Action::DELETE) {
CRM_ACL_BAO_ACL::del($this->_id);
Expand Down
10 changes: 5 additions & 5 deletions CRM/ACL/Form/ACLBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*/

require_once 'CRM/Admin/Form.php';


/**
*
Expand Down Expand Up @@ -89,7 +89,7 @@ public function buildQuickForm() {
return;
}

require_once 'CRM/Core/Permission.php';

$permissions = array_flip(CRM_Core_Permission::basicPermissions());
$this->addCheckBox('object_table',
ts('ACL Type'),
Expand All @@ -98,7 +98,7 @@ public function buildQuickForm() {
array('</td><td>', '</td></tr><tr><td>')
);

require_once 'CRM/Core/OptionGroup.php';


$label = ts('Role');
$role = array('-1' => ts('- select role -'),
Expand Down Expand Up @@ -132,10 +132,10 @@ static function formRule($params) {
* @return None
*/
public function postProcess() {
require_once 'CRM/ACL/BAO/Cache.php';

CRM_ACL_BAO_Cache::resetCache();

require_once 'CRM/ACL/BAO/ACL.php';

$params = $this->controller->exportValues($this->_name);
if ($this->_id ||
$this->_id === '0'
Expand Down
10 changes: 5 additions & 5 deletions CRM/ACL/Form/EntityRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*/

require_once 'CRM/Admin/Form.php';


/**
*
Expand All @@ -59,14 +59,14 @@ public function buildQuickForm() {

$attributes = CRM_Core_DAO::getAttribute('CRM_ACL_DAO_EntityRole');

require_once 'CRM/Core/OptionGroup.php';

$aclRoles = array('' => ts('- select -')) + CRM_Core_OptionGroup::values('acl_role');
$this->add('select', 'acl_role_id', ts('ACL Role'),
$aclRoles, TRUE
);


require_once 'CRM/ACL/BAO/EntityRole.php';


$label = ts('Assigned To');
$group = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup(FALSE, 'Access');
Expand All @@ -83,8 +83,8 @@ public function buildQuickForm() {
* @return None
*/
public function postProcess() {
require_once 'CRM/ACL/BAO/EntityRole.php';
require_once 'CRM/ACL/BAO/Cache.php';


CRM_ACL_BAO_Cache::resetCache();

if ($this->_action & CRM_Core_Action::DELETE) {
Expand Down
8 changes: 4 additions & 4 deletions CRM/ACL/Page/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*/

require_once 'CRM/Core/Page/Basic.php';


/**
*
Expand Down Expand Up @@ -159,7 +159,7 @@ function run() {
* @static
*/
function browse() {
require_once 'CRM/ACL/DAO/ACL.php';


// get all acl's sorted by weight
$acl = array();
Expand All @@ -173,7 +173,7 @@ function browse() {
CRM_Core_DAO::$_nullArray
);

require_once 'CRM/Core/OptionGroup.php';

$roles = CRM_Core_OptionGroup::values('acl_role');

$group = array('-1' => ts('- select -'),
Expand All @@ -186,7 +186,7 @@ function browse() {
'0' => ts('All Profiles'),
) + CRM_Core_PseudoConstant::ufGroup();

require_once 'CRM/Event/PseudoConstant.php';

$event = array('-1' => ts('- select -'),
'0' => ts('All Events'),
) + CRM_Event_PseudoConstant::event();
Expand Down
Loading

0 comments on commit cb6c90b

Please sign in to comment.