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.inc
  • core/modules/update/update.manager.inc
  • core/modules/block_content/block_content.pages.inc
  • core/modules/content_translation/content_translation.admin.inc
  • core/modules/search/search.pages.inc
  • core/modules/image/image.field.inc
  • core/modules/image/image.admin.inc
  • core/modules/system/system.admin.inc
  • core/modules/system/tests/modules/theme_test/theme_test.inc
  • core/modules/system/system.theme.inc
  • core/modules/views_ui/views_ui.theme.inc
  • core/modules/node/node.admin.inc
  • core/modules/locale/locale.pages.inc
  • core/modules/language/language.admin.inc
  • core/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

CommentFileSizeAuthor
#10 CoreIncludes.txt9.5 KBnicxvan
#10 ModuleIncFiles.txt15.23 KBnicxvan

Issue fork drupal-3487962

Command icon 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

nicxvan created an issue. See original summary.

nicxvan’s picture

Issue summary: View changes
berdir’s picture

I'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?

nicxvan’s picture

Yeah, this was cause there are some wider things for deprecating hook_hook_info. This might become unnecessary though.

quietone’s picture

berdir’s picture

That 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()

nicxvan’s picture

@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.

nicxvan’s picture

Title: Deprecate .inc files » Review module .inc files post hook conversion
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
StatusFileSize
new15.23 KB
new9.5 KB

I'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.

nicxvan’s picture

A 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

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes

Updated the IS and crossed off deprecated or removed files.

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
berdir’s picture

pretty 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.

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

I 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.

longwave’s picture

Issue tags: +Kill includes

There 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.

berdir’s picture

The 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.

nicxvan’s picture

Issue summary: View changes

meeni_dhobale made their first commit to this issue’s fork.

nicxvan’s picture

Status: Active » Closed (duplicate)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.