(Critical because the upgrade path is broken)
Currently the filter default settings are not merged in dynamically when loading the filter itself from the database. The whole thing assumes that the default settings are stored on the database as well as in code. When upgrading a site from Drupal 6, you will see some fun notices:
Notice: Undefined index: filter_url_length in _filter_url() (line 1295 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: allowed_html in _filter_html() (line 1158 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: filter_html_nofollow in _filter_html() (line 1161 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: filter_url_length in _filter_url() (line 1295 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: allowed_html in _filter_html() (line 1158 of /shared/core/www/d7/modules/filter/filter.module).
Notice: Undefined index: filter_html_nofollow in _filter_html() (line 1161 of /shared/core/www/d7/modules/filter/filter.module).
I can see two ways forward:
- We merge in defaults in filter_update_7004()
- We merge in defaults dynamically in filter_list_format()... we already call filter_get_filters() there anyway, so the hard part is already done.
Comment | File | Size | Author |
---|---|---|---|
#4 | 839178-filter-settings-silliness.patch | 667 bytes | dawehner |
#2 | 839178-filter-settings-silliness.patch | 885 bytes | Damien Tournoud |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedComment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedI think merging in at runtime is better.
Comment #3
chx CreditAttribution: chx commentedYou have your union backwards. We always add the default to the existing values because the right hand side does not override:
Comment #4
dawehnerhere is a patch
Comment #5
chx CreditAttribution: chx commentedLooks good.
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedThat's why you should never roll patches after 1am :)
Comment #7
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.