CommentParser:
* Move comment formatting backend from Linker to a CommentParser service.
Allow link existence and file existence to be batched.
* Rename $local to $samePage since I think that is clearer.
* Rename $title to $selfLinkTarget since it was unclear what the title
was used for.
* Rename the "autocomment" concept to "section link" in public
interfaces, although the old term remains in CSS classes.
* Keep unsafe HTML pass-through in separate "unsafe" methods, for easier
static analysis and code review.
CommentFormatter:
* Add CommentFormatter and RowCommentFormatter services as a usable
frontend for comment batches, and to replace the Linker static methods.
* Provide fluent and parametric interfaces.
Linker:
* Remove Linker::makeCommentLink() without deprecation -- nothing calls
it and it is obviously an internal helper.
* Soft-deprecate Linker methods formatComment(), formatLinksInComment(),
commentBlock() and revComment().
Caller migration:
* CommentFormatter single: Linker, RollbackAction, ApiComparePages,
ApiParse
* CommentFormatter parametric batch: ImageHistoryPseudoPager
* CommentFormatter fluent batch: ApiQueryFilearchive
* RowCommentFormatter sequential: History feed, BlocklistPager,
ProtectedPagesPager, ApiQueryProtectedTitles
* RowCommentFormatter with index: ChangesFeed, ChangesList,
ApiQueryDeletedrevs, ApiQueryLogEvents, ApiQueryRecentChanges
* RevisionCommentBatch: HistoryPager, ContribsPager
Bug: T285917
Change-Id: Ia3fd50a4a13138ba5003d884962da24746d562d0
Use native PHP feature of iterating over key-value pairs
instead of looking up the value if it's used.
Change-Id: Id55f774b3a9d97463b97581c5b2ffe081489863a
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
Had to look through git blame to find when it was added (1.34)
for a recent review, would be helpful for others if it was easily
available in a doc block; since I'm adding a doc block, also
add @return
Change-Id: I07c4cdda176f309204fa3c2cfe6c165d1df850af
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: Ie32c1b11b3d16ddfc0c83a757327d449ff80b2e4
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: I5ffbb91882ecce2019ab644839eab5e8fb8a1c5f
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: If560596f5e1e0a3da91afc36e656e7c27f040968
This makrs Pager baseclasses as stable for subclassing per the Stable
Interface Policy. This also indicates which of the methods defined by
the base classes can safely be overwritten by extensions.
Bug: T247862
Change-Id: If1e0a35427b55d72c86f8f2530bd47aa4130fa92
Per the Stable Interface Policy, PHP interfaces should not be
directly implemented by extensions, unless they are marked to be safe
for that purpose.
Bug: T247862
Change-Id: Idd5783b70fc00c03d57f5b1a887f0e47c4d7b146
This patch replaces all usages of @protected in core.
The @protected tag was removed in cases where it was redundant or
contradictory. It has been replaced by @internal where usage outside of
core is not desired, and with @note for cases where use by extensions
is desired, but should be limited.
Bug: T247862
Change-Id: I5da208e5cb4504dde4113afb3a44922fd01325a3
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
Member variables in HistoryBlobStub have been marked protected
SpecialPage::setListed() and listed() have been deprecated
CategoryPage::getCategoryViewerClass() and setCategoryViewerClass()
have been deprecated
Change-Id: Id1f530c2c8ec1171615f726dc7446431ee7ca8fe
Re-wording documentation to remove the obvious. Also makes @inheritDoc
more readable and less confusing.
Change-Id: I7178efc7259ef68e3e3b889174140db8c0201640
Documentation is now inherited from the parent, which allows several
return types.
This allows classes that extend TablePager to paginate on multiple
columns, introduced in 6786aa5d8e.
Change-Id: Ic2572bfad9cefe52ffb56cd7acab21251b87ecf9
$mLastShown, $mFirstShown and $mPastTheEndIndex should be arrays
since 6786aa5d8e, but classes that
override doQuery do not all honour this.
Cast these to arrays as they are passed to implode.
Bug: T244941
Change-Id: I1e6d9bee852e304e6b10733f53f942942cc0ff52
This class duplicates a bunch of code from IndexPager, and that code was
changed in 6786aa5d8e in a way that broke
this code. Update it to account for the fact that mFirstShown,
mLastShown and mPastTheEndIndex are now arrays. Also update the
documentation in IndexPager to reflect that.
Bug: T244937
Change-Id: I51a50b6d3be1467f4ee399446d1d12cfed71a06c
Allow subclasses to return an array of column names via
getIndexField. The offset is built using values from those fields,
and the order of precedence for sorting corresponds to the order
of the fields.
The offset is imploded and exploded using '|'.
Bug: T244492
Change-Id: I45c66df4dfe07c947f0ffcd4d6def4e1fcfbb36c
The $mIndexField and $mExtraSortFields properties are set in the
constructor according to the value of 'order', rather than 'count'.
Change-Id: I31298ca86bbc0b95391e60194a1d99a76c662764
Breaks: I810640a07268d93b4f80745528281776b4a54682
Apparently, it is defined on the class prop correctly as an int|string
Bug: T242783
Change-Id: I44b598e885947cadaa3bae2b7446f150395f1cea
In all these cases, the foreach() loop specifies a variable for the
current value. We don't need two ways to access the same value. This
makes the code harder to read.
Change-Id: I6ed7a518439963b7091057194de993a7e977be32
The getExtraSortFields() function was well documented for the case when
getIndexField returns an array. But what if it returns a string?
Currently, using getExtraSortFields with a string as indexField means
that whatever you'll sort the table by, the extra sort will be used.
Instead, with this patch the extra sort will have two different
behaviours, depending on whether the extraSort array is associative or
not. If it is, then only the extra sort for the current field will be used.
Otherwise, like it already does, the extra sort will always be applied.
This is intended to be used by AbuseFilter in I979849e66 for T191694.
Change-Id: I0e695f96f18c7a9229753b1225dd473feb936a31
Follow-up to If07f10075a51fbbe9de24464cb6844faaad94780
and I082152b64141f1a9a4085bba23fe81a99ec8d886.
It will make getRequest use the provided context again.
Change-Id: I60b2598edcb0daed076876482e1e9d6cbf815eb2
Restores position of parent constructor call, changed in commit
I082152b64141f1a.
The parent constructor calls getIndexField(), which depends on the
mSort value already being set.
Bug: T231261
Change-Id: If07f10075a51fbbe9de24464cb6844faaad94780
The property needs to be private because pagers in extensions
may declare the same property with stronger visibility which
would crash.
Bug: T149346
Change-Id: I082152b64141f1a9a4085bba23fe81a99ec8d886