Problem/Motivation
After converting much of the code in .inc files in modules was moved to a hook class.
Let's review the remaining .inc files to see if we can consolidate further.
Here is a complete list including tests and core/includes:
core/modules
- core/modules/update/update.fetch.inc
- core/modules/update/update.compare.inc
- core/modules/field/field.purge.inc
- core/modules/system/tests/modules/entity_test/update/status_report_8002.inc
- core/modules/system/tests/modules/entity_test/update/entity_definition_updates_8001.inc
- core/modules/system/tests/modules/entity_test/update/status_report_8001.inc
- core/modules/system/tests/modules/entity_test/update/entity_definition_updates_8002.inc
- core/modules/system/tests/modules/batch_test/batch_test.set_file.inc
- core/modules/system/tests/modules/module_implements_alter_test/module_implements_alter_test.implementations.inc
- core/modules/system/tests/fixtures/HtaccessTest/access_test.inc
- core/modules/dblog/dblog.admin.inc #3560398: Move _dblog_get_message_types and dblog_filters to a DbLogFilters service and deprecate them
- core/modules/views_ui/admin.inc
- core/modules/locale/locale.batch.inc
- core/modules/locale/locale.bulk.inc
- core/modules/locale/locale.compare.inc
- core/modules/locale/locale.fetch.inc
- core/modules/locale/locale.translation.inc
- core/modules/editor/editor.admin.inc
core/modules/update/update.authorize.inccore/modules/update/update.manager.inccore/modules/block_content/block_content.pages.inccore/modules/content_translation/content_translation.admin.inccore/modules/search/search.pages.inccore/modules/image/image.field.inccore/modules/image/image.admin.inccore/modules/system/system.admin.inccore/modules/system/tests/modules/theme_test/theme_test.inccore/modules/system/system.theme.inccore/modules/views_ui/views_ui.theme.inccore/modules/node/node.admin.inccore/modules/locale/locale.pages.inccore/modules/language/language.admin.inccore/modules/views/views.theme.inc
core/tests
core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/hook_include.inc
core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added/module_handler_test_added.hook.inc
core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
Steps to reproduce
Look at files.
Proposed resolution
This issue is not about core/includes.
Look at each function in each .inc file (see uploaded list)
Do one of the following things with each function:
Helpers
Deprecate it and move it to a method on the hook that is using it.
If more than one hook is using it then move it to a service.
Remaining functions (such as batch functions or form validate functions)
Evaluate individually.
Exceptions
Tests that are specifically testing .inc files.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | CoreIncludes.txt | 9.5 KB | nicxvan |
| #10 | ModuleIncFiles.txt | 15.23 KB | nicxvan |
Issue fork drupal-3487962
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nicxvan commentedComment #3
berdirI'm not sure what the purpose of this issue is. We will deprecate the concept of autoloading inc files for hooks as part of #2233261: Deprecate hook_hook_info groups, mark hook_hook_info() for deletion, but do we really need to do more?
While discouraged and not really serving a purpose, if you load them manually, it's not really an issue? I think this would essentially deprecate \Drupal\Core\Extension\ModuleHandlerInterface::loadInclude(), but for that we IMHO need to get rid of .install too, which is quite a big thing and not really that urgent?
Comment #4
nicxvan commentedYeah, this was cause there are some wider things for deprecating hook_hook_info. This might become unnecessary though.
Comment #5
quietone commentedThere is an existing meta for replacing include files, #3097045: [META] Provide modern replacements for and deprecate the legacy include files
Comment #6
berdirThat meta is for the non-module includes folder. IMHO this is either a duplicate of deprecating hook_hook_info() (which itself now is kind of a duplicate of deprecating legacy hooks) or it's a fairly-far-future deprecation of ModuleHandler::loadInclude()
Comment #7
nicxvan commented@berdir is mostly correct. The one additional thing I might consider here are child tasks to eliminate module .inc files.
They used to be useful from a pure organization standpoint, but now many have just a couple preprocess functions and with the .module files so much shorter it may make sense to consolidate some.
This title may be better called something like evaluate core .inc files in modules.
Comment #8
nicxvan commentedComment #9
nicxvan commentedComment #10
nicxvan commentedI've attached two files.
One with module and test .inc file functions
One with core/includes .inc file functions
I've also updated the proposed resolution.
I'm confident we can and should do the section for helpers, the other sections I'm as convinced it's worth changing.
Comment #11
nicxvan commentedA specific example is: _content_translation_form_language_content_settings_form_alter
It's marked as proxied, which I don't know what the purpose of that is in this context, but that seems like it should be easily moved to:
ContentTranslationHooks
Comment #12
nicxvan commentedComment #13
nicxvan commentedComment #14
nicxvan commentedUpdated the IS and crossed off deprecated or removed files.
Comment #15
nicxvan commentedComment #16
nicxvan commentedComment #17
nicxvan commentedComment #18
nicxvan commentedComment #19
berdirpretty confusing list the core inc files but then also state that they are not in scope, lets just remove that list, you already refer the other issue?
update.authorize.inc and update.manager.inc also just needs the deprecation message as all functions are already deprecated.
There are various open issues about the locale functions, but progress there has been very slow.
various test files,
batch_test.set_file.inc is an interesting one. That's used to test the ability to set a file in a batch definitions that's autoloaded. Since service support for callbacks now landed, I think we should deprecate the ability to do that now, *but* the locale include files use that extensively, so we need to do those first. but I guess one complication of converting those functions to services in the past was also exactly those batch operations, so might be easier to make progress on that now.
The update inc files in entity_test are some really tricky dynamic tests and are dynamically included, we'll only be able to drop those once we have a new API for hook_update() essentially.
views_ui/admin.inc I think just got unblocked with the form callback issue too, or at least some functions in there like views_ui_nojs_submit.
Comment #20
nicxvan commentedComment #21
nicxvan commentedI almost cleaned that up the other day, I did now.
I missed the update files, good catch! #3561139: Deprecate update include files that contain only deprecated functions
I took a pass at locale issues and didn't see them, any chance you know where they are? Might be a good target for 11.4.
Comment #22
longwaveThere might be some issues where work has already started with the "Kill includes" tag, as this is something we've been slowly chipping away at for years.
Comment #23
berdirThe meta issue for locale is #3215707: [META] Modernize Locale module, #2631584: Provide a proper API for updating translations possibly also overlaps the child issues there. Possibly more.
Comment #24
nicxvan commentedComment #26
nicxvan commentedThis is now a duplicate of #3566536: [meta] eliminate core .module files