Digitalist-Open-Cloud / Matomo-Plugin-ExtraTools

ExtraTools is a plugin for Matomo, which provides some console commands.
https://digitalist.cloud/
GNU General Public License v3.0
26 stars 12 forks source link

Missing tables after "matomo:install" #44

Closed mbrodala closed 1 month ago

mbrodala commented 1 month ago

When running ./console matomo:install --do-not-drop-db --force in a Matomo build directory I end up with a bare minimum of DB tables:

access
archive_invalidations
brute_force_log
changes
goal
locks
log_action
log_conversion
log_conversion_item
log_link_visit_action
log_profiling
log_visit
logger_message
option
plugin_setting
sequence
session
site
site_setting
site_url
tracking_failure
twofactor_recovery_code
user
user_token_auth

There is no config/config.ini.php by default but a config/common.config.ini.php:

; <?php exit; ?> DO NOT REMOVE THIS LINE

[General]
always_load_commands_from_plugin=ExtraTools

[Plugins]
Plugins[] = "EnvironmentVariables"
Plugins[] = "ExtraTools"

[PluginsInstalled]
PluginsInstalled[] = "EnvironmentVariables"
PluginsInstalled[] = "ExtraTools"

The config/config.ini.php exists after the matomo:install run with all Plugins and PluginsInstalled from the global.ini.php and the additional entries from the common.config.ini.php.

Now invoking ./console site:add ... fails however, since not all tables are present:

$ ./console site:add --currency=EUR --timezone=Europe/Berlin --name=...
Matomo is not set up yet

Adding a new site
ERROR     [2024-10-22 12:15:25] 1321  Uncaught exception: /var/www/html/libs/Zend/Db/Statement/Pdo.php(236): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'matomo.custom_dimensions' doesn't exist [Query: , CLI mode: 1]

In Pdo.php line 236:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'matomo.custom_dimensions' doesn't exist  

In Pdo.php line 233:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'matomo.custom_dimensions' doesn't exist  

site:add [--name [NAME]] [--urls [URLS]] [--ecommerce [ECOMMERCE]] [--no-site-search [NO-SITE-SEARCH]] [--search-keyword-parameters [SEARCH-KEYWORD-PARAMETERS]] [--search-category-parameters [SEARCH-CATEGORY-PARAMETERS]] [--exclude-ips [EXCLUDE-IPS]] [--exclude-query-parameters [EXCLUDE-QUERY-PARAMETERS]] [--timezone [TIMEZONE]] [--currency [CURRENCY]] [--group [GROUP]] [--start-date [START-DATE]] [--exclude-user-agents] [--keep-url-fragments] [--exclude-unknown-urls] [--type [TYPE]] [--settings-value [SETTINGS-VALUE]]

Did I do something wrong or why are not all tables from all plugins created by matomo:install?

mbrodala commented 1 month ago

Interestingly the missing tables exist after the failing site:add run

 access
 archive_invalidations
 brute_force_log
 changes
+custom_dimensions
 goal
 locks
 log_action
 log_conversion
 log_conversion_item
 log_link_visit_action
 log_profiling
 log_visit
 logger_message
 option
 plugin_setting
+privacy_logdata_anonymizations
+report
+report_subscriptions
+segment
 sequence
 session
 site
 site_setting
 site_url
 tracking_failure
 twofactor_recovery_code
 user
+user_dashboard
+user_language
 user_token_auth

And the site was added just fine.

Actually it seems like invoking any Matomo command triggers the creation of the missing tables, e.g. visits:get with a bogus site ID.