Opened 7 years ago
Closed 7 years ago
#41507 closed enhancement (fixed)
Replace $wpdb->siteid with get_current_network_id()
Reported by: | spacedmonkey | Owned by: | sathyapulse |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Networks and Sites | Keywords: | good-first-bug has-patch commit |
Focuses: | multisite | Cc: |
Description
The helper function get_current_network_id()
was introduced in 4.6. It is already used in a number of places, however there was still references to $wpdb->siteid
throughout the core.
Attachments (4)
Change History (16)
#3
@
7 years ago
@spacedmonkey I have attached the patch file with the ticket which addresses the replace of $wpdb->siteid
with get_current_network_id()
in the functions mentioned. Additionally I found the usage in the function wp_load_core_site_options
and replaced it. Could you please check the patch and let me know your thoughts?
#5
@
7 years ago
@sathyapulse Great work.
Couple of things. Can you make sure to remove the global $wpdb
references and update the docs.
There are also 7 references in the phpunit tests to $wpdb->siteid
that should be replaced.
#6
@
7 years ago
@spacedmonkey I have created a new patch file by removing the global references. I am not sure about the changes in the phpunit tests. It's mostly in the assignment. Could you please be clear what needs to be removed? All the 7 occurrences?
This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.
7 years ago
#10
@
7 years ago
41507.2.diff removes references to $wpdb->siteid
in test. This basically means it is deprecated and is not used for anything.
@flixos90 what are your thoughts on officially deprecating it at some point.
#11
@
7 years ago
- Keywords commit added
41507.3.diff ensures that it applies cleanly after the changes made in [41241]. It furthermore removes the hacky network switching logic from the unit tests completely, since that is no longer necessary as wp_update_network_site_counts()
and wp_update_network_user_counts()
now accept the $network_id
as parameter.
Usage in
Less important as deprecated