-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Add system check to warn if CiviReport disabled & logging enabled #28863
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
Hopefully this is temporary and we'll get that tab switched over to SearchKit in 2024. |
CRM/Core/BAO/Log.php
Outdated
@@ -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 { |
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.
how does this function return type hint work when your returning both an int and also the Boolean FALSE
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.
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
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.
@eileenmcnaughton so it wasn't down the back of the couch?
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.
@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.
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.
@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
bb055fe
to
9153588
Compare
9153588
to
e368d4e
Compare
e368d4e
to
8f82262
Compare
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
Technical Details
Comments