Comments

catch’s picture

Title: forum_uninstall() should not load taxonomy module manually. » forum_uninstall() and simpletest_uninstall() call drupal_load() pointlessly
Issue summary: View changes
ParisLiakos’s picture

Status: Active » Needs review
StatusFileSize
new981 bytes

doesnt make sense indeed

internetdevels’s picture

Title: forum_uninstall() and simpletest_uninstall() call drupal_load() pointlessly » drupal_load() is called pointlessly
StatusFileSize
new2.52 KB
new1.45 KB

Hi! I've checked all remaining places where drupal_load() is called and looks like there is no sense in calling it. So I've decided to remove it all remaining places of the drupal_load() usage.

internetdevels’s picture

Component: forum.module » base system

Status: Needs review » Needs work

The last submitted patch, 3: drupal-core-remove-drupal_load-using-2159911-3.patch, failed testing.

internetdevels’s picture

Status: Needs work » Needs review
StatusFileSize
new2.56 KB
new1.49 KB

Status: Needs review » Needs work

The last submitted patch, 6: drupal-core-remove-drupal_load-using-2159911-6.patch, failed testing.

ianthomas_uk’s picture

Issue tags: +@deprecated
internetdevels’s picture

Status: Needs work » Needs review
StatusFileSize
new2.02 KB
new1.68 KB

One more try...

internetdevels’s picture

StatusFileSize
new1.96 KB
new858 bytes

So it seems that not all drupal_loads was pointless even Drupal installation succeeded without them. I've tested locally different variations of Drupal installation and everything was ok, but testbot fails without these drupal_loads. Here is patch which removes calls mentioned in #2 and changes remaining ones to ModuleHandler::load().

internetdevels’s picture

The last submitted patch, 6: drupal-core-remove-drupal_load-using-2159911-6.patch, failed testing.

sun’s picture

  1. +++ b/core/modules/forum/forum.install
    @@ -104,15 +104,12 @@ function forum_module_preinstall($module) {
       // Load the dependent Comment module, in case it has been disabled.
    -  drupal_load('module', 'comment');
    +  \Drupal::moduleHandler()->load('comment');
    

    Comment module cannot be uninstalled prior to Forum module, because Forum module depends on Comment module, so this load is obsolete.

    (the code comment is obsolete too, since modules also cannot be disabled anymore)

  2. +++ b/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php
    @@ -61,7 +61,7 @@ function testReturn() {
       function testOptionCallback() {
    -    drupal_load('module', 'file_test');
    +    \Drupal::moduleHandler()->load('file_test');
    

    This one should be completely obsolete, since the test defines/enables 'file_test' module via $modules already.

internetdevels’s picture

StatusFileSize
new1.87 KB
new1.07 KB

@sun, thanks for the review! But actually I've tried this in my first patch and it failed tests. Here I've created a re-roll for it, cause it is not applicable yet, let's see what testbot says.

sun’s picture

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

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

Status: Fixed » Closed (fixed)

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