When all hook_menu implementations were removed, internal helper functions _tracker_myrecent_access() and _tracker_user_access() became unnecessary.

The first, _tracker_myrecent_access() was replaced by declarations in tracker.router.yml (tracker.users_recent_content), tracker.services.yml (access_check.tracker.view_own), and src/Access/ViewOwnTrackerAccessCheck.php (class ViewOwnTrackerAccessCheck).

While _tracker_user_access() was replaced by a declaration in tracker.router.yml (tracker.user_tab).

Nothing in D8 invokes these functions. There is a stale reference to _tracker_myrecent_access in modules/migrate_drupal/src/Tests/Table/d7/MenuRouter.php.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jeremy created an issue. See original summary.

Jeremy’s picture

Attached patch removes both unused internal helper functions. No CR seems necessary as these were only internal helper functions (starting with _tracker) never exposed to other modules as an API.

Jeremy’s picture

Updated patch to also remove a stale reference to @see tracker_menu from tracker.pages.inc. That function, tracker_page(), is still invoked by the tracker module in multiple places (from src/Controller/TrackerPage.php, src/Controller/TrackerUserRecent.php and src/Controller/TrackerUserTab.php).

Anonymous’s picture

Status: Needs review » Needs work

Nothing in D8 invokes these functions. There is a stale reference to _tracker_myrecent_access in modules/migrate_drupal/src/Tests/Table/d7/MenuRouter.php.

And two to _tracker_user_access. Shouldn't we fix those while we are at it?

Jeremy’s picture

Status: Needs work » Needs review

This patch isn't modifying the database dumps in migrate_drupal/src/Tests, only active code. The function _tracker_user_access() doesn't show up in the D8 tracker module, so nothing to add here.

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.

Mile23’s picture

Version: 8.3.x-dev » 8.4.x-dev
Priority: Minor » Normal
Status: Needs review » Needs work
Issue tags: -Quickfix +Needs reroll

Moving to 8.4.x because removing functions might be disruptive.

Patch no longer applies.

I see that migrate_drupal/tests/fixtures/drupal7.php has a reference to these functions, but that could be a reference to the D7 implementations. I'm not familiar enough with migrations to know for sure.

jofitz’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.78 KB

Re-rolled.

Mile23’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Thanks.

Wim Leers’s picture

Priority: Normal » Minor
Issue tags: +Trivial patch of the month

Woah, nice catch!

webchick’s picture

Title: Remove unused functions _tracker_myrecent_access and _tracker_user_access » Deprecate unused functions _tracker_myrecent_access and _tracker_user_access
Status: Reviewed & tested by the community » Needs work

Likewise with #2551259-11: Deprecate dead code locale_translation_manual_status(), we'll want to deprecate here rather than full-out remove.

Mile23’s picture

Mile23’s picture

Issue tags: +@deprecated
harsha012’s picture

As per #15 added the @deprecated . please validate.

harsha012’s picture

Status: Needs work » Needs review
Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 16: unused-function-depricitated-2550581-16.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Reviewed & tested by the community

Testbot infrastructure failure:

00:00:02.107 Performing git checkout of git://git.drupal.org/project/drupal.git -b 8.4.x to /var/lib/drupalci/workspace/jenkins-drupal_patches-17660/source.
00:00:02.107 Git Command: git clone -b 8.4.x --depth 1 git://git.drupal.org/project/drupal.git '/var/lib/drupalci/workspace/jenkins-drupal_patches-17660/source'
00:00:02.108 Checkout Error
00:00:02.108 git clone -b 8.4.x --depth 1 git://git.drupal.org/project/drupal.git '/var/lib/drupalci/workspace/jenkins-drupal_patches-17660/source' 2>&1
00:00:02.109 Return Code:128
00:00:02.109 Cloning into '/var/lib/drupalci/workspace/jenkins-drupal_patches-17660/source'...
00:00:02.109 error: copy-fd: write returned No space left on device
00:00:02.110 fatal: cannot copy '/usr/share/git-core/templates/description' to '/var/lib/drupalci/workspace/jenkins-drupal_patches-17660/source/.git/description': No space left on device
00:00:02.111 PHP Warning:  file_put_contents(): Only 0 of 548 bytes written, possibly out of free disk space in /opt/drupalci/testrunner/src/DrupalCI/Build/Build.php on line 481
xjm’s picture

So the difference between this and #2551259: Deprecate dead code locale_translation_manual_status() is that in the fine print of https://www.drupal.org/core/d8-bc-policy#underscore, underscore-prefixed functions etc. are explicitly internal. However, @catch and I discussed this and agreed that it's still probably best to deprecate things by default as a best practice, which is what the latest patch does, so +1.

Let's also explicitly add an @internal to these along with the deprecation. Then we can tack a message to the end of the standard deprecation message like:
As internal API, this may also be removed in a minor release if it becomes needed.

xjm’s picture

Forgot to mention, we'll also update the deprecation documentation to cover this, so that we can deprecate internal API first since it's just less work, but still make it clear that it's internal API and so if there is a problem with it, we're not going to do refactoring to protect it.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Marking CNW for the additional @internal documentation.

xjm’s picture

Sorry, forgot to mark it NW.

harsha012’s picture

As per #23. Added @internal documentation. please validate.

harsha012’s picture

Status: Needs work » Needs review
xjm’s picture

Status: Needs review » Needs work

Updated the policy: https://www.drupal.org/core/deprecation#internal

Thanks @harsha012 -- looks pretty good. I would move the sentence from the @internal to the end of the @deprecated. The example at the link above (which we just wrote now) should help. :)

Also, be sure your comments wrap at 80 characters to follow our coding standards.

Thanks for helping with this!

harsha012’s picture

As per #27 made some improvement. please validate the patch

harsha012’s picture

Status: Needs work » Needs review
xjm’s picture

Thanks @harsha012. Just a few more small issues.

+++ b/core/modules/tracker/tracker.module
@@ -152,6 +159,12 @@ function _tracker_myrecent_access(AccountInterface $account) {
+ * @deprecated _tracker_user_access() is depriciated in Drupal 8.4.0 and will be
+ * removed before Drupal 9.0.0.See https://www.drupal.org/node/2550581. As
+ * internal API, _tracker_user_access() may also be removed in a minor release.
  1. "deprecated" is misspelled. But actually the first part,
    _tracker_myrecent_access() is depriciated <code>,
     can be dropped in the code comment. It just needs to be in the <code>@trigger_error()

    . See https://www.drupal.org/core/deprecation for examples.

  2. I also don't see a @trigger_error? Is it excluded on purpose? See: https://www.drupal.org/core/deprecation
  3. There's a missing space after the period after "Drupal 9.0.0."
  4. Every line of the comment after the first should be indented by two spaces; see core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php for an example. (I just picked that at random out of a grep.)

Please take a close look at the examples in https://www.drupal.org/core/deprecation and try to update the patch based on that. Thanks!

xjm’s picture

Status: Needs review » Needs work
harsha012’s picture

Status: Needs work » Needs review
FileSize
2.39 KB

@xjm, please validate the patch now.

Status: Needs review » Needs work

The last submitted patch, 32: unused-function-deprecated-2550581-32.patch, failed testing.

harsha012’s picture

Status: Needs work » Needs review
xjm’s picture

Thanks @harsha012, that looks much closer.

  1. It looks like the messages are referencing this issue, rather than a change record. We would create a change record and reference that... except since we agreed it's internal API I don't think that's the right course of action. So in this case, how about we remove the sentence See https://www.drupal.org/node/2550581 from the messages?
  2. +++ b/core/modules/tracker/tracker.module
    @@ -135,6 +135,12 @@ function tracker_cron() {
    + *   _tracker_user_access()may also be removed in a minor release.
    

    Missing space between _tracker_user_access() and may.

  3. +++ b/core/modules/tracker/tracker.module
    @@ -145,6 +151,9 @@ function tracker_cron() {
    +  @trigger_error('_tracker_myrecent_access() is deprecated in Drupal 8.4.0 and
    +   will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2550581.
    +   ', E_USER_DEPRECATED);
    
    @@ -162,6 +177,9 @@ function _tracker_myrecent_access(AccountInterface $account) {
    +  @trigger_error('_tracker_user_access is deprecated in Drupal 8.4.0 and
    +   will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2550581.
    +   ', E_USER_DEPRECATED);
    

    Ah, functional code does not need to be wrapped to 80 characters -- just the documentation. You can put function calls on multiple lines to improve readability, but we would do that by putting each parameter on one line -- but in this case, I think it's fine to just put this all on one line.

  4. +++ b/core/modules/tracker/tracker.module
    @@ -152,6 +161,12 @@ function _tracker_myrecent_access(AccountInterface $account) {
    + *   https://www.drupal.org/node/2550581. As internal API, _tracker_user_access()
    

    This line is just one character too long. :) Looks like you noticed that for the other copy of the docblock and rewrapped it (thence the missing space) but it didn't make it to this one.

  5. +++ b/core/modules/tracker/tracker.pages.inc
    @@ -19,8 +19,6 @@
    - *
    - * @see tracker_menu()
    

    We do still need to remove the other two references to this. (Either that, or remove this hunk from the patch, but it makes sense as part of this issue's scope since the functions we're deprecating were the helpers for it.) So there should be three lines like this in the patch for each of these references:

    [ibnsina:drupal | Tue 14:00:06] $ grep -r "tracker_menu" *
    core/modules/tracker/tracker.module: * @see tracker_menu()
    core/modules/tracker/tracker.module: * @see tracker_menu()
    core/modules/tracker/tracker.pages.inc: * @see tracker_menu()
xjm’s picture

Status: Needs review » Needs work

(Sorry, I keep failing to actually mark the issue NW.) :)

xjm’s picture

I updated https://www.drupal.org/node/2856615/revisions/view/10512193/10514226 to clarify that internal API changes might not have change records, including changing the example. Sorry for the confusion over that; this issue is helping us finalize the policy for these sorts of changes. :)

harsha012’s picture

Status: Needs work » Needs review
FileSize
2.43 KB

@xjm, I hope now the issue will be fixed with this patch. please validate

Mile23’s picture

Getting closer... Still doesn't address #35.1, though:

+++ b/core/modules/tracker/tracker.module
@@ -135,16 +135,20 @@ function tracker_cron() {
+  @trigger_error('_tracker_myrecent_access() is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2550581.', E_USER_DEPRECATED);

@@ -152,16 +156,20 @@ function _tracker_myrecent_access(AccountInterface $account) {
+  @trigger_error('_tracker_user_access() is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2550581.', E_USER_DEPRECATED);
xjm’s picture

Status: Needs review » Needs work

Thanks @Mile23.

+++ b/core/modules/tracker/tracker.module
@@ -135,16 +135,20 @@ function tracker_cron() {
+ *   internal API, _tracker_user_access() may also be removed in a minor release.

@@ -152,16 +156,20 @@ function _tracker_myrecent_access(AccountInterface $account) {
+ *   internal API, _tracker_user_access() may also be removed in a minor release.

These lines are also one character too long again. Please configure your editor or IDE to show you where 80 characters is so that you can wrap comments correctly. You can also still use Dreditor for now to see your patch on Drupal.org and review it. The documentation standards for this are here: https://www.drupal.org/node/1354#drupal

harsha012’s picture

Status: Needs work » Needs review
FileSize
2.44 KB

@Mile23 and @xjm,

please check the below link for change recored. please validate it

https://www.drupal.org/node/2885190

Also made changes as per the comment #40.

Mile23’s picture

Status: Needs review » Needs work

Unpublished the change record since this hasn't been committed yet.

We still need to remove the links to this issue as per #39 and #35.1.

gaurav.kapoor’s picture

Status: Needs work » Needs review
FileSize
2.37 KB
1.31 KB

Fixed 39 and 35.1.

Mile23’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! LGTM.

  • catch committed 950362e on 8.4.x
    Issue #2550581 by harsha012, Jeremy, gaurav.kapoor, Jo Fitzgerald, xjm,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 950362e and pushed to 8.4.x. Thanks!

Status: Fixed » Closed (fixed)

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

quietone’s picture

Publish the cr