Commit Graph

31932 Commits

Author SHA1 Message Date
Scott Taylor
cae64c5e13 Unit Tests: in Tests_Cache::test_wp_cache_init(), when wp_using_ext_object_cache(), just check that the global is an instance of WP_Object_Cache. External object cache instances of WP_Object_Cache will contain resources as props that will always have differing internal IDs, so strict comparison won't work.
See #31491.


git-svn-id: https://develop.svn.wordpress.org/trunk@34765 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 05:05:26 +00:00
Drew Jaynes
80e4265277 Docs: Also clarify the expected element types depending on the value of $action in the hook doc for the plugins_api filter.
See [34763] for context.

See #34035.


git-svn-id: https://develop.svn.wordpress.org/trunk@34764 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:51:39 +00:00
Drew Jaynes
4c6d50413b Docs: Clarify the expected replacement element type if replacing the object or array in plugins_api() via the plugins_api hook.
If the `$action` type is 'query_plugins' or 'plugin_information', the API will return an object, thus an object should be passed if replacing it. For 'hot_tags' and 'hot_categories', the same logic applies, but with arrays instead.

See #34035.


git-svn-id: https://develop.svn.wordpress.org/trunk@34763 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:47:14 +00:00
Scott Taylor
a31e54344c Posts: In wp_insert_post(), don't set post_date to current time if it can be derived from a passed value for post_date_gmt.
Adds unit tests.

Props oso96_2000, kawauso.
Fixes #15946.


git-svn-id: https://develop.svn.wordpress.org/trunk@34762 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:35:34 +00:00
Scott Taylor
5a24a0a4f8 Shortcodes/Formatting: Add PCRE Performance Testing
* Move pattern from `wptexturize()` into a separate function.
* Move pattern from `wp_html_split()` into a separate function.
* Beautify code for `wp_html_split()`.
* Remove unnecessary instances of `/s` modifier in patterns that don't use dots.
* Add `tests/phpunit/data/formatting/whole-posts.php` for testing larger strings.
* Add function `benchmark_pcre_backtracking()`.
* Add tests for `wp_html_split()`.
* Add tests for `wptexturize()`.
* Add tests for `get_shortcode_regex()`.

Props miqrogroove.
Fixes #34121.


git-svn-id: https://develop.svn.wordpress.org/trunk@34761 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:25:40 +00:00
Scott Taylor
c152375b58 Plugins: on the Install page, move the name of each plugin into the <h4> to accommodate screen readers.
Props afercia, ChrisMKindred.
Fixes #32400.


git-svn-id: https://develop.svn.wordpress.org/trunk@34760 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:15:12 +00:00
Jeremy Felt
319818a408 Tests: Clarify site option tests storing and retrieving serialized data.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34759 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 02:05:23 +00:00
Jeremy Felt
b9e1b4ab7c Tests: Split test_default_filter() Site Option test into multiple tests.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34758 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 01:55:52 +00:00
Jeremy Felt
e261546a61 Tests: Split test_the_basics() Site Option test into many tests.
Many assertions in one test are now many tests with one assertion.

See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34757 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 01:32:09 +00:00
Jeremy Felt
2322255d81 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@34756 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 22:45:18 +00:00
John Blackbourn
ed81797117 Deprecate get_admin_users_for_domain(). This function has never been used in core.
Fixes #34122


git-svn-id: https://develop.svn.wordpress.org/trunk@34755 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 22:26:19 +00:00
John Blackbourn
d3229b6dfc This function is blessed.
git-svn-id: https://develop.svn.wordpress.org/trunk@34754 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 22:23:51 +00:00
John Blackbourn
cfbd8056c2 Deprecate create_empty_blog(). This function has never been used in core.
Fixes #34120


git-svn-id: https://develop.svn.wordpress.org/trunk@34753 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 22:09:18 +00:00
Dominik Schilling (ocean90)
b2bb4ea2d5 Install: Replace the "Privacy" setting with the "Search Engine Visibility" setting from Reading Settings.
Props Clorith, ocean90.
Fixes #27628.
See #16416.

git-svn-id: https://develop.svn.wordpress.org/trunk@34752 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 21:34:38 +00:00
Dominik Schilling (ocean90)
00762410b0 Upgrader: Clear plugin/theme caches directly after a plugin/theme has been installed.
`wp_update_plugins()` and `wp_update_themes()` are both hooked into `upgrader_process_complete` with priority 10. But at this stage the caches in `get_plugins()`, `search_theme_directories()`, and `wp_get_themes()` aren't refreshed yet so both functions couldn't fetch any translations for the new plugin/theme.
To reset the caches `wp_clean_themes_cache()` and `wp_clean_plugins_cache()` are now hooked into `upgrader_process_complete` with priority 9.

Fixes #34029.

git-svn-id: https://develop.svn.wordpress.org/trunk@34751 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 21:20:09 +00:00
Jeremy Felt
a8b5a8ec63 MS: Remove registration of ID column in Sites and Users list tables.
Reverts a portion of [34289] and leaves the render for the column behind. A plugin can register these fields for display via filter.

Fixes #18661.


git-svn-id: https://develop.svn.wordpress.org/trunk@34750 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 20:57:06 +00:00
Jeremy Felt
b71708647c MS: Provide better UI when a main site's /blog prefix is changed.
The main site on a new network is forced by default into using `/blog` as the prefix for its permalink structure. This can be changed easily through the network admin, though the `options-permalink.php` screen is then unusable to make further changes to the structure.

Now, if `/blog/` is not at the beginning of the `permalink_structure` option, we do not force `/blog` as a prefix in the UI.

Fixes #12002.


git-svn-id: https://develop.svn.wordpress.org/trunk@34749 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 20:38:40 +00:00
Dominik Schilling (ocean90)
2f16a92362 Language Upgrader: Re-use the automatic upgrader skin if the parent upgrader is using it.
Prevents broken Ajax responses when `Language_Pack_Upgrader::async_upgrade()` gets triggered during a shiny update.

Fixes #34048.

git-svn-id: https://develop.svn.wordpress.org/trunk@34748 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 20:24:18 +00:00
Scott Taylor
e0b34f44a3 Shortcodes: Fix PCRE performance bugs in get_shortcode_regexp() and related to wptexturize(), do_shortcode(), and strip_shortcodes()
Alters unit tests.

Props miqrogroove.
Fixes #33517.


git-svn-id: https://develop.svn.wordpress.org/trunk@34747 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 18:04:13 +00:00
Drew Jaynes
08f047176b Docs: Update the argument descriptions for $child_of and $hierarchical in get_pages() to more closely reflect expected behavior.
See #18701. See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@34746 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 17:39:25 +00:00
Scott Taylor
1b70f27b04 Shortcodes: prevent registration of invalid shortcode names.
Adds unit tests.

Props miqrogroove.
Fixes #34090.


git-svn-id: https://develop.svn.wordpress.org/trunk@34745 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 17:33:58 +00:00
Scott Taylor
3c50d18785 Shortcodes: clarify the @return docs for shortcode_parse_atts().
Props miqrogroove.
See #23307.


git-svn-id: https://develop.svn.wordpress.org/trunk@34744 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 17:31:58 +00:00
Andrea Fercia
875ed40ffb In wp_comment_reply() change the H5 headings in fieldset legends for better accessibility.
Also, add a "Edit Comment" legend before the Quick Edit form to pair it with "Reply to Comment" and "Add new Comment" and move the Name, Email, and URL fields after the Comment textarea.

Props joedolson, afercia.

Fixes #33757.

git-svn-id: https://develop.svn.wordpress.org/trunk@34743 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 14:51:25 +00:00
Andrea Fercia
b61d943435 Bump H3 headings to H2 on the Network Site Users screen for better accessibility.
Fixes #34081.

git-svn-id: https://develop.svn.wordpress.org/trunk@34742 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 14:32:15 +00:00
Boone Gorges
2828042b6e Make sure permastruct is set in comments_template() tests.
After [34735].

git-svn-id: https://develop.svn.wordpress.org/trunk@34741 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 12:26:33 +00:00
Dion Hulse
e4a147150e Rewrite insert_with_markers() to use flock() when available, significant cleanup of the function too.
The call to `flock()` is an exclusive advisory lock, which in my testing only PHP respects (apache continues to read it).
Not all filesystems support locking (remote NFS mounts for example) so this offers minimal benefit to those platforms, but offers much better protection against file corruption on systems which do support it.
The call is blocking, so a second process will wait for the first to complete before writing if supported.

See #31767


git-svn-id: https://develop.svn.wordpress.org/trunk@34740 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 07:45:35 +00:00
Dion Hulse
f99f06206e Updates: SSH2 Transport: Add a connection error when the SFTP subsystem cannot be initialized.
Fixes #33478


git-svn-id: https://develop.svn.wordpress.org/trunk@34739 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:42:20 +00:00
Dion Hulse
bb7763c1d1 Updates: SSH2 Transport: Use a work around to avoid a bug where PHP's SSH2 extension fails to list the contents of the / directory.
This fixes issues where SSH2 with chrooted environments runs into a `Unable to locate WordPress Content directory (wp-content).` error.

The workaround is to simply list the contents of the `/./` directory instead of `/`.

Fixes #33919


git-svn-id: https://develop.svn.wordpress.org/trunk@34738 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:39:44 +00:00
Gary Pendergast
f9f56fb942 WPDB: Allow null values in the CRUD functions.
Specifically, `::insert()`, `::replace()`, `::update()`, and `::delete()` can now set a column to `NULL`, or add the `IS NULL` condition to the `WHERE` clause.

This is based on [backpress 279].

Props pento, nbachiyski, sorich87.

Fixes #15158.



git-svn-id: https://develop.svn.wordpress.org/trunk@34737 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:36:15 +00:00
Dion Hulse
3ffcb9548d Press This: Make the regular expressions for matching images easier to read by not requiring escaping.
Fixes #32878


git-svn-id: https://develop.svn.wordpress.org/trunk@34736 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:15:05 +00:00
Boone Gorges
ee2c079ade Ensure that comment permalinks reflect pagination.
After [34561], `wp_list_comments()` no longer passed all of a post's comments
to `Walker_Comments`. As a result, calls to `get_comment_link()` occurring
inside the comment loop had insufficient context to determine the proper
'cpage' value to use when generating comment permalinks. This, in turn, caused
comment permalinks to behave erratically.

The current changeset addresses the problem as follows:

* `get_comment_link()` now accepts a 'cpage' parameter. When present, 'cpage' will be used to build the comment permalink - no automatic calculation will take place.
* When called within the main loop, `wp_list_comments()` calculates the proper 'cpage' value for comments in the loop, and passes it down to `get_comment_link()`.
* `cpage` and `comment-page-x` query vars are generally required in comment permalinks (see #34068), but an exception is made when 'default_comment_page=oldest': the bare post permalink will always be the same as `cpage=1`, so `cpage` is excluded in this case.

Props peterwilsoncc for assiduous spreadsheeting.
Fixes #34073.

git-svn-id: https://develop.svn.wordpress.org/trunk@34735 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:12:39 +00:00
Scott Taylor
c28bc82d4b Canonical: remove unused code (commented-out) from redirect_canonical().
Props hakre, chriscct7.
Fixes #16934.


git-svn-id: https://develop.svn.wordpress.org/trunk@34734 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:08:31 +00:00
Dion Hulse
0e2f9b5019 Updates: Try a more compatible method to detect if a file exists when using the FTP Extension.
This change causes it to list the parent directories files, and assets that the node exists within the returned listing, this is a little more compatible than relying upon the FTP server to correctly filter the returned resultset to the specific file/node being requested.
Fixes #28013


git-svn-id: https://develop.svn.wordpress.org/trunk@34733 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:08:07 +00:00
Boone Gorges
d5fdd9084a Correct some WP_Query metadata lazyloading docs.
Props dlh.
Fixes #34047.

git-svn-id: https://develop.svn.wordpress.org/trunk@34732 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 04:00:48 +00:00
Boone Gorges
27eb520f0c s/add_action()/add_filter() in WP_Query metadata lazyloading.
Props dlh.
See #34047.

git-svn-id: https://develop.svn.wordpress.org/trunk@34731 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 04:00:41 +00:00
Boone Gorges
a7dbb948c5 Prevent extra db queries in WP_Comment::get_children().
`WP_Comment_Query::fill_descendants()` queries for a comment tree in a way that
minimizes database overhead, and places the located descendants with their
proper parents. However, it doesn't touch leaf nodes - comments with no
children - so future calls to `get_children()` on those comment objects
result in unnecessary database queries. To prevent this, `fill_descendants()`
now sets a `populated_children` flag on all located `WP_Comment` objects.

See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34730 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 03:57:53 +00:00
Boone Gorges
f14dc03ad6 Simplify pagination logic in comments_template().
[34561] "fixed" the problem of newest-first comments showing fewer than
'per_page' comments on the post permalink when the total number of comments
was not divisible by 'per_page'. See #29462. But this fix caused numerous
other problems. First, comment pages reported by `get_page_of_comment()`
(which expects comment pages to be filled oldest-first) were no longer correct.
Second, and more seriously, the new logic caused comments to be shifted
between pages, making their permalinks non-permanent.

The current changeset reverts the changed behavior. In order to preserve the
performance improvements introduced in [34561], an additional query must be
performed when 'default_comments_page=newest' and 'cpage=0' (ie, you're viewing
the post permalink). A nice side effect of this revert is that we no longer
need the hacks required to determine proper comment pagination, introduced in
[34561].

See #8071. See #34073.

git-svn-id: https://develop.svn.wordpress.org/trunk@34729 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 03:10:13 +00:00
Scott Taylor
63b6bc751d Post List Table: Ensure that edit.php with no query string produces the proper markup and links in the date column header.
Add 2 methods to `WP_List_Table`, `->get_orderby()` and `->get_order()`. Override the methods in `WP_Posts_List_Table`.

`WP_Posts_List_Table` calls `wp_edit_posts_query()` in `->prepare_items()` which is a wrapper for `wp()`. As such, we can obtain `orderby` and `order` via `get_query_var()`, instead of the URL.

Fixes #25493.



git-svn-id: https://develop.svn.wordpress.org/trunk@34728 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 02:09:41 +00:00
Drew Jaynes
ed1240234d Formatting: Rename the $richedit parameter in format_to_edit() to $rich_text.
Previously, it was necessary to explain in a double-negative that `$richedit` being false would prevent `$content` from being passed through `esc_textarea()`. The updated `$rich_edit` name and documentation now better reflects the intent of the parameter.

Fixes #21613.


git-svn-id: https://develop.svn.wordpress.org/trunk@34727 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 02:00:42 +00:00
Helen Hou-Sandi
f737a197c2 Comments: Trash blacklisted comments by default.
If trash is disabled, they wil continue to go into spam like they do now.

props wonderboymusic, solarissmoke, MikeHansenMe.
fixes #7051.


git-svn-id: https://develop.svn.wordpress.org/trunk@34726 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 01:48:14 +00:00
Drew Jaynes
3725408616 Docs: Document declaration of the $submenu_file global in wp-admin/menu-header.php.
See #24531. See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@34725 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 01:47:07 +00:00
Drew Jaynes
72e5ad9390 Declare the $submenu_file global to avoid a notice generated by passing it as a parameter to the submenu_file hook, introduced in [34722].
Fixes #24531.


git-svn-id: https://develop.svn.wordpress.org/trunk@34724 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 01:22:55 +00:00
Helen Hou-Sandi
11144bd39e Don't show the "Add New" link on post-new.php.
Using the same `$post_new_file` global variable name in `wp-admin/menu.php` in [33723] was unintentional, but we're already unsetting other variables that are in global scope so we can just unset this one as well. Someday the admin menu won't be a big pile of sad and cryptic globals. Maybe.

props johnjamesjacoby, norcross.
fixes #34045.


git-svn-id: https://develop.svn.wordpress.org/trunk@34723 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 00:47:22 +00:00
Sergey Biryukov
be98773ac9 Add 'submenu_file' filter for the file of an admin menu sub-menu item.
This complements the `'parent_file'` filter added in [12712].

Props swissspidy, kraftbj.
Fixes #24531.

git-svn-id: https://develop.svn.wordpress.org/trunk@34722 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 00:22:37 +00:00
Weston Ruter
00f500f135 Customize: Style the nav menu "Add Items" button as disabled when reordering.
Fixes CSS selector to match what is being used for the "Add Widget" button in the customizer.

Props umesh.nevase.
Fixes #34102.


git-svn-id: https://develop.svn.wordpress.org/trunk@34721 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 22:54:59 +00:00
Boone Gorges
9dd6f369cf Fix db_version juggling during non-multisite tests.
Continuing with the "code is poetry" theme after [34719], we need to continue
to update the option in the database on non-multisite in this
`wp_insert_term()` test.

See #31130.

git-svn-id: https://develop.svn.wordpress.org/trunk@34720 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 13:27:09 +00:00
Boone Gorges
13e28a6d34 Prevent Multisite term tests from hitting database for 'db_version'.
[34718] introduced a 'db_version' check to term meta functions, to ensure that
they don't run when the term meta schema is not yet in place. This call to
`get_option()` causes a database hit during Multisite tests, due to the
presence of the `WP_INSTALLING` constant. See #31130. The extra database
queries are causing cache tests to fail.

In similar cases, we have `markTestSkipped()` when `is_multisite()`. Because
the term meta API is so extensive - term meta caches can be primed anywhere a
`WP_Query` loop is fired up - we implement a more generous workaround in this
case. To prevent `get_option( 'db_version' )` from hitting the database during
multisite unit tests, we use a 'pre_option_' filter.

Heaven help us.

See #34091.

git-svn-id: https://develop.svn.wordpress.org/trunk@34719 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 13:08:49 +00:00
Boone Gorges
8e0b9bae2e Bail out of termmeta functions if schema is not up-to-date.
Termmeta cache priming was throwing database errors on installations that had
not yet gone through the database update routine. To avoid errors in all cases,
the check has been added to all termmeta functions. These checks will be
removed in a future version of WordPress. (Hang on to your hats!)

Fixes #34091.

git-svn-id: https://develop.svn.wordpress.org/trunk@34718 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 04:52:28 +00:00
Drew Jaynes
69db043e3c Docs: There are quite alot of typos in core inline comments.
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@34717 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 04:12:16 +00:00
Boone Gorges
87fbd30548 Use array hash notation for get_comment_link() $args.
See #34068, #34073.

git-svn-id: https://develop.svn.wordpress.org/trunk@34716 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 04:12:06 +00:00