[wp-trac] [WordPress Trac] #46602: Add missing global variable $wpdb in upgrade.php

WordPress Trac noreply at wordpress.org
Fri Mar 22 11:49:54 UTC 2019


#46602: Add missing global variable $wpdb in upgrade.php
--------------------------------------+------------------------------
 Reporter:  jayupadhyay01             |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Upgrade/Install           |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch good-first-bug  |     Focuses:  docs
--------------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * focuses:   => docs


Comment:

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

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

 Per the [https://make.wordpress.org/core/handbook/best-practices/inline-
 documentation-standards/php/ 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?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46602#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list