Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Taking a look at update_helpful_links(), you see it mentions:
we can't use l() here because the URL would point to 'core/update.php?q=admin'.
- This is actually very untrue. Using "absolute", you can reference direct pages
- This is also broken since we switched to index.php/%page, so ?q=admin is obsolete
- Hard-coding HTML is ew, let's switch to theme_links()
Comment | File | Size | Author |
---|---|---|---|
#18 | update-comment-1648004-18.patch | 573 bytes | dcam |
#13 | improve-helpful-links-1648004-13.patch | 1.76 KB | dcam |
#6 | before.png | 16.33 KB | dcam |
#6 | after.png | 16.4 KB | dcam |
#2 | improve-helpful-links-1648004-2.patch | 1.79 KB | Devin Carlson |
Comments
Comment #1
RobLoachIt's an easy patch review.
Comment #2
Devin Carlson CreditAttribution: Devin Carlson commentedThe patch in the original issue looks good but I think that we could also change
$form['links']
from "#markup" to "#theme => 'links'" to make it easier to override.Also, I don't see any reference to "absolute" in the theme_links API docs. However, I tested the update page without "absolute" and the links continued to work (even without clean URLs in Drupal 7).
Comment #4
Devin Carlson CreditAttribution: Devin Carlson commentedHmm, one test failure in comment module? The test is passing locally for me so trying once more before digging deeper.
Comment #5
Devin Carlson CreditAttribution: Devin Carlson commented#2: improve-helpful-links-1648004-2.patch queued for re-testing.
Comment #6
dcam CreditAttribution: dcam commentedThe patch looks good to me. It was tested by running update.php before and after applying, both with and without updates to apply. Screenshots from the tests without updates are attached.
Comment #8
dcam CreditAttribution: dcam commented#2: improve-helpful-links-1648004-2.patch queued for re-testing.
Comment #10
dcam CreditAttribution: dcam commentedComment #11
webchickNice clean-up!
Committed and pushed to 8.x. Thanks!
Comment #12
dcam CreditAttribution: dcam commentedRerolled for D7.
Comment #13
dcam CreditAttribution: dcam commentedIt helps to actually attach the patch.
Comment #14
Devin Carlson CreditAttribution: Devin Carlson commentedThe patch in #13 is a backport of the patch for D8 in #2 and makes the same changes. The patch applied cleanly and resulted in proper links being generated to both the front and administration pages after an update was performed.
Comment #15
webchickHm. Typically we can't make data structure/markup changes like this in a stable release. Assigning to David to get his thoughts.
Comment #16
David_Rothstein CreditAttribution: David_Rothstein commentedYeah, I would say that although people aren't that likely to do hook_form_alter() or custom theming on update.php, we still shouldn't change the data structures and markup if the only reason is code cleanup (i.e., not fixing an actual bug).
However, this part of the patch:
seems like it might be OK to backport (at the very least getting rid of the inaccurate code comment is obviously OK). I've run across that code comment before and had the sneaking suspicion it was all a complete lie; I'm glad someone discovered that it actually was :)
Even switching the actual base_path() stuff out with a call to l() instead might be fine. Although, calling l() has the effect of initializing the theme system, and it's scary to change the time/place we do that when something as fragile as update.php is running... so yeah, maybe better safe than sorry here.
Comment #17
David_Rothstein CreditAttribution: David_Rothstein commentedComment #18
dcam CreditAttribution: dcam commentedFollowing David_Rothstein's recommendation in #16, this patch removes the inaccurate comment with no other changes.
Comment #19
David_Rothstein CreditAttribution: David_Rothstein commentedLooks good to me.
Comment #20
webchickHm. Not sure.. I still think that hunk could use a comment (though an accurate one ;)) as to why we're not using l() here, since someone's likely to try and "fix" this later.
Comment #21
David_Rothstein CreditAttribution: David_Rothstein commentedMy understanding is that there is no real reason (which is why the Drupal 8 patch changed it)...
"We are afraid to initialize the theme system at this point in update.php in a stable release" but not sure fear belongs in code comments :)
Comment #22
David_Rothstein CreditAttribution: David_Rothstein commentedAlright, no one has moved it back from RTBC and no one else has commented either, so committing it to 7.x for now... thanks! http://drupalcode.org/project/drupal.git/commit/c6a5487
Feel free to reopen if you have ideas for a better code comment to add there, though.