Commit Graph

48 Commits

Author SHA1 Message Date
Jeremy Felt
2979167ba7 Multisite: Use get_network() and get_current_network_id() for current network data.
`get_network()` falls back to the current network when called without any arguments. Between this and `get_current_network_id()`, we can replace almost all instances of the global `$current_site` and all instances of `get_current_site()`.

This effectively deprecates `get_current_site()`, something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.


git-svn-id: https://develop.svn.wordpress.org/trunk@38814 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-19 04:46:14 +00:00
Jeremy Felt
1d2db9eade Multisite: Clarify that get_site_by_path() does not return exact matches.
Props stevenlinx.
Fixes #38152.


git-svn-id: https://develop.svn.wordpress.org/trunk@38781 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-12 01:09:29 +00:00
Jeremy Felt
824a10a8a6 Multisite: Ensure a consistent WP_Site return from get_site_by_path().
It is possible to short circuit `get_site_by_path()` using the `pre_get_site_by_path` filter. When this happens and a standard site object is provided, we can make sure it is upgraded to a proper `WP_Site` object before passing it on.

Props flixos90.
Fixes #37053.


git-svn-id: https://develop.svn.wordpress.org/trunk@38681 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-30 04:09:45 +00:00
Jeremy Felt
6f62798887 Multisite: Deprecate wp_get_network().
`wp_get_network()` was converted into a wrapper for `get_network()` in 4.6.0 and can now be deprecated.

This moves `wp_get_network()` to the bottom of `ms-load.php` as `ms-deprecated.php` is not available early enough.

Props PieWP, flixos90.
Fixes #37553.


git-svn-id: https://develop.svn.wordpress.org/trunk@38515 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 23:48:00 +00:00
John Blackbourn
5cc963a721 Docs: Correct and clarify various @since docs.
Fixes #37562


git-svn-id: https://develop.svn.wordpress.org/trunk@38201 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-04 22:53:40 +00:00
Drew Jaynes
7e52b06003 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 2/2.

Fixes #37318.


git-svn-id: https://develop.svn.wordpress.org/trunk@38125 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-20 19:32:05 +00:00
Sergey Biryukov
920f29616a Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.

git-svn-id: https://develop.svn.wordpress.org/trunk@37985 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-06 12:39:01 +00:00
Jeremy Felt
229e0d5300 Multisite: Simplify logic assigning orderby in get_site_by_path().
Before [37628], there were 3 separate conditions for ordering by domain and/or path in `get_site_by_path()` that each resulted in it's own query. Now that `get_sites()` is used and supports `WP_Site_Query`, this can be simplified.

Props spacedmonkey.
Fixes #37215.


git-svn-id: https://develop.svn.wordpress.org/trunk@37930 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-30 16:58:06 +00:00
Jeremy Felt
204dedb99a Multisite: Replace wp_get_network() internals with get_network().
`get_network()` should be considered a replacement for `wp_get_network()`.

Props flixos90.
Fixes #32504.


git-svn-id: https://develop.svn.wordpress.org/trunk@37896 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-28 21:28:48 +00:00
Jeremy Felt
5640b2b02c Multisite: Move call of get_blog_details() inside ms_site_check().
This allows the `ms_site_check` filter or `is_super_admin()` check to return `true` before `get_blog_details()` is used.

Props danielbachhuber.
Fixes #37118.


git-svn-id: https://develop.svn.wordpress.org/trunk@37850 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-22 21:33:20 +00:00
Jeremy Felt
9bbc0df8d8 Multisite: Replace $wpdb->blog queries in get_site_by_path() with get_sites()
Props spacedmonkey, DrewAPicture.
See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37628 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 21:45:20 +00:00
Drew Jaynes
d11f7ed391 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.


git-svn-id: https://develop.svn.wordpress.org/trunk@37518 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-22 18:49:05 +00:00
Jeremy Felt
757c0767f7 Multisite: Wrap the main bootstrap process in a function
Introduce `ms_load_current_site_and_network`. This is used by core during the multisite bootstrap process to populate the `$current_site` and `$current_blog` globals based on a requested domain and path.

Return values from this function inform `ms-settings.php` as to whether a page view should continue, `ms_not_installed()` should fire, or a redirect to a new location should occur.

This was previously a procedural block in `ms-settings.php`. Wrapping this code and providing specific return values allows us to write tests that do not rely on the manual and repeated inclusion of `ms-settings.php`.

This should not be used by plugins or themes. Please.

See #34941.


git-svn-id: https://develop.svn.wordpress.org/trunk@37475 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 20:56:54 +00:00
Sergey Biryukov
8e439f1bd0 I18N: Move translatable Codex URLs to separate strings in wp-includes/ms-load.php.
Props ramiy.
Fixes #34687.

git-svn-id: https://develop.svn.wordpress.org/trunk@35668 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-18 17:41:21 +00:00
Jeremy Felt
5acf79fa7e Multisite: Clarify documentation for WP_Network::get_by_path().
See #31985.


git-svn-id: https://develop.svn.wordpress.org/trunk@35573 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-08 02:24:32 +00:00
Sergey Biryukov
64bf19ba40 Don't use <a> in translatable string in wp-includes/ms-load.php.
Add translator commment.

Props ramiy.
Fixes #34506.

git-svn-id: https://develop.svn.wordpress.org/trunk@35453 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-30 09:15:42 +00:00
Drew Jaynes
0cb7c0bd9f Docs: Add missing descriptions for the $wpdb global in DocBlocks all the places.
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@35170 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-14 23:43:10 +00:00
Jeremy Felt
599fb50e09 Revert [34778], continue using _site_option() for the current network.
The `_network_option()` parameter order will be changing to accept `$network_id` first. The `_site_option()` functions will remain in use throughout core as our way of retrieving a network option for the current network.

See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34912 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 17:11:01 +00:00
Jeremy Felt
3c177b8c6f MS: Use *_network_option() functions throughout core.
Replaces all uses of `*_site_option()` with the corresponding "network" function.

This excludes one usage in `wp-admin/admin-footer.php` that needs more investigation.

Props spacedmonkey.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34778 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 19:07:23 +00:00
Jeremy Felt
13dd966554 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@34099 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-13 23:39:20 +00:00
Jeremy Felt
591a9aa73c 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@34097 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-13 23:30:57 +00:00
Jeremy Felt
9473a479d9 Multisite: Correct ms_not_installed() @since version for new parameters
Props dimadin.
See 27264.


git-svn-id: https://develop.svn.wordpress.org/trunk@33999 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-10 16:20:29 +00:00
Jeremy Felt
d0706ac9ca Multisite: Remove $domain and $path globals in ms_not_installed()
Further reduces the reliance on these unnecessary globals.

Fixes #27264.


git-svn-id: https://develop.svn.wordpress.org/trunk@33989 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-10 03:52:21 +00:00
Scott Taylor
85e3befce9 Fix doc blocks for ms-*.php files.
A few functions can return a conditional instead of an `if`/`else` of `true`/`false`.

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32611 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-26 21:50:13 +00:00
Dominik Schilling (ocean90)
b0d6757918 Use HTTPS URLs for codex.wordpress.org.
see #27115.

git-svn-id: https://develop.svn.wordpress.org/trunk@32116 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-12 21:28:58 +00:00
Dominik Schilling (ocean90)
74874407e1 Remove <code> tags from translatable strings.
Uncomment deprecation notice for `get_bloginfo( 'text_direction' )`, see [14360].

props ramiy, DrewAPicture.
fixes #30614.

git-svn-id: https://develop.svn.wordpress.org/trunk@31899 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-26 15:16:33 +00:00
Jeremy Felt
03b4e1f0aa Return HTTP status code 500 by default in ms_not_installed()
In admin views, specify a response code of 500 when using `wp_die()` to show an expanded message for a broken or missing multisite installation.

On front end views, use `dead_db()` rather than `die()` to generate the generic "Error establishing a database connection" message. `dead_db()` sets a status code of 500 by default and allows for the override of this generic error with a `db-error.php` template.

Props craig-ralston, jeremyfelt.

Fixes #30002.


git-svn-id: https://develop.svn.wordpress.org/trunk@31657 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 05:34:47 +00:00
Scott Taylor
218dd4fd6b For clarity, initialize some arrays that previously were only assigned via short circuit in loops.
See #30799.


git-svn-id: https://develop.svn.wordpress.org/trunk@30982 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-20 22:46:53 +00:00
Drew Jaynes (DrewAPicture)
6007c0c17d Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Backtick-escape an HTML tag in the description for the `media_upload_mime_type_links()` hook
* Backtick-escape inline code in the description for `wp_get_active_network_plugins()`
* Remove HTML tags from the summaries for the `nav_menu_css_class`, `nav_menu_item_id`, and `nav_menu_link_attributes` hooks
* Backtick-escape HTML tags, add inline `@see` tags to parameter descriptions for the `nav_menu_css_class`, `nav_menu_item_id`, and `nav_menu_link_attributes` hooks

Props rarst.
See #30473.


git-svn-id: https://develop.svn.wordpress.org/trunk@30543 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 05:52:45 +00:00
Scott Taylor
84ad12b439 Replace all uses of like_escape() with $wpdb->esc_like().
Props miqrogroove.
See #10041.


git-svn-id: https://develop.svn.wordpress.org/trunk@28712 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 00:43:32 +00:00
Sergey Biryukov
95e42909a9 Suggest get_current_site() as an alternative for get_current_site_name().
props jesin.
fixes #28346.

git-svn-id: https://develop.svn.wordpress.org/trunk@28573 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-25 14:31:16 +00:00
Scott Taylor
3f2a078f5e In get_network_by_path(), $exact_domains is unused.
See #27882.


git-svn-id: https://develop.svn.wordpress.org/trunk@28329 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-06 21:31:14 +00:00
Sergey Biryukov
18916debfd Update deleted site message in ms_site_check().
props boonebgorges.
fixes #28150.

git-svn-id: https://develop.svn.wordpress.org/trunk@28321 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-06 18:45:54 +00:00
Andrew Nacin
cb022f4957 Multisite: Treat 'www' as a special subdomain, reversing 3.9 regression.
props jeremyfelt.
fixes #27927.


git-svn-id: https://develop.svn.wordpress.org/trunk@28280 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-06 05:31:12 +00:00
Andrew Nacin
55d6cc4e1d Formally deprecate wpmu_current_site().
props jeremyfelt.
fixes #27702.


git-svn-id: https://develop.svn.wordpress.org/trunk@28009 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-07 21:27:13 +00:00
Drew Jaynes (DrewAPicture)
372e6c5c94 Inline documentation improvements in wp-includes/ms-load.php for 3.9 functionality.
Clarifies some mixed type parameters, spacing and comment style, and language fixes.

See #27700.


git-svn-id: https://develop.svn.wordpress.org/trunk@28006 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-07 20:58:11 +00:00
Andrew Nacin
ff3c96208a In get_site_by_path(), avoid passing $paths through prepare(). If a path contains a %, we end up with problems. see #27003.
git-svn-id: https://develop.svn.wordpress.org/trunk@27439 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-06 18:17:32 +00:00
Andrew Nacin
bceb10680b Deprecate get_current_site_name(). see #27003.
git-svn-id: https://develop.svn.wordpress.org/trunk@27407 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-05 06:38:23 +00:00
Andrew Nacin
aeb0957aea Doc fixes for wp_get_network().
props TobiasBg.
see #27003.


git-svn-id: https://develop.svn.wordpress.org/trunk@27381 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 18:55:08 +00:00
Andrew Nacin
6869d203d0 Introduce get_site_by_path() and further rewrite the site detection process for multisite.
This is the first big step to supporting arbitrary domains and paths. In this new approach, sites are detected first where possible, then the network is inferred. Allows filtering for arbitrary path segments, smooths out some weirdness, and removes various restrictions. A sunrise plugin could do much of its work by adding filters, if those are even needed.

see #27003.


git-svn-id: https://develop.svn.wordpress.org/trunk@27359 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-02 22:24:50 +00:00
Mark Jaquith
46ee6fbc51 Fix a sometimes notice in wpmu_current_site()
props johnjamesjacoby. see #27003.

git-svn-id: https://develop.svn.wordpress.org/trunk@27275 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-25 20:52:05 +00:00
Andrew Nacin
31d3af406c Multisite: Add get_network_by_path() and wp_get_network() to begin cleanup of multisite load.
Tries to get network detection under control by simplifying wpmu_current_site(). It now also pops off each subdomain to find a more general match. Adds unit tests for get_network_by_path() and a new network factory for unit tests.

Much of this is likely to change in 3.9 as more of ms-load.php and ms-settings.php gets hacked to bits.

props jeremyfelt.
see #27003.


git-svn-id: https://develop.svn.wordpress.org/trunk@27178 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-13 23:06:12 +00:00
Andrew Nacin
ed1ece6e3b Remove an unnecessary variable passed to wpdb::prepare() during multisite load.
props jeremyfelt.
fixes #26941.


git-svn-id: https://develop.svn.wordpress.org/trunk@27076 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-02 22:08:14 +00:00
Sergey Biryukov
39d55fddb8 Use get_current_site() instead of the $current_site global when possible.
props jeremyfelt.
fixes #25158.

git-svn-id: https://develop.svn.wordpress.org/trunk@26120 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-13 03:22:48 +00:00
Sergey Biryukov
bc6c0c9b0f Correct @since values for various hooks. fixes #25766.
git-svn-id: https://develop.svn.wordpress.org/trunk@25991 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-30 03:19:16 +00:00
Ryan Boren
30f822b8ee Pinking shears
git-svn-id: https://develop.svn.wordpress.org/trunk@25880 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-23 14:37:54 +00:00
Drew Jaynes
0db187f915 Inline documentation for hooks in wp-includes/ms-load.php.
Props nukaga, johnbillion.
Fixes #25509.


git-svn-id: https://develop.svn.wordpress.org/trunk@25732 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-08 20:00:17 +00:00
Andrew Nacin
b43712e0f7 New develop.svn.wordpress.org repository based on the old core.svn repository.
* All WordPress files move to a src/ directory.
 * New task runner (Grunt), configured to copy a built WordPress to build/.
 * svn:ignore and .gitignore for Gruntfile.js, wp-config.php, and node.js.
 * Remove Akismet external from develop.svn. Still exists in core.svn.
 * Drop minified files from src/. The build process will now generate these.

props koop.
see #24976.

and see http://wp.me/p2AvED-1AI.



git-svn-id: https://develop.svn.wordpress.org/trunk@25001 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-07 05:25:25 +00:00