-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add WP_ALLOW_COLLABORATION constant #11311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
3041494
6727bfb
7d114c8
c77ced1
9bd0e60
72f9195
be03ad0
c76e32b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,25 @@ | |
| * @since 7.0.0 | ||
| */ | ||
|
|
||
| /** | ||
| * Determines whether real-time collaboration is enabled. | ||
| * | ||
| * If the WP_DISABLE_COLLABORATION constant is defined and true, | ||
| * collaboration is always disabled regardless of the database option. | ||
| * Otherwise, falls back to the 'wp_collaboration_enabled' option. | ||
|
Comment on lines
+12
to
+14
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a potential edge case to verify here: if Can we verify that this function can't be called before the constant is defined? If we can't verify this, or we found a way to call
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constant is defined in
function wp_is_collaboration_enabled() {
if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) {
$env_value = getenv( 'WP_ALLOW_COLLABORATION' );
if ( false !== $env_value ) {
define( 'WP_ALLOW_COLLABORATION', 'true' === $env_value );
} else {
// Environment variable is not defined, default to true.
define( 'WP_ALLOW_COLLABORATION', true );
}
}
if ( ! WP_ALLOW_COLLABORATION ) {
return false
}
return (bool) get_option( 'wp_collaboration_enabled' );
}Which would be fine with me. There's a precedence of a similar behavior in kses.php:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest we keep this part as it is for beta6 and revisit it in RC1 cc @ellatrix
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirming that this makes sense to me 👍
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this, I hadn't noticed the order of operations. Of the two suggestions I think defining the constant in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @peterwilsoncc I started a new PR for that here: #11333 |
||
| * | ||
| * @since 7.0.0 | ||
| * | ||
| * @return bool Whether real-time collaboration is enabled. | ||
| */ | ||
| function wp_is_collaboration_enabled() { | ||
| if ( defined( 'WP_DISABLE_COLLABORATION' ) && WP_DISABLE_COLLABORATION ) { | ||
| return false; | ||
| } | ||
|
|
||
| return (bool) get_option( 'wp_collaboration_enabled' ); | ||
| } | ||
|
|
||
| /** | ||
| * Injects the real-time collaboration setting into a global variable. | ||
| * | ||
|
|
@@ -18,7 +37,7 @@ | |
| function wp_collaboration_inject_setting() { | ||
| global $pagenow; | ||
|
|
||
| if ( ! (bool) get_option( 'wp_collaboration_enabled' ) ) { | ||
| if ( ! wp_is_collaboration_enabled() ) { | ||
| return; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.