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

Plugin throws error during core:archive when visits log is disabled #19

Open
Starker3 opened this issue Jun 19, 2022 · 1 comment
Open
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Starker3
Copy link

Describe the bug
When the Visits log and Visitor profile is disabled (https://matomo.org/faq/how-to/how-do-i-disable-the-visits-log-or-the-visitor-profile-feature/) the plugin throws the following error in the core:archive logs:

/usr/bin/php7.2 /srv/http/matomo/console core:archive --no-ansi >> /var/log/matomo/cron-matomo-archive.log
ERROR [2022-06-17 00:10:56] 9045 Uncaught exception in API: /srv/http/matomo/plugins/Live/Live.php(68): Visits log is deactivated globally. A user with super user access can enable this feature in the general settings.
#0 /srv/http/matomo/plugins/Live/API.php(165): Piwik\Plugins\Live\Live::checkIsVisitorLogEnabled('1')
#1 [internal function]: Piwik\Plugins\Live\API->getLastVisitsDetails('1', 'day', 'yesterday', false, '200', false, false, false, false)
#2 /srv/http/matomo/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#3 /srv/http/matomo/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#4 /srv/http/matomo/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#5 /srv/http/matomo/core/API/Request.php(266): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'getLastVisitsDe...', Array)
#6 /srv/http/matomo/core/API/Request.php(559): Piwik\API\Request->process()
#7 /srv/http/matomo/plugins/IPtoCompany/API.php(64): Piwik\API\Request::processRequest('Live.getLastVis...', Array)
#8 [internal function]: Piwik\Plugins\IPtoCompany\API->getCompanies('1', 'day', 'yesterday', false, 200)
#9 /srv/http/matomo/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#10 /srv/http/matomo/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#11 /srv/http/matomo/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#12 /srv/http/matomo/core/API/Request.php(266): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'getCompanies', Array)
#13 /srv/http/matomo/core/API/Request.php(559): Piwik\API\Request->process()
#14 /srv/http/matomo/plugins/IPtoCompany/Tasks.php(46): Piwik\API\Request::processRequest('IPtoCompany.get...', Array)
#15 [internal function]: Piwik\Plugins\IPtoCompany\Tasks->getListOfCompaniesThatVisitedWebsiteYesterday('1')
#16 /srv/http/matomo/core/Scheduler/Scheduler.php(309): call_user_func(Array, '1')
#17 /srv/http/matomo/core/Scheduler/Scheduler.php(154): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Scheduler\Task))
#18 /srv/http/matomo/plugins/CoreAdminHome/API.php(68): Piwik\Scheduler\Scheduler->run()
#19 /srv/http/matomo/core/CronArchive.php(653): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
#20 /srv/http/matomo/core/CronArchive.php(279): Piwik\CronArchive->runScheduledTasks()
#21 /srv/http/matomo/core/Access.php(661): Piwik\CronArchive->Piwik\{closure}()
#22 /srv/http/matomo/core/CronArchive.php(284): Piwik\Access::doAsSuperUser(Object(Closure))
#23 /srv/http/matomo/plugins/CoreConsole/Commands/CoreArchiver.php(32): Piwik\CronArchive->main()
#24 /srv/http/matomo/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /srv/http/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /srv/http/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /srv/http/matomo/core/Console.php(135): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /srv/http/matomo/core/Access.php(670): Piwik\Console->Piwik\{closure}()
#30 /srv/http/matomo/core/Console.php(136): Piwik\Access::doAsSuperUser(Object(Closure))
#31 /srv/http/matomo/core/Console.php(87): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /srv/http/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /srv/http/matomo/console(32): Symfony\Component\Console\Application->run()
#34 {main} [Query: , CLI mode: 1]

To Reproduce
Steps to reproduce the behavior:

  1. Disable Visits log setting
  2. Execute core:archive command
  3. See error in the logs/output

Expected behavior
It would likely be best that the plugin detects that the Visits Log (And therefore the Live API) is disabled and use a different method of getting the data for the report generation.
If that isn't possible then maybe detecting the setting is enabled and throwing a warning in the logs or perhaps the UI could work.

@Romain
Copy link
Owner

Romain commented Aug 3, 2022

Thanks for this feedback.
Indeed, a first step would be to check the visit log setting and trigger archive based on this.

Then, as an improvement, find an other way to get the data for the report, though I have no clue so far of what this other approach could be...

I can't give you an ETA on this for the moment, if you want to submit a PR, feel free to do so!

@Romain Romain added bug Something isn't working good first issue Good for newcomers labels Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants