New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some options not mapped to VPID #819

Closed
pavelevap opened this Issue Mar 24, 2016 · 7 comments

Comments

Projects
None yet
4 participants
@pavelevap
Copy link
Contributor

pavelevap commented Mar 24, 2016

Some options from wp_options are not mapped to VPID:

  • default_category
  • default_email_category
  • sticky_posts (serialized array of sticky posts IDs)
  • {$taxonomy}_children (not sure about it, maybe used only for internal caching and not needed)
@octopuss

This comment has been minimized.

Copy link
Contributor

octopuss commented Mar 28, 2016

I've added sticky_posts: post to option in wordpress-schema.yml as value-reference. I know that it might not be that easy because the value is stored as serialized array for sticky_posts option. When I try to make some post sticky, VersionPress tries to find the reference to the parent post, but fails early in this condition :

if ($entity[$valueColumn] == 0) {

I don't know why the condition is there but it get's evaluated to true for string value (e.g. "a:3:{i:0;i:3;i:1;i:5;i:2;i:7;}") Maybe @JanVoracek could explain this why the condition is there.

@octopuss

This comment has been minimized.

Copy link
Contributor

octopuss commented Mar 28, 2016

I've also found that default_link_category is changed if you perform first save on Settings->Writing page of WordPress. I think we can map it to vp_id even though links are not used any more (or are they ?)

octopuss added a commit that referenced this issue Mar 28, 2016

@octopuss

This comment has been minimized.

Copy link
Contributor

octopuss commented Mar 29, 2016

@pavelevap do you know how to create {$taxonomy}_children so i can test it ?

Thank you.

@pavelevap

This comment has been minimized.

Copy link
Contributor

pavelevap commented Mar 29, 2016

@octopuss: When you create for example child category, there will be option category_children in wp_options table with following value: a:1:{i:1;a:1:{i:0;i:5;}} (ID = 1 is parent category, ID = 5 is child category).

@octopuss

This comment has been minimized.

Copy link
Contributor

octopuss commented Mar 30, 2016

VersionPress is currently not able to track (replace id with vp_id) options containing serialized string as their value, if the value is reference to another WordPress entity. We need to create separate issue for that. VersionPress should be able to determine if the reference (not only for option entity, but for all entities) is connected with single entity or contains serialized array of entities. (@borekb: will you do that as we spoke about it yesterday, or should I?)

It means that from this issue only default_link_category, default_category and default_email_category is/will be mirrored correctly.

@borekb

This comment has been minimized.

Copy link
Member

borekb commented Mar 30, 2016

@octopuss I've created #829 for that.

@JanVoracek

This comment has been minimized.

Copy link
Member

JanVoracek commented Mar 31, 2016

Re condition for sticky_posts: The condition should be probably something like $entity[$valueColumn] === 0 || $entity[$valueColumn] === '0' or something like that. WordPress uses 0 as a 'null reference'. We should probably fix it in #829.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment