Change documentation to null or false where the type is allowed
Also use int on Linker::tocLine, because an int is passed most
Change-Id: I9591ac91586aa9a28f38f80e0ab576b66b303d8d
Hook handlers for the MediaWikiServicesHook must not use services,
since the service container is not fully initialized when the hooks is
called. This is by nature of the hook itself, which exists to allow
configuration and wiring to be manipulated.
Depends-On: I1519aea8bca2f3977fcf15ee8776a1b3319687b5
Change-Id: Ifbc60e72167e5280e3609d14a47ffa6232fabca6
Results in passing a user where previously the fallback
to $wgUser was being used, mostly in tests.
Bug: T255507
Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
Updates for the removal of the Revision class itself
and the various methods/hooks/variables removed in the
process, including:
- Update some documentation removing most references
to the Revision class and updating the MCR migration
notes to reflect the past tense for Revision methods.
- Change some capitalization from "Revision" to "revision"
to make it clear comments are about revisions in general,
not the Revision class in particular.
- Minor code tweaks including removing unused variables that
were around for the old hooks that were removed, and
removing the use of DeprecatablePropertyArray where no
longer needed for anything.
- Fix incorrect documentation for PageUpdater::getStatus(),
the status value changed a while ago to have revision-record
in addition to revision, and recently to only have the
revision-record, but ironically PageUpdater was never updated.
- Removed Parser::$mRevisionObject, used to be a Revision object
and was deprecated in 1.35, missed earlier because it was no
longer being set to Revision objects, always null.
- Add RevisionRecord typehints in DummyLinker to match those
in the corresponding Linker methods
This should be a no-op in terms of functionality.
Bug: T247143
Change-Id: I03bbb94fc29085855448780b1a5ad9063911ecc4
Remove `@stable to implement` now that it is deprecated,
and add the missing entry to DeprecatedHooks as a silent
deprecation (i.e. the equivalent of soft deprecation).
Follow-up: I5124789fac333a664b73b4b4a1e801ecc0a618ca
Change-Id: I8aece4b9811344b997a8c31f5376b4dd9784d4e2
All hard deprecated in 1.35
* BeforeHttpsRedirect
* CanIPUseHTTPS
* UserRequiresHTTPS
Also soft deprecate the wfCanIPUseHTTPS
method, which always returns true. Will
be hard deprecated once callers are updated
Change-Id: Ie6d71809d09edf6be9b8280debeb152ef7fce398
All hooks were previously hard deprecated
in 1.35. Affected hooks:
* ArticleRevisionUndeleted - use RevisionUndeleted
* ArticleRollbackComplete - use RollbackComplete
* DiffRevisionTools - use DiffTools
* DiffViewHeader - use DifferenceEngineViewHeader
* HistoryRevisionTools - use HistoryTools
* NewRevisionFromEditComplete - use RevisionFromEditComplete
* PageContentInsertComplete - use PageSaveComplete
* PageContentSaveComplete - use PageSaveComplete
* ParserFetchTemplate - use BeforeParserFetchTemplateRevisionRecord
* RevisionInsertComplete - use RevisionRecordInserted
* TitleMoveComplete - use PageMoveComplete
* TitleMoveCompleting - use PageMoveCompleting
* UndeleteShowRevision - no replacement
Includes a fix for setting the associated rev id
of page protections, which previously was only done
using $nullRevision which was a Revision object created
if any hooks needed it; those hooks were hard deprecated
and so for WMF prod the rev id was not being set.
Bug: T247143
Depends-On: Idfa345193ae99fb2f1c9a8f8d28d8d540a6e3d62
Change-Id: I519167f76a5a3c1f5410415b2721462a3dcc3ec8
The hook was added when the TitleArray class
was created, based on the UserArray class that
has a similar hook, onUserArrayFromResult.[1]
However, while the user array hook has extensions
that use it, there are no extensions that use the
title array hook, and it doesn't really make sense
to do so.
[1] See 38473966ea
Change-Id: Ic4253490af3eaaf5986e3665c230835b298ec4b6
This hook has become defunct after the classic edit toolbar was removed.
Its only uses are to disable it, which is pointless as the toolbar
doesn't display when the hook doesn't provide any content.
Bug: T278563
Change-Id: I3285d01715f32a028ea9d5710800c4fd30fe1c59
No extension is meant to be able to prevent other extensions from
using this hook. Incidents of that have only been accidents.
Change-Id: I048e3ac4a6a6889fc55681b8d49d6fd433e8b3fc
Were not removed in doc review following creation
of hook interfaces. Fix line length where needed
Change-Id: I2eafffcf3a1c40d0f5613a893c53e0aa14eed6a2
Breaking changes:
* Ids 'mwProtectSet', 'mw-protect-table3', and
'mw-protect-table-$action' are no longer present on page.
* Module 'mediawiki.legacy.protect' has been removed and replace by
'mediawiki.action.protect'.
Deprecations:
* ProtectionForm::buildForm has been replaced by
ProtectionForm::addFormFields with backwards compatibility.
Other changes:
* Expiry is no longer editable when "Allow all users" is selected
* When "Unlock further protect options" is disabled, the expiry of
the first section is used for the other sections
* Legacy form elements added by extensions are added to a separate
section which uses a blank i18n string as the header
* Unprivileged users see the expiry selector instead of the expiry
text input as it has the expiry date
Changes to ProtectionForm.php are based off of
I95d0289acceaa7ede789d5a6ea094fae757af6dc.
Bug: T235424
Bug: T236218
Change-Id: Ib22a3b53c1933e107ef5609bb2262aa44b5abb7a
Refactor the database setup code to share more code between
ParserTestRunner and MediaWikiIntegrationTestCase. Made
`::setupAllTestDBs` static so it can be reused from
ParserTestRunner.
Made ParserTestRunner::addArticle more like
MediaWikiIntegrationTestCase::addCoreDBData(). Some additional
refactoring work could be done here in the future to share more code.
After the refactoring the ParserTestTables hook is no longer necessary
and so has been (soft) deprecated. MediaWikiIntegrationTestCase
clones all database tables, so ParserTestRunner no longer needs to ask
extensions for a list of specific tables it should clone. Cleaning up
the handful of extensions which define this hook will be left to a
future patch set.
Change-Id: I5124789fac333a664b73b4b4a1e801ecc0a618ca
AbuseFilter has been using type hints on these methods for a while, so
we can be pretty confident that the documented types reflect the real
types.
Change-Id: I7192be5843cbf26c22bae9dc4a838536469b90fd
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.
Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.
Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
Also move ResourceLoaderRegisterModulesHook under the same
namespace. I forgot this one in commit b7ac554304.
This is mainly motivated by making the collaboration graph
on doc.wikimedia.org not huge by pulling in the full range
of core hook interfaces.
<https://doc.wikimedia.org/mediawiki-core/master/php/classResourceLoader.html>
Depends-On: Ifa53d96dd3e4592208dbc991e2af9e6b7598e44d
Depends-On: Ib4571d80f55a4716e28b76ba1d007f95b0fb2540
Change-Id: I576305a5edb36a2ffb513e6d557bbf1d337cb17e
For compliance with the new version of the table interface policy
(T255803).
This patch was created by an automated search & replace operation
on the includes/ directory.
Bug: T257789
Change-Id: I17e5e92e24c708ffc846945a136347670a3a20c7
In EditPage::showStandardInputs, where the hook is called, the $tabIndex
looks like it will always be an int, not a string.
Change-Id: If3bd9f628e29d078b524242f51f120a27f7ed35e
1. ResourceLoaderForeignApiModules
2. ResourceLoaderGetConfigVars
3. ResourceLoaderJqueryMsgModuleMagicWords
4. ResourceLoaderSiteModulePages
5. ResourceLoaderSiteStylesModulePages
6. ResourceLoaderTestModules
7. ResourceLoaderRegisterModules
Their return values were already ignored by hook triggers,
so returning false from these would not have prevented or aborted
anything, except blocking other extensions from using the same
hook.
Depends-On: I54381b7581f6518326048057b8d496b6a32e6e2f
Change-Id: I3ec9d4cc5b575f5fc80e5ad1e8c2cdf113ad564a
Add $wgForceHTTPS. When set to true:
* It makes the HTTP to HTTPS redirect unconditional and suppresses the
forceHTTPS cookie.
* It makes session cookies be secure.
* In the Action API, it triggers the existing deprecation warning and
avoids more expensive user/session checks.
* In login and signup, it suppresses the old hidden form fields for
protocol switching.
* It hides the prefershttps user preference.
Other changes:
* Factor out the HTTPS redirect in MediaWiki::main() into
maybeDoHttpsRedirect() and shouldDoHttpRedirect(). Improve
documentation.
* User::requiresHTTPS() reflects $wgForceHTTPS whereas the Session
concept of "force HTTPS" does not. The documentation of
User::requiresHTTPS() says that it includes configuration, and
retaining this definition was beneficial for some callers. Whereas
Session::shouldForceHTTPS() was used fairly narrowly as the value
of the forceHTTPS cookie, and injecting configuration into it is not
so easy or beneficial, so I left it as it was, except for clarifying
the documentation.
* Deprecate the following hooks: BeforeHttpsRedirect, UserRequiresHTTPS,
CanIPUseHTTPS. No known extension uses them, and they're not compatible
with the long-term goal of ending support for mixed-protocol wikis.
BeforeHttpsRedirect was documented as unstable from its inception.
CanIPUseHTTPS was a WMF config hack now superseded by GFOC's SNI
sniffing.
* For tests which failed with $wgForceHTTPS=true, I mostly split the
tests, testing each configuration value separately.
* Add ArrayUtils::cartesianProduct() as a helper for generating
combinations of boolean options in the session tests.
Bug: T256095
Change-Id: Iefb5ba55af35350dfc7c050f9fb8f4e8a79751cb
This adds new functionality to allow non-checkbox widgets to be
used in the checkboxes row of the edit form, and adds a dropdown
widget for the watchlist-expiry field.
Bug: T248494
Change-Id: Ice5113a97b1ef97253bfa6874ea71d910a5cd8fd
* Remove the mention of 'return true' being legal.
This is only allowed for compat with code from before MW 1.21,
when I added hook aborting as well as tolerance for null to
be the same as true.
Since then, there is no reason to return null or return true.
For early returns, an explicitly void 'return;' should be used
instead. Returning anything else like null/true serves no purpose
other than to confuse the reader.
* Mark the interfaces as natively 'void' with return type hints.
This means in core code that runs the hook, static analysis
like Phan and in IDEs, it will be known that these onFoo()s
never return a value, thus allowing them to detect if its
return value is assigned or used in a conditional for any
reason, which can be an easy mistake.
It also means that in the future when extensions start using
these interfaces in 'implements' statement, they will be
required to mark their hooks as void.
That migration is opt-in and still up ahead. This is not
a breaking change even for all existing extensions where
a return true/null may exist in an abortable hook since this
only applies to code directly typed against the interface.
The internal run() method doesn't care.
Change-Id: Ib79289bd486ac97cec492e72f9a8dee70cf2f6c2
We intially thought we wouldn't need this and would only need
PageMoveComplete, but it turns out Flow does need it.
Bug: T250023
Bug: T255608
Change-Id: I8e7308541d2fe6d02b9dad63e1c86c89f6e7cf53
This makes the hook name consistent with GetDoubleUnderscoreIDs, and
is part of a set of related documentation changes clarifying the difference
between "magic words" (a localization infrastructure) and the various
functions which use magic words for localization, such as parser functions,
double underscore variables, magic variables, etc.
See also I621c888e3790a145ca9978f6b30ff1a8f685b64c.
Change-Id: Ie2a6df4b179a360fb7cdfb219e915bedff501d1d
Phan flagged a lot of incorrect type hints when run against the call
site migration patch.
Bug: T240307
Change-Id: I698de5536446c241b200430198b21b72763b0c69
The callers were removed in recent commits by Niklas. Not having a
caller means the hook migration scripts doesn't know what to do with
them.
Bug: T240307
Change-Id: Icc0b6e7f5a52601ea1d37d065eebaf5e7103b2ab