Commit Graph

127 Commits

Author SHA1 Message Date
Jeremy Felt
364e63b83b MS: Reject truthy, non-numeric network ids in _network_option().
A valid `$network_id` or `null`/`false` is expected as the first parameter for `_network_option()`. If something other than that is passed, we immediately return `false` rather than attempting to guess what network was intended.

See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-11 23:30: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
John Blackbourn
95045d629b Correctly set the secure flag for the test cookie based on the login URL scheme, and the same for the user settings cookies based on the admin URL scheme.
Fixes #34159

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


git-svn-id: http://core.svn.wordpress.org/trunk@34896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 03:05:25 +00:00
Jeremy Felt
9926983b66 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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 17:11:25 +00:00
Sergey Biryukov
2702fd12cf Transients: Clarify the expiration_of_site_transient_$transient filter description.
See #21330.
Built from https://develop.svn.wordpress.org/trunk@34878


git-svn-id: http://core.svn.wordpress.org/trunk@34843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 18:11:24 +00:00
Dominik Schilling
e237e59172 Transients: Rename filters added in [34865].
* `expiration_pre_set_transient_$transient` => `expiration_of_transient_$transient`
* `expiration_pre_set_site_transient_$transient` => `expiration_of_site_transient_$transient`

Fix hook docs.

Props chriscct7.
Fixes #21330.
Built from https://develop.svn.wordpress.org/trunk@34877


git-svn-id: http://core.svn.wordpress.org/trunk@34842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 17:59:25 +00:00
Scott Taylor
1dcc6e1b51 Transients, add filters for $expiration:
* `'expiration_pre_set_site_transient_' . $transient`
* `'expiration_pre_set_transient_' . $transient`
 
Props chriscct7, wpsmith, nacin.
Fixes #21330.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 14:10:25 +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
Jeremy Felt
dba5a73119 Docs: Add deprecation note for $use_cache in get_site_option().
Props johnbillion.
See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 19:32:30 +00:00
Jeremy Felt
54512d64cb 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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 19:08:26 +00:00
Jeremy Felt
3c2273ef45 MS: Introduce *_network_option functions.
Introduces `add_network_option()`, `update_network_option()`, `get_network_option()`, and `delete_network_option()`, which use the internals previously found in the `*_site_option()` functions and allow for a network ID to enable cross network storage and retrieval of network options.

* `*_site_option()` functions are now wrappers for `*_network_option()` and will interact with options for the current network in a multisite environment.
* All will continue to fallback to `*_option()` for non-multisite uses.
* Adds basic tests for cross network storage and retrieval.
* Existing tests for `*_site_option()` functions provide coverage for storage and retrieval of current network options.

Props spacedmonkey, DrewAPicture, jeremyfelt.
See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 18:01:27 +00:00
Jeremy Felt
e2c6216b21 MS: Remove @todo for ms_protect_special_option() from delete_site_option().
This todo has been in place since the original merge of MU. At the time of merge, `wpmu_protect_special_option()` protected an empty array, and there has been no noticeable need since. As we introduce `_network_option()`, let's leave this behind. A new ticket can be opened if necessary.

See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 22:46:28 +00:00
Sergey Biryukov
99c85c5b45 Update the length limit in set_transient() docs after [34030].
Props OriginalEXE.
Fixes #13310.
Built from https://develop.svn.wordpress.org/trunk@34045


git-svn-id: http://core.svn.wordpress.org/trunk@34013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-11 15:10:27 +00:00
Scott Taylor
a829ee32ce User Settings: allow dashes in get|set_user_setting() in PHP and get|setUserSetting() in JS.
Add unit tests - there were none. Mock `set_user_setting()` since it won't run due to `headers_sent()` being `true`.

Fixes #22781.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-01 03:57:21 +00:00
Drew Jaynes
6a839cf091 Docs: Add a changelog entry to the set_site_transient_$transient hook doc for the $transient parameter, added in [33738].
Fixes #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:41:21 +00:00
Drew Jaynes
0c2d49b844 Docs: Add a changelog entry to the pre_set_site_transient_$transient hook doc for the $transient parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:40:21 +00:00
Drew Jaynes
45c5fe16c2 Docs: Add a changelog entry to the site_transient_$transient hook doc for the $transient parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:39:21 +00:00
Drew Jaynes
5e8df999b8 Docs: Add a changelog entry to the pre_site_transient_$transient hook doc for the $transient parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:37:21 +00:00
Drew Jaynes
2f926931a0 Docs: Add a changelog entry to the pre_update_site_option_$option hook doc for the $option parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:36:21 +00:00
Drew Jaynes
9342ae98e9 Docs: Add a changelog entry to the pre_delete_site_option_$option hook doc for the $option parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:35:21 +00:00
Drew Jaynes
f62b7a70ba Docs: Add a changelog entry to the pre_add_site_option_$option hook doc for the $option parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:34:21 +00:00
Drew Jaynes
5d1a7579b2 Docs: Add a changelog entry to the site_option_$option hook doc for the $option parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:32:21 +00:00
Drew Jaynes
6ec59018cf Docs: Add a changelog entry to the default_site_option_$option hook doc for the $option parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:31:21 +00:00
Drew Jaynes
111559495f Docs: Add a changelog entry to the pre_site_option_$option hook doc for the $option parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:30:20 +00:00
Drew Jaynes
94775c9391 Docs: Add a changelog entry to the pre_set_transient_$transient hook doc for the $transient parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:29:21 +00:00
Drew Jaynes
df9aa619d7 Docs: Add a changelog entry to the transient_$transient hook doc for the $transient parameter, introduced in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:27:20 +00:00
Drew Jaynes
d850f67df6 Docs: Add a changelog entry to the pre_transient_$transient hook doc for the $transient parameter, introduced in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:25:21 +00:00
Drew Jaynes
7cec289b60 Docs: Add a changelog entry to the update_option_{$option} hook doc for the $option parameter, introduced in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:24:21 +00:00
Drew Jaynes
96cd3a4a3c Docs: Add a changelog entry to the pre_update_option_$option hook doc for the $option parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:22:20 +00:00
Drew Jaynes
e33d5c45bc Docs: Add a changelog entry to the option_$option hook doc for the $option parameter, added in [33738].
See #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:20:20 +00:00
Drew Jaynes
7c02c6b6fb Docs: Add a changelog entry to the default_option_$option hook doc for the $option parameter, added in [33738].
See #28402

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


git-svn-id: http://core.svn.wordpress.org/trunk@33746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 15:18:22 +00:00
Drew Jaynes
4affa545d0 Docs: Add a changelog entry to the pre_option_$option hook doc for the $option parameter, added in [33738].
See #28402

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


git-svn-id: http://core.svn.wordpress.org/trunk@33736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-27 17:00:24 +00:00
Scott Taylor
a13230b93f Pass option name to option and transient filters with dynamic names.
Props Viper007Bond, SergeyBiryukov, MikeHansenMe.
Fixes #28402.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 21:42:20 +00:00
Dominik Schilling
92fe9c9649 Transients: If get_option( $transient_timeout ) returns false, don't bother trying to delete the transient in get_transient().
props jamesgol, ericmann.
fixes #30380.
Built from https://develop.svn.wordpress.org/trunk@33110


git-svn-id: http://core.svn.wordpress.org/trunk@33081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-07 16:45:26 +00:00
Scott Taylor
26855e651b In get_site_option() and get_option(), ensure that $notoptions is an array before writing to it. Prevents a flood of Cannot use a scalar value as an array, because $notoptions is otherwise set to the result of wp_cache_get(), which returns mixed.
Props hauvong.
Fixes #31147.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-25 19:01:26 +00:00
Scott Taylor
ea89aeee0b Fix doc blocks for option.php.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-26 22:17:25 +00:00
Drew Jaynes
73892c112c Update the DocBlock description for update_option() to account for the ability to define the $autoload parameter, added in 4.2.
Props Clorith for the initial patch.
Fixes #32331.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-10 16:58:27 +00:00
Boone Gorges
305cf8b95e Allow $autoload setting to be changed for existing options using update_option().
[31628] made it possible to pass an `$autoload` param to `update_option()` that
applies when the option does not yet exist in the database. The current
changeset introduces parity for existing options: the `$autoload` setting
for existing options can be changed via the `$autoload` parameter. For internal
simplicity, `$autoload` is ignored for existing options when `$value` is not
also changed.

This changeset also moves `update_option()` tests into their own class.

Props dd32.
Fixes #26394.
Built from https://develop.svn.wordpress.org/trunk@31640


git-svn-id: http://core.svn.wordpress.org/trunk@31621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 13:57:26 +00:00
Boone Gorges
11ec50e453 Introduce $autoload parameter to update_option().
When creating an option via `add_option()`, the `$autoload` param allows you to
tell WP whether the option should be loaded as part of the 'alloptions' cache
during every pageload. `update_option()`, when used with a non-existent option
calls `add_option()` internally. The new `$autoload` param in `update_option()`
is passed along to `add_option()` in cases where the option does not yet exist.

The associated unit tests are skipped on multisite due to an issue that causes
`WP_INSTALLING` to force cache misses. See #31130.

Props codix, nofearinc, MikeHansenMe.
Fixes #26394.
Built from https://develop.svn.wordpress.org/trunk@31628


git-svn-id: http://core.svn.wordpress.org/trunk@31609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 19:13:25 +00:00
Boone Gorges
ec8aef8233 Respect 'default_option_' filters during early sanity checks in add_option() and update_option().
`add_option()` and `update_option()` both call `get_option()` to compare the
value passed to the function with any existing value for the given option name.
When a `'default_option_'` filter is in place to change the default value of
an option, `add_option()` and `update_option()` ought to check against the
filtered value, rather than a hardcoded `false`, in order to determine whether
a prior value exists.

Props GregLone, tyxla.
Fixes #31047.
Built from https://develop.svn.wordpress.org/trunk@31473


git-svn-id: http://core.svn.wordpress.org/trunk@31454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-18 19:14:27 +00:00
John Blackbourn
4d12ccadd8 Add $expiration as a parameter to the pre_set_transient_{$transient} filter.
Props mgibbs189
Fixes #30576

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


git-svn-id: http://core.svn.wordpress.org/trunk@31395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-11 17:12:26 +00:00
Andrew Nacin
1b8f71041b Allow $autoload in add_option() to receive false.
props dllh.
fixes #31119.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-25 07:51:23 +00:00
Dion Hulse
1d59ca9004 Add braces around a Docblock in an if statement, although not required by PHP, this is required by our coding standards for readability.
Introduced in 3.9 with r27365
See #25905

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


git-svn-id: http://core.svn.wordpress.org/trunk@30876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-16 05:52:23 +00:00
Scott Taylor
ba914c7df1 Improve various @param docs.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 22:56:25 +00:00
Drew Jaynes
439fe48010 Docs Formatting: Backtick-escape inline code for all dynamic hook docs in wp-includes/option.php.
Affects DocBlocks for the following hooks:
* `pre_option_ . $option`
* `default_option_ . $option`
* `option_ . $option`
* `pre_update_option_ . $option`
* `update_option_{$option}`
* `add_option_{$option}`
* `delete_option_$option`
* `delete_transient_ . $transient`
* `pre_transient_ . $transient`
* `transient_ . $transient`
* `pre_set_transient_ . $transient`
* `set_transient_ . $transient`
* `pre_site_option_ . $option`
* `default_site_option_ . $option`
* `site_option_ . $option`
* `pre_add_site_option_ . $option`
* `add_site_option_{$option}`
* `pre_delete_site_option_ . $option`
* `delete_site_option_{$option}`
* `pre_update_site_option_ . $option`
* `update_site_option_{$option}`
* `delete_site_transient_ . $transient`
* `pre_site_transient_ . $transient`
* `site_transient_ . $transient`
* `pre_set_site_transient_ . $transient`
* `set_site_transient_ . $transient`

See #30552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 11:53:22 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Andrew Ozz
8f2b4fbe9e Fix the wp-settings-* cookies used in getUserSetting()/setUserSetting(). They should be set without COOKIE_DOMAIN to work properly for sub-domains. Fixes #29095.
Built from https://develop.svn.wordpress.org/trunk@29478


git-svn-id: http://core.svn.wordpress.org/trunk@29256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-13 02:47:16 +00:00
Andrew Ozz
9662554bfb Add blog_id to the wp-settings-* cookie (used for storing user state) to prevent it being overloaded on sub-domain sites. Fixes #29095.
Built from https://develop.svn.wordpress.org/trunk@29362


git-svn-id: http://core.svn.wordpress.org/trunk@29138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-02 20:09:16 +00:00
Dominik Schilling
2e4be94288 Replace is_https_url() with 'https' === parse_url( $url, PHP_URL_SCHEME ).
see #28427, #28487.
Built from https://develop.svn.wordpress.org/trunk@29311


git-svn-id: http://core.svn.wordpress.org/trunk@29092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-27 17:46:17 +00:00
John Blackbourn
60ff3a61f9 Conditionally set the the secure flag on the test cookie, post password cookie, settings cookies, and comment author cookies depending on whether the front end and/or admin area are served over https. Fixes #28427
Built from https://develop.svn.wordpress.org/trunk@28895


git-svn-id: http://core.svn.wordpress.org/trunk@28694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 13:25:16 +00:00
Drew Jaynes
66bcd85529 Improve inline documention for set_transient() and set_site_transient() to specify the 45- and 40-character limits for their respective transient name values.
Props edwin-at-studiojoyo.com for the original patch.
See #15058, #13310. Fixes #28467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-11 16:33:15 +00:00
Sergey Biryukov
c8a55d08e6 Add a note about return value in case of an expired transient to get_transient() and get_site_transient().
props ruud@joyo.
fixes #28462.
Built from https://develop.svn.wordpress.org/trunk@28676


git-svn-id: http://core.svn.wordpress.org/trunk@28494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-05 15:34:14 +00:00
Dominik Schilling
bc8cf4e966 Introduce pre_update_option filter.
Filter is available in update_option() and allows to filter any option before its value is (maybe) serialized and updated.

see #27504.
props westonruter.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 13:57:14 +00:00
Andrew Nacin
d63fbed03d Transients: Allow a non-expiring transient to be updated with an expiry.
props shahpranaf, sandyr.
fixes #22807.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 18:23:14 +00:00
Drew Jaynes
af8c5df4d0 Inline documentation for hooks in wp-includes/option.php.
Props siobhyb for the initial patch. Props DrewAPicture, kpdesign.
Fixes #25905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-02 23:35:13 +00:00
Drew Jaynes
cb8951b0b3 Remove all @package and @subpackage PHPDoc tags not at the file- or class-levels in core.
See #27200.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:14:14 +00:00
Scott Taylor
784bd41501 Prefix the notoptions cache key in the multisite site-options group with $wpdb->siteid to avoid collisions and race conditions when using a fancy multi-network setup. Adds unit test.
Fixes #25883.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-21 19:07:10 +00:00
Andrew Nacin
d6b436afe8 In update_option(), call the update_option hook before the DB update.
Reverses a regression from [25664].

props calin.
fixes #25705 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-26 02:57:09 +00:00
Andrew Nacin
fe03c1170a When queries fail in option functions, bail before setting cache.
Standardize variables so things are less confusing.

fixes #25015.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 20:43:10 +00:00
Andrew Nacin
85d4685894 Always pass integer expirations to cache backends.
props SergeyBiryukov, andreasnrb.
fixes #25308.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-16 17:43:09 +00:00
Dion Hulse
fc1fc39a89 Fix the action that set_site_transient() fires so as not to include the private option prefix. This brings set_site_transient() back in line with it's documented behaviour, and the behaviour of all other transient functions. Fixes #25213
Built from https://develop.svn.wordpress.org/trunk@25350


git-svn-id: http://core.svn.wordpress.org/trunk@25312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-11 08:46:10 +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 Ozz
c79ef61b12 User state settings:
- Allow empty cookie value to be saved.
- Use get_current_user_id() instead of wp_get_current_user().
- Use is_user_member_of_blog().
- Sanitize both name and value in wp_set_all_user_settings().
- Some var names and code formatting cleanup.
Fixes #24921.
Built from https://develop.svn.wordpress.org/trunk@25109


git-svn-id: http://core.svn.wordpress.org/trunk@25091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-23 21:43:09 +00:00
Scott Taylor
a9dc60c9a8 Improve inline docs for function params that can be serialized when non-scalar. Fixes #18488.
Built from https://develop.svn.wordpress.org/trunk@25076


git-svn-id: http://core.svn.wordpress.org/trunk@25061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-21 21:11:09 +00:00
Jon Cave
55f60d7af4 Pass false returned for timed out transients through transient_$transient filter.
This brings the same behaviour as external object caches to the default database
backend.

Props johnbillion. Fixes #24685.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-21 19:14:09 +00:00
Jon Cave
727696d7be Introduce a notoptions cache for site options.
Props wonderboymusic. Fixes #19008.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-16 22:42:09 +00:00
Andrew Nacin
062928d842 Make update_option() consistent with add_option() for how serializable data is stored in the object cache.
props rmccue.
fixes #23381.



git-svn-id: http://core.svn.wordpress.org/trunk@24760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-22 04:24:13 +00:00
Andrew Nacin
69581bd827 Pass value and expiration to result hooks in set_transient() and set_site_transient(). props johnbillion, fixes #24583.
git-svn-id: http://core.svn.wordpress.org/trunk@24433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-16 04:06:12 +00:00
Andrew Nacin
699262666b Ensure we strictly compare 'alloptions' and 'notoptions' when protecting these special options.
Trim and check for emptiness of $option in delete_option(), as done for get, update, and add.

fixes #23289.



git-svn-id: http://core.svn.wordpress.org/trunk@23510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-28 16:49:20 +00:00
Andrew Nacin
1847d7e85b Trim the option name in get_option() before calling the pre_option_$option filter, not after. props evansolomon. fixes #22358.
git-svn-id: http://core.svn.wordpress.org/trunk@22633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-17 13:20:57 +00:00
Ryan Boren
1714e085e4 Don't create {$blog_id}_user-settings, {$blog_id}_user-settings-time, and {$blog_id}_dashboard_quick_press_last_post_id user options when a super admin visits a site they aren't a member of. Instead, rely solely on the wp-settings cookie.
fixes #22178


git-svn-id: http://core.svn.wordpress.org/trunk@22256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-17 18:58:09 +00:00
Andrew Nacin
557d9313a7 Introduce constants to allow for easier expression of time periods in seconds. Adds MINUTE_IN_SECONDS, HOUR_IN_SECONDS, DAY_IN_SECONDS, WEEK_IN_SECONDS, YEAR_IN_SECONDS. props nbachiyski, SergeyBiryukov. fixes #20987.
git-svn-id: http://core.svn.wordpress.org/trunk@21996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-25 05:26:19 +00:00
Andrew Nacin
dc49f24a6c Remove ms-files.php rewriting from WordPress multisite. fixes #19235.
Keep existing networks compatible with a ms_files_rewriting network option.



git-svn-id: http://core.svn.wordpress.org/trunk@21823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 22:22:20 +00:00
ryan
7c3c1267ec Call filters for default option values only as needed to reduce number of filter calls. Props Ott042. see #20448
git-svn-id: http://core.svn.wordpress.org/trunk@20784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-14 17:00:13 +00:00
ryan
db3da0b695 Add filters for the default to get_option() and get_site_option(). Provide default overrides in the customizer. Props Otto42. see #20448
git-svn-id: http://core.svn.wordpress.org/trunk@20783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-14 16:45:32 +00:00
nacin
0730535015 Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-24 15:24:31 +00:00
ryan
24ab16bc4e Move option, setting, and transient functions from functions.php to option.php. see #19552
git-svn-id: http://svn.automattic.com/wordpress/trunk@19602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-19 23:15:32 +00:00