summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2020-02-17 11:55:41 -0500
committerAnthony G. Basile <blueness@gentoo.org>2020-02-17 11:55:41 -0500
commitdd791649a46b33fd7d5ea388fa42f1cf99c82884 (patch)
treeddc745e49425b01732343da42a19018b7dd737c4 /plugins/jetpack/vendor/automattic/jetpack-sync/src/modules/class-constants.php
parentRemove extraneous .zip (diff)
downloadblogs-gentoo-dd791649a46b33fd7d5ea388fa42f1cf99c82884.tar.gz
blogs-gentoo-dd791649a46b33fd7d5ea388fa42f1cf99c82884.tar.bz2
blogs-gentoo-dd791649a46b33fd7d5ea388fa42f1cf99c82884.zip
update jetpack 8.2.1
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/vendor/automattic/jetpack-sync/src/modules/class-constants.php')
-rw-r--r--plugins/jetpack/vendor/automattic/jetpack-sync/src/modules/class-constants.php49
1 files changed, 43 insertions, 6 deletions
diff --git a/plugins/jetpack/vendor/automattic/jetpack-sync/src/modules/class-constants.php b/plugins/jetpack/vendor/automattic/jetpack-sync/src/modules/class-constants.php
index d4fecb3b..b95c3bc0 100644
--- a/plugins/jetpack/vendor/automattic/jetpack-sync/src/modules/class-constants.php
+++ b/plugins/jetpack/vendor/automattic/jetpack-sync/src/modules/class-constants.php
@@ -112,18 +112,19 @@ class Constants extends Module {
*
* @access public
*
- * @param array $config Full sync configuration for this sync module.
+ * @param array $config Full sync configuration for this sync module.
* @param int $max_items_to_enqueue Maximum number of items to enqueue.
- * @param boolean $state True if full sync has finished enqueueing this module, false otherwise.
+ * @param boolean $state True if full sync has finished enqueueing this module, false otherwise.
+ *
* @return array Number of actions enqueued, and next module state.
*/
public function enqueue_full_sync_actions( $config, $max_items_to_enqueue, $state ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
/**
* Tells the client to sync all constants to the server
*
- * @since 4.2.0
- *
* @param boolean Whether to expand constants (should always be true)
+ *
+ * @since 4.2.0
*/
do_action( 'jetpack_full_sync_constants', true );
@@ -132,11 +133,31 @@ class Constants extends Module {
}
/**
+ * Send the constants actions for full sync.
+ *
+ * @access public
+ *
+ * @param array $config Full sync configuration for this sync module.
+ * @param int $send_until The timestamp until the current request can send.
+ * @param array $state This module Full Sync status.
+ *
+ * @return array This module Full Sync status.
+ */
+ public function send_full_sync_actions( $config, $send_until, $state ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
+ // we call this instead of do_action when sending immediately.
+ $this->send_action( 'jetpack_full_sync_constants', array( true ) );
+
+ // The number of actions enqueued, and next module state (true == done).
+ return array( 'finished' => true );
+ }
+
+ /**
* Retrieve an estimated number of actions that will be enqueued.
*
* @access public
*
* @param array $config Full sync configuration for this sync module.
+ *
* @return array Number of items yet to be enqueued.
*/
public function estimate_full_sync_actions( $config ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
@@ -180,10 +201,10 @@ class Constants extends Module {
/**
* Tells the client to sync a constant to the server
*
- * @since 4.2.0
- *
* @param string The name of the constant
* @param mixed The value of the constant
+ *
+ * @since 4.2.0
*/
do_action( 'jetpack_sync_constant', $name, $value );
$constants_checksums[ $name ] = $checksum;
@@ -204,6 +225,7 @@ class Constants extends Module {
*/
public function get_all_constants() {
$constants_whitelist = $this->get_constants_whitelist();
+
return array_combine(
$constants_whitelist,
array_map( array( $this, 'get_constant' ), $constants_whitelist )
@@ -217,6 +239,7 @@ class Constants extends Module {
* @access private
*
* @param string $constant Constant name.
+ *
* @return mixed Return value of the constant.
*/
private function get_constant( $constant ) {
@@ -231,6 +254,7 @@ class Constants extends Module {
* @access public
*
* @param array $args The hook parameters.
+ *
* @return array $args The hook parameters.
*/
public function expand_constants( $args ) {
@@ -241,8 +265,21 @@ class Constants extends Module {
$constants_checksums[ $name ] = $this->get_check_sum( $value );
}
update_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, $constants_checksums );
+
return $constants;
}
+
return $args;
}
+
+ /**
+ * Return Total number of objects.
+ *
+ * @param array $config Full Sync config.
+ *
+ * @return int total
+ */
+ public function total( $config ) {
+ return count( $this->get_constants_whitelist() );
+ }
}