Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 101 additions & 101 deletions src/wp-admin/includes/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,163 +409,163 @@ function populate_options( array $options = array() ) {
}

$defaults = array(
'siteurl' => $guessurl,
'home' => $guessurl,
'blogname' => __( 'My Site' ),
'blogdescription' => '',
'users_can_register' => 0,
'admin_email' => 'you@example.com',
'siteurl' => $guessurl,
'home' => $guessurl,
'blogname' => __( 'My Site' ),
'blogdescription' => '',
'users_can_register' => 0,
'admin_email' => 'you@example.com',
/* translators: Default start of the week. 0 = Sunday, 1 = Monday. */
'start_of_week' => _x( '1', 'start of week' ),
'use_balanceTags' => 0,
'use_smilies' => 1,
'require_name_email' => 1,
'comments_notify' => 1,
'posts_per_rss' => 10,
'rss_use_excerpt' => 0,
'mailserver_url' => 'mail.example.com',
'mailserver_login' => 'login@example.com',
'mailserver_pass' => '',
'mailserver_port' => 110,
'default_category' => 1,
'default_comment_status' => 'open',
'default_ping_status' => 'open',
'default_pingback_flag' => 1,
'posts_per_page' => 10,
'start_of_week' => _x( '1', 'start of week' ),
'use_balanceTags' => 0,
'use_smilies' => 1,
'require_name_email' => 1,
'comments_notify' => 1,
'posts_per_rss' => 10,
'rss_use_excerpt' => 0,
'mailserver_url' => 'mail.example.com',
'mailserver_login' => 'login@example.com',
'mailserver_pass' => '',
'mailserver_port' => 110,
'default_category' => 1,
'default_comment_status' => 'open',
'default_ping_status' => 'open',
'default_pingback_flag' => 1,
'posts_per_page' => 10,
/* translators: Default date format, see https://www.php.net/manual/datetime.format.php */
'date_format' => __( 'F j, Y' ),
'date_format' => __( 'F j, Y' ),
/* translators: Default time format, see https://www.php.net/manual/datetime.format.php */
'time_format' => __( 'g:i a' ),
'time_format' => __( 'g:i a' ),
/* translators: Links last updated date format, see https://www.php.net/manual/datetime.format.php */
'links_updated_date_format' => __( 'F j, Y g:i a' ),
'comment_moderation' => 0,
'moderation_notify' => 1,
'permalink_structure' => '',
'rewrite_rules' => '',
'hack_file' => 0,
'blog_charset' => 'UTF-8',
'moderation_keys' => '',
'active_plugins' => array(),
'category_base' => '',
'ping_sites' => 'https://rpc.pingomatic.com/',
'comment_max_links' => 2,
'gmt_offset' => $gmt_offset,
'links_updated_date_format' => __( 'F j, Y g:i a' ),
'comment_moderation' => 0,
'moderation_notify' => 1,
'permalink_structure' => '',
'rewrite_rules' => '',
'hack_file' => 0,
'blog_charset' => 'UTF-8',
'moderation_keys' => '',
'active_plugins' => array(),
'category_base' => '',
'ping_sites' => 'https://rpc.pingomatic.com/',
'comment_max_links' => 2,
'gmt_offset' => $gmt_offset,

// 1.5.0
'default_email_category' => 1,
'recently_edited' => '',
'template' => $template,
'stylesheet' => $stylesheet,
'comment_registration' => 0,
'html_type' => 'text/html',
'default_email_category' => 1,
'recently_edited' => '',
'template' => $template,
'stylesheet' => $stylesheet,
'comment_registration' => 0,
'html_type' => 'text/html',

// 1.5.1
'use_trackback' => 0,
'use_trackback' => 0,

// 2.0.0
'default_role' => 'subscriber',
'db_version' => $wp_db_version,
'default_role' => 'subscriber',
'db_version' => $wp_db_version,

// 2.0.1
'uploads_use_yearmonth_folders' => 1,
'upload_path' => '',
'uploads_use_yearmonth_folders' => 1,
'upload_path' => '',

// 2.1.0
'blog_public' => '1',
'default_link_category' => 2,
'show_on_front' => 'posts',
'blog_public' => '1',
'default_link_category' => 2,
'show_on_front' => 'posts',

// 2.2.0
'tag_base' => '',
'tag_base' => '',

// 2.5.0
'show_avatars' => '1',
'avatar_rating' => 'G',
'upload_url_path' => '',
'thumbnail_size_w' => 150,
'thumbnail_size_h' => 150,
'thumbnail_crop' => 1,
'medium_size_w' => 300,
'medium_size_h' => 300,
'show_avatars' => '1',
'avatar_rating' => 'G',
'upload_url_path' => '',
'thumbnail_size_w' => 150,
'thumbnail_size_h' => 150,
'thumbnail_crop' => 1,
'medium_size_w' => 300,
'medium_size_h' => 300,

// 2.6.0
'avatar_default' => 'mystery',
'avatar_default' => 'mystery',

// 2.7.0
'large_size_w' => 1024,
'large_size_h' => 1024,
'image_default_link_type' => 'none',
'image_default_size' => '',
'image_default_align' => '',
'close_comments_for_old_posts' => 0,
'close_comments_days_old' => 14,
'thread_comments' => 1,
'thread_comments_depth' => 5,
'page_comments' => 0,
'comments_per_page' => 50,
'default_comments_page' => 'newest',
'comment_order' => 'asc',
'sticky_posts' => array(),
'widget_categories' => array(),
'widget_text' => array(),
'widget_rss' => array(),
'uninstall_plugins' => array(),
'large_size_w' => 1024,
'large_size_h' => 1024,
'image_default_link_type' => 'none',
'image_default_size' => '',
'image_default_align' => '',
'close_comments_for_old_posts' => 0,
'close_comments_days_old' => 14,
'thread_comments' => 1,
'thread_comments_depth' => 5,
'page_comments' => 0,
'comments_per_page' => 50,
'default_comments_page' => 'newest',
'comment_order' => 'asc',
'sticky_posts' => array(),
'widget_categories' => array(),
'widget_text' => array(),
'widget_rss' => array(),
'uninstall_plugins' => array(),

// 2.8.0
'timezone_string' => $timezone_string,
'timezone_string' => $timezone_string,

// 3.0.0
'page_for_posts' => 0,
'page_on_front' => 0,
'page_for_posts' => 0,
'page_on_front' => 0,

// 3.1.0
'default_post_format' => 0,
'default_post_format' => 0,

// 3.5.0
'link_manager_enabled' => 0,
'link_manager_enabled' => 0,

// 4.3.0
'finished_splitting_shared_terms' => 1,
'site_icon' => 0,
'finished_splitting_shared_terms' => 1,
'site_icon' => 0,

// 4.4.0
'medium_large_size_w' => 768,
'medium_large_size_h' => 0,
'medium_large_size_w' => 768,
'medium_large_size_h' => 0,

// 4.9.6
'wp_page_for_privacy_policy' => 0,
'wp_page_for_privacy_policy' => 0,

// 4.9.8
'show_comments_cookies_opt_in' => 1,
'show_comments_cookies_opt_in' => 1,

// 5.3.0
'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ),
'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ),

// 5.5.0
'disallowed_keys' => '',
'comment_previously_approved' => 1,
'auto_plugin_theme_update_emails' => array(),
'disallowed_keys' => '',
'comment_previously_approved' => 1,
'auto_plugin_theme_update_emails' => array(),

// 5.6.0
'auto_update_core_dev' => 'enabled',
'auto_update_core_minor' => 'enabled',
'auto_update_core_dev' => 'enabled',
'auto_update_core_minor' => 'enabled',
/*
* Default to enabled for new installs.
* See https://core.trac.wordpress.org/ticket/51742.
*/
'auto_update_core_major' => 'enabled',
'auto_update_core_major' => 'enabled',

// 5.8.0
'wp_force_deactivated_plugins' => array(),
'wp_force_deactivated_plugins' => array(),

// 6.4.0
'wp_attachment_pages_enabled' => 0,
'wp_attachment_pages_enabled' => 0,

// 6.9.0
'wp_notes_notify' => 1,
'wp_notes_notify' => 1,

// 7.0.0
'wp_enable_real_time_collaboration' => 1,
'wp_collaboration_enabled' => 0,
);

// 3.3.0
Expand Down
8 changes: 5 additions & 3 deletions src/wp-admin/options-writing.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@
</td>
</tr>
<tr>
<th scope="row"><label for="wp_enable_real_time_collaboration"><?php _e( 'Collaboration' ); ?></label></th>
<th scope="row"><?php _e( 'Collaboration' ); ?></th>
<td>
<input name="wp_enable_real_time_collaboration" type="checkbox" id="wp_enable_real_time_collaboration" value="1" <?php checked( '1', get_option( 'wp_enable_real_time_collaboration' ) ); ?> />
<label for="wp_enable_real_time_collaboration"><?php _e( 'Enable real-time collaboration' ); ?></label>
<label for="wp_collaboration_enabled">
<input name="wp_collaboration_enabled" type="checkbox" id="wp_collaboration_enabled" value="1" <?php checked( '1', (bool) get_option( 'wp_collaboration_enabled' ) ); ?> />
<?php _e( 'Enable real-time collaboration' ); ?>
</label>
</td>
</tr>
<?php
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
'default_email_category',
'default_link_category',
'default_post_format',
'wp_enable_real_time_collaboration',
'wp_collaboration_enabled',
),
);
$allowed_options['misc'] = array();
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/collaboration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
function wp_collaboration_inject_setting() {
global $pagenow;

if ( ! get_option( 'wp_enable_real_time_collaboration' ) ) {
if ( ! (bool) get_option( 'wp_collaboration_enabled' ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the (bool) necessary since this is doing a truthy/falsy check anyway?

return;
}

Expand Down
5 changes: 2 additions & 3 deletions src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,8 @@
// Timezone.
add_filter( 'pre_option_gmt_offset', 'wp_timezone_override_offset' );

// If the upgrade hasn't run yet, set some default options.
add_filter( 'default_option_link_manager_enabled', '__return_true' ); // Assume link manager is used.
add_filter( 'default_option_wp_enable_real_time_collaboration', '__return_true' ); // Enable real-time collaboration.
// If the upgrade hasn't run yet, assume link manager is used.
add_filter( 'default_option_link_manager_enabled', '__return_true' );

// This option no longer exists; tell plugins we always support auto-embedding.
add_filter( 'pre_option_embed_autourls', '__return_true' );
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/option.php
Original file line number Diff line number Diff line change
Expand Up @@ -2887,12 +2887,12 @@ function register_initial_settings() {

register_setting(
'writing',
'wp_enable_real_time_collaboration',
'wp_collaboration_enabled',
array(
'type' => 'boolean',
'description' => __( 'Enable Real-Time Collaboration' ),
'sanitize_callback' => 'rest_sanitize_boolean',
'default' => true,
'default' => false,
'show_in_rest' => true,
)
);
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ function create_initial_post_types() {
)
);

if ( get_option( 'wp_enable_real_time_collaboration' ) ) {
if ( (bool) get_option( 'wp_collaboration_enabled' ) ) {
register_post_type(
'wp_sync_storage',
array(
Expand Down Expand Up @@ -8672,7 +8672,7 @@ function wp_create_initial_post_meta() {
)
);

if ( get_option( 'wp_enable_real_time_collaboration' ) ) {
if ( (bool) get_option( 'wp_collaboration_enabled' ) ) {
register_meta(
'post',
'_crdt_document',
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ function create_initial_rest_routes() {
$icons_controller->register_routes();

// Collaboration.
if ( get_option( 'wp_enable_real_time_collaboration' ) ) {
if ( (bool) get_option( 'wp_collaboration_enabled' ) ) {
$sync_storage = new WP_Sync_Post_Meta_Storage();
$sync_server = new WP_HTTP_Polling_Sync_Server( $sync_storage );
$sync_server->register_routes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function create_item( $request ) {
* the saved post. This diff is then applied to the in-memory CRDT
* document, which can lead to duplicate inserts or deletions.
*/
$is_collaboration_enabled = get_option( 'wp_enable_real_time_collaboration' );
$is_collaboration_enabled = (bool) get_option( 'wp_collaboration_enabled' );

if ( $is_draft && (int) $post->post_author === $user_id && ! $post_lock && ! $is_collaboration_enabled ) {
/*
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/tests/rest-api/rest-autosaves-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ public function test_rest_autosave_published_post() {
}

public function test_rest_autosave_draft_post_same_author() {
add_filter( 'pre_option_wp_enable_real_time_collaboration', '__return_zero' ); // Zero as false doesn't work for pre-flight options.
add_filter( 'pre_option_wp_collaboration_enabled', '__return_zero' ); // Zero as false doesn't work for pre-flight options.

wp_set_current_user( self::$editor_id );

Expand Down Expand Up @@ -746,7 +746,7 @@ public function test_get_item_sets_up_postdata() {
}

public function test_update_item_draft_page_with_parent() {
add_filter( 'pre_option_wp_enable_real_time_collaboration', '__return_zero' ); // Zero as false doesn't work for pre-flight options.
add_filter( 'pre_option_wp_collaboration_enabled', '__return_zero' ); // Zero as false doesn't work for pre-flight options.

wp_set_current_user( self::$editor_id );
$request = new WP_REST_Request( 'POST', '/wp/v2/pages/' . self::$child_draft_page_id . '/autosaves' );
Expand Down Expand Up @@ -930,7 +930,7 @@ public static function data_head_request_with_specified_fields_returns_success_r
* same author should create a revision instead of updating the post directly.
*/
public function test_rest_autosave_draft_post_same_author_with_rtc() {
add_filter( 'pre_option_wp_enable_real_time_collaboration', '__return_true' );
add_filter( 'pre_option_wp_collaboration_enabled', '__return_true' );

wp_set_current_user( self::$editor_id );

Expand Down Expand Up @@ -976,7 +976,7 @@ public function test_rest_autosave_draft_post_same_author_with_rtc() {
* a parent should create a revision instead of updating the page directly.
*/
public function test_update_item_draft_page_with_parent_with_rtc() {
add_filter( 'pre_option_wp_enable_real_time_collaboration', '__return_true' );
add_filter( 'pre_option_wp_collaboration_enabled', '__return_true' );

wp_set_current_user( self::$editor_id );
$request = new WP_REST_Request( 'POST', '/wp/v2/pages/' . self::$child_draft_page_id . '/autosaves' );
Expand Down
Loading
Loading