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

Status Check - Report the overall status (accurately) #24027

Merged
merged 2 commits into from
Jul 21, 2022

Conversation

totten
Copy link
Member

@totten totten commented Jul 20, 2022

Overview

The page-footer includes a summary message about the system status (eg "System Status: Ok" or "System Status: Error"). The footer has inaccurately summarized the status.

cc @seamuslee001 @mattwire

Before

Suppose you have 5 "Error" messages and 1 "OK" message. It will summarize as "System Status: Ok".

(It emphasizes the least severe status-message.)

Code is more complex.

After

Suppose you have 5 "Error" messages and 1 "OK" message. It will summarize as "System Status: Error".

(It emphasizes the most severe status-message.)

Code is less complex.

Comments

The overall value is determined in CRM_Utils_Check::checkAll(). Heretofore, checkAll() sorted the messages by severity and then emphasized the first visible message.

The problem is that the sort-order has flip-flopped, so "first" means different things:

  • In v4.7, the messages were descending. So "first" was "most severe".
  • In v5.39 (11d593e), the order was ascending. So "first" was "least severe". (This appears to have been accidental.)
  • In v5.45 (728c1cc), the order flipped back to descending, but only for the Angular UI (civicrm/a/#/status). The footer still uses ascending order!

IMHO, the flip-floppiness means that callers cannot rely on the order returned by checkAll() -- they should instead do a higher-level sort (as in v5.45's 728c1cc). The uasort() within checkAll() is therefore redundant. We might as well skip it -- and simplify the logic.

(The base-commit for this PR should be equally agreeable with master or 5.52.)

Overview
--------

The page-footer includes a summary message about the system status (eg "System
Status: Ok" or "System Status: Error").  The footer has inaccurately summarized
the status.

Before
------

Suppose you have 5 "Error" messages and 1 "OK" message. It will summarize as "System Status: Ok".

(It emphasizes the *least severe* status-message.)

Code is more complex.

After
------

Suppose you have 5 "Error" messages and 1 "OK" message. It will summarize as "System Status: Error".

(It emphasizes the *most severe* status-message.)

Code is less complex.

Comments
--------

The overall value is determined in `CRM_Utils_Check::checkAll()`.  Heretofore,
`checkAll()` sorted the messages by severity and then emphasized the *first*
visible message.

The problem is that the sort-order has flip-flopped, so "first" means different things:

* In v4.7, the messages were descending. So "first" was "most severe".
* In v5.39 (11d593e), the order was ascending.
  So "first" was "least severe". (It appears accidental.)
* In v5.45 (728c1cc), the order flipped back
  to descending, but *only* for the Angular (`civicrm/a/#/status`) -- not the footer.

IMHO, the flip-floppiness means that callers cannot rely on the order returned
by `checkAll()` -- they should instead do a higher-level sort (as in v5.45's
728c1cc).  The `uasort()` within `checkAll()`
is therefore redundant.  We might as well skip it -- and simplify the logic.
@civibot
Copy link

civibot bot commented Jul 20, 2022

(Standard links)

@civibot civibot bot added the master label Jul 20, 2022
@totten totten mentioned this pull request Jul 20, 2022
CRM/Utils/Check.php Outdated Show resolved Hide resolved
Co-authored-by: demeritcowboy <demeritcowboy@hotmail.com>
@colemanw
Copy link
Member

I agree with this simplification. Both APIv4 and APIv3 have their own sort/orderBy params which makes the order of the source data irrelevant.

@colemanw colemanw added the merge ready PR will be merged after a few days if there are no objections label Jul 20, 2022
@demeritcowboy demeritcowboy merged commit 2265be8 into civicrm:master Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants