Follow-up to #2188661: Extension System, Part II: ExtensionDiscovery

Preparation for #340723: Make modules and installation profiles only require .info.yml files

Objective

  1. Change all code to use Extension::getType() instead of $file->type.
  2. Change all code to use Extension::getName() instead of $file->name.
  3. Make $file->uri the pathname of the main extension file (.profile/.module/.theme). [temporary]
  4. Remove public access to $file->filename.

Comments

sun’s picture

Status: Needs review » Needs work

The last submitted patch, extension.uri_.0.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new54.2 KB
new3.24 KB

Fixed tests.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

I read through the patch and all the changes look good here.

-   * @return \stdClass|bool
-   *   Returns a stdClass object if the module data is found containing at
-   *   least an uri property with the module path, for example
-   *   core/modules/user/user.module.
+   * @return \Drupal\Core\Extension\Extension|bool
+   *   Returns an Extension object if the module is found, FALSE otherwise.

Much better!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

extension.uri_.3.patch no longer applies.

error: patch failed: core/lib/Drupal/Core/Extension/ThemeHandler.php:271
error: core/lib/Drupal/Core/Extension/ThemeHandler.php: patch does not apply
error: patch failed: core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php:242
error: core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php: patch does not apply

sun’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs reroll
StatusFileSize
new56.46 KB

Merge branch '8.x' into extension-uri-340723-sun

longwave’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new54.86 KB
new961 bytes
longwave’s picture

Ha, sorry sun :)

longwave’s picture

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

StatusFileSize
new56.46 KB
new2.32 KB

Re-uploading #6, see interdiff (between #7 and #6).

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/lib/Drupal/Core/DrupalKernel.php
    @@ -416,7 +414,7 @@ protected function initializeContainer() {
    -      $this->registerNamespaces($this->getModuleNamespaces($container_modules));
    +      $this->registerNamespaces($this->container->getParameter('container.namespaces'));
    

    This looks like it is unrelated.

  2. +++ b/core/modules/field/field.module
    +++ b/core/modules/field/field.module
    @@ -161,7 +161,7 @@ function field_system_info_alter(&$info, $file, $type) {
    
    +++ b/core/modules/locale/tests/modules/locale_test/locale_test.module
    +++ b/core/modules/locale/tests/modules/locale_test/locale_test.module
    @@ -18,7 +18,7 @@ function locale_test_system_info_alter(&$info, $file, $type) {
    
    +++ b/core/modules/locale/tests/modules/locale_test_translate/locale_test_translate.module
    @@ -13,7 +13,7 @@
     function locale_test_translate_system_info_alter(&$info, $file, $type) {
    
    +++ b/core/modules/system/tests/modules/module_test/module_test.module
    @@ -16,43 +16,43 @@ function module_test_permission() {
     function module_test_system_info_alter(&$info, $file, $type) {
    
    +++ b/core/modules/system/system.api.php
    @@ -993,19 +993,18 @@ function hook_system_breadcrumb_alter(array &$breadcrumb, array $attributes, arr
    -function hook_system_info_alter(&$info, $file, $type) {
    +function hook_system_info_alter(array &$info, \Drupal\Core\Extension\Extension $file, $type) {
    
    +++ b/core/modules/system/tests/modules/system_test/system_test.module
    +++ b/core/modules/system/tests/modules/system_test/system_test.module
    @@ -42,23 +42,23 @@ function system_test_system_info_alter(&$info, $file, $type) {
    
    +++ b/core/modules/update/tests/modules/update_test/update_test.module
    @@ -21,7 +21,7 @@
     function update_test_system_info_alter(&$info, $file) {
    

    Considering the typehint is added to the API doc for the hook lets make all the implementations correct - Missing type hinting on $file - also need to typehint theme_page_test_system_info_alter() which is currently not in the patch.

sun’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new60.16 KB
new8.73 KB
  1. Removed unrelated change to DrupalKernel::initializeContainer().
  2. Added Extension type-hints to all hook_system_info_alter() implementations.

As these were rather minor, I hope it's OK if I move straight back to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 2c51074 and pushed to 8.x. Thanks!

sun’s picture

Regarding change notices:

Edited the existing for ExtensionDiscovery to state that people should use method names instead of public properties:
https://drupal.org/node/2198695

Added a change notice for the change to drupal_get_filename():
https://drupal.org/node/2212815

Overall though, once we're done with the major refactoring of the extension system, any amount of change notices won't really cut it — we will much rather need a new handbook/documentation page that explains the completely new architecture, similar to the menu/routing/request upgrade handbook page.

alexpott’s picture

Status: Fixed » Reviewed & tested by the community

Had to revert since this break testbots :(

Committed d8c718b and pushed to 8.x.

Create PR https://github.com/drush-ops/drush/pull/509 to fix. Back to rtbc awaiting merge of PR.

webchick’s picture

Hm. Why is it that these testbot breakages are not being caught prior to these patches being committed? This is at least the second in a week or so, and in both cases the patch looked hunky-dory in the issue queue.

sun’s picture

@webchick, the reason for that seemingly is that not all testbots are running PIFR 3.x (which uses Drush to install the initial test runner environment).

But anyway, next to the Drush PR that might unblock this issue "soon-ish", we need to resolve #2206501: Remove dependency on Drush from test reviews

To do so, I restarted work on #1808220: Remove run-tests.sh dependency on existing/installed parent site — which, coincidentally, goes hand in hand with some critically important install system clean-ups I wanted to work on anyway. So, even though the rollback of this patch (just because of Drush) really drives me nuts (the 4th major issue that gets blocked on it), I have some very exciting installer clean-ups in the pipeline, ready to rumble in a few minutes. :-)

sun’s picture

The base building block of that work now lives in #2213357: Use a proper kernel in early installer

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

extension.uri_.12.patch no longer applies.

error: patch failed: core/includes/install.core.inc:1388
error: core/includes/install.core.inc: patch does not apply
error: patch failed: core/modules/system/system.admin.inc:6
error: core/modules/system/system.admin.inc: patch does not apply
error: patch failed: core/themes/engines/twig/twig.engine:4
error: core/themes/engines/twig/twig.engine: patch does not apply

sutharsan’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new60.2 KB

Patch #12 rerolled

Status: Needs review » Needs work

The last submitted patch, 20: extension.uri_.20.patch, failed testing.

sun’s picture

Status: Needs work » Postponed

The actual status here is that this issue is postponed on either #2206501: Remove dependency on Drush from test reviews or https://github.com/drush-ops/drush/pull/509 — whichever happens first.

Grayside’s picture

sun’s picture

Yeah, but now the latest version of Drush needs to get deployed to all testbots first..... :-/

→ That's why I'm currently working incredibly hard on #1808220: Remove run-tests.sh dependency on existing/installed parent site

sun’s picture

Status: Postponed » Needs review
StatusFileSize
new61.61 KB
new3.49 KB

Even though #1808220: Remove run-tests.sh dependency on existing/installed parent site is semi-RTBC already, I can only assume that adjusting PIFR + deploying to testbots will take another week or so...

So in order to move forward:

Restored public Extension class properties as a temporary shim until external dependencies are resolved.

The old and new $filename properties have different values and meanings, so renamed the new to $_filename. This code will be reverted back to the clean state of #12, as soon as PIFR + testbots have been fixed, so I hope we can live with this slightly ugly temporary property naming workaround for a few days/weeks.

Status: Needs review » Needs work

The last submitted patch, 25: extension.uri_.25.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new61.62 KB
new521 bytes

Fixed bogus variable.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Same patch as the RTBC/committed before, just leaving a temporary BC shim in for Drush, so I hope it's OK if I move this back to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Let's try again :)

Committed 28d0b8e and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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

sun’s picture