|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | /** |
10 | | - * Determines whether real-time collaboration is enabled. |
| 10 | + * Checks whether real-time collaboration is enabled. |
11 | 11 | * |
12 | | - * If the WP_ALLOW_COLLABORATION constant is false, |
13 | | - * collaboration is always disabled regardless of the database option. |
14 | | - * Otherwise, falls back to the 'wp_collaboration_enabled' option. |
| 12 | + * The feature requires both the site option and the database schema |
| 13 | + * introduced in db_version 61841. |
15 | 14 | * |
16 | 15 | * @since 7.0.0 |
17 | 16 | * |
18 | | - * @return bool Whether real-time collaboration is enabled. |
| 17 | + * @return bool True if collaboration is enabled, false otherwise. |
19 | 18 | */ |
20 | 19 | function wp_is_collaboration_enabled() { |
21 | | - return ( |
22 | | - wp_is_collaboration_allowed() && |
23 | | - (bool) get_option( 'wp_collaboration_enabled' ) |
24 | | - ); |
25 | | -} |
26 | | - |
27 | | -/** |
28 | | - * Determines whether real-time collaboration is allowed. |
29 | | - * |
30 | | - * If the WP_ALLOW_COLLABORATION constant is false, |
31 | | - * collaboration is not allowed and cannot be enabled. |
32 | | - * The constant defaults to true, unless the WP_ALLOW_COLLABORATION |
33 | | - * environment variable is set to string "false". |
34 | | - * |
35 | | - * @since 7.0.0 |
36 | | - * |
37 | | - * @return bool Whether real-time collaboration is enabled. |
38 | | - */ |
39 | | -function wp_is_collaboration_allowed() { |
40 | | - if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) { |
41 | | - $env_value = getenv( 'WP_ALLOW_COLLABORATION' ); |
42 | | - if ( false === $env_value ) { |
43 | | - // Environment variable is not defined, default to allowing collaboration. |
44 | | - define( 'WP_ALLOW_COLLABORATION', true ); |
45 | | - } else { |
46 | | - /* |
47 | | - * Environment variable is defined, let's confirm it is actually set to |
48 | | - * "true" as it may still have a string value "false" – the preceeding |
49 | | - * `if` branch only tests for the boolean `false`. |
50 | | - */ |
51 | | - define( 'WP_ALLOW_COLLABORATION', 'true' === $env_value ); |
52 | | - } |
53 | | - } |
54 | | - |
55 | | - return WP_ALLOW_COLLABORATION; |
| 20 | + return get_option( 'wp_enable_real_time_collaboration' ) |
| 21 | + && get_option( 'db_version' ) >= 61841; |
56 | 22 | } |
57 | 23 |
|
58 | 24 | /** |
|
0 commit comments