Problem/Motivation
In #2260187: Deprecate drupal_static() and drupal_static_reset() we'll deprecate the drupal_static()
& drupal_static_reset()
procedural functions. However, in order to do so, we have to remove first all usages from Drupal core.
Proposed resolution
We cannot do all the removals in one step. Each usage it's an issue itself. So, this issues is a META to track the progress:
Child issues:
- #2412669: Remove drupal_static from BookManager
- #3035288: [PP-1] Deprecate theme_get_setting()
- #3035297: Don't use drupal_static in AutoIncrementingTestItem
- #3035340: Deprecate views_ui_add_ajax_trigger()
- #2875151: Implement batch api as a service, #2875219: Batch not using new service to cover the usage in
_batch_needs_update()
. - #2324719: Node indexing - should use view mode for comments, not hook to cover the usage in
comment_node_update_index()
. - #3035343: Deprecate drupal_attach_tabledrag(). Move its logic in Table form element to cover the usage from
drupal_attach_tabledrag()
. - [needs issue] usage from
drupal_flush_all_caches()
. This is tricky! Probably we want to deprecatedrupal_static()
only when writing to the cache but we still want to allow a non-deprecateddrupal_static_reset()
to clear the static cache. - #3036010: Fold drupal_get_updaters() into Updater class, deprecate drupal_get_updaters() usage from
drupal_get_updaters()
- [needs issue] usage from
drupal_get_filetransfer_info()
- #3035345: Remove usage of drupal_static_reset() from ContentTranslationOperationsTest
- #3035347: Remove usage of drupal_static_reset() from ContentTranslationTestBase
- #3035349: Remove usage of drupal_static_reset() from EntityReferenceFieldTranslatedReferenceViewTest
- #3035350: Remove usages of drupal_static() from field_test.module
- #3035352: Deprecate file_get_file_references(). Move the logic to file.usage service
- #3035361: Remove usages of drupal_static() & drupal_static_reset() from file_test.module
- #2536594: Add a FilterFormatRepository providing methods to load filter formats to cover usages from
filter_formats()
andfilter_formats_reset()
. - [needs issue] usage from
FunctionalTestSetupTrait
. This is also tricky for the same reason asdrupal_flush_all_caches()
. - #3035376: Remove usage of drupal_static() from GetFilenameTest
- #2081585: Introduce HistoryRepository service to cover usages in
history.module
. - #3035518: Split tests from the functional ImageEffectsTest & ToolkitTest as kernel tests to cover usages from
ImageEffectsTest
andimage_module_test_image_effect_info_alter()
- #3036962: Remove usage of drupal_static() from install_profile_info()
- #2660338: locale_get_plural call in PluralTranslatableString is wrong to cover removal from
locale_get_plural()
- #3036982: Deprecate locale_translation_get_projects() and locale_translation_clear_cache_projects()
- #2908886: Split off SchemaInstaller from schema.inc to cover removals from
drupal_get_installed_schema_version()
,update_set_schema()
and\Drupal\system\Tests\Update\UpdatePathTestBase::runUpdates()
. - MORE TO COME...
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Original report
from comment #19 of #1567428: Active trail tests, in order to handle static variables in Drupal 8 we should convert every use of statics to instead be protected properties of proper objects. The result of this effort will be that we properly register objects into the Dependency Injection Container and perhaps do away with drupal_static() and drupal_static_reset().