WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 8 weeks ago

#38630 new enhancement

Discourage usage of legacy properties in WP_Site

Reported by: flixos90 Owned by:
Milestone: Future Release Priority: low
Severity: normal Version: 4.5
Component: Networks and Sites Keywords: has-patch 2nd-opinion
Focuses: multisite Cc:

Description

Working on #38597, it was figured out that the best solution for handling problems with IDE handling of WP_Networks magic ID property is to rename the actual properties to reflect our current naming conventions. This enhancement will encourage to use the new conventions while still supporting the old ones for legacy code.

Let's do the same for WP_Site:

  • $blog_id (string) is replaced with $id (int)
  • $site_id (string) is replaced with $network_id (int)
  • both legacy names will continue to work through magic methods

Attachments (3)

38630.diff (2.6 KB) - added by flixos90 5 years ago.
38630.2.diff (3.1 KB) - added by flixos90 5 years ago.
38630.3.diff (3.3 KB) - added by flixos90 4 years ago.

Download all attachments as: .zip

Change History (15)

@flixos90
5 years ago

#1 @flixos90
5 years ago

  • Keywords has-patch added; needs-patch removed

38630.diff takes care of the proposed steps.

#2 @johnjamesjacoby
5 years ago

  • Version set to 4.5

I reviewed and approve of the proposed changes. Nice work!

#3 @flixos90
5 years ago

  • Keywords early removed
  • Milestone changed from Future Release to 4.8

@flixos90
5 years ago

#4 @flixos90
5 years ago

  • Keywords 2nd-opinion added

In 38630.2.diff I adjusted the to_array() method to be backward-compatible, but at the same time deprecated it.

The method is (as far as I can see) only called in wp_get_sites() which is already deprecated, and it is easily possible to achieve the same effect (only with the new properties instead) by using get_object_vars( $site ). We should probably discuss this change soon (as deprecations should happen early in the cycle), and it would definitely need to be highlighted in a multisite dev note.

If we decide deprecating it is right, let's do that in a separate ticket though.

Last edited 5 years ago by flixos90 (previous) (diff)

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


4 years ago

@flixos90
4 years ago

#6 @flixos90
4 years ago

38630.3.diff brings a few improvements over the previous patch:

  • In the to_array() method, it is ensured that the legacy properties are strings.
  • The $id and $network_id properties are no longer handled in the __get() and __isset() methods since they are public anyway. They are however still part of __set() since this method is called manually in the constructor.

Looking at the unit tests, I'm wary of this change although I definitely like its approach. Most unit tests failures (there are several) are only a result of the deprecation of to_array() which we can easily adjust, but the other two failures are actual failures, so anyone using get_object_vars() on WP_Site objects or iterating over them would run into problems (see https://core.trac.wordpress.org/ticket/40180#comment:3 for background). I'm starting to think we should hold off changing the public properties, although I don't like to say it.

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


4 years ago

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


4 years ago

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


4 years ago

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


4 years ago

#11 @flixos90
4 years ago

  • Milestone changed from 4.8 to Future Release
  • Priority changed from normal to low

This is a developer-centric change that could easily cause unexpected issues. We need to put more thoughts into it and merge it early in a major release. Let's come back to this later.

#12 @usernameunkowns
8 weeks ago

https://uaenewsagency.blogspot.com/
https://dubaivehicle.blogspot.com/
https://uaeultimate.blogspot.com/
https://uaeblogonline.blogspot.com/
https://fddddsfddcdc.blogspot.com/
https://projectorliteblog.blogspot.com/
https://pakeducationalist.blogspot.com/
https://lionsonlineforcesacademy.blogspot.com/
https://dubaitimesblog.blogspot.com/
https://edcationinpakistan.blogspot.com/
https://mywebsitestorenew.blogspot.com/
https://mywebsitestoreold.blogspot.com/
https://theguestpostcontent.blogspot.com/
https://thesupercontent.blogspot.com/
https://thesuperbloggers.blogspot.com/
https://thebloggerfundablog.blogspot.com/
https://therunnerblogger.blogspot.com/
https://Foodreviewbloggerblog.blogspot.com/
https://thenewbieblogger.blogspot.com/
https://eindianbloggershub.blogspot.com/
https://eamericansupperblogger.blogspot.com/
https://eperfectaustralianblogger.blogspot.com/
https://themostwantedbloggernow.blogspot.com/
https://howyoudothatbloggers.blogspot.com/
https://whywearebestbloggernow.blogspot.com/
https://WhereIamgoing.blogspot.com
https://eLetmedownslowly.blogspot.com/
https://RedditRefrencesblogger.blogspot.com/
https://digitalTeamworkblogger.blogspot.com/
https://theseoandwriteragency.blogspot.com/
https://Theclientproblemsolver.blogspot.com/
https://theworldnewblogger.blogspot.com/
https://thewonderofworldbloggers.blogspot.com/
https://theestatementblogger.blogspot.com/
https://emobilesandgamesblog.blogspot.com/
http://social.technet.microsoft.com/profile/fashioninstitute/
https://bit.ly/3chMZO9
https://cutt.ly/oncdnP2
https://t.ly/WqVN
http://social.technet.microsoft.com/profile/lawyersarbi/
https://t.ly/UwAb
https://cutt.ly/4ncdQiR
https://bit.ly/3wVNvcD
http://social.technet.microsoft.com/profile/zardosi/
https://cutt.ly/2ncdElQ
https://t.ly/N7X2
https://bit.ly/34QYPdW
http://social.technet.microsoft.com/profile/rajendralawyer/
https://cutt.ly/TncsDUr
https://bit.ly/3g6qdKp
http://social.technet.microsoft.com/profile/barassociation/
https://bit.ly/2Sc69OP
http://social.technet.microsoft.com/profile/consumerlawyer/
https://cutt.ly/FncdvT0
https://bit.ly/3cjXZuF
http://bbs.now.qq.com/home.php?mod=space&uid=1021004/
http://bbs.now.qq.com/?1021004/
http://social.technet.microsoft.com/profile/Findtrademark/
https://cutt.ly/KncdzdW
https://bit.ly/2TIpsja
http://social.technet.microsoft.com/profile/gstlawyers/
https://cutt.ly/Hncdj1Q
https://bit.ly/34LPMer
http://social.technet.microsoft.com/profile/backlinkesysteml/
https://cutt.ly/HncdhyW
https://bit.ly/3wZDrzc
http://social.technet.microsoft.com/profile/backlinkesystemm/
https://cutt.ly/encdfp9
https://bit.ly/3z1P0Id
http://social.technet.microsoft.com/profile/backlinkesystemn/
https://cutt.ly/incda40
https://bit.ly/3vVlDp8
http://social.technet.microsoft.com/profile/backlinkesystemo/
https://cutt.ly/8ncdpSk
https://bit.ly/34K6lr1
http://social.technet.microsoft.com/profile/backlinkesystemj/
https://cutt.ly/ZncdoIr
https://bit.ly/2SXhe6i
https://social.technet.microsoft.com/profile/zardosi/
https://social.technet.microsoft.com/profile/backlinkesystemk/
https://social.technet.microsoft.com/profile/gstlawyers/
https://social.technet.microsoft.com/profile/backlinkesystemp/
https://social.technet.microsoft.com/profile/backlinkesystemp/
https://social.technet.microsoft.com/profile/registercompany/
https://social.technet.microsoft.com/profile/fashioninstitute/
https://social.technet.microsoft.com/profile/Findtrademark/
https://social.technet.microsoft.com/profile/squrefeet/
https://social.technet.microsoft.com/profile/backlinkesystemn/
https://social.technet.microsoft.com/profile/backlinkesysteml/
https://social.technet.microsoft.com/profile/backlinkesystemj/
https://social.technet.microsoft.com/profile/finaceconsult/
https://social.technet.microsoft.com/profile/divvorcelegal/
https://social.technet.microsoft.com/profile/backlinkesystemm/
https://social.technet.microsoft.com/profile/backlinkesystemi/
https://social.technet.microsoft.com/profile/backlinkesystemq/
https://social.technet.microsoft.com/profile/backlinkesystemr/
https://social.technet.microsoft.com/profile/drtlaw/
https://social.technet.microsoft.com/profile/publicforum/
https://social.technet.microsoft.com/profile/tamilsir/
https://social.technet.microsoft.com/profile/realestatelaw/
https://social.technet.microsoft.com/profile/ncltadvocate/
https://social.technet.microsoft.com/profile/BankLoan/
https://social.technet.microsoft.com/profile/PropertyLawyer/
https://social.technet.microsoft.com/profile/backlinkesystemo/
https://social.technet.microsoft.com/profile/fashioninstitute/
http://social.technet.microsoft.com/profile/backlinkesystemk/
https://cutt.ly/sncdiWH
https://bit.ly/3fPHAQT
http://social.technet.microsoft.com/profile/backlinkesystemp/
https://cutt.ly/pncdyHb
https://bit.ly/3ifrvp9
http://social.technet.microsoft.com/profile/lawyersch/
https://cutt.ly/bncdtYk
https://bit.ly/2THHCSb
http://social.technet.microsoft.com/profile/registercompany/
https://cutt.ly/hncdrAG
https://bit.ly/3fNXB9K
http://social.technet.microsoft.com/profile/squrefeet
https://cutt.ly/CncdqTC
https://bit.ly/3z56WS7
http://social.technet.microsoft.com/profile/finaceconsult/
https://cutt.ly/mncs51e
https://bit.ly/3g8vUrg
http://social.technet.microsoft.com/profile/divvorcelegal/
https://cutt.ly/0ncs7De
https://bit.ly/2SVtp3J
http://social.technet.microsoft.com/profile/backlinkesystemi/
https://cutt.ly/Cncs4G4
https://bit.ly/3fMq3Jc
http://social.technet.microsoft.com/profile/backlinkesystemq/
https://cutt.ly/Sncs8lL
https://bit.ly/2SYKYQo
https://www.liveinternet.ru/users/caisar987522/profile
https://cutt.ly/Lncs976
https://bit.ly/2SXi82G
http://social.technet.microsoft.com/profile/backlinkesystemr/
https://cutt.ly/hncs2To
https://bit.ly/3phAtni
http://social.technet.microsoft.com/profile/drtlaw/
https://cutt.ly/Oncs0ta
https://bit.ly/2TxUk5K
http://social.technet.microsoft.com/profile/publicforum/
https://cutt.ly/YncsMBR
https://bit.ly/3gdj8YF
http://social.technet.microsoft.com/profile/realestatelaw/
https://cutt.ly/fncsBWy
https://bit.ly/3fRRLnG
http://social.technet.microsoft.com/profile/tamilsir/
https://cutt.ly/PncsVtk
https://bit.ly/3vSQsdN
http://social.technet.microsoft.com/profile/ncltadvocate/
https://cutt.ly/yncsXFH
https://bit.ly/3vWqBBS
http://social.technet.microsoft.com/profile/PropertyLawyer/
https://cutt.ly/oncsL88
https://bit.ly/34KlhFV
http://social.technet.microsoft.com/profile/BankLoan/
https://cutt.ly/jncsKW2
https://bit.ly/3gcT4gb
https://uaenewsagency.blogspot.com/
https://bit.ly/3yJwJ22
https://dubaivehicle.blogspot.com/
https://bit.ly/3yINs5M
https://uaeultimate.blogspot.com/
https://bit.ly/3vw08uz
https://uaeblogonline.blogspot.com/
https://bit.ly/3wweWJY
https://fddddsfddcdc.blogspot.com/
https://bit.ly/2TfRYIy
https://projectorliteblog.blogspot.com/
https://bit.ly/3fUyQrc
https://pakeducationalist.blogspot.com/
https://bit.ly/3wBIRQU
https://lionsonlineforcesacademy.blogspot.com/
https://bit.ly/3i0RUH4
https://dubaitimesblog.blogspot.com/
https://bit.ly/3fOoeKB
https://edcationinpakistan.blogspot.com/
https://bit.ly/3vw9yXd
https://mywebsitestorenew.blogspot.com/
https://bit.ly/34nhY75
https://mywebsitestoreold.blogspot.com/
https://bit.ly/3fqZ8lR
https://theguestpostcontent.blogspot.com/
https://nodepositpokeronline.com/
https://edex.adobe.com/member/H0VBng_md
https://bit.ly/3hZB6jC
https://adobe.ly/3fxWURN
https://onlinecasinoku.com/
https://edex.adobe.com/member/m668LxZKy
https://adobe.ly/3c4PlQp
https://bit.ly/2TkwbiZ
https://redbettips.com/
https://edex.adobe.com/member/r5FTQM4Y9
https://adobe.ly/3fvS7QQ
https://bit.ly/2SCyU6V
https://sharkcasinogames.com/
https://edex.adobe.com/member/gEEJupeb3
https://adobe.ly/3c3druY
https://bit.ly/2Te9TiP
https://redwinecasino.com/
https://edex.adobe.com/member/Pill23DNX
https://adobe.ly/34rDVSC
https://bit.ly/3c04vXc
https://publicforum.in/
https://edex.adobe.com/member/kUuSuKqZO
https://adobe.ly/3i1veGy
https://bit.ly/3oVl4ZI
https://lawyerschennai.com/
https://edex.adobe.com/member/_gZSmBWL2
https://adobe.ly/3fvOB9e
https://bit.ly/2RIlM0h
https://wwwtamilsiragugal.com/
https://edex.adobe.com/member/TW44VSdgu
https://adobe.ly/34ry7st
https://bit.ly/2RK348A
https://ncltadvocates.com/
https://edex.adobe.com/member/avVnuvrJh
https://adobe.ly/3i2SwMd
https://bit.ly/2RIlNkR
https://drtlaw.in/
https://edex.adobe.com/member/4mLkt0zfW
https://adobe.ly/3yQNcS7
https://bit.ly/3vqhj0G
https://realestatelaw.in/
https://edex.adobe.com/member/jyeQssh0l
https://adobe.ly/2SyZqOJ
https://bit.ly/2Sy2ElI
https://propertylawyer.org.in/
https://edex.adobe.com/member/Rr0eM5mMO
https://adobe.ly/2TtqLT1
https://bit.ly/2ToSm7P
https://bankloan.org.in/
https://edex.adobe.com/member/Tn9F_WPGt
https://adobe.ly/2RMXLVV
https://bit.ly/3bWei0f
https://consumerlawyer.in/
https://edex.adobe.com/member/mWcQ_DOw_
https://adobe.ly/3yWqRTx
https://bit.ly/2RJmp9X
https://findtrademark.org/
https://edex.adobe.com/member/w3RIxeJ1X
https://adobe.ly/3p0nm9Z
https://bit.ly/2Sulie5
https://gstlawyers.in/
https://edex.adobe.com/member/CWQu1Jp5k
https://adobe.ly/3fuxFjs
https://bit.ly/3yMuevS
https://buddypress.trac.wordpress.org/ticket/3755
https://bit.ly/3p6KKCw
https://cutt.ly/DngZR8y
https://shorturl.at/npxO2
https://https://tinyurl.com/4mzz9xr2
https://tiny.cc/7qcytz
https://shorturl.at/sLMY5
http://lnkiy.in/UFnsd
https://pxlme.me/bdZoNvXk
https://redirect.is/gtdy3ax
https://t.ly/mFky
http://bitly.ws/dGnv
https://n9.cl/bitlyyy
https://fashioninstitute.co.in/
https://edex.adobe.com/member/iz9iLOmJ0
https://adobe.ly/2SFDiSG
https://bit.ly/3vvb6kc
https://lawyersarbitrators.com/
https://edex.adobe.com/member/HzwB02DKQ
https://adobe.ly/3p4AU4o
https://bit.ly/3wwg7ZU
https://zardosi.in/
https://edex.adobe.com/member/s5lSTFiyP
https://adobe.ly/3p2VKkj
https://bit.ly/3vAzMYI
https://rajendralawoffice.com/
https://adobe.ly/2RMXIJJ
https://edex.adobe.com/member/Snf6tuTsn
https://bit.ly/3bZReOa
https://barassociation.in/
https://edex.adobe.com/member/Sv4VjZ_A3
https://adobe.ly/2SDk68r
https://bit.ly/3oZoBpC
https://registeracompany.in/
https://edex.adobe.com/member/KJDWKng9v
https://adobe.ly/3fvFk0H
https://bit.ly/3yLjcqH
https://www.bestsquarefeet.com/
https://edex.adobe.com/member/pQTa07ing
https://adobe.ly/3fU4Trn
https://bit.ly/34wvKEt
https://financeconsultants.net/
https://edex.adobe.com/member/TrbX55Kbk
https://adobe.ly/3i8OjHb
https://bit.ly/3bYCKhR
https://divorcelegal.in/
https://edex.adobe.com/member/lUWaOzfPT
https://adobe.ly/3uyYsPJ
https://bit.ly/3wwguUi
https://bit.ly/3vtRD3b
https://thesupercontent.blogspot.com/
https://bit.ly/3vwQVlP
https://thesuperbloggers.blogspot.com/
https://bit.ly/3yHXiVx
https://thebloggerfundablog.blogspot.com/
https://bit.ly/3vw9MO3
https://therunnerblogger.blogspot.com/
https://bit.ly/3uro9Sb
https://Foodreviewbloggerblog.blogspot.com/
https://bit.ly/3i0L8kK
https://thenewbieblogger.blogspot.com/
https://bit.ly/3yKy7S7
https://eindianbloggershub.blogspot.com/
https://bit.ly/3i0Lo3c
https://eamericansupperblogger.blogspot.com/
https://bit.ly/3wwfgZc
https://eperfectaustralianblogger.blogspot.com/
https://bit.ly/3yLihXh
https://themostwantedbloggernow.blogspot.com/
https://bit.ly/3yMyfQW
https://howyoudothatbloggers.blogspot.com/
https://bit.ly/3oWbp4U
https://whywearebestbloggernow.blogspot.com/
https://bit.ly/3wFPRfw
https://WhereIamgoing.blogspot.com/
https://bit.ly/3p9z02t
https://eLetmedownslowly.blogspot.com/
https://bit.ly/3yK1VhO
https://RedditRefrencesblogger.blogspot.com/
https://bit.ly/3uCT9z3
https://digitalTeamworkblogger.blogspot.com/
https://bit.ly/3yJXKCM
https://theseoandwriteragency.blogspot.com/
https://bit.ly/3vyet9Z
https://Theclientproblemsolver.blogspot.com/
https://bit.ly/2Tqot76
https://theworldnewblogger.blogspot.com/
https://bit.ly/3bZ2GK9
https://thewonderofworldbloggers.blogspot.com/
https://bit.ly/3wAJZEv
https://theestatementblogger.blogspot.com/
https://bit.ly/2RLaybo
https://emobilesandgamesblog.blogspot.com/
https://bit.ly/3wKnixP

Note: See TracTickets for help on using tickets.