Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ref] improve readability of acl code #16131

Merged
merged 1 commit into from
Dec 26, 2019
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Code readability tidy up

Before

Variables ($acl & $cg2) used for table names in the sql

After

aliases assigned in mysql & used for table names in the sql

Technical Details

Variables are used in this code for table names, making the queries hard to read.

Since there is quite a bit I've only tackled 2 patterns

  1. using where an alias within mysql would do
  2. using where an alias within mysql would do

Ideally we want to switch to using CRM_Core_DAO::executeQuery & ditch the variables for
table names altogether but since there is a lot I've stuck to one pattern for this change

Comments

Variables are used in this code for table names, making the queries hard to read.

Since there is quite a bit I've only tackled 2 patterns
1) using  where an alias within mysql would do
2) using  where an alias withing mysql would do

Ideally we want to switch to using CRM_Core_DAO::executeQuery & ditch the variables forr
table names altogether but since there is a lot I've stuck to one pattern for this change
@civibot
Copy link

civibot bot commented Dec 21, 2019

(Standard links)

@civibot civibot bot added the master label Dec 21, 2019
@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 wanna check this - it passes tests & I tried to limit the change so it would be an easy merge

@yashodha
Copy link
Contributor

@eileenmcnaughton The pattern seems to be repeated on https://github.com/civicrm/civicrm-core/blob/master/CRM/ACL/BAO/ACL.php#L360 as well. Are you planning on making changes in other places as well?

@eileenmcnaughton
Copy link
Contributor Author

@yashodha yes - if this gets merged I'll chip away further at the readability of the class

@yashodha
Copy link
Contributor

@eileenmcnaughton looks good to me

@eileenmcnaughton
Copy link
Contributor Author

@yashodha please merge it if you have reviewed it

@yashodha
Copy link
Contributor

@eileenmcnaughton merging this

@yashodha yashodha merged commit c5eff0a into civicrm:master Dec 26, 2019
@eileenmcnaughton eileenmcnaughton deleted the acl branch December 30, 2019 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants