Problem/Motivation

1) hook_update_N() implementations should have an 'Implements HOOKNAME()' first line the same as any other hook, both for DX and for the API module to find them easily.

2) Implementation and technical detail can not be added to the docblock because it is displayed in entirety to the user.

Both of the above are changes to the existing coding standards for update_hook_N().

Steps to reproduce

Proposed resolution

1) Add Implements HOOKNAME() to update_hook_N() implementation and ignore that line in update_get_update_list().

2) Only subset of the docblock should be used for the UI. Needs work to decided how to identify the lines to display.

Remaining tasks

Patch
Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#9 1663218-9.patch1 KBquietone
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Issue summary: View changes
Status: Active » Needs review
Issue tags: +Bug Smash Initiative
FileSize
1 KB

The IS lists wo problems

  1. the function's docs on api.d.o doesn't connect with http://api.drupal.org/api/drupal/modules!system!system.api.php/function/...
  2. I think this is the line that 'doesn't connect'.
    The documentation block preceding this function is stripped of newlines and used as the description for the update on the pending updates task list, which users will see when they run the update.php script.

    That can be improved by stripping of new lines phrase is needed.
    The documentation block preceding this function is used as the description for the update on the pending updates task list, which users will see when they run the update.php script.

  3. the docblock can't go into further technical detail
  4. This is fixed by #1624278: cleanup of docblock to UI text in update_get_update_list() is weak. Multi line doc block should display correctly now.

Not running tests until there is agreement on the text.

Lendude’s picture

The title and IS could use some more updating to make it clearer what he scope here is now.

New suggested text looks good to me in light of #1624278: cleanup of docblock to UI text in update_get_update_list() is weak

joachim’s picture

> the function's docs on api.d.o doesn't connect with

It took me a moment to remember what I meant by this, sorry!

What I mean is that the api.d.org page for the hook_update_N() doesn't list implementations of the hook, because the docblock of implementations doesn't say 'Implements hook_update_N()' as is standard for other hooks.

And the docblocks can't say that because then that 'Implements hook_update_N()' would end up in the user-facing text, which we don't want.

quietone’s picture

Title: whole of hook_update_N() docs being used for UI prevents API connection and further technical detail » Document that the multi line doc blocks of hook_update_N() can be used
Issue summary: View changes
Related issues: +#1624278: cleanup of docblock to UI text in update_get_update_list() is weak

for 1) The api pages for hook_update list the functions that implement hook_update_N. For hook_update_N/9.2.x all the hook_update_N functions have a docblock that does not say 'Implements ...'. The same is true for D8.9 and D7. So, presumably everyone is well behaved and the review process and the committers prevent a docblock of 'implements ..' in a hook_update_N. There is a coding standard for this, Update functions (implementations of hook_update_N()) although I didn't check to see how long that has been approved. I don't know if there is a sniff for that either.

Finding this issue made me read module.api.php and see that it a minor improvement can be made.

Better?

quietone’s picture

Title: Document that the multi line doc blocks of hook_update_N() can be used » Document that multi line doc blocks of hook_update_N() can be used
Issue summary: View changes

Fix some typos

joachim’s picture

> The api pages for hook_update list the functions that implement hook_update_N. For hook_update_N/9.2.x all the hook_update_N functions have a docblock that does not say 'Implements ...'. The same is true for D8.9 and D7. So, presumably everyone is well behaved and the review process and the committers prevent a docblock of 'implements ..' in a hook_update_N. There is a coding standard for this

Ok, but my point is that the api page for hook_update_N() doesn't list implementations because we don't do this, and it should, and therefore, implementations of this SHOULD have the 'Implements ...' first line, which the UI should ignore.

quietone’s picture

@joachim, sorry, but I am not following. Can you provide a link to the page to be sure I am looking at the same one and then describe what you want and don't want to see.

joachim’s picture

Ok it looks like API module has had this improved since I filed this issue.

Back when I filed it, the API page at https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension... didn't show you the implementations of hook_update_N().

Now it does, but it looks pretty broken still -- action_post_update_move_plugins()? views_ui_ajax_update_form()? Those look totally wrong!

My point is that hook_update_N() implementations should have an 'Implements HOOKNAME()' first line the same as any other hook, both for DX and for the API module to find them easily. The code that slurps up the docblock for the UI should be changed so that it ignores this line.

The second point is that slurping up the whole of the docblock for the UI means that the docblock can't be used for implementation details which are important to developers but not admin users running an update. There should be a way to have the slurping code stop and ignore some of the text.

quietone’s picture

Version: 8.9.x-dev » 9.2.x-dev
Issue summary: View changes

Ah, thank you! I was definitely stuck there. And I love the use of 'slurping', very accurate.

I have radically changed the IS. And I think this is a Feature Request because it is suggesting a change to a coding standard. Agree?

Note the api page does warn that functions other that hook_update_N() will be shown
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

quietone’s picture

Title: Document that multi line doc blocks of hook_update_N() can be used » Allow hook_update_N() doc block to contain details that are not displayed to the user
Project: Drupal core » Coding Standards
Version: 9.2.x-dev »
Component: update.module » Coding Standards
Category: Bug report » Feature request
Status: Needs review » Active

Trying to follow the Coding standards process here. Moving to coding standards project for discussion.

joachim’s picture

I am wondering whether at this point, we should postpone this until Drupal uses PHP8 attributes, as then we could do something like:

- normal docblock is just a docblock for developers
- UI text is in a function annotation