In performance tests, editing large documents in the site-editor suite (loading large-post.html) can cause performance tests in the site editor to time out with memory errors. Developed in: https://github.com/WordPress/wordpress-develop/pull/11181. Props alecgeatches, mukesh27. See #64622. Built from https://develop.svn.wordpress.org/trunk@61986 git-svn-id: http://core.svn.wordpress.org/trunk@61268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
37 lines
689 B
PHP
37 lines
689 B
PHP
<?php
|
|
/**
|
|
* Bootstraps collaborative editing.
|
|
*
|
|
* @package WordPress
|
|
* @since 7.0.0
|
|
*/
|
|
|
|
/**
|
|
* Injects the real-time collaboration setting into a global variable.
|
|
*
|
|
* @since 7.0.0
|
|
*
|
|
* @access private
|
|
*
|
|
* @global string $pagenow The filename of the current screen.
|
|
*/
|
|
function wp_collaboration_inject_setting() {
|
|
global $pagenow;
|
|
|
|
if ( ! get_option( 'wp_enable_real_time_collaboration' ) ) {
|
|
return;
|
|
}
|
|
|
|
// Disable real-time collaboration on the site editor.
|
|
$enabled = true;
|
|
if ( 'site-editor.php' === $pagenow ) {
|
|
$enabled = false;
|
|
}
|
|
|
|
wp_add_inline_script(
|
|
'wp-core-data',
|
|
'window._wpCollaborationEnabled = ' . wp_json_encode( $enabled ) . ';',
|
|
'after'
|
|
);
|
|
}
|