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.

Event Timeline

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

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

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.

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

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.Jan 29 2020, 8:45 PM
DannyS712 closed this task as Resolved.
DannyS712 updated the task description. (Show Details)
Art-Baltai claimed this task.
Art-Baltai reassigned this task from Art-Baltai to DannyS712.