[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

Deprecate and remove $wgUser
Open, MediumPublic

Description

See parent task for reasoning.

Live search for current uses of global $wgUser in wikimedia deployed code: https://codesearch.wmflabs.org/deployed/?q=global%5B%5E%3B%5D%2B%5C%24wgUser%5B%2C%3B%5D&i=nope&files=&repos=

Live search for current code using $wgUser in deployed code: https://codesearch.wmcloud.org/deployed/?q=wgUser(%5B%3B%2C%27%22-%5D%7C%5Cs%7C%24)&i=nope&files=%5C.php%24&repos=

Patches that need to be reviewed: https://gerrit.wikimedia.org/r/#/q/topic:global-wguser+status:open

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
DannyS712 removed subtasks: T244112: MassMessage needs uses of global $wgUser removed, T243922: UserMerge needs uses of global $wgUser removed, T243874: Thanks needs uses of global $wgUser removed, T243823: Newsletter needs uses of global $wgUser removed, T243807: TorBlock needs uses of global $wgUser removed, T243733: LdapAuthentication needs uses of global $wgUser removed, T243732: Echo needs uses of global $wgUser removed, T243577: OpenStackManager needs uses of global $wgUser removed, T243554: ArticlePlaceholder needs uses of global $wgUser removed, T242994: CentralAuth needs uses of global $wgUser removed, T242936: ConfirmEdit needs uses of global $wgUser removed, T242677: CodeReview needs uses of global $wgUser removed, T242557: GeoCrumbs needs uses of global $wgUser removed, T241952: WikiEditor needs uses of global $wgUser removed, T241947: Stop using $wgUser in Wikibase, T241924: PagedTiffHandler needs uses of global $wgUser removed, T241923: SecurePoll needs uses of global $wgUser removed, T241915: Jade needs uses of global $wgUser removed, T241912: Translate needs uses of global $wgUser removed, T241911: WikibaseLexeme needs uses of global $wgUser removed, T241903: TimedMediaHandler needs uses of global $wgUser removed, T241815: Nostalgia needs uses of global $wgUser removed, T241704: SpamBlacklist needs uses of global $wgUser removed, T241630: WikimediaIncubator needs uses of global $wgUser removed, T241619: LiquidThreads needs uses of global $wgUser removed, T241618: GlobalCssJs needs uses of global $wgUser removed, T241617: GlobalBlocking needs uses of global $wgUser removed, T241616: Collection needs uses of global $wgUser removed, T241615: CentralNotice needs uses of global $wgUser replaced, T241608: FlaggedRevs needs uses of global $wgUser replaced, T241583: GettingStarted needs uses of global $wgUser replaced, T241582: GeoData needs use of global $wgUser replaced, T241575: PageTriage needs uses of global $wgUser removed.Feb 23 2020, 10:30 PM

Trying to organize subtasks - T245959: WMF deployed extensions need uses of global $wgUser removed [tracking] is tracking all WMF deployed extensions and the progress towards hard deprecation

Anomie subscribed.

Untagging from Clinic Duty as there does not seem to be any open patches remaining on this task.

DannyS712 added a subscriber: Anomie.

Untagging from Clinic Duty as there does not seem to be any open patches remaining on this task.

All of the patches in https://gerrit.wikimedia.org/r/#/q/topic:global-wguser+status:open are part of this, though they are listed as for individual subtasks. Retagging to make it clear that there are still patches to review (rather than tagging each subtask)

DannyS712 removed subtasks: T247772: DynamicPageList needs uses of global $wgUser removed, T246732: ShoutWikiAds needs uses of global $wgUser removed, T246308: SiteScout needs uses of global $wgUser removed, T246307: SimpleSecurity needs uses of global $wgUser removed, T246306: RightFunctions needs uses of global $wgUser removed, T246305: RevisionCommentSupplement needs uses of global $wgUser removed, T246304: OnlineStatusBar needs uses of global $wgUser removed, T244455: BlueSpice extensions needs uses of global $wgUser removed [tracking], T244453: Social tools extensions need uses of global $wgUser removed [tracking], T243567: AccessControl needs uses of global $wgUser removed, T243566: AkismetKlik needs uses of global $wgUser removed, T243541: Metrolook needs uses of global $wgUser removed, T243534: OpenBadges needs uses of global $wgUser removed, T243532: MediaWikiChat needs uses of global $wgUser removed, T243531: GroupsSidebar needs uses of global $wgUser removed, T243527: LiveTranslate needs uses of global $wgUser removed, T243526: Lingo needs uses of global $wgUser removed, T243487: PageForms needs uses of global $wgUser removed, T243372: CollapsibleVector needs uses of global $wgUser removed, T242937: WikiLexicalData needs uses of global $wgUser removed, T242890: BibManager needs uses of global $wgUser removed, T242695: OfflineImportLexicon needs uses of global $wgUser removed, T242694: News needs uses of global $wgUser removed, T242693: Favorites needs uses of global $wgUser removed, T242567: AddPersonalUrls needs uses of global $wgUser removed, T242566: OpenID needs uses of global $wgUser removed, T242565: JsonData needs uses of global $wgUser removed, T242564: ImageRating needs uses of global $wgUser removed, T241816: Lockdown needs uses of global $wgUser removed, T241813: SVGEdit needs uses of global $wgUser removed, T241812: OnlyRecentRecentChanges needs uses of global $wgUser removed, T241810: AutoProxyBlock needs uses of global $wgUser removed, T241805: FilterListUsers needs uses of global $wgUser removed, T241804: EtherpadLite needs uses of global $wgUser removed, T241803: DisableAccount needs uses of global $wgUser removed, T241802: DataTable2 needs uses of global $wgUser removed, T241801: Commentbox needs uses of global $wgUser removed, T241799: BlockAndNuke needs uses of global $wgUser removed, T241703: SiteSettings needs uses of global $wgUser removed, T241702: ShowRealUsernames needs uses of global $wgUser removed, T241701: RT needs uses of global $wgUser removed, T241700: PrivateDomains needs uses of global $wgUser removed, T241699: PopupPages needs uses of global $wgUser removed, T241698: PopcornEditor needs uses of global $wgUser removed, T241697: PhpTagsStorage needs uses of global $wgUser removed, T241696: LookupUser needs uses of global $wgUser removed, T241695: LinkSuggest needs uses of global $wgUser removed, T241631: ArticleFeedbackv5 needs uses of global $wgUser removed, T241629: TwitterLogin needs uses of global $wgUser removed, T241628: Duplicator needs uses of global $wgUser removed, T241627: Drafts needs uses of global $wgUser removed, T241626: AzharAuth needs uses of global $wgUser removed, T241625: Athena needs uses of global $wgUser removed, T241624: MarkAsHelpful needs uses of global $wgUser removed, T241622: AnonPrivacy needs uses of global $wgUser removed, T241621: RegexBlock needs uses of global $wgUser removed, T241620: Survey needs uses of global $wgUser removed, T241613: AbsenteeLandlord needs uses of global $wgUser replaced, T241612: OAuthAuthentication needs uses of global $wgUser replaced, T241611: LogEntry needs uses of global $wgUser replaced, T241610: EditSimilar needs uses of global $wgUser replaced, T241609: Cargo needs uses of global $wgUser replaced, T241581: UserPageViewTracker needs uses of global $wgUser replaced, T241579: SocialLogin needs use of global $wgUser removed, T241578: Html2Wiki needs uses of global $wgUser removed, T241577: AdminLinks needs uses of global $wgUser removed, T241576: ApprovedRevs needs uses of global $wgUser removed.Mar 16 2020, 9:49 PM

All of the patches in https://gerrit.wikimedia.org/r/#/q/topic:global-wguser+status:open are part of this, though they are listed as for individual subtasks. Retagging to make it clear that there are still patches to review (rather than tagging each subtask)

Our current working process is to have the actual task with the patch on the workboard, making use of either the task's "Related Gerrit Patches" section or a bot-generated list like the one at https://wikifarm.wmflabs.org/cpt/index.php/Phab:T159299 to find the patches from the task. So when a task has no patches, it's confusing to still have it in the "needs review" column on the workboard.

There has been some discussion about somehow switching to a Gerrit dashboard that would contain just the patches needing Clinic Duty review. I don't know any details as to how that might wind up working as a replacement though.

Change 582285 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Declare $wgUser to be deprecated in version 1.35

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

Didn't happen in 1.34, patch above declares it (soft) deprecated as of 1.35

Change 582285 merged by jenkins-bot:
[mediawiki/core@master] Declare $wgUser to be deprecated in version 1.35

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

Status update for all uses of global $wgUser in deployed code

Core

Maintenance scripts writing to $wgUser

Needed until all reads are removed:
cleanupSpam.php, cleanupTable.inc, deleteBatch.php, eleteDefaultMessages.php, deleteEqualMessages.php, edit.php, importImages.php, importSiteScripts.php, moveBatch.php, preprocessorFuzzTest.php

Tests
  • ParserTestRunner.php - to be addressed
  • MediaWikiIntegrationTestCase.php - to be addressed
  • ApiMainTest.php - testing code that uses $wgUser, needed until removal from ApiMain
  • ApiTestCase.php - to be addressed
  • ApiUserrightsTest.php - to be addressed
  • LanguageConverterTest.php - testing code that uses $wgUser, needed until removal from LanguageConverter

Some tests also use setMwGlobals to interact with $wgUser: EditPageTest.php, RevisionDbTest.php, RevisionTest.php, CheckBlocksSecondaryAuthenticationProviderTest.php, RequestContextTest.php, LogFormatterTest.php, ParserOptionsTest.php, UserTest.php, DumpTestCase.php - all to be addressed

Deployed extensions

Still used in

The codesearch linked in the task description didn't catch some of these, because they were accessed via $GLOBALS, setMwGlobals, or were in the global context already. I'm updating the link to hopefully catch them all.

DannyS712 renamed this task from Deprecate $wgUser to Deprecate and remove $wgUser.Nov 15 2020, 12:17 AM

Status update for deployed code:

A bunch of places still write to $wgUser - those need to be kept until after reading from it emits deprecation notices. I have a plan for doing that based on the DeprecatedGlobal class. The following is a list of core uses of $wgUser excluding most writes:

  • MessageCache::getParserOptions() - patch to fix is pending (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/701275)
  • DoubleRedirectJob::run() - only reads so that it can restore the old value at the end, will be handled along with other writes
  • LanguageConverter::getPreferredVariant() - patch to fix is pending (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/701276)
  • WikiPage::doEditContent() falls back to $wgUser if no performer is passed - entire method is soft deprecated and will be hard deprecated soon, T255507
  • WikiPage::prepareContentForEdit() falls back to $wgUser if no user is passed - omitting a user will be hard deprecated soon, T285447
  • SpecialPageFactory::capturePath() - only reads so it can restore the old value at the end, will be handled along with other writes
  • ParserTestRunner::perTestSetup() - reads to restore old value later, and also to ensure that the relevant context has the same user as $wgUser, will be handled with other writes
  • MediaWikiIntegrationTestCase::resetDB() - uses $wgUser to call User::clearInstanceCache(), TDB, likely will need to be kept to support extension tests and so will bypass the eventual deprecation notices
  • ApiMainTest::testSuppressedLogin() - testing logic that changes $wgUser
  • ApiTestCase::setUp() and ::doApiRequest() - see T285448
  • WikiPageDbTest::testDoEditContent() - testing a fallback to $wgUser
  • LanguageConverterTest::setContextUser() and ::setUp() - LanguageConverter is reading from $wgUser, patch to fix is pending (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/701276)

Extensions:

If people are willing to help review patches, it is entirely possible to be emitting deprecation notices when $wgUser is read from before 1.37 is cut, and then we can finally remove it in 1.38 (my understanding of php is that it is impossible to detect replacing a global variable, i.e. when an extension sets $wgUser to anything). My thanks to @Pchelolo for helping with so many reviews already.

(last updated 7/15/21)

Now that the Echo extension no longer reads from $wgUser, we can finally start emitting deprecation warnings - doing that at T267861: [GOAL] Emit deprecation warnings reading from $wgUser

Okay, we are now emitting deprecation warnings, and should be ready to start removing the writes soon - but lets wait for 1.37 to be officially released before we start dropping stuff, just in case something was missed in the deprecations