Page MenuHomePhabricator

Remove uses of Title::moveTo
Closed, ResolvedPublic

Description

Title::moveTo has been deprecated since 1.25, and has been hard-deprecated in 1.34. Its uses should now be removed.

All callers (in core and wmf-maintained extensions; codesearch) should be gone by now. If there are any left, they must be changed to to use MovePage instead.

Details

Related Gerrit Patches:
mediawiki/extensions/UserMerge : masterReplace deprecated Title::moveTo with MovePage method
mediawiki/extensions/UserMerge : mastercomponent: Refactofing of Title::moveTo to MovePageFactory->MovePage
mediawiki/extensions/WikimediaMaintenance : masterReplace deprecated Title::moveTo with MovePage method
mediawiki/extensions/LiquidThreads : masterReplace deprecated Title::moveTo with MovePage method
mediawiki/extensions/Wikibase : masterRe-apply: Use MovePage instead of deprecated Title::moveTo
mediawiki/extensions/Wikibase : masterUse MovePage instead of deprecated Title::moveTo

Event Timeline

Restricted Application removed a project: Patch-For-Review. · View Herald TranscriptApr 26 2019, 10:36 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 504545 had a related patch set uploaded (by simetrical; owner: simetrical):
[mediawiki/extensions/Wikibase@master] Use MovePage instead of deprecated Title::moveTo

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

That caveat should be removed by https://gerrit.wikimedia.org/r/504336 when that lands.

Change 504545 merged by Daniel Kinzler:
[mediawiki/extensions/Wikibase@master] Use MovePage instead of deprecated Title::moveTo

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

Change 507861 had a related patch set uploaded (by Jforrester; owner: simetrical):
[mediawiki/extensions/Wikibase@master] Re-apply: Use MovePage instead of deprecated Title::moveTo

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

Change 507861 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Re-apply: Use MovePage instead of deprecated Title::moveTo

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

Ammarpad updated the task description. (Show Details)Nov 28 2019, 5:08 PM
Aklapper removed a project: Google-Code-in-2019.EditedDec 5 2019, 5:27 PM

It is unclear to me if this task is about MW core (one patch mentioned), or random unknown MW extensions (one patch mentioned), or a mess of both, as zero code repository project tags have been added to this task.

Restricted Application added a project: User-DannyS712. · View Herald TranscriptDec 10 2019, 5:48 AM
DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.Dec 10 2019, 5:48 AM

Change 560349 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/LiquidThreads@master] Replace deprecated Title::moveTo with MovePage method

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

Change 560349 abandoned by DannyS712:
Replace deprecated Title::moveTo with MovePage method

Reason:
Already removed in I6404c92407ce8ab910bcf0e70aebfd15c5cb429d

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

Change 560350 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/WikimediaMaintenance@master] Replace deprecated Title::moveTo with MovePage method

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

Change 560351 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/UserMerge@master] Replace deprecated Title::moveTo with MovePage method

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

Change 560350 merged by jenkins-bot:
[mediawiki/extensions/WikimediaMaintenance@master] Replace deprecated Title::moveTo with MovePage method

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

Restricted Application added a project: Wikidata. · View Herald TranscriptDec 28 2019, 11:13 AM
daniel added a subscriber: daniel.Jan 14 2020, 1:16 PM

The sole remaining issue here is to add a test for UserMerge that tests the page move, so we can merge the respective patch with confidence:

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UserMerge/+/560351

DannyS712 added a subscriber: Peter.ovchyn.

The sole remaining issue here is to add a test for UserMerge that tests the page move, so we can merge the respective patch with confidence:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UserMerge/+/560351

I've still been working on this, not sure why I was removed as the assignee...
Added a test to the patch

Change 566838 had a related patch set uploaded (by Art-Baltai; owner: Art-Baltai):
[mediawiki/extensions/UserMerge@master] component: Refactofing of Title::moveTo to MovePageFactory->MovePage

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

Oh, sorry, @DannyS712 :)
We get the same code, so it looks correct.

Also, I added an example for global invoke
https://3v4l.org/MpY9D
https://3v4l.org/hjYJo
link is temporary

Change 566838 abandoned by Art-Baltai:
component: Refactofing of Title::moveTo to MovePageFactory->MovePage

Reason:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UserMerge/ /560351

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

I close my patch https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UserMerge/+/566838

note about global var

https://3v4l.org/MpY9D

https://3v4l.org/hjYJo

<?php

class Orig {};
class Override {};
$instance = new Orig;
function test() {
    global $instance;
    $newInstance = new Override;
    $instance=$newInstance;
    check();
}
function check() {
    global $instance;
    var_dump($instance);
}
test();

Result:

$instance = new Override;

so Title::moveTo will use $wgUser, not $oldUser

Yes, since Title::moveTo defaults to $wgUser, I left the behavior the same by passing $wgUser for the move call.

Change 560351 merged by jenkins-bot:
[mediawiki/extensions/UserMerge@master] Replace deprecated Title::moveTo with MovePage method

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

daniel renamed this task from Remove uses of Title::moveTo to Remove Title::moveTo.Jan 24 2020, 10:22 AM
daniel updated the task description. (Show Details)
DannyS712 renamed this task from Remove Title::moveTo to Remove uses of Title::moveTo.Wed, Jan 29, 8:45 PM
DannyS712 closed this task as Resolved.
DannyS712 updated the task description. (Show Details)
Art-Baltai reopened this task as Open.Thu, Jan 30, 12:28 PM
Art-Baltai claimed this task.
Art-Baltai closed this task as Resolved.Thu, Jan 30, 12:34 PM
Art-Baltai reassigned this task from Art-Baltai to DannyS712.