@@ 439-457 (lines=19) @@ | ||
436 | $callable_checksums = (array) \Jetpack_Options::get_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, array() ); |
|
437 | $has_changed = false; |
|
438 | // Only send the callables that have changed. |
|
439 | foreach ( $callables as $name => $value ) { |
|
440 | $checksum = $this->get_check_sum( $value ); |
|
441 | // Explicitly not using Identical comparison as get_option returns a string. |
|
442 | if ( ! is_null( $value ) && $this->should_send_callable( $callable_checksums, $name, $checksum ) ) { |
|
443 | /** |
|
444 | * Tells the client to sync a callable (aka function) to the server |
|
445 | * |
|
446 | * @since 4.2.0 |
|
447 | * |
|
448 | * @param string The name of the callable |
|
449 | * @param mixed The value of the callable |
|
450 | */ |
|
451 | do_action( 'jetpack_sync_callable', $name, $value ); |
|
452 | $callable_checksums[ $name ] = $checksum; |
|
453 | $has_changed = true; |
|
454 | } else { |
|
455 | $callable_checksums[ $name ] = $checksum; |
|
456 | } |
|
457 | } |
|
458 | if ( $has_changed ) { |
|
459 | \Jetpack_Options::update_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, $callable_checksums ); |
|
460 | } |
@@ 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 |