| @@ -531,8 +531,13 @@ | ||
| 531 | 531 | // means the request-terminating nginx isn't user-editable on this |
| 532 | 532 | // host — the banner uses this to switch to honest messaging |
| 533 | 533 | // instead of dangling a snippet the user can't apply. |
| 534 | 534 | 'behind_proxy' => Server::is_behind_proxy(), |
| 535 | + // Mirrors /status (see the note there). On first paint the | |
| 536 | + // probe is whatever was last cached, so this is usually | |
| 537 | + // `unknown` until the Health tab runs a live probe — the | |
| 538 | + // dashboard needs the key present either way. | |
| 539 | + 'rules' => Cache::rules_state( $probe ), | |
| 535 | 540 | ); |
| 536 | 541 | } |
| 537 | 542 | |
| 538 | 543 | return array( |
| @@ -628,8 +633,13 @@ | ||
| 628 | 633 | if ( empty( $schema ) && empty( $custom_panel ) ) { |
| 629 | 634 | continue; |
| 630 | 635 | } |
| 631 | 636 | $settings = Settings_Manager::get_public( $slug ); |
| 637 | + // Something else on the site has taken over this module's job. It | |
| 638 | + // stands down whatever its own switch says, so it is reported off, | |
| 639 | + // with the reason in place of its usual one. | |
| 640 | + $blocked = $module->blocked_by(); | |
| 641 | + $active = $module->is_active(); | |
| 632 | 642 | |
| 633 | 643 | $entry = array( |
| 634 | 644 | 'slug' => $slug, |
| 635 | 645 | 'tier' => $module->tier(), |
| @@ -654,9 +664,9 @@ | ||
| 654 | 664 | // must read THIS, not `enabled`, which only ever described the |
| 655 | 665 | // modules that happen to store that one key. null means the |
| 656 | 666 | // module has no meaningful on/off and should be excluded from |
| 657 | 667 | // any count rather than treated as off. (#363) |
| 658 | - 'active' => $module->is_active(), | |
| 668 | + 'active' => ( null !== $blocked && true === $active ) ? false : $active, | |
| 659 | 669 | // One sentence explaining the line above, computed next to it |
| 660 | 670 | // so the two cannot disagree. The UI shows it behind an (i) |
| 661 | 671 | // beside the status pill: "On" is a bare assertion otherwise, |
| 662 | 672 | // and least obvious exactly where it matters -- Media |
| @@ -661,9 +671,13 @@ | ||
| 661 | 671 | // beside the status pill: "On" is a bare assertion otherwise, |
| 662 | 672 | // and least obvious exactly where it matters -- Media |
| 663 | 673 | // Optimization reads On while its two most prominent switches |
| 664 | 674 | // are off, because three other flags are on. (#363) |
| 665 | - 'active_reason' => $module->active_reason(), | |
| 675 | + 'active_reason' => null !== $blocked ? $blocked : $module->active_reason(), | |
| 676 | + // A purchase or licence the module still waits on. Shown in the | |
| 677 | + // page header in place of the On/Off pill. Not while another | |
| 678 | + // module has taken over: that reason is the one to show. | |
| 679 | + 'status_label' => null !== $blocked ? null : $module->status_label(), | |
| 666 | 680 | 'label' => $meta['label'] ?? ucfirst( $slug ), |
| 667 | 681 | 'icon' => $meta['icon'] ?? 'Square', |
| 668 | 682 | 'description' => $meta['description'] ?? '', |
| 669 | 683 | // The dashboard group the module belongs to (cache, performance, |
| @@ -689,8 +703,12 @@ | ||
| 689 | 703 | 'setting_origins' => Settings_Manager::origins( $slug ), |
| 690 | 704 | 'schema' => $schema, |
| 691 | 705 | 'notices' => $module->ui_notices(), |
| 692 | 706 | 'custom_panel' => $meta['custom_panel'] ?? null, |
| 707 | + // Why this module may not be switched on, when something else | |
| 708 | + // on the site has taken over from it. Null for almost every | |
| 709 | + // module almost always — Free never blocks anything itself. | |
| 710 | + 'blocked_by' => $blocked, | |
| 693 | 711 | ); |
| 694 | 712 | |
| 695 | 713 | /** |
| 696 | 714 | * Last-mile descriptor filter. Lets Pro (or third-party |