diff options
Diffstat (limited to 'plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php')
-rw-r--r-- | plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php | 83 |
1 files changed, 71 insertions, 12 deletions
diff --git a/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php b/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php index 69b7c7a8..c6ff4632 100644 --- a/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php +++ b/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php @@ -7,10 +7,7 @@ namespace Automattic\Jetpack\Sync; -require_once JETPACK__PLUGIN_DIR . 'modules/sso/class.jetpack-sso-helpers.php'; - use Automattic\Jetpack\Status; -use Automattic\Jetpack\Sync\Functions; /** * Just some defaults that we share with the server. @@ -283,11 +280,6 @@ class Defaults { 'shortcodes' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_shortcodes' ), 'rest_api_allowed_post_types' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'rest_api_allowed_post_types' ), 'rest_api_allowed_public_metadata' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'rest_api_allowed_public_metadata' ), - 'sso_is_two_step_required' => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ), - 'sso_should_hide_login_form' => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ), - 'sso_match_by_email' => array( 'Jetpack_SSO_Helpers', 'match_by_email' ), - 'sso_new_user_override' => array( 'Jetpack_SSO_Helpers', 'new_user_override' ), - 'sso_bypass_default_login_form' => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ), 'wp_version' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'wp_version' ), 'get_plugins' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_plugins' ), 'get_plugins_action_links' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_plugins_action_links' ), @@ -346,6 +338,19 @@ class Defaults { * @return array Whitelist of callables allowed to be managed via the JSON API. */ public static function get_callable_whitelist() { + $default = self::$default_callable_whitelist; + + if ( defined( 'JETPACK__PLUGIN_DIR' ) && include_once JETPACK__PLUGIN_DIR . 'modules/sso/class.jetpack-sso-helpers.php' ) { + $sso_helpers = array( + 'sso_is_two_step_required' => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ), + 'sso_should_hide_login_form' => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ), + 'sso_match_by_email' => array( 'Jetpack_SSO_Helpers', 'match_by_email' ), + 'sso_new_user_override' => array( 'Jetpack_SSO_Helpers', 'new_user_override' ), + 'sso_bypass_default_login_form' => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ), + ); + $default = array_merge( $default, $sso_helpers ); + } + /** * Filter the list of callables that are manageable via the JSON API. * @@ -355,7 +360,7 @@ class Defaults { * * @param array The default list of callables. */ - return apply_filters( 'jetpack_sync_callable_whitelist', self::$default_callable_whitelist ); + return apply_filters( 'jetpack_sync_callable_whitelist', $default ); } /** @@ -1018,14 +1023,14 @@ class Defaults { * * @var int Number of seconds. */ - public static $default_sync_wait_threshold = 5; + public static $default_sync_wait_threshold = 10; /** * Default wait between attempting to continue a full sync via requests. * * @var int Number of seconds. */ - public static $default_enqueue_wait_time = 10; + public static $default_enqueue_wait_time = 1; /** * Maximum queue size. @@ -1130,6 +1135,13 @@ class Defaults { public static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue. /** + * Default max time for sending in immediate mode. + * + * @var float Number of Seconds + */ + public static $default_full_sync_send_duration = 9; + + /** * Defaul for time between syncing callables. * * @var int Number of seconds. @@ -1154,7 +1166,7 @@ class Defaults { * * @var int Number of seconds. */ - public static $default_cron_sync_time_limit = 30; // 30 seconds. + public static $default_cron_sync_time_limit = 4 * MINUTE_IN_SECONDS; /** * Default for number of term relationship items sent in an full sync item. @@ -1176,4 +1188,51 @@ class Defaults { * @var int 1 for true. */ public static $default_full_sync_sender_enabled = 1; // Should send full sync items. + + /** + * Default Full Sync config + * + * @var array list of module names. + */ + public static $default_full_sync_config = array( + 'constants' => 1, + 'functions' => 1, + 'options' => 1, + 'updates' => 1, + 'themes' => 1, + 'users' => 1, + 'terms' => 1, + 'posts' => 1, + 'comments' => 1, + 'term_relationships' => 1, + ); + + /** + * Default Full Sync max objects to send on a single request. + * + * @var array list of module => max. + */ + public static $default_full_sync_limits = array( + 'users' => array( + 'chunk_size' => 100, + 'max_chunks' => 10, + ), + 'terms' => array( + 'chunk_size' => 1000, + 'max_chunks' => 10, + ), + 'posts' => array( + 'chunk_size' => 100, + 'max_chunks' => 1, + ), + 'comments' => array( + 'chunk_size' => 100, + 'max_chunks' => 10, + ), + 'term_relationships' => array( + 'chunk_size' => 1000, + 'max_chunks' => 10, + ), + ); + } |