Commit Graph

22 Commits

Author SHA1 Message Date
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Felix Arntz
82c6a301f2 Multisite: Pass network object instead of ID to pre_get_main_site_id.
In the original function introduced in [41380], and subsequently [41861], only the network ID was passed to the new `pre_get_main_site_id` filter. In order to make give quick access to other network properties, it was decided to pass the whole object instead. The changeset includes an additional test.

Fixes #29684.

Built from https://develop.svn.wordpress.org/trunk@42043


git-svn-id: http://core.svn.wordpress.org/trunk@41877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-30 19:56:47 +00:00
Felix Arntz
5ea3d62192 Multisite: Take WP_Network::$blog_id into account in get_main_site_id().
When the `WP_Network::$blog_id` property is set manually, for example in the multisite bootstrap process, `get_main_site_id()` should use that value instead of running its own logic. The main logic for the function was therefore moved into the internal `WP_Network::get_main_site_id()` method, which is now being accessed by the function through the magic property handling for `WP_Network::$blog_id` (and its equivalent `WP_Network::$site_id`).

Props spacedmonkey, jeremyfelt.
Fixes #41936.

Built from https://develop.svn.wordpress.org/trunk@41861


git-svn-id: http://core.svn.wordpress.org/trunk@41695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-14 22:42:54 +00:00
Felix Arntz
f2d9abd022 Multisite: Introduce get_main_site_id().
This function can be used to easily get the main site ID of a given network via the optional `$network_id` parameter, which defaults to the current network. The existing `is_main_site()` now uses the new function internally and now accepts an optional `$network_id` parameter as well.

The main purpose of the new function at this point is to ensure that the `WP_Network::$blog_id` property is always set. Magic getters in the class have been adjusted to auto-fill the property when it is accessed and empty. Furthermore the function encapsulates logic that was previously part of `ms_load_current_site_and_network()` and has been replaced with a call to the function now.

Props spacedmonkey, jeremyfelt, johnjamesjacoby, flixos90.
Fixes #29684.

Built from https://develop.svn.wordpress.org/trunk@41380


git-svn-id: http://core.svn.wordpress.org/trunk@41213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-15 11:15:52 +00:00
John Blackbourn
28eda6f4bc General: Improve terminology used when referring to installations of WordPress and its extensions.
"Install" is not a noun, and while it might be acceptable to use the verb as a noun, it is not correct. Using the correct
noun, "installation", increases clarity, especially for non-native English speakers.

This change fixes the usage in user-facing text and in developer documentation.

Fixes #41620

Built from https://develop.svn.wordpress.org/trunk@41289


git-svn-id: http://core.svn.wordpress.org/trunk@41129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-22 11:52:48 +00:00
Drew Jaynes
0860bb2771 Docs: Remove @access notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

Built from https://develop.svn.wordpress.org/trunk@41162


git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Sergey Biryukov
c6ab84c4c4 General: Always use colon instead of a semicolon in switch() control structures.
Props jrf.
Fixes #41234.
Built from https://develop.svn.wordpress.org/trunk@40997


git-svn-id: http://core.svn.wordpress.org/trunk@40847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-04 09:52:41 +00:00
Felix Arntz
55df308b4d Multisite: Use WP_Network_Query in WP_Network::get_by_path().
An additional unit test has been introduced to verify the method works properly when using an external object cache.

Props spacedmonkey, jeremyfelt.
Fixes #37217.

Built from https://develop.svn.wordpress.org/trunk@40102


git-svn-id: http://core.svn.wordpress.org/trunk@40039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-22 10:42:45 +00:00
Drew Jaynes
f93c2807cc Docs: Supplement a changelog entry in the DocBlock for the $id property in WP_Network.
See [37657] for where access was changed from public to private.
See [37870] for where the type was changed from `string` to `int`.

See #36717.

Built from https://develop.svn.wordpress.org/trunk@37919


git-svn-id: http://core.svn.wordpress.org/trunk@37860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 19:35:28 +00:00
Jeremy Felt
93a26a2a58 Multisite: Set WP_Network blog_id property default to string as expected.
The `blog_id` property is always returned (and expected) as a string, so we should set it as one by default.

Props flixos90.
See #36717.

Built from https://develop.svn.wordpress.org/trunk@37871


git-svn-id: http://core.svn.wordpress.org/trunk@37812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:57 +00:00
Jeremy Felt
6f3f00ea97 Multisite: Change WP_Network id property to an integer.
For consistency and developer sanity.

Props flixos90.
Fixes #37050.

Built from https://develop.svn.wordpress.org/trunk@37870


git-svn-id: http://core.svn.wordpress.org/trunk@37811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:29 +00:00
Jeremy Felt
4cce2ca14f Multisite: Fix switch( spacing after [37657]
Fixes #36717.

Built from https://develop.svn.wordpress.org/trunk@37658


git-svn-id: http://core.svn.wordpress.org/trunk@37624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-08 04:48:27 +00:00
Jeremy Felt
b885fe6761 Multisite: Allow access to network and site properties using current naming conventions
* Add magic `__get()`, `__set()`, and `__isset()` methods to `WP_Site` and `WP_Network.
* Provide `(int) $network->site_id` for `(string) $network->blog_id`
* Provide `(int) $site->id` for `(string) $site->blog_id`
* Provide `(int) $site->network_id` for `(string) $site->site_id`

Props flixos90, jeremyfelt.
Fixes #36717.

Built from https://develop.svn.wordpress.org/trunk@37657


git-svn-id: http://core.svn.wordpress.org/trunk@37623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-08 04:14:29 +00:00
Drew Jaynes
602b51a209 Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37492


git-svn-id: http://core.svn.wordpress.org/trunk@37460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:15:28 +00:00
Jeremy Felt
fcd674ca6c Docs: Fix type documentation for WP_Network properties.
* `$cookie_domain` was incorrectly documented as an `int`.
* `$id` and `$blog_id`, though numeric, are provided as strings and should be documented as such.

Fixes #35404.

Built from https://develop.svn.wordpress.org/trunk@36340


git-svn-id: http://core.svn.wordpress.org/trunk@36307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-18 02:59:27 +00:00
Jeremy Felt
c0a3348487 Multisite: Clarify documentation for WP_Network::get_by_path().
See #31985.

Built from https://develop.svn.wordpress.org/trunk@35573


git-svn-id: http://core.svn.wordpress.org/trunk@35537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-08 02:25:25 +00:00
Dominik Schilling
22874716dd Multisite: Remove the strictness for $using_paths in WP_Network::get_by_path().
The network lookup was broken when using an external object cache because `$using_paths` isn't always a boolean. Added in [34099].

See #31985, #31491.
Built from https://develop.svn.wordpress.org/trunk@35212


git-svn-id: http://core.svn.wordpress.org/trunk@35178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-15 22:07:24 +00:00
Jeremy Felt
092478579a MS: Adjust _network_option() parameter order, $network_id is first.
This better aligns with expectations and matches the structure used by `_blog_option()`. The `_site_option()` functions remain as an appropriate method for working with the current network.

See #28290.

Built from https://develop.svn.wordpress.org/trunk@35024


git-svn-id: http://core.svn.wordpress.org/trunk@34989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-11 22:44:27 +00:00
Jeremy Felt
a8771a3914 MS: Populate site_name property in a new WP_Network.
This allows us to reduce some extra handling in `ms-settings.php`. Requires [34777].

Props johnjamesjacoby for the initial patch.
See #31985.

Built from https://develop.svn.wordpress.org/trunk@34819


git-svn-id: http://core.svn.wordpress.org/trunk@34784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-04 20:51:25 +00:00
Scott Taylor
5acee30d9d Docs: object != class
See [33893] et al.

Built from https://develop.svn.wordpress.org/trunk@34585


git-svn-id: http://core.svn.wordpress.org/trunk@34549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-26 07:04:28 +00:00
Jeremy Felt
fa1e1a8850 Multisite: Implement the get_by_path method in WP_Network.
Move the internals of `get_network_by_path()` to `WP_Network()` and allow network objects to be retrieved by passing a requested domain and path.

Props johnjamesjacoby, jeremyfelt, drewapicture, wonderboymusic.
See #31985.

Built from https://develop.svn.wordpress.org/trunk@34099


git-svn-id: http://core.svn.wordpress.org/trunk@34067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-13 23:40:24 +00:00
Jeremy Felt
16b4096779 Multisite: Introduce the WP_Network class.
A `WP_Network` object initially matches a row from `wp_site` and is populated with additional properties used by WordPress core. The first iteration is used to retrieve an existing network based on data passed to the class.

* A network can be retrieved by its ID through `WP_Network::get_instance()`, following in the steps of `WP_Post` and `WP_Comment`.
* A network object can be created or completed by passing initial properties in as a standard object to `new WP_Network()`.

Using these methods, we are now able to populate the global `$current_site` during load via this class.

Props johnjamesjacoby, jeremyfelt, drewapicture, wonderboymusic.
See #31985.

Built from https://develop.svn.wordpress.org/trunk@34097


git-svn-id: http://core.svn.wordpress.org/trunk@34065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-13 23:31:26 +00:00