Do not allow enabling database logging when using multilingual
Overview
If a non-US English system is set to logging (at least under Joomla), you get Network errors.
Reproduction steps
- Set the system to logging.
- Change a group membership.
- View the change log - you get Network Error.
I'm flagging it up here as someone may have a quick fix for it or may know where view creation takes place.
Current behaviour
SELECT title FROM `joomla`.log_civicrm_group_en_GB WHERE log_date <= 20200612110114 AND id = 59 ORDER BY log_date DESC LIMIT 1 [nativecode=1146 ** Table 'joomla.log_civicrm_group_en_gb' doesn't exist]"]
Expected behaviour
You see the change log.
Environment information
- Browser: Irrelevant_
- CiviCRM: 5.26.1 but may not be relevant
- PHP: 7.4, but irrelevant_
- CMS: Joomla 3.9.6 but may be irrelevant
- Database: MySQL 5.7.30-log but probably irrelevant
- Web Server: irrelevant...
Comments
The issue is resolved by creating this view in MySQL. It would probably make sense for the all the necessary log views to be created when the log tables are created.
CREATE
ALGORITHM = UNDEFINED
DEFINER = `<database user in question`
SQL SECURITY DEFINER
VIEW `log_civicrm_group_en_GB` AS
SELECT
`log_civicrm_group`.`id` AS `id`,
`log_civicrm_group`.`name` AS `name`,
`log_civicrm_group`.`description` AS `description`,
`log_civicrm_group`.`source` AS `source`,
`log_civicrm_group`.`saved_search_id` AS `saved_search_id`,
`log_civicrm_group`.`is_active` AS `is_active`,
`log_civicrm_group`.`visibility` AS `visibility`,
`log_civicrm_group`.`where_clause` AS `where_clause`,
`log_civicrm_group`.`select_tables` AS `select_tables`,
`log_civicrm_group`.`where_tables` AS `where_tables`,
`log_civicrm_group`.`group_type` AS `group_type`,
`log_civicrm_group`.`cache_date` AS `cache_date`,
`log_civicrm_group`.`refresh_date` AS `refresh_date`,
`log_civicrm_group`.`parents` AS `parents`,
`log_civicrm_group`.`children` AS `children`,
`log_civicrm_group`.`is_hidden` AS `is_hidden`,
`log_civicrm_group`.`is_reserved` AS `is_reserved`,
`log_civicrm_group`.`created_id` AS `created_id`,
`log_civicrm_group`.`modified_id` AS `modified_id`,
`log_civicrm_group`.`title_en_GB` AS `title`,
`log_civicrm_group`.`log_date` AS `log_date`,
`log_civicrm_group`.`log_conn_id` AS `log_conn_id`,
`log_civicrm_group`.`log_user_id` AS `log_user_id`,
`log_civicrm_group`.`log_action` AS `log_action`
FROM
`log_civicrm_group`
Edited by bgm