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

Add system check to warn if CiviReport disabled & logging enabled #28863

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Add system check to warn if CiviReport disabled & logging enabled

Before

If a site admin enables logging & disables CiviReport the logging ChangeLog tab becomes (at least partially) unavailable but the admin is not warned

After

image

Technical Details

Comments

Copy link

civibot bot commented Jan 4, 2024

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@colemanw
Copy link
Member

colemanw commented Jan 4, 2024

Hopefully this is temporary and we'll get that tab switched over to SearchKit in 2024.

@@ -161,28 +161,22 @@ public static function getContactLogCount($contactID) {
* @return int|FALSE
* report id of Contact Logging Report (Summary)
*/
public static function useLoggingReport() {
if (!\Civi::settings()->get('logging')) {
public static function useLoggingReport(): int {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this function return type hint work when your returning both an int and also the Boolean FALSE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's wrong - it didn't error so I assume it cases to 0 but....

  • but on the bright side you just helped me find the commit I was looking for - I thought this PR only had the check, not this fix & was hunting around for where I put this one

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton so it wasn't down the back of the couch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 no - but possibly hiding behind civi-mail...

CRM_Utils_Check_Component_EnvTest::testLoggingWithReport
Failure in api call for System check: Failed to find extension: civi_mail
#0 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/CRM/Extension/Container/Basic.php(143): CRM_Extension_Container_Basic->getRelPath('civi_mail')
#1 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/CRM/Extension/Mapper.php(233): CRM_Extension_Container_Basic->getPath('civi_mail')
#2 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/CRM/Core/Resources.php(261): CRM_Extension_Mapper->keyToBasePath('civi_mail')
#3 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/CRM/Core/Resources.php(311): CRM_Core_Resources->getPath('civi_mail')
#4 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/Civi/Angular/Manager.php(217): CRM_Core_Resources->glob('civi_mail', Array)
#5 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/Civi/Angular/Manager.php(114): Civi\Angular\Manager->resolvePatterns(Array)
#6 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/CRM/Utils/Check/Component/Env.php(1139): Civi\Angular\Manager->getModules()
#7 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/CRM/Utils/Check/Component.php(76): CRM_Utils_Check_Component_Env->checkAngularModuleSettings(false)
#8 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/CRM/Utils/Check.php(215): CRM_Utils_Check_Component->checkAll(Array, false)
#9 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/CRM/Utils/Check.php(185): CRM_Utils_Check::checkStatus()
#10 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/api/v3/System.php(137): CRM_Utils_Check::checkAll()
#11 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_system_check(Array)
#12 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/Civi/API/Kernel.php(156): Civi\API\Provider\MagicFunctionProvider->invoke(Array)
#13 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/Civi/API/Kernel.php(79): Civi\API\Kernel->runRequest(Array)
#14 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/api/api.php(28): Civi\API\Kernel->runSafe('System', 'check', Array)
#15 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/Civi/Test/Api3TestTrait.php(307): civicrm_api('System', 'check', Array)
#16 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/Civi/Test/Api3TestTrait.php(188): CiviUnitTestCase->civicrm_api('System', 'check', Array)
#17 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/tests/phpunit/CRM/Utils/Check/Component/EnvTest.php(55): CiviUnitTestCase->callAPISuccess('System', 'check')
#18 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/tests/phpunit/CRM/Utils/Check/Component/EnvTest.php(39): CRM_Utils_Check_Component_EnvTest->checkChecks('checkLoggingHas...')
#19 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/Framework/TestCase.php(1315): CRM_Utils_Check_Component_EnvTest->testLoggingWithReport()
#20 /home/homer/buildkit/build/build-0/web/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php(247): PHPUnit\Framework\TestCase->runTest()
#21 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/Framework/TestCase.php(981): CiviUnitTestCase->runTest()
#22 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/Framework/TestResult.php(588): PHPUnit\Framework\TestCase->runBare()
#23 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/Framework/TestCase.php(772): PHPUnit\Framework\TestResult->run(Object(CRM_Utils_Check_Component_EnvTest))
#24 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/Framework/TestSuite.php(510): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#25 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/Framework/TestSuite.php(510): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#26 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/TextUI/TestRunner.php(479): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#27 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/TextUI/Command.php(125): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
#28 phar:///home/homer/buildkit/extern/phpunit9/phpunit9.phar/phpunit/TextUI/Command.php(94): PHPUnit\TextUI\Command->run(Array, true)
#29 /home/homer/buildkit/extern/phpunit9/phpunit9.phar(2307): PHPUnit\TextUI\Command::main()
#30 {main}
Failed asserting that a integer is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 that test issue looks tough - I'm gonna remove the test from this PR & get the check merged & put the test in a separate PR

@eileenmcnaughton eileenmcnaughton merged commit a53657b into civicrm:master Jan 4, 2024
3 checks passed
@eileenmcnaughton eileenmcnaughton deleted the logging_detail branch January 4, 2024 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants