Problem/Motivation
Splitting this issue from #2998103: dblog_update_8600() breaks views.view.watchdog config entity, leading to PHP warning on admin/reports/dblog and configuration import errors
That issue was covering 2 problems that appear to happen in the update 8.6.0 and possibly involving dblog_update_8600() and a site was installed with a language beside English
- The user simply went to
admin/reports/dblogand encountered an error - The user tries to edit the watchdog View at
admin/reports/dblogand encountered an error
this issue will cover #2
Steps reproduce
- git checkout 8.5.5
- drush sql-drop
- rm -rf vendor && composer install
- drush si standard --account-pass=admin --locale=es
- sign-in in the web
- git checkout 8.6.0
- rm -rf vendor && composer install
- run update.php via web
- goto admin/reports/dblog
- edit and save the view
The last step will get the error
I step debugged this and interestingly I think in this case it becauseEl sitio web encontró un error inesperado. Vuelva a intentarlo más tarde.InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (line 729 of core/lib/Drupal/Core/Database/Connection.php).
Drupal\Core\Database\Connection->query('UPDATE {locales_target} SET translation=:db_update_placeholder_0, customized=:db_update_placeholder_1 WHERE (lid = :db_condition_placeholder_0) AND (language = :db_condition_placeholder_1)', Array, Array) (Line: 148)
dblog_update_8600() did not update the view.
Because dblog_update_8600 has
// Only update the empty text if is untouched from the original version.
if ($empty_text['area']['id'] == 'area' &&
$empty_text['area']['plugin_id'] == 'text' &&
$empty_text['area']['field'] == 'area' &&
$empty_text['area']['content']['value'] == 'No log messages available.') {
The last condition does not pass when installing in Spanish $empty_text['area']['content']['value'] == 'No log messages available.' will not true because this actually has the Spanish translation.
Proposed resolution
This can be repaired from the UI. It may be easier to do if one has the configuration export of views.view.watchdog.yml from before the upgrade. The following uses the default view.
1. Export view.view.watchdog.yml.
2. Find the empty section for the No results behavior. In the default config, in 8.5.5 it starts at line 656.
empty:
area:
id: area
table: views
field: area
relationship: none
group_type: group
admin_label: ''
empty: true
tokenize: false
content:
value: 'Nessun messaggio di log disponibile.'
format: basic_html
plugin_id: text
4. Delete the entire section, include the 'empty:'.
5. Import the config
6. Now add back the empty section, with some modifications. These are 'id', 'field', 'admin_label', 'content' and 'plugin_id'. If you have not customized this part of the view then use the following. If it was customized, then changing these fields should enable you to use the UI to make further changes.
empty:
area:
id: area_text_custom
table: views
field: area_text_custom
relationship: none
group_type: group
admin_label: 'Nessun messaggio di log disponibile.'
empty: true
tokenize: false
content: 'Nessun messaggio di log disponibile.'
plugin_id: text_custom
7. Import the config.
8. Do not remove and re-add this plugin. If you do there will be errors in the log. You can follow these steps again.
Remaining tasks
TBD
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
None
Comments
Comment #3
tedbowCrediting the steps to reproduce were from a version listed(slightly edit because I couldn't reproduce exactly)
Comment #4
catchGiven this is reproducible via the UI, upgrading to major.
Comment #7
dakwamineI have had trouble to update better_exposed_filters due to this watchdog view (the update itself changes nothing, it just resaves it as is). I have had to debug by throwing exceptions in the drush output and sending the output to a file to check the diff.
dump(),echoand Xdebug were not working. Very bad developer experience.I have replaced some values of the views.view.watchdog.yml config with the original one in the config/optional directory:
diff --git a/src/config/sync/views.view.watchdog.yml b/src/config/sync/views.view.watchdog.yml index b08c496..b02d5ee 100644 --- a/src/config/sync/views.view.watchdog.yml +++ b/src/config/sync/views.view.watchdog.yml @@ -658,18 +658,16 @@ display: footer: { } empty: area: - id: area + id: area_text_custom table: views - field: area + field: area_text_custom relationship: none group_type: group - admin_label: '' + admin_label: 'Aucune entr<C3><A9>e du journal n''est disponible.' empty: true tokenize: false - content: - value: 'Aucune entr<C3><A9>e du journal n''est disponible.' - format: basic_html - plugin_id: text + content: 'Aucune entr<C3><A9>e du journal n''est disponible.' + plugin_id: text_custom relationships: uid: id: uidPlease notice that the website is in french language.
How can we fix this error on a live site with cmi?
The fix must run with a high priority, before any other update working on this view.
Comment #8
dakwamineAlso, please note I have never customised this view. It's coming right from the core.
I'm linking #2999869: InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() when updating the database to 8.6.x which seems related and contains some crash cases information (#28).
Comment #11
quietone commentedTagging
Comment #12
quietone commentedI was able to reproduce this problem with the steps in the IS. I then tested and confirmed that this can be fixed via the UI and added the steps to the Issue Summary.
Comment #13
quietone commentedAfter testing over in #2998103: dblog_update_8600() breaks views.view.watchdog config entity, leading to PHP warning on admin/reports/dblog and configuration import errors I am not so sure about this. I tried the fix I suggested and it it didn't prevent the error but the patch in the other issue did.
Comment #14
quietone commentedTweaking the work around in the IS.
Comment #15
quietone commentedI am closing this as a duplicate of the issue it was original split off from. They are very much tied together and the fix is the same.
If that is wrong, reopen the issue, by setting the status to 'Active', and add a comment.
Thanks!
Comment #16
quietone commentedForgot to tag