@@ 197-214 (lines=18) @@ | ||
194 | ||
195 | $constants_checksums = (array) get_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, array() ); |
|
196 | ||
197 | foreach ( $constants as $name => $value ) { |
|
198 | $checksum = $this->get_check_sum( $value ); |
|
199 | // Explicitly not using Identical comparison as get_option returns a string. |
|
200 | if ( ! $this->still_valid_checksum( $constants_checksums, $name, $checksum ) && ! is_null( $value ) ) { |
|
201 | /** |
|
202 | * Tells the client to sync a constant to the server |
|
203 | * |
|
204 | * @param string The name of the constant |
|
205 | * @param mixed The value of the constant |
|
206 | * |
|
207 | * @since 4.2.0 |
|
208 | */ |
|
209 | do_action( 'jetpack_sync_constant', $name, $value ); |
|
210 | $constants_checksums[ $name ] = $checksum; |
|
211 | } else { |
|
212 | $constants_checksums[ $name ] = $checksum; |
|
213 | } |
|
214 | } |
|
215 | update_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, $constants_checksums ); |
|
216 | } |
|
217 |
@@ 473-491 (lines=19) @@ | ||
470 | $callable_checksums = (array) \Jetpack_Options::get_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, array() ); |
|
471 | $has_changed = false; |
|
472 | // Only send the callables that have changed. |
|
473 | foreach ( $callables as $name => $value ) { |
|
474 | $checksum = $this->get_check_sum( $value ); |
|
475 | // Explicitly not using Identical comparison as get_option returns a string. |
|
476 | if ( ! is_null( $value ) && $this->should_send_callable( $callable_checksums, $name, $checksum ) ) { |
|
477 | /** |
|
478 | * Tells the client to sync a callable (aka function) to the server |
|
479 | * |
|
480 | * @since 4.2.0 |
|
481 | * |
|
482 | * @param string The name of the callable |
|
483 | * @param mixed The value of the callable |
|
484 | */ |
|
485 | do_action( 'jetpack_sync_callable', $name, $value ); |
|
486 | $callable_checksums[ $name ] = $checksum; |
|
487 | $has_changed = true; |
|
488 | } else { |
|
489 | $callable_checksums[ $name ] = $checksum; |
|
490 | } |
|
491 | } |
|
492 | if ( $has_changed ) { |
|
493 | \Jetpack_Options::update_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, $callable_checksums ); |
|
494 | } |