On AggregatorController::adminOverview(), the $next variable is initialized, but never used.

$next_update = $next = $this->t('%time left', ['%time' => $this->dateFormatter->formatInterval($last_checked + $refresh_rate - REQUEST_TIME)]);

That variable needs to be removed from the code.

CommentFileSizeAuthor
#4 3146474-3.patch843 bytesshaktik
#2 3145963-2.patch989 bytesshaktik

Comments

shaktik created an issue. See original summary.

shaktik’s picture

StatusFileSize
new989 bytes

Kindly Review Patch

shaktik’s picture

Assigned: Unassigned » shaktik
shaktik’s picture

StatusFileSize
new843 bytes

sorry of first #2 patch Please check #3 patch.

shaktik’s picture

Issue summary: View changes
shaktik’s picture

Assigned: shaktik » Unassigned
Rkumar’s picture

Interestingly it's a legacy code :)

sivaji_ganesh_jojodae’s picture

Status: Needs review » Needs work
+++ b/core/modules/aggregator/src/Controller/AggregatorController.php
@@ -125,7 +125,7 @@ public function adminOverview() {
+        $next_update = $this->t('%time left', ['%time' => $this->dateFormatter->formatInterval($last_checked + $refresh_rate - REQUEST_TIME)]);

Should not the REQUEST_TIME be replaced with the \Drupal::time()->getRequestTime()?

pavnish’s picture

@DevJoJodae Hi i think this is the deprecation it would be great if we can create separate ticket for deprecation.

avpaderno’s picture

Status: Needs work » Needs review

Yes, using a service instead of a constant is out of topic for this issue, which is about removing a variable that isn't used.

avpaderno’s picture

Issue summary: View changes
Issue tags: +Novice
avpaderno’s picture

Status: Needs review » Reviewed & tested by the community

Yes, the $next variable is initialized, but never used. This patch removes every reference to that variable from the code.

avpaderno’s picture

I also verified the code used from the AggregatorController class doesn't contain other references to that variable.

  • xjm committed 5866d88 on 9.1.x
    Issue #3146474 by shaktik, kiamlaluno: Remove Unused variable $next from...

  • xjm committed 2e1e194 on 9.0.x
    Issue #3146474 by shaktik, kiamlaluno: Remove Unused variable $next from...

  • xjm committed 92fea64 on 8.9.x
    Issue #3146474 by shaktik, kiamlaluno: Remove Unused variable $next from...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Typically, when I see unused variables, I like to know why they're there (as sometimes it can be covering up other bugs).

  • I used git log -L for the elseif, and it looks like the variable definition was added in #2228823: Aggregator feed overview misleading text .
  • I checked out the commit from that issue (12b8a2f77) and verified that the variable was also unused in the original commit.
  • It also did not exist in the commit before that one.
  • Reading interdiffs on #2228823: Aggregator feed overview misleading text , it looks like the variable was named $next in the original patch, and was renamed without explanation in comment 4 of that issue (with no changes to the logic). That's when the duplication was introduced.

So, it looks like this is indeed a safe cleanup.

As a cleanup of dead code for a local variable, this is eligible for backport to the production branch. So, committed to 9.1.x, and cherry-picked to 9.0.x and 8.9.x. Thanks!

Status: Fixed » Closed (fixed)

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