Changeset 38387
- Timestamp:
- 08/26/2016 09:15:22 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-roles.php
r37431 r38387 71 71 72 72 /** 73 * @since 4.7.0 74 * @access protected 75 * @var wpdb 76 */ 77 protected $db; 78 79 /** 73 80 * Constructor 74 81 * … … 76 83 */ 77 84 public function __construct() { 85 $this->db = $GLOBALS['wpdb']; 86 78 87 $this->_init(); 79 88 } … … 106 115 * @access protected 107 116 * 108 * @global wpdb $wpdb WordPress database abstraction object.109 117 * @global array $wp_user_roles Used to set the 'roles' property value. 110 118 */ 111 119 protected function _init() { 112 global $wp db, $wp_user_roles;113 $this->role_key = $ wpdb->get_blog_prefix() . 'user_roles';120 global $wp_user_roles; 121 $this->role_key = $this->db->get_blog_prefix() . 'user_roles'; 114 122 if ( ! empty( $wp_user_roles ) ) { 115 123 $this->roles = $wp_user_roles; … … 138 146 * @since 3.5.0 139 147 * @access public 140 *141 * @global wpdb $wpdb WordPress database abstraction object.142 148 */ 143 149 public function reinit() { 144 150 // There is no need to reinit if using the wp_user_roles global. 145 if ( ! $this->use_db ) 146 return; 147 148 global $wpdb; 151 if ( ! $this->use_db ) { 152 return; 153 } 149 154 150 155 // Duplicated from _init() to avoid an extra function call. 151 $this->role_key = $ wpdb->get_blog_prefix() . 'user_roles';156 $this->role_key = $this->db->get_blog_prefix() . 'user_roles'; 152 157 $this->roles = get_option( $this->role_key ); 153 158 if ( empty( $this->roles ) )
Note: See TracChangeset
for help on using the changeset viewer.