Skip to content

Commit

Permalink
Boost: Always save the default cornerstone pages (#40003)
Browse files Browse the repository at this point in the history
  • Loading branch information
haqadn authored Nov 1, 2024
1 parent 47721f7 commit 3a7b766
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
11 changes: 6 additions & 5 deletions projects/plugins/boost/app/data-sync/Cornerstone_Pages_Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ public function __construct( $option_key ) {
$this->option_key = 'jetpack_boost_ds_' . $option_key;
}

public function get( $fallback_value = false ) {
if ( $fallback_value !== false ) {
$urls = get_option( $this->option_key, $fallback_value );
} else {
$urls = get_option( $this->option_key );
public function get( $fallback_value = array() ) {
$urls = get_option( $this->option_key, array() );

if ( empty( $urls ) && ! empty( $fallback_value ) ) {
$urls = $fallback_value;
$this->set( $urls );
}

return array_map( array( $this, 'transform_to_absolute' ), $urls );
Expand Down
2 changes: 1 addition & 1 deletion projects/plugins/boost/app/lib/Cornerstone_Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function setup() {
}

public function register_ds_stores() {
$schema = Schema::as_array( Schema::as_string() )->fallback( self::default_pages() );
$schema = Schema::as_array( Schema::as_string() )->fallback( $this->default_pages() );
jetpack_boost_register_option( 'cornerstone_pages_list', $schema, new Cornerstone_Pages_Entry( 'cornerstone_pages_list' ) );
jetpack_boost_register_readonly_option( 'cornerstone_pages_properties', array( $this, 'get_properties' ) );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Change to an unreleased feature


0 comments on commit 3a7b766

Please sign in to comment.