This could be quite a big patch and need a few re-rolls so the sooner we can get this in the better.

Meta Issue.
#1916134: Remove module_* deprecated functions

CommentFileSizeAuthor
#59 drupal_2045921_59.patch11.64 KBianthomas_uk
#54 drupal_2045921_54.patch11.71 KBXano
#52 drupal_2045921_52.patch11.47 KBXano
#50 drupal_2045921_50.patch11.42 KBXano
#46 drupal_2045921_46.patch11.9 KBXano
#42 interdiff-8385295-40-42.txt7.03 KBInternetDevels
#42 replace_deprecated_module_invoke-2045921-42.patch10.91 KBInternetDevels
#40 replace_deprecated_module_invoke-2045921-39.patch10.9 KBSutharsan
#40 interdiff-2045921-34-39.txt941 bytesSutharsan
#34 interdiff-2045921-33-34.patch3.41 KBSutharsan
#34 replace_deprecated_module_invoke-2045921-34.patch10.89 KBSutharsan
#33 replace_deprecated_module_invoke-2045921-33.patch7.62 KBSutharsan
#31 replace_deprecated_module_invoke-2045921-31.patch15.57 KBjuanolalla
#28 replace_deprecated_module_invoke-2045921-28.patch37 bytesjuanolalla
#24 replace_deprecated_module_invoke-2045921-23.patch18.3 KBjuanolalla
#22 replace_deprecated_module_invoke-2045921-18.patch18.74 KBjuanolalla
#18 replace_deprecated_module_invoke-2045921-18.patch19.36 KBjuanolalla
#15 replace_deprecated_module_invoke-2045921-15.patch19.3 KBjuanolalla
#15 interdiff.txt5.1 KBjuanolalla
#13 replace_deprecated_module_invoke-2045921-13.patch24.39 KBjuanolalla
#13 interdiff.txt604 bytesjuanolalla
#11 replace_deprecated_module_invoke-2045921-11.patch24.81 KBjuanolalla
#9 replace_deprecated_module_invoke-2045921-9.patch25.95 KBjuanolalla
#6 replace_deprecated_module_invoke-2045921-6.patch28.42 KBjuanolalla
#6 interdiff.txt20.37 KBjuanolalla
#2 replace_deprecated_module_invoke-2045921-2.patch27 KBjuanolalla
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

juanolalla’s picture

Assigned: Unassigned » juanolalla

I'm working on it.

juanolalla’s picture

Status: Active » Needs review
FileSize
27 KB

I upload the patch with all the replacements.

Status: Needs review » Needs work

The last submitted patch, replace_deprecated_module_invoke-2045921-2.patch, failed testing.

juanolalla’s picture

Assigned: juanolalla » Unassigned

I'll try to fix it

michaellander’s picture

If the file has a namespace, you'll have to use a global path instead of relative, like so:

-Drupal::moduleHandler()->invoke(...);
+\Drupal::moduleHandler()->invoke(...);
juanolalla’s picture

Status: Needs work » Needs review
FileSize
20.37 KB
28.42 KB

Thank you michael! I added \Drupal... to every module file and fixed the self ModuleHandler class wich I forgot to switch to $this->invoke(). Uploading the patch and interdiff

benjy’s picture

Status: Needs review » Needs work

Patch no longer applies

juanolalla’s picture

Assigned: Unassigned » juanolalla

I'll do it again!

juanolalla’s picture

Status: Needs work » Needs review
FileSize
25.95 KB

Uploading a new patch from scratch

Status: Needs review » Needs work

The last submitted patch, replace_deprecated_module_invoke-2045921-9.patch, failed testing.

juanolalla’s picture

Status: Needs work » Needs review
FileSize
24.81 KB

Previous patch doesn't apply so I started again from scratch.

Status: Needs review » Needs work

The last submitted patch, replace_deprecated_module_invoke-2045921-11.patch, failed testing.

juanolalla’s picture

Status: Needs work » Needs review
FileSize
604 bytes
24.39 KB

I've resolved a little mistake I made yesterday.

benjy’s picture

Status: Needs review » Needs work

As per: https://drupal.org/node/2045931#comment-7697279 Let's remove all the \Drupal:: from the OO code and create a new issue.

Then update this patch to replace all procedural code only.

Good work so far!

juanolalla’s picture

Status: Needs work » Needs review
FileSize
5.1 KB
19.3 KB

Going back to module_invoke() at OO code.

benjy’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Extension/ModuleHandler.phpundefined
@@ -761,7 +761,7 @@ function disable($module_list, $disable_dependents = TRUE) {
+        $this->invoke($module, 'disable');

Let's remove this for consistency and put it in with the OO patch. Do you want to create a new issue for the OO patch and link it from here?

juanolalla’s picture

I've created the OO task in #2055333: Replace module_invoke() deprecated function calls in OO code

The patch doesn't apply so I'll re-roll it as soon as possible.

juanolalla’s picture

Status: Needs work » Needs review
FileSize
19.36 KB

Re-rolled.

Status: Needs review » Needs work

The last submitted patch, replace_deprecated_module_invoke-2045921-18.patch, failed testing.

benjy’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, replace_deprecated_module_invoke-2045921-18.patch, failed testing.

juanolalla’s picture

Status: Needs work » Needs review
FileSize
18.74 KB

Uploading a new patch from scratch.

benjy’s picture

Status: Needs review » Needs work

Needs reroll and then we should be good.

juanolalla’s picture

Status: Needs work » Needs review
FileSize
18.3 KB

Re-rolled.

benjy’s picture

Status: Needs review » Reviewed & tested by the community

If the bot likes it the code looks good to me. Nice clean up!

star-szr’s picture

Status: Reviewed & tested by the community » Needs work

Needs a reroll.

Checking patch core/includes/common.inc...
Checking patch core/includes/install.inc...
Checking patch core/includes/schema.inc...
Checking patch core/includes/update.inc...
Checking patch core/modules/comment/comment.admin.inc...
Checking patch core/modules/field/field.attach.inc...
Checking patch core/modules/field/field.crud.inc...
Checking patch core/modules/field/field.info.inc...
Checking patch core/modules/field/field.views.inc...
Checking patch core/modules/file/file.module...
Hunk #1 succeeded at 670 (offset 9 lines).
Checking patch core/modules/node/node.module...
Checking patch core/modules/node/node.pages.inc...
Hunk #1 succeeded at 85 (offset 1 line).
Checking patch core/modules/search/search.api.php...
Checking patch core/modules/search/search.module...
error: while searching for:

  foreach (config('search.settings')->get('active_modules') as $module) {
    // Update word index
    module_invoke($module, 'update_index');
  }
}


error: patch failed: core/modules/search/search.module:364
error: core/modules/search/search.module: patch does not apply
Checking patch core/modules/system/system.module...
Hunk #1 succeeded at 2983 (offset -35 lines).
Checking patch core/modules/system/tests/modules/module_test/module_test.module...
Checking patch core/modules/taxonomy/taxonomy.admin.inc...
Checking patch core/modules/user/user.admin.inc...
Checking patch core/modules/user/user.module...
star-szr’s picture

Issue tags: +Needs reroll

Tagging.

juanolalla’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
37 bytes

Re-rolled.

star-szr’s picture

Thanks @juanolalla! Removing Needs review tag, we have a status for that :)

benjy’s picture

Status: Needs review » Needs work

patch is empty.

juanolalla’s picture

Status: Needs work » Needs review
FileSize
15.57 KB

Ups! Sorry, I don't know what happened, uploading re-roll patch.

juanolalla’s picture

Issue summary: View changes

bold text

areke’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

The patch no longer applies; it needs to be rebased.

Sutharsan’s picture

Rerolled patch from #31.

Changes in the following files could not be applied because the code was not there anymore.

  • comment.admin.inc
  • field.info.inc
  • field.purge.inc
  • field.views.inc
  • node.module
  • node.pages.inc
  • search.api.php
  • search.module
  • taxonomy.admin.inc
  • user.admin.inc

Leavings issue status at 'needs work'. Some 35 implementations of module_invoke() still remain in core.

Sutharsan’s picture

Status: Needs work » Needs review
FileSize
10.89 KB
3.41 KB

I miscounted (also counted the module_invoke_all()). Only 2 remained and 3 in comment or text.
I did not remove the function module_invoke() itself, as similar issues don't do that too.

The last submitted patch, 34: replace_deprecated_module_invoke-2045921-34.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 34: interdiff-2045921-33-34.patch, failed testing.

The last submitted patch, 34: interdiff-2045921-33-34.patch, failed testing.

sun’s picture

Issue tags: +@deprecated
Sutharsan’s picture

oeps, did not notice #39 coming

Sutharsan’s picture

Should this issue also add dependency injections since it introduces the use of module_handler service in classes? (i.e. Drupal\node\NodeFormController::form() and Drupal\user\Plugin\views\access\Permission::buildOptionsForm())

The last submitted patch, 42: replace_deprecated_module_invoke-2045921-42.patch, failed testing.

benjy’s picture

Xano’s picture

FileSize
11.9 KB

Re-roll. I also removed module_invoke() itself, as related issues do it too, and it helps us make sure there is absolutely no other code still using it.

Should this issue also add dependency injections since it introduces the use of module_handler service in classes?

Let's do that in follow-ups, where we can also unit test those classes. It would be out of scope for this issue.

benjy’s picture

In previous issues we didn't replace the OO code at all and then created a follow up to inject them properly

benjy’s picture

46: drupal_2045921_46.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 46: drupal_2045921_46.patch, failed testing.

Xano’s picture

Status: Needs work » Needs review
FileSize
11.42 KB

Re-roll.

ianthomas_uk’s picture

Status: Needs review » Reviewed & tested by the community

Patch still applies and looks good to me

Xano’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
11.47 KB

Re-roll.

sun’s picture

Status: Needs review » Reviewed & tested by the community
Xano’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
11.71 KB

Re-roll.

sun’s picture

Component: other » extension system
Status: Needs review » Reviewed & tested by the community
xjm’s picture

Issue tags: +API change

https://drupal.org/node/1894902 looks like it already covers the API change for this, so I've simply added a reference to this issue there.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Approved API change

Committed 98cdbfe and pushed to 8.x. Thanks!

alexpott’s picture

Status: Fixed » Needs work

Reverted as this broke drush which is used by PIFR. Committed 12953f2 and pushed to 8.x

This cause a HEAD fail: PHP Fatal error: Call to undefined function module_invoke() in /opt/drush/classes/DrushRole.php on line 227

https://github.com/drush-ops/drush/issues/452

We could just roll a patch without the function removal for now.

ianthomas_uk’s picture

Status: Needs work » Needs review
FileSize
11.64 KB

This version doesn't remove module_invoke. Instead, I've updated its comment to avoid a conflict with the latest patch on #2045927: Replace all drupal_alter() deprecated function calls. and included the change from #2187735: Add removal information to docblock of all @deprecated functions to make the reroll on that one as easy as possible.

Comment is now (changes in bold)

/**
* Invokes a hook in a particular module.
*
* All arguments are passed by value. Use \Drupal::moduleHandler()->alter() if
* you need to pass arguments by reference.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. Use
* \Drupal::moduleHandler()->invoke($module, $hook, $args = array()).
*
* @see \Drupal\Core\Extension\ModuleHandler::alter()
* @see \Drupal\Core\Extension\ModuleHandler::invoke()
*/

ianthomas_uk’s picture

Issue tags: +Needs change record

I think this needs to be listed on https://drupal.org/node/1894902

And https://drupal.org/node/1816456 needs to be updated.

ianthomas_uk’s picture

I've updated those change records so I think this is ready for RTBC again. Does anyone agree?

Sutharsan’s picture

Status: Needs review » Reviewed & tested by the community

I've checked the changes between #54 and #59 patches. Ok
I've checked the change in the Change Records. Ok
I've checked for any other Change Records containing module_invoke. Non applicable to change.
I've checked for remaining module_invoke() usage after this patch. None found.
Patch still applies.

All green, so back to RTBC.

Sutharsan’s picture

Issue tags: -Needs change record

Removing tag 'Needs change record'.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5c1c02f and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.