WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 8 months ago

#46602 closed defect (bug) (fixed)

Remove documentation reference to global $wpdb in upgrade.php

Reported by: jayupadhyay01 Owned by: dswebsme
Milestone: 5.2 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: has-patch commit
Focuses: docs Cc:
PR Number:

Description

I've found Some Code Changes Require about Variable Defining.

Attachments (2)

#46602.diff (452 bytes) - added by jayupadhyay01 9 months ago.
#46602(changes).diff (424 bytes) - added by jayupadhyay01 9 months ago.
Document changes as per suggestion.

Download all attachments as: .zip

Change History (15)

#1 @mukesh27
9 months ago

  • Component changed from General to Upgrade/Install
  • Keywords good-first-bug added
  • Summary changed from Code Changes in upgrade.php from wp-admin to Add missing global variable $wpdb in upgrade.php
  • Type changed from enhancement to defect (bug)

#2 @SergeyBiryukov
9 months ago

  • Focuses docs added

Hi @jayupadhyay01, welcome to WordPress Trac! Thanks for the patch.

$wpdb is already available here via wp-load.php.

Per the documentation standards, the @global tag is meant to list PHP globals used within functions or methods.

Looking at other files in wp-admin, it seems like we don't generally document $wpdb in code that itself is in the global namespace. The standards don't say anything about it either.

So perhaps we should remove @global wpdb $wpdb here instead. Introduced in [32642].

@DrewAPicture, do you have an opinion on documenting globals outside of functions or methods?

@jayupadhyay01
9 months ago

Document changes as per suggestion.

#3 @jayupadhyay01
9 months ago

Hi @SergeyBiryukov

As per your suggestion i have changed the document and Added another patch #46602(changes).diff, Please have a look and let me know if any further actions required?

This ticket was mentioned in Slack in #core by jayupadhyay01. View the logs.


8 months ago

#5 @SergeyBiryukov
8 months ago

  • Milestone changed from Awaiting Review to 5.2

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


8 months ago

#7 @audrasjb
8 months ago

  • Owner set to dswebsme
  • Status changed from new to assigned

#8 @dswebsme
8 months ago

Tested and confirmed that the updated patch #46602(changes).diff correctly addresses the issue by fixing the documentation. No functional code modified.

Ready for commit.

#9 @dswebsme
8 months ago

  • Summary changed from Add missing global variable $wpdb in upgrade.php to Remove documentation reference to global $wpdb in upgrade.php

#10 @jayupadhyay01
8 months ago

  • Keywords has-dev-note added

#11 @andraganescu
8 months ago

  • Keywords commit added; good-first-bug removed

#12 @desrosj
8 months ago

  • Keywords has-dev-note removed

Removing has-dev-note. This keyword should only be used for noting tickets that have had a developer note published to the Make WordPress Core website.

#13 @SergeyBiryukov
8 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 45233:

Docs: Remove @global tag for $wpdb from wp-admin/install.php and wp-admin/upgrade.php.

Per the documentation standards, the @global tag is meant to list PHP globals used within functions or methods.

The code in question uses the variable in global namespace, but does not explicitly declare it.

Props jayupadhyay01, dswebsme.
Fixes #46602.

Note: See TracTickets for help on using tickets.