Commit Graph

199 Commits

Author SHA1 Message Date
Dominik Schilling
727e859b3e Load: Remove unused global imports in wp_load_translations_early().
See #38535.
Built from https://develop.svn.wordpress.org/trunk@39130


git-svn-id: http://core.svn.wordpress.org/trunk@39070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:13:27 +00:00
Dominik Schilling
a1d18b7b8a I18N: Don't initialize WP_Locale_Switcher in wp_load_translations_early().
`wp_load_translations_early()` is used when WordPress isn't fully initialized. Therefore using the `WP_Locale_Switcher` with `get_locale()`/`get_user_locale()` can cause PHP fatal errors.
This reverts [38976] and [38977], and instead removes `WP_Locale_Switcher` from `wp_load_translations_early()`.

See #29783.
Fixes #38535.
Built from https://develop.svn.wordpress.org/trunk@39005


git-svn-id: http://core.svn.wordpress.org/trunk@38947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-29 11:23:33 +00:00
Dominik Schilling
7819e2b4ba I18N: Introduce a locale-switching function.
With the introduction of user-specific languages in [38705] it's necessary to be able to switch translations on the fly. For example emails should be sent in the language of the recipient and not the one of the current user.

This introduces a new `WP_Locale_Switcher` class which is used for switching locales and translations. It holds the stack of locales whenever `switch_to_locale( $locale )` is called. With `restore_previous_locale()` you can restore the previous locale. `restore_current_locale()` empties the stack and sets the locale back to the initial value.

`switch_to_locale()` is added to most of core's email functions, either with the value of `get_locale()` (site language) or `get_user_locale()` (user language with fallback to site language).

Props yoavf, tfrommen, swissspidy, pbearne, ocean90.
See #29783.
Fixes #26511.
Built from https://develop.svn.wordpress.org/trunk@38961


git-svn-id: http://core.svn.wordpress.org/trunk@38904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 15:36:31 +00:00
Dion Hulse
0314e29667 Drop the requirement for the entry points to WordPress to be parsable by PHP4.
Previously we ensured that the entry points to WordPress were parsable by PHP4 in order to display a friendly not-supported-php error message.
However, for the last two years the main entry points have not actually parsed, and we've only added extra parse errors since it last worked in 3.9, so it's time we just remove this 'feature'.
The PHP version checks are still there for PHP 5.0/5.1, and so it's inplace when we eventually drop PHP 5.2 support.

See #29489.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 03:15:30 +00:00
Jeremy Felt
1560fbcbc5 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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 04:47:30 +00:00
Jeremy Felt
58f107fa95 Multisite: Revert [38388].
Restore `get_current_site()` to a multisite only function. Providing this in single site may be a possibility in the future, but should have a dedicated ticket and discussion.

See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 21:39:29 +00:00
Sergey Biryukov
7196188459 Docs: Use a third-person singular verb for wp_doing_ajax filter added in [38334].
See #25669.
Built from https://develop.svn.wordpress.org/trunk@38607


git-svn-id: http://core.svn.wordpress.org/trunk@38550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-14 21:51:28 +00:00
Scott Taylor
a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor
e5225324a2 Multisite: use get_current_blog_id() where applicable, in lieu of plucking the $blog_id global from outer space.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 04:55:54 +00:00
Dion Hulse
56bc1dc194 Bootstrap: Check that ini_get_all() exists before calling it, allows us to work around hosts who disable the function for "security purposes".
Fixes #37680 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-29 02:59:30 +00:00
John Blackbourn
a7c3974cdc Upgrade/Install: Don't display PHP errors during installation.
If a user is installing WordPress for the first time and has set `WP_DEBUG` to true, a PHP error during installation makes for a visually jarring experience.

Fixes #37358

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


git-svn-id: http://core.svn.wordpress.org/trunk@38364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-28 17:50:29 +00:00
Scott Taylor
390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse
ec83ce1a0c i18n: Retire another remaining wp-includes/locale.php require, and instead load the required WP_Locale class directly.
See #37827.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 15:13:33 +00:00
Dion Hulse
0e31a46161 Bootstrap: Revert [38399] as it's broken /build/ and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

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


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor
6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
Scott Taylor
08233c6aff Multisite: move get_current_site() to load.php so that it can be used in more places, instead of importing global $current_site.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 21:35:30 +00:00
Scott Taylor
4d17b67eed Load: move is_wp_error() to load.php so that WP_Error is in a file by itself.
See #37827.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 09:58:28 +00:00
Scott Taylor
b7812bd416 AJAX: add a new function, wp_doing_ajax(), which can replace... (wait for it...) DOING_AJAX checks via the constant.
Props Mte90, sebastian.pisula, swissspidy.
Fixes #25669.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 14:33:30 +00:00
Sergey Biryukov
df97f83cb6 Docs: Replace some more HTTP links with HTTPS.
Props johnpgreen.
Fixes #37622. See #36993.
Built from https://develop.svn.wordpress.org/trunk@38239


git-svn-id: http://core.svn.wordpress.org/trunk@38180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-10 16:10:31 +00:00
Dominik Schilling
9b2f385b07 Bootstrap: Make wp_is_ini_value_changeable() compatible with PHP 5.2.6 - 5.2.17.
There is a bug in PHP 5.2.6 - 5.2.17 (https://bugs.php.net/bug.php?id=44936, https://3v4l.org/IL0A2) which changes the access level of a setting to 63 after `ini_set()` was called.
To continue comparing the access value against `INI_ALL` and `INI_USER` use the bit operator `& 7`:

* `1 & 7 === 1` (INI_USER)
* `2 & 7 === 2` (INI_PERDIR)
* `4 & 7 === 4` (INI_SYSTEM)
* `7 & 7 === 7` (INI_ALL)
* `63 & 7 === 7` (INI_ALL)

See [38015].
See #32075.
Built from https://develop.svn.wordpress.org/trunk@38017


git-svn-id: http://core.svn.wordpress.org/trunk@37958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 18:36:30 +00:00
Dominik Schilling
aa561e67a1 Bootstrap: Enhance core's memory limit handling.
* Don't lower memory limit if the current limit is greater than `WP_MAX_MEMORY_LIMIT`.
* Set `WP_MEMORY_LIMIT` and `WP_MAX_MEMORY_LIMIT` to current limit if the `memory_limit` setting can't be changed at runtime.
* Use `wp_convert_hr_to_bytes()` when parsing the value of the `memory_limit` setting because it can be a shorthand or an integer value.
* Introduce `wp_raise_memory_limit( $context )` to raise the PHP memory limit for memory intensive processes. This DRYs up some logic and includes the existing `admin_memory_limit` and `image_memory_limit` filters. The function can also be used for custom contexts, the `{$context}_memory_limit` filter allows to customize the limit.
* Introduce `wp_is_ini_value_changeable( $setting )` to determine whether a PHP ini value is changeable at runtime.
* Remove a `function_exists( 'memory_get_usage' )` check. Since PHP 5.2.1 support for memory limit is always enabled.

Related commits: [38011-38013]

Props jrf, A5hleyRich, swissspidy, ocean90.
Fixes #32075.
Built from https://develop.svn.wordpress.org/trunk@38015


git-svn-id: http://core.svn.wordpress.org/trunk@37956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 14:37:30 +00:00
Dominik Schilling
682e028a5a Bootstrap: Clean up wp_convert_hr_to_bytes().
* Don't return a value higher than `PHP_INT_MAX`.
* Add unit tests.

Props jrf.
See #32075.
Built from https://develop.svn.wordpress.org/trunk@38013


git-svn-id: http://core.svn.wordpress.org/trunk@37954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 12:54:28 +00:00
Dominik Schilling
5eae48b414 Boostrap: Move wp_convert_hr_to_bytes() to wp-includes/load.php.
`wp_convert_hr_to_bytes()` was previously defined in wp-includes/media.php because it's only used by `wp_max_upload_size()` in the same file.
Moving this function to load.php allows us to improve core's memory limit handling.

See #32075.
Built from https://develop.svn.wordpress.org/trunk@38012


git-svn-id: http://core.svn.wordpress.org/trunk@37953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 11:27:27 +00:00
Sergey Biryukov
139387b7e5 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.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Jeremy Felt
b077123a98 Multisite: Lazy load extended WP_Site properties when requested.
In the past, `get_blog_details()` has been used to retrieve the `home`, `siteurl`, `blogname`, and `post_count` options for a site. By lazy loading properties in a `WP_Site` object, we can avoid having to use `get_blog_details()` and instead provide the properties as needed.

This introduces the global `site-details` cache group in which standard objects representing the site are stored. This will one day be a replacement for the `blog-details` cache group that is currently used in `get_blog_details()`.

This relies on the `ms_loaded` action introduced in [37916] as properties are not available via `get_option()` until multisite has been fully loaded.

Props flixos90.
Fixes #36935.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 19:32:27 +00:00
Aaron Jorbin
c918c1ede1 Bootstrap/Load. Adjust filters added in [37626].
These adjustments improve the documentation for the filters and adjust the names make them more consistent with other filters already in core.

See #34936.
Props DrewAPicture, ocean90, jorbin

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


git-svn-id: http://core.svn.wordpress.org/trunk@37656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-12 02:43:27 +00:00
Drew Jaynes
2600c28169 Boostrap: Move is_ssl() to wp-includes/load.php.
Moving to load.php introduces parity with other commonly evaluated `is_*()` functions such as `is_admin()` or `is_multisite()`.  It also makes `is_ssl()` available much earlier in the loading process, such as for use in drop-ins like advanced-cache.php.

Props johnjamesjacoby.
Fixes #35844.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 18:56:31 +00:00
Jeremy Felt
c63c4d9345 Multisite: Introduce get_current_network_id()
Similar to `get_current_blog_id`, this can be used to get the ID of the `$current_site` global. If not available, it will fallback to the main network ID. In single site, this will return 1.

Props spacedmonkey, flixos90.
Fixes #33900.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-09 20:34:28 +00:00
Aaron Jorbin
cedaaaf779 Introduce filters for skipping parts of the bootstrap process
Non web interfaces with WordPress (such as wp-cli) need to be able to bypass certain checks in the bootstrap process. This introduces three new filters to allow for those checks to be skipped.

1. Provides a way of forcefully bypassing wp_maintenance().
2. Provides a way of forcefully bypassing wp_debug_mode(). See https://github.com/wp-cli/wp-cli/issues/177
3. Provide a way of forcefully skipping loading wp-content/advance-cache.php. See https://github.com/wp-cli/wp-cli/pull/164

These filters should not be used by plugins (in fact, they run before plugins are loaded, so they can't be used by plugins). In general, they should only be used in non-web interactions with WordPress.

See #34936.
Props jorbin, DrewAPicture.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-02 18:47:27 +00:00
Boone Gorges
1f2635d52b Make the 'comment' cache group persistent.
'comment' was made non-persistent in [7986], to address the difficulty of
reliable cache invalidation. Since then, the comment system has improved such
that we can be more confident that caches are being busted as needed.

Props spacedmonkey.
Fixes #36906.
Built from https://develop.svn.wordpress.org/trunk@37613


git-svn-id: http://core.svn.wordpress.org/trunk@37581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-01 21:26:27 +00:00
Pascal Birchler
eeadf35fa9 Bootstrap/Load: Silence ini_set() in wp_debug_mode().
Props SergeyBiryukov.
Fixes #36708 for trunk.
Built from https://develop.svn.wordpress.org/trunk@37448


git-svn-id: http://core.svn.wordpress.org/trunk@37416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-17 20:22:28 +00:00
Drew Jaynes
b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Dominik Schilling
956627ff83 Don't display errors during Ajax requests.
See #34915 for REST and #23811 for XML-RPC.

Props pento.
Fixes #26262.
Built from https://develop.svn.wordpress.org/trunk@36571


git-svn-id: http://core.svn.wordpress.org/trunk@36538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-18 16:43:27 +00:00
Rachel Baker
85e82cf571 REST API: Don’t display errors during REST API requests.
Uses `wp_debug_mode()` to prevent response from being broken by debug errors. Matches similar behavior of the XML-RPC API.

Props rockwell15.

Fixes #34915.
Built from https://develop.svn.wordpress.org/trunk@36530


git-svn-id: http://core.svn.wordpress.org/trunk@36497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-16 01:36:25 +00:00
Gary Pendergast
e19a8796fd Database: Allow loading when only the mysqlnd extension is loaded.
We do an early check for a mysql extension being loaded, but it fails if the `mysqlnd` extension is the only one present.

Props nexurium.

Fixes #33261.


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


git-svn-id: http://core.svn.wordpress.org/trunk@36401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-02 00:59:25 +00:00
Dominik Schilling
e8cc1b5a32 Multisite: Add the global cache group sites to restore_current_blog() and wp_start_object_cache().
See #32450.
Built from https://develop.svn.wordpress.org/trunk@36413


git-svn-id: http://core.svn.wordpress.org/trunk@36380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-27 13:51:26 +00:00
Eric Lewis
ededb78efc Docs: Use "site" rather than "blog" in get_current_blog_id() docs.
Fixes #35415.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 13:18:27 +00:00
Dion Hulse
abbcc01542 Multisite: The networks group should be global.
Fixes #35251.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-11 05:04:26 +00:00
Sergey Biryukov
f0cdd8d0b4 Docs: Correct wp_debug_mode() description to clarify that WP_DEBUG_DISPLAY is true by default.
Props jrf.
Fixes #34960.
Built from https://develop.svn.wordpress.org/trunk@35882


git-svn-id: http://core.svn.wordpress.org/trunk@35846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-12 01:49:26 +00:00
Aaron Jorbin
e8d8e79371 Revert [34291] bringing back my-hacks
Keeping myhacks support is a small price to pay for not breaking people's sites.  Even if it is very very very few sites, breaking sites isn't something that should be encouraged. Even with 10 years of deprecation notices.

https://core.trac.wordpress.org/ticket/33741#comment:18 outlines all the ways that the hack_file and my-hacks options can be setup and thus all the ways that the removal of those options could break sites.

Fixes #33741.



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


git-svn-id: http://core.svn.wordpress.org/trunk@35652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 20:49:26 +00:00
John Blackbourn
43bc6dc931 Revert [35639] pending investigation into failures on PHP 5.2.
See #19455

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


git-svn-id: http://core.svn.wordpress.org/trunk@35605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-16 00:54:28 +00:00
John Blackbourn
45658705f3 On servers running PHP <= 5.4 which have magic_quotes_sybase enabled, the superglobals need to be magic-quoted before magic_quotes_sybase is subsequently disabled to avoid incorrect un-slashing. This must surely effect a miniscule number of servers, but so be it.
Fixes #19455
Props summerblue, kurtpayne, lucatume

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


git-svn-id: http://core.svn.wordpress.org/trunk@35603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-15 23:00:28 +00:00
Sergey Biryukov
6209004bf7 Remove <code> tags from translatable string in wp-includes/load.php.
Add translator comment.

Props ramiy.
Fixes #34621.
Built from https://develop.svn.wordpress.org/trunk@35632


git-svn-id: http://core.svn.wordpress.org/trunk@35596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-12 18:21:24 +00:00
Boone Gorges
226bb29ff0 Move wp_installing() to load.php.
Various functions in load.php need to check whether WP is in installation mode.
Let's let them.

Props adamsilverstein.
See #31130.
Built from https://develop.svn.wordpress.org/trunk@34896


git-svn-id: http://core.svn.wordpress.org/trunk@34861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 03:02:23 +00:00
Scott Taylor
4d3223b28e Introduce wp_get_server_protocol() to DRY protocol parsing logic and make adding more protocols, like HTTP/2, easier.
Props johnbillion, wonderboymusic.
Fixes #34131.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 02:35:26 +00:00
Boone Gorges
0e7c1d3b14 Use wp_installing() instead of WP_INSTALLING constant.
The `WP_INSTALLING` constant is a flag that WordPress sets in a number of
places, telling the system that options should be fetched directly from the
database instead of from the cache, that WP should not ping wordpress.org for
updates, that the normal "not installed" checks should be bypassed, and so on.

A constant is generally necessary for this purpose, because the flag is
typically set before the WP bootstrap, meaning that WP functions are not yet
available.  However, it is possible - notably, during `wpmu_create_blog()` -
for the "installing" flag to be set after WP has already loaded. In these
cases, `WP_INSTALLING` would be set for the remainder of the process, since
there's no way to change a constant once it's defined. This, in turn, polluted
later function calls that ought to have been outside the scope of site
creation, particularly the non-caching of option data. The problem was
particularly evident in the case of the automated tests, where `WP_INSTALLING`
was set the first time a site was created, and remained set for the rest of the
suite.

The new `wp_installing()` function allows developers to fetch the current
installation status (when called without any arguments) or to set the
installation status (when called with a boolean `true` or `false`). Use of
the `WP_INSTALLING` constant is still supported; `wp_installing()` will default
to `true` if the constant is defined during the bootstrap.

Props boonebgorges, jeremyfelt.
See #31130.
Built from https://develop.svn.wordpress.org/trunk@34828


git-svn-id: http://core.svn.wordpress.org/trunk@34793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 15:06:28 +00:00
John Blackbourn
bdcf5717de Send a 500 HTTP response code when the server's PHP or MySQL checks fail.
Fixes #33689
Props jeichorn

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


git-svn-id: http://core.svn.wordpress.org/trunk@34426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-23 21:57:26 +00:00
Aaron Jorbin
10d03c1ab3 Remove support for my-hacks.php
For the last 10 years, my-hacks has been deprecated and has been throwing a deprecation notice. For the last six years, you haven't been able to enable my-hacks.php in the admin UI. That should be enough time to give developers notice. Plugins and themes seem like they might have staying power.

Fixes #33741
Props bobbingwide


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


git-svn-id: http://core.svn.wordpress.org/trunk@34255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-18 17:06:25 +00:00
Dion Hulse
36bda54e88 Favicon: Do not specify a Content-Length: 0 header for our "empty" response to fail more gracefully on environments with extra whitespace on output.
This allows for the web server to generate the appropriate `Content-Length` header for the request, allowing for strict clients/proxies/servers to process the response.

Props swissspidy.
Fixes #33626

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


git-svn-id: http://core.svn.wordpress.org/trunk@33904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-07 02:18:26 +00:00
Dominik Schilling
96a6f0ac1f Pinking shears.
Built from https://develop.svn.wordpress.org/trunk@33627


git-svn-id: http://core.svn.wordpress.org/trunk@33594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-17 21:39:25 +00:00
Scott Taylor
0ba1025d66 Add missing doc blocks to load.php
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-26 18:53:27 +00:00
Andrew Nacin
116d1d354e Add useremail and userslugs as global cache groups. fixes #31243.
Built from https://develop.svn.wordpress.org/trunk@31347


git-svn-id: http://core.svn.wordpress.org/trunk@31328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-06 03:24:23 +00:00
Scott Taylor
ac654632fe Use PHP_SAPI constant instead of php_sapi_name() in iis7_supports_permalinks(), wp_fix_server_vars(), and wp_redirect().
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 04:59:22 +00:00
Scott Taylor
60b0cd7943 The keyword elseif should be used instead of else if so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Scott Taylor
786caa4d55 Correct the @param docs for arguments that are truthy/falsey.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 23:04:23 +00:00
Dominik Schilling
47f89b1d91 Remove unbounded check for "install.php" in wp_not_installed().
The check is true for `wp-admin/plugin-install.php` and `wp-admin/theme-install.php` too. This will end in a redirect to `/wp-admin/upgrade.php` or a screen with a bunch of errors.
The `WP_INSTALLING` constant was added in WordPress 1.5.1 to `wp-admin/install.php` which makes the check for "install.php" redundant.

props joemcgill.
fixes #29694.
Built from https://develop.svn.wordpress.org/trunk@30581


git-svn-id: http://core.svn.wordpress.org/trunk@30571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-26 20:56:23 +00:00
Sergey Biryukov
fa8e82efab Send nocache_headers() on installation screens and when redirecting to them.
fixes #29248.
Built from https://develop.svn.wordpress.org/trunk@29599


git-svn-id: http://core.svn.wordpress.org/trunk@29373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-25 17:40:16 +00:00
Drew Jaynes
18a6253747 Improve inline documentation for wp-includes/load.php.
Props ericlewis, DrewAPicture.
Fixes #24886.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-04 04:12:17 +00:00
Andrew Nacin
88e3ebe05b Revert the conversion of adjacent post queries to WP_Query. Explanation on the ticket.
Reverts [27285], [27286], [27287], [27288], [27291], [27292], [27293], [27296], [27633], [27634], [27635], and [27692].

see #26937.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-29 06:03:15 +00:00
Andrew Nacin
2061a3aa5f Return a bool from wp_using_ext_object_cache(), never a null.
see #26937.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-20 02:55:14 +00:00
Andrew Nacin
a37d4609be Send a charset header when erroring out in wp_check_php_mysql_versions().
props rodrigosprimo.
fixes #26536.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-15 06:17:14 +00:00
Drew Jaynes
c01c33a6aa Inline documentation fixes for timer_stop().
See #26874.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-01 02:42:14 +00:00
John Blackbourn
50c240d4d0 Correct the inline docs for timer_stop(). Fixes #26874. Props jackreichert
Built from https://develop.svn.wordpress.org/trunk@27332


git-svn-id: http://core.svn.wordpress.org/trunk@27184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-28 22:18:14 +00:00
Andrew Nacin
c51ce41c59 Use mysqli for WordPress development versions, regardless of PHP version, to increase testing footprint.
Allow the lack of ext/mysql to pass wp_check_php_mysql_versions().

see #21663.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 15:53:13 +00:00
Sergey Biryukov
1de240d5a2 Inline documentation for hooks in wp-includes/load.php.
props mordauk.
see #25229.
Built from https://develop.svn.wordpress.org/trunk@25455


git-svn-id: http://core.svn.wordpress.org/trunk@25376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-16 18:30:10 +00:00
Dion Hulse
641d3b2560 Fix wp_guess_url() to work in every scenario I could find, allows us to use it to determine the correct path to the WordPress Site URL before installation for install.php and setup-config.php redirects. Fixes #24480 Fixes #16884
Built from https://develop.svn.wordpress.org/trunk@25396


git-svn-id: http://core.svn.wordpress.org/trunk@25327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-12 06:57:09 +00:00
Scott Taylor
d7cc1f506a Introduce wp_using_ext_object_cache() - mimic wp_suspend_cache_invalidation() and discourage direct access to $_wp_using_ext_object_cache, cleaning up importing of globals in functions and provides function to modify that global. Loads the packaged object cache when an external cache hasn't been loaded or doesn't contain wp_cache_init().
Fixes #21401.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 18:10:09 +00:00
Andrew Nacin
cbfc7470e2 Documentation for [24564]. see #23811.
git-svn-id: http://core.svn.wordpress.org/trunk@24581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-08 12:59:10 +00:00
Mark Jaquith
a62e681239 Don't display errors for XML-RPC requests, as they malform the response.
fixes #23811. props kovshenin, markoheijnen.

git-svn-id: http://core.svn.wordpress.org/trunk@24564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-05 17:38:14 +00:00
Andrew Nacin
316bfc63a2 When WP_DEBUG, set PHP error_reporting level to E_ALL. This will include E_DEPRECATED in PHP 5.3, and E_STRICT in PHP 5.4.
fixes #24357.



git-svn-id: http://core.svn.wordpress.org/trunk@24288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-17 20:44:54 +00:00
Mark Jaquith
b2d13224ec No longer need to work around zend_hash_del_key_or_index bug. fixes #24029. see [4717]
git-svn-id: http://core.svn.wordpress.org/trunk@23947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-10 07:57:58 +00:00
Andrew Nacin
2cb5fccd5c Ensure we have a charset before calling mb_internal_encoding(), avoiding an unnecessary (if suppressed) warning. props dfavor. fixes #23093.
git-svn-id: http://core.svn.wordpress.org/trunk@23373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-02 02:01:29 +00:00
Ryan Boren
9fc9d42d0a * Register blog-id-cache group as global
* Introduce clean_blog_cache() so we can run it independently of refresh_blog_details() which assumes the blog still exists and get_blog_details() can be called.
* Don't db escape cache keys in get_blog_id_from_url()
* prepare() the query in get_blog_id_from_url()
* Return 0 for all failures in get_blog_id_from_url()
* clean_blog_cache() after dropping tables in wpmu_delete_blog() to make sure the cache is for real cleaned.



git-svn-id: http://core.svn.wordpress.org/trunk@22092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-01 18:03:23 +00:00
Andrew Nacin
a42ce2353a Stop cleaning the cache of a post's children. Ancestors are no longer cached against the post object, which means this kind of walking is unnecessary. It is also prohibitively expensive with large hierarchies.
We need to remove post_ancestors non-persistent caching for this. get_post_ancestors() can simply rely on the caching of get_post() instead. Previously, it was a direct query, hence the extra layers of caching and clearing.

Child cache clearing stays in wp_delete_post() as children get a new parent.

fixes #11399.



git-svn-id: http://core.svn.wordpress.org/trunk@21952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-22 15:55:02 +00:00
Andrew Nacin
c97452d955 Don't include functions.php in wp_load_translations_early()
to avoid a parse error in a PHP4 environment (caused by use of
the clone keyword in option.php).

Manually include functions.php in the rare situations where it
is not already included by the time we need to load translations
early.

Remove the functions.php dependency by switching the wp_die() calls
to die(), in wp_check_php_mysql_versions().

props SergeyBiryukov, see #21316, for trunk.




git-svn-id: http://core.svn.wordpress.org/trunk@21715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-04 02:38:37 +00:00
Ryan Boren
37a631387c s/blog/site/. see #21742
git-svn-id: http://core.svn.wordpress.org/trunk@21693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 20:45:28 +00:00
Ryan Boren
f0c8b8d0e7 Introduce WP_Screen::in_admin() for determining which admin the screen is in.
Change is_*_admin() to reference in_admin() with fallback to the WP_*_ADMIN constants during early bootstrap. This allows unit tests and ajax handlers to set the admin context.

fixes #21742


git-svn-id: http://core.svn.wordpress.org/trunk@21687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 17:16:46 +00:00
Ryan Boren
9377523bce Introduce WP_Post class. Clean up ancestors handling. Props scribu, toppa. fixes #10381 see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 19:47:52 +00:00
ryan
14ecba530b Move get_current_blog_id() to load.php so it is available during multisite bootstrap. fixes #21432
git-svn-id: http://core.svn.wordpress.org/trunk@21484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-09 13:17:14 +00:00
ryan
295ca4d76f Introduce wp_cache_switch_to_blog() and WP_Object_Cache::switch_to_blog() as a lighter/faster way to switch the cache to a new blog id.
Add the blog id to the cache keys for multisite installs.

Use wp_cache_switch_to_blog() instead of wp_cache_init() in switch_to_blog().

Use wp_cache_switch_to_blog() instead of wp_cache_reset() in wp_start_object_cache().

Deprecate wp_cache_reset().

This avoids the many queries needed to re-prime the cache after switch_to_blog() on multisite installs using the default cache backend.

fixes #21434



git-svn-id: http://core.svn.wordpress.org/trunk@21403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-02 18:31:14 +00:00
ryan
09d728e46b Take the mmm out of comment_ID. Just mm is sufficient.
Props wonderboymusic
fixes #21400


git-svn-id: http://core.svn.wordpress.org/trunk@21363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-30 16:16:13 +00:00
nacin
81bb2f7ed7 Use is_rtl() for html direction when possible. In sites.php, language_attributes() will always exist (MU vestige). When the DB is dead, language_attributes() is worse than a simple is_rtl() check. is_rtl() exists here due to wp_load_translations_early(). see #18180.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 06:05:35 +00:00
nacin
1d5e72a39c Do RTL detection based on a translated string, rather than a hardcoded list. Makes things a bit cleaner. fixes #19924, fixes #19600.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-06 19:36:24 +00:00
nacin
ce311c1035 Load admin-$locale.mo in setup-config.php. see #19852, see #18180.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-29 20:49:34 +00:00
nacin
81ed9a7563 Introduce wp_load_translations_early(), which can be used before the locale is properly loaded in order to translate early error strings. Internationalize setup-config.php -- translators no longer have a reason to modify this file. fixes #18180.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-26 20:34:27 +00:00
ryan
e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
dd32
9a4be393ec Revert Debug cruft from [19679], See #19249
git-svn-id: http://svn.automattic.com/wordpress/trunk@19681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 07:43:40 +00:00
ryan
fd1393ab7a Clear strict notices for the walkers. fixes #19249
git-svn-id: http://svn.automattic.com/wordpress/trunk@19679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-04 23:03:46 +00:00
nacin
6424c5b733 Ask for a float from microtime() for timer_start(), timer_stop(). Clarify docs. props solarissmoke, fixes #19157.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-20 21:36:53 +00:00
ryan
07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
ryan
32e25b6aec phpdoc typo and readability fixes. Props SergeyBiryukov. fixes #18560
git-svn-id: http://svn.automattic.com/wordpress/trunk@18827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 22:57:43 +00:00
nacin
50f5ad2216 Force display_errors to off when WP_DEBUG_DISPLAY == false. Technically a backwards incompatible change - if you want the passthrough to php.ini (which false used to provide) then use WP_DEBUG_DISPLAY === null. see #18391.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-13 18:59:05 +00:00
azaozz
5256d7951f <!DOCTYPE html> for all, fixes #18202
git-svn-id: http://svn.automattic.com/wordpress/trunk@18460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-22 00:25:41 +00:00
nacin
db78833264 Mark a few files as needing to be parsable by PHP4 in order to show the proper error messages. Non-exhaustive. see #17934.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-29 16:50:07 +00:00
nacin
ad1e1df0f2 wp_check_php_mysql_versions() during setup and install. see #17934.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-29 16:46:46 +00:00
ryan
10823b5d77 Avoid PHP 4 parse error prior to version checks. Props dd32. see #17880
git-svn-id: http://svn.automattic.com/wordpress/trunk@18339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-24 21:32:40 +00:00
nacin
4dcb9576c8 Avoid _deprecated_function() in wp_clone(). An object cache gets loaded before i18n functions exist. Maybe a better solution in 3.3. see #17206.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-12 20:36:47 +00:00
ryan
f9b418a2f9 Move wp_clone() back to load.php. Props technosailor. fixes #17206
git-svn-id: http://svn.automattic.com/wordpress/trunk@17681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-22 17:46:02 +00:00
nacin
1cdd5ad41a Remove more E_RECOVERABLE_ERROR checks. props duck_, see #16920.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-12 09:21:13 +00:00