Page MenuHomePhabricator

Can't create an item redirect over existing item, if item has deleted revisions
Closed, ResolvedPublic

Description

If an Item exists and also has deleted revisions, we currently fail to redirect it, claiming "Could not create a new page. It already exists.".

See https://www.wikidata.org/w/index.php?title=MediaWiki_talk:Gadget-Merge.js&oldid=478063270#Error_merging_2

Event Timeline

Change 350087 had a related patch set uploaded (by Hoo man):
[mediawiki/extensions/Wikibase@master] Use Title::exists to find out whether a page exists

https://gerrit.wikimedia.org/r/350087

Can you please explain this tasks description in more detail? It says one can not create a redirect "if an Item has deleted revisions". If this sentence is true it means no redirect can be created, because all redirects are meant to replace deleted Items.

But what the patch https://gerrit.wikimedia.org/r/350087 does is the opposite. The old code did not allowed to create a redirect if there are no deleted revisions. So: o_O?

What I meant is that: You can't turn an Item into a redirect if it has one or more deleted revisions.

hoo renamed this task from Can't created an item redirect if item has deleted revisions to Can't created an item redirect over existing item, if item has deleted revisions.Apr 25 2017, 6:15 AM
hoo updated the task description. (Show Details)

If this is the problem, how does it help to remove an other check that is there to block creating redirects if there was no deleted revision? How can such a check do the opposite?

You latest comment on the patch helps. I still wonder.

The semantics of Title::isDeleted seem to be utterly broken. It does not say if a page is currently deleted, but if there was ever a revision deleted, and how much. Can we please deprecate this shit and rename it to hasDeletedRevisons or something?

thiemowmde triaged this task as High priority.
thiemowmde moved this task from incoming to in progress on the Wikidata board.
thiemowmde moved this task from Proposed to Review on the Wikidata-Former-Sprint-Board board.

The semantics of Title::isDeleted seem to be utterly broken. It does not say if a page is currently deleted, but if there was ever a revision deleted, and how much. Can we please deprecate this shit and rename it to hasDeletedRevisons or something?

Yes, that's the root of the problem here: Title::isDeleted is true (well an integer over 0) if there are deleted revisions for a page, no matter whether the page currently exists (which is very counter intuitive). Thus setting EDIT_NEW (which says we that only page creation is allowed) based on Title::isDeleted can lead to the problems described here.

@hoo Thanks for the explanation! So we need to check !exists && isDeleted.

WMDE-leszek renamed this task from Can't created an item redirect over existing item, if item has deleted revisions to Can't create an item redirect over existing item, if item has deleted revisions.May 2 2017, 11:51 AM

Change 351334 had a related patch set uploaded (by Thiemo Mättig (WMDE); owner: Thiemo Mättig (WMDE)):
[mediawiki/extensions/Wikibase@master] Avoid duplicate and optional code in CreateRedirectTest

https://gerrit.wikimedia.org/r/351334

Change 350087 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Redirect creation: Don't set EDIT_NEW on edit if the page exists

https://gerrit.wikimedia.org/r/350087

hoo removed a project: Patch-For-Review.
hoo moved this task from Review to Done on the Wikidata-Former-Sprint-Board board.

Will be fixed with the next deploy.

Change 351334 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Avoid duplicate and optional code in CreateRedirectTest

https://gerrit.wikimedia.org/r/351334