| @@ 395-413 (lines=19) @@ | ||
| 392 | $callable_checksums = (array) \Jetpack_Options::get_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, array() ); |
|
| 393 | $has_changed = false; |
|
| 394 | // Only send the callables that have changed. |
|
| 395 | foreach ( $callables as $name => $value ) { |
|
| 396 | $checksum = $this->get_check_sum( $value ); |
|
| 397 | // Explicitly not using Identical comparison as get_option returns a string. |
|
| 398 | if ( ! is_null( $value ) && $this->should_send_callable( $callable_checksums, $name, $checksum ) ) { |
|
| 399 | /** |
|
| 400 | * Tells the client to sync a callable (aka function) to the server |
|
| 401 | * |
|
| 402 | * @since 4.2.0 |
|
| 403 | * |
|
| 404 | * @param string The name of the callable |
|
| 405 | * @param mixed The value of the callable |
|
| 406 | */ |
|
| 407 | do_action( 'jetpack_sync_callable', $name, $value ); |
|
| 408 | $callable_checksums[ $name ] = $checksum; |
|
| 409 | $has_changed = true; |
|
| 410 | } else { |
|
| 411 | $callable_checksums[ $name ] = $checksum; |
|
| 412 | } |
|
| 413 | } |
|
| 414 | if ( $has_changed ) { |
|
| 415 | \Jetpack_Options::update_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, $callable_checksums ); |
|
| 416 | } |
|
| @@ 176-193 (lines=18) @@ | ||
| 173 | ||
| 174 | $constants_checksums = (array) get_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, array() ); |
|
| 175 | ||
| 176 | foreach ( $constants as $name => $value ) { |
|
| 177 | $checksum = $this->get_check_sum( $value ); |
|
| 178 | // Explicitly not using Identical comparison as get_option returns a string. |
|
| 179 | if ( ! $this->still_valid_checksum( $constants_checksums, $name, $checksum ) && ! is_null( $value ) ) { |
|
| 180 | /** |
|
| 181 | * Tells the client to sync a constant to the server |
|
| 182 | * |
|
| 183 | * @since 4.2.0 |
|
| 184 | * |
|
| 185 | * @param string The name of the constant |
|
| 186 | * @param mixed The value of the constant |
|
| 187 | */ |
|
| 188 | do_action( 'jetpack_sync_constant', $name, $value ); |
|
| 189 | $constants_checksums[ $name ] = $checksum; |
|
| 190 | } else { |
|
| 191 | $constants_checksums[ $name ] = $checksum; |
|
| 192 | } |
|
| 193 | } |
|
| 194 | update_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, $constants_checksums ); |
|
| 195 | } |
|
| 196 | ||