-
Notifications
You must be signed in to change notification settings - Fork 246
Conversation
stilez
commented
Jan 14, 2016
- Nested IF statements can be combined
- Add/remove shellcmd contains logic that only needs to run if the early shellcmd array does/doesn't exist
- Logs should be non-vague ("...added/removed a shellcmd" is better if it states the command added/removed, and for removal, clarify it removed an existing command)
1) Nested IF statements can be combined 2) Add/remove shellcmd contains logic that only needs to run if the early shellcmd array does/doesn't exist 3) Logs should be non-vague ("...added/removed a shellcmd" is better if it states the command added/removed, and for removal, clarify it removed an existing command)
} | ||
} else { | ||
$a_earlyshellcmd = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way the code was changed, this line (and thus the whole "else") is no longer necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely not. The one below, yes but this one adds an item to earlyshellcmd if nothing is found, and will therefore always need the array created if it didn't exist, since that's the most obvious way for !$found to be true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not need to be explicitly created as an array in that case. It will be turned into an array during the assignment with []. The only reason it had to be explicitly declared was to make foreach happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that's something new to me. Did not realise that $x[] = ... would implicitly create/recreate $x as an array if it wasn't one or didn't exist
Somehow I overlooked that this was done against the old pfsense-packages repo, can you resubmit this against our freebsd-ports repo for the 2.3 copy of the package instead? I'd rather not make any more changes to the 2.2.x version of the package unless they're necessary. |
1) Nested IF statements can be combined 2) Add/remove shellcmd contains logic that only needs to run if the early shellcmd array does/doesn't exist 3) Logs should be non-vague ("...added/removed a shellcmd" is better if it states the command added/removed, and for removal, clarify it removed an existing command) Resubmit of pfsense/pfsense-packages#1229 submitted against the old 2.2 repo as requested
@jim-p Against the master or devel branch? (And will it always be the same branch I should submit against?) |
@stilez against devel please. master branch is a read-only copy of FreeBSD's repo |
1) Nested IF statements can be combined 2) Add/remove shellcmd contains logic that only needs to run if the early shellcmd array does/doesn't exist 3) Logs should be non-vague ("...added/removed a shellcmd" is better if it states the command added/removed, and for removal, clarify it removed an existing command) Resubmitted as originally against old pfsense-packages, see pfsense/pfsense-packages#1229
Resubmitted, see pfsense/FreeBSD-ports#47 |