Page MenuHomePhabricator

Update Maintenance scripts in extensions to use $this->requireExtension()
Open, NormalPublic

Description

Maintenance scripts from extensions are special in that they can be run from the CLI without the extension ever being enabled, causing weird issues. We created $this->requireExtension('ExtensionName') for that (it goes in the constructor, and is checked after extensions are loaded). Only a few scripts have been updated to use it though.

Documentation: https://www.mediawiki.org/wiki/Manual:Writing_maintenance_scripts#Extensions

Example commit: rECRE62b0bc4fe579: Set extension dependency in maintenance scripts

Name of MediaWiki extensionAssignee to work on it
AbuseFilterPppery
AntiSpoofPppery
ArticleFeedbackv5@subins2000
Athena@subins2000
BlockAndNuke@subins2000
BlueSpiceExtendedSearch@subins2000 @Osnard
BlueSpiceExtensions@RazeSoldier
BlueSpiceFoundation@RazeSoldier
Cargo@IvanFon
CentralAuth@subins2000
CentralNotice@Georggi199
CheckUserPppery
Cognate@Zoranzoki21
CollapsibleVector@RazeSoldier
ConfirmEdit@divadsn
ContentTranslation@Zoranzoki21
Contributors@FilipGCI
CreditsSource@FilipGCI
DisableAccount@RazeSoldier
DonationInterface@Zoranzoki21
Echo@MtDu
EditAccount@Jayprakash12345
ExtensionDistributor@Jayprakash12345
Flow@Phantom42
GeoData@FilipGCI
GlobalBlocking@Jayprakash12345
GlobalCssJsAlready done. See https://pastebin.com/G1u5yy5W
GlobalUsage@Jayprakash12345
HitCounters@Jayprakash12345
LocalisationUpdate@Jayprakash12345
MassMessage@RazeSoldier
Math@IvanFon
MathSearch@Phantom42
Newsletter@Phantom42
OATHAuth@MtDu
OAuth@divadsn
ORES@Zoranzoki21
PagedTiffHandler@Zoranzoki21
PageImages@Zoranzoki21
Renameuser@Jayprakash12345
ReplaceText@Jayprakash12345
SecurePoll@Jayprakash12345
ShortUrl@RazeSoldier
SyntaxHighlight_GeSHi@Zoranzoki21
TitleKey@Jayprakash12345
TorBlock@divadsn
TranslationNotifications@Jayprakash12345
UniversalLanguageSelectorPer source of code it is already done.
UploadWizard@Zoranzoki21
UrlShortener@MtDu
VisualEditor@IvanFon
wikihiero@MaxSem
ProofreadPage@Jayprakash12345
BibManager@Jayprakash12345
SecureSessions@Jayprakash12345
PluggableSSO@Jayprakash12345
StopForumSpam@Jayprakash12345
WikibaseLexeme@Jayprakash12345
CongressLookup@Jayprakash12345
WikimediaMaintenance@Phantom42

Following Extensions are in awaiting, this can be done once they will Extension registration.

Name of MediaWiki extensionAssignee to work on it
GWToolset
WikiLexicalData
RevisionCommentSupplement
CirrusSearch
CommonMessages
OpenID
SemanticTasks
SimpleFarm
SphinxSearch
Teahouse
TimedMediaHandler
UserGroups
Wikibase

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 407062 merged by jenkins-bot:
[mediawiki/extensions/ApprovedRevs@master] Update maintenance scripts to use $this->requireExtension

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

Change 407193 had a related patch set (by Jayprakash12345) published:
[mediawiki/extensions/NSFileRepo@master] Use $this->requireExtension() in maintenance scripts

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

Change 407122 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceSMWConnector@master] Update maintenance scripts to use $this->requireExtension

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

Change 407121 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceAvatars@master] Correct Update maintenance scripts to use $this->requireExtension

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

Jayprakash12345 added a comment.EditedFeb 1 2018, 2:03 PM
jay@Jay MINGW64 ~/extensions
$ grep -R "extends Maintenance" | cut -d'/' -f1 | sort -n | uniq -c
      2 AbuseFilter
      1 AntiSpoof
      1 ApprovedRevs
      4 ArticleFeedbackv5
     10 Athena
      2 BibManager
      1 BlockAndNuke
      1 BlueSpiceAvatars
      2 BlueSpiceExtendedSearch
      6 BlueSpiceFoundation
      2 BlueSpiceSMWConnector
      1 BounceHandler
      3 Cargo
     19 CentralAuth
      1 CentralNotice
      2 CheckUser
     18 CirrusSearch
      1 cldr
      8 CodeReview
      4 Cognate
      1 CollapsibleVector
      1 CommonMessages
      5 Configure
      3 ConfirmEdit
      4 CongressLookup
      3 ContentTranslation
      1 ContributionReporting
      1 Contributors
      1 CreditsSource
      1 DisableAccount
      5 DonationInterface
      7 Echo
      1 EditAccount
      1 EducationProgram
      1 ExtensionDistributor
      1 ExternalArticles
     11 FlaggedRevs
     14 Flow
      1 GeoData
      1 GlobalBlocking
      1 GlobalCssJs
      1 GlobalUsage
      1 GWToolset
      1 HitCounters
      1 LocalisationUpdate
      1 MassMessage
      1 Math
     14 MathSearch
      2 Newsletter
      3 NSFileRepo
      2 OATHAuth
      1 OAuth
      1 OpenID
      8 OpenStackManager
      1 OracleTextSearch
      6 ORES
      1 PageAssessments
      1 PagedTiffHandler
      1 PageImages
      5 PageTriage
      1 PluggableSSO
      1 PropertySuggester
      3 ReadingLists
      2 Renameuser
      1 ReplaceText
      3 RevisionCommentSupplement
      1 SecurePoll
      1 SecureSessions
      1 SemanticTasks
      1 ShortUrl
      1 SimpleFarm
      1 SphinxSearch
      1 StopForumSpam
      2 SyntaxHighlight_GeSHi
      1 Teahouse
      1 TimedMediaHandler
      1 TitleKey
      1 TorBlock
     24 Translate
      2 TranslationNotifications
      4 UniversalLanguageSelector
      1 UploadWizard
      1 UrlShortener
      1 UserGroups
      1 VisualEditor
     15 Wikibase
      1 WikibaseLexeme
      2 WikibaseQualityConstraints
      1 WikibaseQualityExternalValidation
     18 Wikidata
      5 WikiLexicalData
     33 WikimediaMaintenance

Change 407066 merged by Umherirrender:
[mediawiki/extensions/ArticleFeedbackv5@master] Correct Update maintenance scripts to use $this->requireExtension

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

Change 407193 merged by Umherirrender:
[mediawiki/extensions/NSFileRepo@master] Use $this->requireExtension() in maintenance scripts

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

Change 409294 had a related patch set (by Jayprakash12345) published:
[mediawiki/extensions/SecureSessions@master] Use $this->requireExtension() in maintenance scripts

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

Change 409296 had a related patch set (by Jayprakash12345) published:
[mediawiki/extensions/PluggableSSO@master] Use $this->requireExtension() in maintenance scripts

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

Change 409299 had a related patch set (by Jayprakash12345) published:
[mediawiki/extensions/StopForumSpam@master] Use $this->requireExtension() in maintenance scripts

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

Change 409300 had a related patch set (by Jayprakash12345) published:
[mediawiki/extensions/WikibaseLexeme@master] Use $this->requireExtension() in maintenance scripts

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

Change 409303 had a related patch set (by Jayprakash12345) published:
[mediawiki/extensions/CongressLookup@master] Use $this->requireExtension() in maintenance scripts

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

Jayprakash12345 updated the task description. (Show Details)

I have a question. Maintenance::requireExtension() is used to load the extension. But how does it load the extension? Via extension.json?

I saw this manual.

This will only work for extensions that use extension.json.

So should RevisionCommentSupplement extension be ruled out? This extension does not have extension.json.

TheDJ added a subscriber: TheDJ.Feb 9 2018, 1:04 PM

This will only work for extensions that use extension.json.

So should RevisionCommentSupplement extension be ruled out? This extension does not have extension.json.

Not necessarily, but it does mean that fixing it will be blocked, until the point that that extension is converted to make use of extension.json

TheDJ added a comment.Feb 9 2018, 1:05 PM

I have a question. Maintenance::requireExtension() is used to load the extension. But how does it load the extension? Via extension.json?

LocalSettings.php is responsible for loading extensions. The extension cannot force an extension to be loaded.

I understand why these extensions are placed at the end of the description.

Change 409299 merged by jenkins-bot:
[mediawiki/extensions/StopForumSpam@master] Use $this->requireExtension() in maintenance scripts

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

Change 409296 merged by jenkins-bot:
[mediawiki/extensions/PluggableSSO@master] Use $this->requireExtension() in maintenance scripts

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

Change 409294 merged by jenkins-bot:
[mediawiki/extensions/SecureSessions@master] Use $this->requireExtension() in maintenance scripts

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

Change 409303 merged by jenkins-bot:
[mediawiki/extensions/CongressLookup@master] Use $this->requireExtension() in maintenance scripts

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

Change 409300 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Use $this->requireExtension() in maintenance scripts

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

Change 415757 had a related patch set uploaded (by Ejegg; owner: Ejegg):
[mediawiki/extensions/DonationInterface@master] Make requireExtension calls conditional

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

Change 415757 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Make requireExtension calls conditional

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

Change 429750 had a related patch set uploaded (by Gopavasanth; owner: Gopavasanth):
[mediawiki/extensions/CirrusSearch@master] Update maintenance scripts to use $this->requireExtension

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

Currently, are all the extensions are done are extension remaining (or) to be done? As so far with the above main list.

Smalyshev updated the task description. (Show Details)Apr 30 2018, 7:38 PM
Smalyshev added a subscriber: subins2000.
nikitavbv updated the task description. (Show Details)Jun 15 2018, 7:33 PM

Change 440563 had a related patch set uploaded (by Phantom42; owner: Phantom42):
[mediawiki/extensions/WikimediaMaintenance@master] Update Maintenance scripts to use $this->requireExtension()

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

PFWOz added a subscriber: PFWOz.EditedNov 28 2018, 8:34 PM

Is it expected for this to break these extensions on 1.27 LTS? Since this line was added I've had to comment it out in TitleKey in order to run update.php without a "Call to undefined method RebuildTitleKeys::requireExtension()" error.

TheDJ added a comment.Nov 28 2018, 8:57 PM

@PFWOz yes. We always advise people to use extensions that are of the same branch version as core. So you shouldn't use a 1.32 version of an extension on an LTS 1.27 release of core. We provide no guarantees that this will work, and only after 1.27 we are keeping a limited set of information per extension that keeps track of compatibility (But because of how new that is and the enormous backlog, I wouldn't rely on this information yet to judge actual compatibility).

Same release branch of both extensions and core is your best bet.

PFWOz added a comment.Nov 28 2018, 9:13 PM

@TheDJ Thanks. I'll request backports of some significant fixes to the extension that were made after REL1_27 was cut. Should hopefully be possible since the only breaking change appears to be the use of requireExtension() in the maintenance script.

Change 529552 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/AdvancedMeta@master] Call Maintenance::requireExtension

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

Change 529553 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/CentralAuth@master] Call Maintenance::requireExtension

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

Change 529555 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/EntitySchema@master] Call Maintenance::requireExtension

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

Change 529556 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/Flow@master] Call Maintenance::requireExtension

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

Change 529557 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/Kartographer@master] Call Maintenance::requireExtension

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

Change 529558 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/LDAPProvider@master] Call Maintenance::requireExtension

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

Change 529560 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/ORES@master] Call Maintenance::requireExtension

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

Change 529561 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/PageTriage@master] Call Maintenance::requireExtension

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

Change 529563 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/SecurePoll@master] Call Maintenance::requireExtension

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

Change 529564 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/TEI@master] Call Maintenance::requireExtension

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

Change 529565 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/TimedMediaHandler@master] Call Maintenance::requireExtension

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

Change 529566 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/WikibaseLexeme@master] Call Maintenance::requireExtension

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

Change 529567 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/WikibaseQualityConstraints@master] Call Maintenance::requireExtension

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

Change 529568 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/FlaggedRevs@master] Call Maintenance::requireExtension

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

Change 529555 merged by jenkins-bot:
[mediawiki/extensions/EntitySchema@master] Call Maintenance::requireExtension

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

Change 529569 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/Translate@master] Call Maintenance::requireExtension

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

Change 529570 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/BlueSpiceEchoConnector@master] Call Maintenance::requireExtension

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

Change 529571 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/BlueSpiceFoundation@master] Call Maintenance::requireExtension

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

Change 529573 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/BlueSpicePermissionManager@master] Call Maintenance::requireExtension

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

Change 529575 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/GWToolset@master] Call Maintenance::requireExtension

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

Change 529576 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/MediaWikiAuth@master] Call Maintenance::requireExtension

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

Change 529557 merged by jenkins-bot:
[mediawiki/extensions/Kartographer@master] Call Maintenance::requireExtension

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

Change 529561 merged by jenkins-bot:
[mediawiki/extensions/PageTriage@master] Call Maintenance::requireExtension

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

Change 529553 merged by jenkins-bot:
[mediawiki/extensions/CentralAuth@master] Call Maintenance::requireExtension

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

Change 529556 merged by jenkins-bot:
[mediawiki/extensions/Flow@master] Call Maintenance::requireExtension

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

Change 529565 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@master] Call Maintenance::requireExtension

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

Change 529552 merged by jenkins-bot:
[mediawiki/extensions/AdvancedMeta@master] Call Maintenance::requireExtension

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

Change 529563 merged by jenkins-bot:
[mediawiki/extensions/SecurePoll@master] Call Maintenance::requireExtension

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

Change 529560 merged by jenkins-bot:
[mediawiki/extensions/ORES@master] Call Maintenance::requireExtension

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

At the moment for all extensions the necessary patch sets exists

Change 529575 merged by jenkins-bot:
[mediawiki/extensions/GWToolset@master] Call Maintenance::requireExtension

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

Change 529566 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Call Maintenance::requireExtension

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

Change 529567 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Call Maintenance::requireExtension

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

Change 529564 merged by jenkins-bot:
[mediawiki/extensions/TEI@master] Call Maintenance::requireExtension

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

Change 529576 merged by jenkins-bot:
[mediawiki/extensions/MediaWikiAuth@master] Call Maintenance::requireExtension

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

Change 529558 merged by jenkins-bot:
[mediawiki/extensions/LDAPProvider@master] Call Maintenance::requireExtension

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

Change 529573 merged by jenkins-bot:
[mediawiki/extensions/BlueSpicePermissionManager@master] Call Maintenance::requireExtension

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

Change 529571 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceFoundation@master] Call Maintenance::requireExtension

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

Change 529570 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceEchoConnector@master] Call Maintenance::requireExtension

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

Zoranzoki21 updated the task description. (Show Details)Aug 11 2019, 1:14 PM

Change 529568 merged by jenkins-bot:
[mediawiki/extensions/FlaggedRevs@master] Call Maintenance::requireExtension

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

Change 529569 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Call Maintenance::requireExtension

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