Skip to content
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

Testing an existence of a subobject and then creating it if non-existent #4786

Closed
jaideraf opened this issue May 24, 2020 · 2 comments
Closed
Labels

Comments

@jaideraf
Copy link
Member

jaideraf commented May 24, 2020

Setup and configuration

  • SMW version: 3.2.0-alpha
  • MW version: 1.34.1
  • PHP version: 7.2.24
  • MariaDB: 10.1.44

Question

This is a question, not an issue.
If I need to test an existence of a subobject and then creating it if non-existent, what should I have to do? Is it a paradox when I purge de page? Is there a better aproach?

I have an aways mutating result when I put the following code.
See it on sandbox: Click on "More > Refresh" more than once and look at the "exists" and "does not exist" messages.

{{#if: {{#show:{{FULLPAGENAME}}#Name
|?Has text
|format=plainlist
|link=none
|headers=hide
|mainlabel=-
}} | subobject exists (it won't create it) | subobject does not exist (now creating it)

{{#subobject:Name|Has text=This is a test, subobject is created}}

}}

Steps to reproduce

See: https://sandbox.semantic-mediawiki.org/wiki/Issue/4786

@kghbln
Copy link
Member

kghbln commented May 25, 2020

Good question. In this case, since it is a named subobject, unconditionally creating it should probably work but this is not the answer. I suspect that I cannot be done out of the box.

@jaideraf
Copy link
Member Author

jaideraf commented Jun 16, 2020

Closing it because I believe there is nothing to do to make this work right now. James already answered many times [0] about how MediaWiki handle the processing>storage>retrieve of queries that is done in the same page (edit, revision) of the storage. So I guess this is somewhat expected.

[0] #2375

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants