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

Add special page to import an entity #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucaswerkmeister
Copy link
Contributor

@lucaswerkmeister lucaswerkmeister commented May 23, 2017

Special:ImportEntity imports a single entity and then redirects to the imported entity.

Two new configuration options are added to provide a human-readable link to the remote Wikibase installation on the special page, in addition to the API URL that the extension needs to actually import the entity.

Importing statements does not work properly, since the page_props table is apparently not updated at all anymore once the first attempt to import statements is made. For now, the checkbox to import statements is disabled, and statements are never imported.

This commit is not yet ready for merging, since it currently includes two changes to EntityImporterFactory; the change from private to public might be necessary, but the commented-out toplevel statements probably have some better solution.


This is live on wikidata-constraints.wmflabs.org: https://wikidata-constraints.wmflabs.org/index.php/Special:ImportEntity

@lucaswerkmeister
Copy link
Contributor Author

I also just noticed that entity imports are done by an IP address (10.68.21.68 in the case of the test wiki mentioned above), not the user that used the special page. That’s fine for my test wiki, but I should also try to fix that before this can be merged.

lucaswerkmeister added a commit to lucaswerkmeister/WikibaseImport that referenced this pull request May 24, 2017
If the import script is run from the command line, there is no session,
and the edit is still credited to 127.0.0.1. However, if there is a
session – for example, if the import is run from a special page (filbertkm#25) –
this ensures that the correct user is used.
@lucaswerkmeister
Copy link
Contributor Author

On my local development wiki, I get an error (local entity not found in page_props) when importing with statements, so statements import is currently disabled. Ideally, that would be a checkbox on the form once that bug is fixed (or turns out to only affect my local wiki).

Not a local bug, happens on wikidata-constraints as well :( apparently, as soon as I import the first entity with statements, page_props no longer gets new rows, even on later imports without statements.

@lucaswerkmeister
Copy link
Contributor Author

PR updated – some general refactoring, and also a checkbox for importing statements (disabled so far, but at least this communicates that statements won’t be imported). Still live on wikidata-constraints.

@lucaswerkmeister
Copy link
Contributor Author

I just noticed that this bypasses all permission checks, since it uses EntityStore::saveEntity and not EditEntity::attemptSave. So this special page is definitely not suitable for any non-test environment in its current form.

lucaswerkmeister added a commit to lucaswerkmeister/WikibaseImport that referenced this pull request Apr 12, 2019
If the import script is run from the command line, there is no session,
and the edit is still credited to 127.0.0.1. However, if there is a
session – for example, if the import is run from a special page (filbertkm#25) –
this ensures that the correct user is used.
Special:ImportEntity imports a single entity and then redirects to the
imported entity.

Two new configuration options are added to provide a human-readable link
to the remote Wikibase installation on the special page, in addition to
the API URL that the extension needs to actually import the entity.

Importing statements does not work properly, since the page_props table
is apparently not updated at all anymore once the first attempt to
import statements is made. For now, the checkbox to import statements is
disabled, and statements are never imported.

This commit is not yet ready for merging, since it currently includes
two changes to EntityImporterFactory; the change from private to public
might be necessary, but the commented-out toplevel statements probably
have some better solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant