Skip to content

Commit

Permalink
Jetpack Sync: Use static vs self for calling 'get_setting' within 'Se…
Browse files Browse the repository at this point in the history
…ttings' class (#41238)

* Jetpack Sync Settings: Use static vs self for calling 'get_setting' within class

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12904054563

Upstream-Ref: Automattic/jetpack@95fa35b
  • Loading branch information
fgiannar authored and matticbot committed Jan 22, 2025
1 parent e17e0e4 commit de567de
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 178 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"automattic/jetpack-stats": "^0.15.0",
"automattic/jetpack-stats-admin": "^0.24.0",
"automattic/jetpack-status": "^5.0.2",
"automattic/jetpack-sync": "^4.4.0",
"automattic/jetpack-sync": "^4.4.1-alpha",
"automattic/jetpack-videopress": "^0.25.7",
"automattic/jetpack-waf": "^0.23.2",
"automattic/jetpack-wordads": "^0.4.6",
Expand Down
5 changes: 5 additions & 0 deletions jetpack_vendor/automattic/jetpack-sync/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.4.1-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

## [4.4.0] - 2025-01-20
### Added
- Add context for full sync. [#40930]
Expand Down Expand Up @@ -1374,6 +1378,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Packages: Move sync to a classmapped package

[4.4.1-alpha]: https://github.com/Automattic/jetpack-sync/compare/v4.4.0...v4.4.1-alpha
[4.4.0]: https://github.com/Automattic/jetpack-sync/compare/v4.3.0...v4.4.0
[4.3.0]: https://github.com/Automattic/jetpack-sync/compare/v4.2.0...v4.3.0
[4.2.0]: https://github.com/Automattic/jetpack-sync/compare/v4.1.1...v4.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '4.4.0';
const PACKAGE_VERSION = '4.4.1-alpha';

const PACKAGE_SLUG = 'sync';

Expand Down
32 changes: 16 additions & 16 deletions jetpack_vendor/automattic/jetpack-sync/src/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Settings {
public static function get_settings() {
$settings = array();
foreach ( array_keys( self::$valid_settings ) as $setting ) {
$settings[ $setting ] = self::get_setting( $setting );
$settings[ $setting ] = static::get_setting( $setting );
}

return $settings;
Expand Down Expand Up @@ -350,7 +350,7 @@ public static function is_network_setting( $setting ) {
* @return string SQL WHERE clause.
*/
public static function get_blacklisted_post_types_sql() {
return 'post_type NOT IN (\'' . implode( '\', \'', array_map( 'esc_sql', self::get_setting( 'post_types_blacklist' ) ) ) . '\')';
return 'post_type NOT IN (\'' . implode( '\', \'', array_map( 'esc_sql', static::get_setting( 'post_types_blacklist' ) ) ) . '\')';
}

/**
Expand All @@ -365,7 +365,7 @@ public static function get_disallowed_post_types_structured() {
return array(
'post_type' => array(
'operator' => 'NOT IN',
'values' => array_map( 'esc_sql', self::get_setting( 'post_types_blacklist' ) ),
'values' => array_map( 'esc_sql', static::get_setting( 'post_types_blacklist' ) ),
),
);
}
Expand All @@ -380,7 +380,7 @@ public static function get_disallowed_post_types_structured() {
* @return string SQL WHERE clause.
*/
public static function get_blacklisted_taxonomies_sql() {
return "taxonomy NOT IN ('" . implode( "', '", array_map( 'esc_sql', self::get_setting( 'taxonomies_blacklist' ) ) ) . "')";
return "taxonomy NOT IN ('" . implode( "', '", array_map( 'esc_sql', static::get_setting( 'taxonomies_blacklist' ) ) ) . "')";
}

/**
Expand All @@ -393,7 +393,7 @@ public static function get_blacklisted_taxonomies_sql() {
* @return string SQL WHERE clause.
*/
public static function get_whitelisted_post_meta_sql() {
return 'meta_key IN (\'' . implode( '\', \'', array_map( 'esc_sql', self::get_setting( 'post_meta_whitelist' ) ) ) . '\')';
return 'meta_key IN (\'' . implode( '\', \'', array_map( 'esc_sql', static::get_setting( 'post_meta_whitelist' ) ) ) . '\')';
}

/**
Expand All @@ -408,7 +408,7 @@ public static function get_allowed_post_meta_structured() {
return array(
'meta_key' => array(
'operator' => 'IN',
'values' => array_map( 'esc_sql', self::get_setting( 'post_meta_whitelist' ) ),
'values' => array_map( 'esc_sql', static::get_setting( 'post_meta_whitelist' ) ),
),
);
}
Expand All @@ -425,7 +425,7 @@ public static function get_blacklisted_taxonomies_structured() {
return array(
'taxonomy' => array(
'operator' => 'NOT IN',
'values' => array_map( 'esc_sql', self::get_setting( 'taxonomies_blacklist' ) ),
'values' => array_map( 'esc_sql', static::get_setting( 'taxonomies_blacklist' ) ),
),
);
}
Expand All @@ -442,7 +442,7 @@ public static function get_allowed_taxonomies_structured() {
global $wp_taxonomies;

$allowed_taxonomies = array_keys( $wp_taxonomies );
$allowed_taxonomies = array_diff( $allowed_taxonomies, self::get_setting( 'taxonomies_blacklist' ) );
$allowed_taxonomies = array_diff( $allowed_taxonomies, static::get_setting( 'taxonomies_blacklist' ) );
return array(
'taxonomy' => array(
'operator' => 'IN',
Expand All @@ -461,7 +461,7 @@ public static function get_allowed_taxonomies_structured() {
* @return string SQL WHERE clause.
*/
public static function get_whitelisted_comment_meta_sql() {
return 'meta_key IN (\'' . implode( '\', \'', array_map( 'esc_sql', self::get_setting( 'comment_meta_whitelist' ) ) ) . '\')';
return 'meta_key IN (\'' . implode( '\', \'', array_map( 'esc_sql', static::get_setting( 'comment_meta_whitelist' ) ) ) . '\')';
}

/**
Expand All @@ -476,7 +476,7 @@ public static function get_allowed_comment_meta_structured() {
return array(
'meta_key' => array(
'operator' => 'IN',
'values' => array_map( 'esc_sql', self::get_setting( 'comment_meta_whitelist' ) ),
'values' => array_map( 'esc_sql', static::get_setting( 'comment_meta_whitelist' ) ),
),
);
}
Expand Down Expand Up @@ -573,7 +573,7 @@ public static function is_importing() {
* @return boolean Whether sync is enabled.
*/
public static function is_sync_enabled() {
return ! ( self::get_setting( 'disable' ) || self::get_setting( 'network_disable' ) );
return ! ( static::get_setting( 'disable' ) || static::get_setting( 'network_disable' ) );
}

/**
Expand Down Expand Up @@ -664,7 +664,7 @@ public static function set_is_sending( $is_sending ) {
* @return boolean Whether sync is enabled.
*/
public static function is_sender_enabled( $queue_id ) {
return (bool) self::get_setting( $queue_id . '_sender_enabled' );
return (bool) static::get_setting( $queue_id . '_sender_enabled' );
}

/**
Expand All @@ -676,7 +676,7 @@ public static function is_sender_enabled( $queue_id ) {
* @return boolean Whether sync is enabled.
*/
public static function is_checksum_enabled() {
return ! (bool) self::get_setting( 'checksum_disable' );
return ! (bool) static::get_setting( 'checksum_disable' );
}

/**
Expand All @@ -688,7 +688,7 @@ public static function is_checksum_enabled() {
* @return boolean Whether dedicated Sync flow is enabled.
*/
public static function is_dedicated_sync_enabled() {
return (bool) self::get_setting( 'dedicated_sync_enabled' );
return (bool) static::get_setting( 'dedicated_sync_enabled' );
}

/**
Expand All @@ -700,7 +700,7 @@ public static function is_dedicated_sync_enabled() {
* @return boolean Whether custom queue table is enabled.
*/
public static function is_custom_queue_table_enabled() {
return (bool) self::get_setting( 'custom_queue_table_enabled' );
return (bool) static::get_setting( 'custom_queue_table_enabled' );
}

/**
Expand All @@ -712,6 +712,6 @@ public static function is_custom_queue_table_enabled() {
* @return boolean Whether wpcom rest api is enabled.
*/
public static function is_wpcom_rest_api_enabled() {
return (bool) self::get_setting( 'wpcom_rest_api_enabled' );
return (bool) static::get_setting( 'wpcom_rest_api_enabled' );
}
}
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
),
'jetpack-sync' => array(
'path' => 'jetpack_vendor/automattic/jetpack-sync',
'ver' => '4.4.0',
'ver' => '4.4.1-alpha1737534132',
),
'jetpack-videopress-pkg' => array(
'path' => 'jetpack_vendor/automattic/jetpack-videopress',
Expand Down
Loading

0 comments on commit de567de

Please sign in to comment.