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
Modules group together endpoints by a shared prefix. The idea is that each module has its own version and can generated self-contained self-documentation. This allows clients to have clear expectations about the endpoints of each module, no matter what wiki they are accessing. So far, each wiki may be exposing a different set of endpoints, with no way to provide a spec that describes that set of endpoints in a way that would be consistent across wikis and stable over time.
Bug: T362480
Change-Id: Iebcde4645d472d27eee5a30adb6eee12cc7d046b
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 special pages that re-use logic from
SpecialContributions. These will be similar but use different
pager classes.
What:
* Add ContributionsSpecialPage parent class, which does most of
the work for SpecialContributions.
* ContributionsSpecialPage is not able to be an abstract class
since its ancestor classes aren't (all the way up to SpecialPage)
but it provides a function ::getPager that must be overridden by
subclasses.
* Hooks that were provided by SpecialContributons are run from
ContributionsSpecialPage in order to allow extensions to modify
contributions pages in general, and not have to reimplement the
modification for every contributions page. For backwards
compatability, hooks are not renamed. Comments are added instead.
* In order to limit the scope of this patch, keep the history
clean and not introduce new bugs, this is purely a refactor.
It does not aim to fix any of the problems already existing in
SpecialContributions, or to update any of the old styles used.
Bug: T363358
Change-Id: Ic00fa3297fb08eacf570d3ec3fcf64925fcf69c5
This is an output transform to resolve the mw:I18n and mw:LocalizedAttrs
to their localized forms.
Bug: T358191
Change-Id: Id32bc05ff72eb2d9fba7f8c2f192c9f7812cbc70
This patch introduces a namespace declaration for the
MediaWiki\Debug to DeprecationHelper and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I808c6aa7836445feaa7b401624d79d01f2c70322
Do not allow optional path parameters or empty path segments
within the path. Handlers may still consider a path parameter
to be non-required. Normally this is when a handler services
multiple routes, and not all routes supply all parameters.
Bug: T359652
Change-Id: I4f82ee2b6ec5b631249d26496688e5f42696c1d0
Make the Router class know about redirect definitions, so it is no
necessary to explcitly specify the RedirectHandler.
Bug: T361840
Change-Id: I2f3bce5b426639f1c4ecf55a6c003794019acd14
This was added in 300fcfd00b
for an experimental REST endpoint that was removed in
c3fe4b037d, and is now unused.
Bug: T305506
Change-Id: I900c00747f77af6b0844105e9681c9d4acfe1ad5
Requested by the zgh community in the Wikimedia Incubator at [1];
the converter is the same as for Shilha (`shi`); the main difference
between the two languages is that the main script for `zgh` is
Tifinagh, which can't be losslessly converted to the Latin script
(the former is unicameral, the latter is bicameral), so the
converter and configuration added here is essentially one-directional.
[1] https://incubator.wikimedia.org/wiki/Special:PermaLink/6060805
Change-Id: I483a1594f001226439497f0870176e9a1e447458
Why: supporting JSON schema $refs is desired for the
CommunityConfiguration 2.0 project so configuration
schemas can reuse definitions coming from another
PHP JsonSchema class. The https://json-schema.org/
specification supports relative and absolute URIs
as the content of a $ref. The change aims
to support only the former. Meaning that any
$ref defined in a schema should point to a
class that can be resolved by PHP.
What: update schema traversing in JsonSchemaTrait
to resolve any reference specified as:
[ 'class' => SomeClass:class, 'field' => 'someClassField' ]
into an actual json schema compliant $ref, eg:
$ref: '#/$defs/SomeDefinitionName'. Also annotate
new definitions found in a "$defs" array with the
resolved value of the refed class field.
Bug: T357718
Change-Id: I130326e5762e706be4889e308eeec45a6c7683c5
ParamValidator so far only supports primitive types as input, which is
insufficient for validating request bodies.
This adds an "array" parameter type that accepts any array. In the
future, we should add validation for such parameters, based on JSON
schema.
Change-Id: Idfa1c90be40772948a3c53d010441905b44b7b4e
This is useful for cases that we can't use the common expression
builders but we don't have a choice but to pass raw SQL. Common usecases
are comparing fields ("a.user_id > b.user_id") and function calls
("user_editcount > COUNT(rev_id)")
Bug: T210206
Change-Id: Ieb73d449262e22557f6f470105ca65ab0afc50e3
This moves a code out of file scope into classes to make it
testable. The code is left in the same structure as it was before,
global functions have been converted into methods on the new
ThumbnailEntryPoint and Thumbnail404EntryPoint classes.
This test introduces comprehensive phpunit tests covering all functional
code paths in ThumbnailEntryPoint. This is intended to support
refactoring of this code.
Change-Id: I459abc7b11d0ab4ee682a863c9525a945048296f
The RandomPage alias was dropped in an earlier commit, so
group the release note entry in with these.
Change-Id: I207d7463ced1a1bb8b8ac749eba175fc0037a217
ObjectCache is already doing a lot of factory pattern logic like
creating instances of the various BagOStuff, this should really be
the responsibility of the factory servicet.
This patch introduces a proper factory (ObjectCacheFactory) to handle
the responsibility of creating various instances of BagOStuff. Since
`newFromParams()` is a static function that gets passed in configuration
of $wgObjectCaches, that can stay that way (to keep supporting how we do
this in prod today).
Technical Breaking Change: `ObjectCache::makeLocalServerCache()` now has
a parameter and requires it but there are no callers of this method outside
MW core hence it is safe to change (and this patch update all callers) to
work correctly. Cache prefix is gotten from global state because sometimes
at this stage, the services container is not available.
Bug: T358346
Change-Id: I3179a387486377c6a575d173f39f82870c49c321
These four endpoints have been experimental for many months:
/coredev/v0/me/contributions
/coredev/v0/user/{user}/contributions
/coredev/v0/me/contributions/count
/coredev/v0/user/{user}/contributions/count
Analytics data shows they are not receiving any traffic.
Remove to clear out the coreDevelopmentRoutes.json file for
unrelated experiments, and to reduce future code maintenance.
Bug: T305506
Change-Id: I21cf9a398638d34725a3c34d348fbad50df40153
This class defines convenient shortcuts for common commands, like
creating a User object. To use on shell.php and similar tools.
Change-Id: I7982d163521e7ae8f2be22613ac6a6fb6af1d7cd
DatabaseInstaller had some LSP violations, such as calling undeclared
methods of the supplied Installer object, assuming that it was a
WebInstaller. It was also large.
So, split the web form parts of DatabaseInstaller into separate classes.
We have a class hierarchy for the connect forms, and a class hierarchy
for the settings forms, with a base class DatabaseForm mostly as a place
to put protected helper methods.
Also, have DatabaseInstaller::getConnection() return a special subclass
of Status, so that we can remove many Phan type overrides.
Change-Id: Ie84025f8f70b895fa6882848b9a21ba1750d60e2
The new trait provides conveniance methods for logging and throwing
errors based on StatusValue instances.
Change-Id: Id7cbacb744bee79cd8a6f61291a26b36e6243053
The TranslationAliasesDirs configuration allows defining translatable
aliases in JSON files. The value should be a name or names of folders
that contains files that have localized aliases. Each language should
have a separate file.
Currently, it supports defining special page aliases but in the
future can be extended to support magic words and namespace aliases.
The patch adds a script: ConvertExtensionsMessagesToTranslationAlias
that can be used to convert existing ExtensionMessagesFiles to the new
format.
Bug: T89947
Change-Id: Ief16a48a8dc8742854f67301791aa2a0b0531116
This reverts commit cb09a27cc2.
The class is not very useful as it is now, due to performance issues
(T169027#9342985). The Graph extension is not going to use iframes
(T334940#9537862) and that was the only concrete feature for this, so
making the class usable in practice is unlikely to get prioritized.
No point in leaving the code in its current halfway state.
Bug: T222807
Bug: T169027
Change-Id: Id1b5193975435b58aebc225528e30f04456d0c41
To this end, we create a trait to coalesce together all upload methods
common to all upload mechanisms.
Change-Id: I28d0be0239f3b25efc6ea8bc3d400b9d0f5bc7bf
Follows-up Iadea44b7867f48a2be6ccbf00c0e56911a5af74e.
ResourceLoaderEntryPoint:
* Rename from Resource to ResourceLoader, as it is the entry point
for ResourceLoader.
* Fix accidental use of ingroup on the file docblock
instead of the class.
https://phabricator.wikimedia.org/F42046908
* Fix broken "see" reference to "/load.php" on the ResourceEntryPoint
class on doc.wikimedia.org. Files are indexed in Doxygen by full
name without leading slash.
* Remove load.php from docgroup, akin to index.php.
tests:
* Remove unrelated Rest namespace from test suite.
* Remove redundant default values in newResourceLoader(),
especially null values were confusing by showing an
apparent intent to set a value without actually
isplacing the default, given that isset/?? treat
set null as not set.
* Simplify test by using the built-in startup module instead.
EntryPoint:
* Remove comment in test about doPostOutputShutdown.
It sounded like it was explaining that we use getCapturedOutput()
instead of run() because the latter calls doPostOutputShutdown
which we want to avoid. Except, we don't avoid it,
since run() is called and does call doPostOutputShutdown.
Unclear what it was explaining.
* Improve docs around getCapturedOutput() in the base class,
and make explicit that this seemingly unused complexity
exists for the purpose of testing.
Bug: T354216
Change-Id: I5139fda90a3d5ac7ea1ed917c8045d1a09961d78
This replaces the old pass-by-reference $predicates array and makes the
intent clearer. It also supports lazy-loading of predicated properties,
which useful for avoiding expensive computations like SHA-1 hashes when
they end up not being needed.
Pass FileOp::doPrecheck() a mutable "batch level" FileStatePredicates
instance along with an immutable "operation level" FileStatePredicates
instance. The later can be used in callbacks that need to recall the
predicated file states just before the start of the operation.
Make FileOp::precheckDestExistence() support lazy size/sha1 closures.
Bug: T348294
Change-Id: I709c1920d2bee4b76f69e38c1643a44a73d63265
Add SpecialPrefixIndexGetFormFiltersHook hook that allow extensions
to add custom filters on Special:PrefixIndex and another hook
SpecialPrefixIndexQuery that allows you to modify the query builder
to add more conditions based on the filters selected.
Bug: T299308
Change-Id: Iabc672086547d0b19f01cc95892633c2668821ef