Skip to content

Commit

Permalink
Merge pull request #448 from GatherPress/mauteri-updates-1
Browse files Browse the repository at this point in the history
Clean up work to remove old breaking changes.
  • Loading branch information
mauteri authored Dec 18, 2023
2 parents d454721 + 27e7ff3 commit 7cec03d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 82 deletions.
81 changes: 0 additions & 81 deletions includes/core/classes/class-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ public function filter_plugin_action_links( array $actions ): array {
* @return void
*/
public function activate_gatherpress_plugin(): void {
$this->maybe_rename_blocks();
$this->maybe_rename_table();
$this->maybe_create_custom_table();
$this->add_online_event_term();

Expand Down Expand Up @@ -402,85 +400,6 @@ public function delete_event( int $post_id ): void {
);
}

/**
* Rename the attendees table to rsvps.
*
* @coverCoverageIgnore
*
* @todo Remove this code with 1.0.0; it's temporary to address a breaking change.
*
* This method renames the attendees table to rsvps, but it's intended as a temporary solution
* to handle a breaking change. Evaluate whether this code can be removed in the future.
*
* @since 1.0.0
*
* @return void
*/
public function maybe_rename_table(): void {
global $wpdb;

$new_table = sprintf( Rsvp::TABLE_FORMAT, $wpdb->prefix );
$old_table = sprintf( '%sgp_attendees', $wpdb->prefix );

// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$wpdb->query( "RENAME TABLE `$old_table` TO `$new_table`" );
}

/**
* Rename attendance blocks to RSVP blocks.
*
* @codeCoverageIgnore
*
* @todo Remove this code with 1.0.0; it's temporary to address a breaking change.
*
* This method scans and updates content for all posts of specified types, replacing
* occurrences of attendance-related blocks with RSVP-related blocks. It's recommended
* to review and potentially remove this code once the transition is complete.
*
* @since 1.0.0
*
* @return void
*/
public function maybe_rename_blocks(): void {
$posts = get_posts(
array(
'post_type' => array( Event::POST_TYPE, Venue::POST_TYPE ),
'numberposts' => -1,
'post_status' => 'any',
)
);

if ( $posts ) {
foreach ( $posts as $post ) {
$post->post_content = str_replace(
'wp:gatherpress/attendance-selector',
'wp:gatherpress/rsvp',
$post->post_content
);

$post->post_content = str_replace(
'wp:gatherpress/attendance-list',
'wp:gatherpress/rsvp-response',
$post->post_content
);

$post->post_content = str_replace(
'wp:gatherpress/event-venue',
'wp:gatherpress/venue',
$post->post_content
);

$post->post_content = str_replace(
'wp:gatherpress/venue-information',
'wp:gatherpress/venue',
$post->post_content
);

wp_update_post( $post );
}
}
}

/**
* Create a custom table if it doesn't exist for the main site or the current site in a network.
*
Expand Down
2 changes: 1 addition & 1 deletion includes/data/credits/credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
return array(
'0.26.0' => array(
'project-leaders' => array( 'mauteri', 'hrmervin' ),
'gatherpress-team' => array( 'jmarx', 'meaganhanes', 'pbrocks' ),
'gatherpress-team' => array( 'jmarx', 'meaganhanes', 'pbrocks', 'patricia70' ),
'contributors' => array( 'hauvong', 'phoopee3', 'cameronbarrett', 'prashantabellad', 'courane01', 'newyorkerlaura', 'calebthedev', 'prayagm' ),
),
);
13 changes: 13 additions & 0 deletions includes/data/credits/latest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@
96 => '//www.gravatar.com/avatar/b6d92ca42584e8419dffc636e809321a?s=96&r=g&d=mm',
),
),
3 =>
array (
'id' => 7586875,
'name' => 'Patricia BT',
'link' => 'https://profiles.wordpress.org/author/patricia70/',
'slug' => 'patricia70',
'avatar_urls' =>
array (
24 => '//www.gravatar.com/avatar/eff55f7591ee0908b90dd1724c290d0a?s=24&r=g&d=mm',
48 => '//www.gravatar.com/avatar/eff55f7591ee0908b90dd1724c290d0a?s=48&r=g&d=mm',
96 => '//www.gravatar.com/avatar/eff55f7591ee0908b90dd1724c290d0a?s=96&r=g&d=mm',
),
),
),
'contributors' =>
array (
Expand Down

0 comments on commit 7cec03d

Please sign in to comment.