Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#46602 closed defect (bug) (fixed)

Remove documentation reference to global $wpdb in upgrade.php

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

Description

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

Attachments (2)

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

Download all attachments as: .zip

Change History (15)

@jayupadhyay01
6 years ago

#1 @mukesh27
6 years 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
6 years 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
6 years ago

Document changes as per suggestion.

#3 @jayupadhyay01
6 years 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.


5 years ago

#5 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.2

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


5 years ago

#7 @audrasjb
5 years ago

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

#8 @dswebsme
5 years 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
5 years ago

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

#10 @jayupadhyay01
5 years ago

  • Keywords has-dev-note added

#11 @andraganescu
5 years ago

  • Keywords commit added; good-first-bug removed

#12 @desrosj
5 years 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
5 years 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.