This needs to get $classes by reference
Bug: T378132
Depends-On: I9d4507fc8e7b2e44c8ecbda9400c5af8103b7c81
Follow-Up: I95a5b88ec81583e16ccf8e58cdb8e12e00aae5bf
Change-Id: I810f26e04113d5c9c7c51f88430063b0d07e6b25
(cherry picked from commit 83c5211931e1f53448d7dc69956a9584f87b7620)
Downstream pagers that extend ContributionsPager may want to use their
own templates and fields. To avoid polluting the upstream pager, allow
the template and parameters to be overriden.
- Move template processing into two overrideable functions,
`getTemplateParams` and `getProcessedTemplate`
Bug: T356292
Change-Id: I95a5b88ec81583e16ccf8e58cdb8e12e00aae5bf
Why:
* ContributionsPager is being updated to allow subclasses greater
control over formatting. The $messages property holds a cache of
messages used for formatting, so is needed by subclasses.
What:
* Make the $messages property protected.
Bug: T377482
Change-Id: Ic3a475cc4fbd730f11a9c68972b89ac52094330c
Why:
* Deleted revision authors are marked in the contributions line. The
visibility check uses the row's RevisionRecord. However, in some
subclasses there is no RevisionRecord, but visibility can be
determined from the row directly. A separate method allows
subclasses to perform this check.
What:
* Separate out the author visibility check into a new method.
Bug: T377482
Change-Id: I92074f28ff66266e574e743ccd57009589177f06
Why:
* Each revision is displayed as a <li> with a data attribute
containing the revision ID. However, for subclasses that show
contributions from external wikis, it doesn't make sense to add
revision IDs to the HTML.
What:
* Make a separate method for populating HTML attributes, that can
be overridden by a subclass.
Bug: T377482
Change-Id: Ia22dde32071408798797b9f6f9f862ec5b57b2a4
Why:
* A ContributionsPager can be configured to fetch only revisions,
or to display revisions and other types of contributions, added
by extensions. It avoids formatting rows from extensions. It
infers whether to skip by checking whether a RevisionRecord and
Title object could be made for the row.
* However, if configured only to fetch revisions, then it should
never skip the formatting, since every row is a revision.
What:
* Always execute ::formatRow if $revisionsOnly is true.
Bug: T377482
Change-Id: Ia7d4ab2abe4bef482ee8016ccbe4343977053611
Why:
* ContributionsPager::doBatchLookups should skip a row if a
RevisionRecord can't be made. The check is hard-coded instead
of using the ::tryCreatingRevisionRecord method. This means that
if a subclass overrides ::tryCreatingRevisionRecord, the
override won't be used here.
What:
* Call ::tryCreatingRevisionRecord from ::doBatchLookups.
Bug: T377482
Change-Id: Ic6675e31a12360d81fc8f16029ec0e7b170ec32f
Why:
* Formatting helper methods were introduced so that subclasses could
have more control of formatting their rows.
* These helper methods should take only the actual row as an argument,
since that is the only thing a subclass can guarantee is available,
e.g. it may not be possible to make a Title or RevisionRecord from
the row.
What:
* Pass only the row into the formatting helper methods.
Bug: T377482
Change-Id: Ic03b00bf93d25265cc162f57464f9d92d0a3c717
.comment has a unicode-bidi: isolate; so this isn't needed.
It fixes yet other regression of
I919bb8270ddb13b38d747dba1a3a7fa0d3bb1a4f
Bug: T377555
Change-Id: Id60a7df155e550639004543026459b97eb01d840
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead
Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a
Break one long line in SpecialPage.php
Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
Why:
* ContributionsPager::formatRow builds links and other elements in
a contributions row. It is a long, old method that is difficult
to work with since it does a lot and is sometimes in a confusing
order.
* Since ContributionsPager is extended by various classes, it is
helpful to have separate, overridable methods for some of the
formatting.
What:
* Refactor ::formatRow by introducing separate methods for each link
or other element in the row. This allows handling to be overridden
by subclasses, and also makes the formatRow easier to understand.
* To make code review easier and safer, make minimal changes - e.g.
keep old variable names, comments and flow structure.
Bug: T356292
Change-Id: Iee83deafa584fbfe7f6adb1c30df014ec6945288
This removes use of getDirMark() in Special:Contributions and
both forms of Special:RecentChanges (the old and "new" grouped
one).
They had common parts that's why they should've been dealt with
at once.
Bug: T375975
Change-Id: I919bb8270ddb13b38d747dba1a3a7fa0d3bb1a4f
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.
Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.
Change-Id: Id75cb2e5fbee0fe7600f92473d876f23730d46b7
Y2K38 is 14 years from now. Past experience shows that some installs
survive well over 14 years.
Windows 32bit is 0.04% and those systems are very unlikely to ever run a
2025 version of MediaWiki.
Bug: T122660
Change-Id: I45274f639159de83413e05aa498539f7be5f0e05
Why:
* Special:DeletedContributions is built entirely separately
from Special:Contributions and lacks many of the features
that Special:Contributions has, such as search form filters.
* As part of the temporary accounts project, a special page
showing deleted contributions for temporary accounts was
added via the CheckUser extension (T363362), which has
feature parity with Special:Contributions. This was achieved
by factoring out abstract base classes for contributions
pages.
* SpecialDeletedContributions and DeletedContribsPager should
be updated to make use of this shared functionality, to
avoid confusion for users switching between these various
pages.
What:
* Update DeletedContribsPager to extend ContributionsPager.
* Two hooks were run from DeletedContribsPager:
- DeletedContribsPager__reallyDoQuery
- onDeletedContributionsLineEnding
Run both from ContributionsPager instead, when in archive
mode, similar to their normal-mode counterpart hooks.
* Add a basic test to ensure that Special:DeletedContributions
doesn't encounter an error while building the pager.
* SpecialDeletedContributions will be updated in a separate
patch.
Bug: T370438
Change-Id: Ifa266898781449a1ebd99bcf3e72182899c2452d
Don't refer to Special:Contributions in a debug log and HTML
comment, since that is only one subclass of ContributionsPager.
This is needed ahead of work to make DeletedContribsPager extend
ContributionsPager.
Bug: T370438
Change-Id: Ifbc15998861b4a3ab5e47f620d139618d7b674b8
Why:
* ContributionsPager::formatRow creates the same date link for
normal and archive mode. This links to the revision, which is
deleted when in archive mode.
* Instead, it should do what DeletedContribsPager does, and link
to Special:Undelete.
What:
* Handle the date links the same in ContributionsPager (archive
mode) as in DeletedContribsPager.
* Also rename the variable $lang to $language for clarity.
Bug: T371518
Change-Id: Ied2282d06e7c2be0735203c132c605e3d7f40857
Why:
* ContributionsSpecialPage builds a search form for filtering
contributions. Subclasses can show different types of contributions,
from the revision or the archive table.
* When searching the archive table, the filter for showing only
contributions that are the latest version of a page don't make any
sense, since the page gets deleted when the revisions are moved to
the archive table. Therefore it should be removed in archive mode.
What:
* Add isArchive method to ContributionsSpecialPage for subclasses to
define whether they search the revision or archive table. Default
to true, to avoid needing to update SpecialContributions.
* Only add the filter for showng latest page revisions if not in
archive mode.
Bug: T371495
Change-Id: If1c5772ec4693300e770e34faae9197fe6138fe4
Use expression builder to use IN() or NOT IN() when the associated
namespace is also part of the condition.
old: (rc_namespace != 0 AND rc_namespace != 1)
new: (rc_namespace NOT IN (0,1))
Change-Id: I8bec03812607d61894594081c1be9e6f69f478d7
Why:
* ContributionsPager is an abstract class that can be extended to
show contributions lists from different sources. For example the
CheckUser extension displays contributions based on lookups in
the CheckUser tables.
* A contribution is modelled as a RevisionRecord object,
corresponding to a row in the `revision` table.
* RevisionRecord objects can also correspond to rows in the
`archive` table, where deleted revisions are stored; however,
ContributionsPager doesn't recognize these.
* By allowing ContributionsPager to handle revisions from the
`archive` table, we allow any subclasses to choose revision or
archive mode.
* Although out of scope here, DeletedContribsPager could later be
replaced with ContributionsPager in `archive` mode, allowing
better feature parity between SpecialContributions and
SpecialDeletedContributions, e.g. T36524, T36523.
What:
* Add isArchive property that subclasses can set, to control
whether revisions are fetched from `revision` or `archive`.
* Add relevant links to each row (history, diff, undelete, etc.)
depending on whether the revisions are existing or archived.
* Only run hooks when in `revision` mode, because handlers assume
certain field names are present.
* Make the selected field names configurable so that a subclass
can override them. Default to the field names used for a
`revision` table lookup. (Note that an extension might want to
specify its own table, so make these completely configurable,
rather than just allowing fields from either the `revision` or
the `archive` table.)
Bug: T366510
Change-Id: Ie48b728d98a74022aa11c2135ee871bfda1f2a9f
This patch introduces a new namespace declaration,
MediaWiki\Xml and adds Xml and XmlSelect to it
and establishes class aliases marked as deprecated
since version 1.43.
Bug: T353458
Change-Id: I45cccd540b6e15f267d3ab588a064fbeb719d921
Why:
* For the temporary accounts project, we will make some changes to
how user contributions can be viewed, including showing global
contributions (T337089) and showing contributions from temporary
accounts using the same IP (T358852).
* We will create new pagers that re-use logic from ContribsPager.
These will behave similarly to ContribsPager, but will get the
revisions using a different query.
What:
* Make ContribsPager extend a new abstract parent class,
ContributionsPager.
* ContributionsPager:
- handles filtering on edit type (minor, etc), namespace, tag,
date and user permissions (e.g. hiding suppressed revisions)
- runs the hooks that ContribsPager used to run, and keeps the
same names for backwards compatability
- handles displaying results
- provides an abstract method getRevisionQuery for a subclass
to specify where the revision comes from. (Examples are
the `revision` table or the `cu_changes` table, but in the
future this could also include archive.)
* ContribsPager:
- handles an IP range target by using the ip_changes table
- includes some public static functions that are kept for
backwards compatability. (Future work could put them somewhere
more appropriate.)
Scope:
* ContributionsPager is designed to select (existing) revisions.
It could be abstracted out further to handle deleted revisions
from the archive table, to help bring feature parity to
Special:DeletedContributions. This is left out of scope for this
patch.
* To keep the scope limited and the commit history clean, this
patch doesn't attempt to fix the various TODOs in ContribsPager,
or update old styles that are used.
Bug: T363358
Change-Id: I85bb28c9d85426ecc82c533a0cdd3f010c247b02
UsersPager defines a "join group", which is not supported by
SelectQueryBuilder::tables
Bug: T364428
Follow-Up: I6490caae3984efaae81bd2583220a7dd1c3b371d
Change-Id: I27e4de5d2d114fd8b0bfb86ca28278e16108c959
This cases cannot benefit from the SelectQueryBuilder as each argument
get processed by hooks with fix signature or coming from abstract
functions providing the arguments separate.
Bug: T344971
Change-Id: I6490caae3984efaae81bd2583220a7dd1c3b371d
ParserOutput::getText() is not a simple getter, but does
transformations on the "text" of the ParserOutput; the simple getter
is named ::getRawText().
To maintain consistency, rename ParserOutput::setText() to
::setRawText() and the property name ParserOutput::$mText to
::$mRawText so future readers are not confused.
The JSON property name as it appears in the serialized ParserCache
is left as 'Text' so that we don't have any forward- or backward-
rollback issues.
Change-Id: I3ef34814ab9473cc70d0a6806e8c5a4a02b73491
Update cases where one of the IConnectionProvider methods is called
immediately.
This doesn't really change anything, but I hope it helps promote
getConnectionProvider() as the common way to do this.
Follow-up to 8604c384f6.
Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112