Commit Graph

68 Commits

Author SHA1 Message Date
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