Skip to content

Feature/meta sync#36

Closed
phatsk wants to merge 10 commits intothemarcusbattle:masterfrom
phatsk:feature/meta-sync
Closed

Feature/meta sync#36
phatsk wants to merge 10 commits intothemarcusbattle:masterfrom
phatsk:feature/meta-sync

Conversation

@phatsk
Copy link
Copy Markdown
Collaborator

@phatsk phatsk commented Feb 8, 2018

This PR incorporates #35

The intent of this PR is to allow the ability to sync meta fields for posts and attachments instead of the entire post object.

This could be useful in situations where metadata is backfilled or updated on the source site, but we don't need to resync all posts completely.

@phatsk phatsk added the feature label Feb 8, 2018
@phatsk phatsk self-assigned this Feb 8, 2018
Comment thread includes/class-api.php Outdated
return $this->fix_term_relationships( $local_post['ID'], $post_args );
}

if ( ! empty( $this->ps_meta_repair_fields ) ) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens usually if this is empty? Can we reverse the condition to remove a level of nesting to make this block easier to read/

Comment thread includes/class-api.php Outdated
return false;
}

if ( ! empty( $this->ps_meta_repair_fields ) ) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as previous.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way both of these methods is structured doesn't allow us to reverse this just yet. It could at some point, but right now these "short-circuit" the login in the enclosing method and return early, otherwise the functions continue and do a lot of other work.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment still shows for the similar line, however this is moved out from where it was earlier.

Comment thread includes/class-api.php Outdated
$meta_result = array();

foreach ( $post_args['meta_input'] as $field => $value ) {
if ( false === strpos( $field, 'press_sync_' ) && ! in_array( $field, $this->ps_meta_repair_fields ) ) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I was John L., I'd be asking whether we can put this if condition into a method with a more easily understood name so it better explains what's being processed. There's a lot of mental overhead here to figure out what we're checking.

@phatsk
Copy link
Copy Markdown
Collaborator Author

phatsk commented Feb 14, 2018

This has been superceded by #41 and is now moot.

@phatsk phatsk closed this Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants