I believe the more recent syntax is quite a bit more readable. The
most obvious benefit is that it allows for much less duplication.
Note this patch is intentionally only touching tests, so it can't
have any effect on production code.
Change-Id: Ibdde9e37edf80f0d3bb3cb9056bee5f7df8010ee
Why:
* The SpecialPreferencesTest::testLongUsernameDoesNotFatal test
uses a mock user object to perform the test, but using this
mock user causes test failures when the DiscussionTools
extension is installed.
* Using a "real" test user will avoid this issue because methods
such as User::getTalkPage will be defined as it's not a mock.
What:
* Use a test user instead of creating a mock User object to avoid
test failures.
Bug: T372038
Change-Id: Ic2264d113b7e1cdccdf1bfdbb9e0a9e9525eba08
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 should be updated to make use of
this shared functionality, to avoid confusion for users
switching between these various pages.
What:
* Update SpecialDeletedContributions to extend
ContributionsSpecialPage.
* Update ContributionsSpecialPage::getUserLinks to be a
protected instance method instead of a public static method.
This can just be done, since it was only made public to be
called from SpecialDeletedContributions, and there are no
other callers.
* Build a link to Special:Contributions instead of
Special:DeletedContributions from SpecialDeletedContributions
by overriding ::getUserLinks.
Bug: T370438
Change-Id: Ica817be5c5e078b88c9b3157b54d0dbf997e8893
Why:
* In T370438 we are refactoring SpecialDeletedContributions to
extend ContributionsSpecialPage, a parent class shared with
other special pages showing contributions. Ahead of this, we
should ensure good test coverage to reduce the risk of these
changes introducing bugs.
What:
* Add some tests for the main functionality of the
Special:DeletedContributions page.
* Coverage is not 100% becuase there are a some blocks of code
that will be removed from SpecialDeletedContributions that
are the same as code that will now be run from the parent
instead, and are already covered by existing tests.
Bug: T370438
Change-Id: I4d5bda9beb25f4b355a6013159363eb5be4d13a3
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
Also:
1. Other minor fixes in comments touched by this patch.
2. Add a separate test for subpage with spaces.
Change-Id: I267f19027098e5778b1cd491826e1741fc7ee794
Why:
* In T370438 we are making extensive changes to DeletedContribsPager.
Ahead of this, we should ensure good test coverage.
What:
* Add some integration tests to DeletedContribsPagerTest.
* Also update coverage annotations to use the recommended style.
Bug: T370438
Bug: T354968
Change-Id: I6538b787c784efcd0f13dd1d55d38907d80c9f5c
Instead of using these terrible regexp assertions to match any SQL
query regardless of current time, set a fake time instead and use
simple string assertions like in the other tests.
Change-Id: If88e0f1487f79e2126d75a5123872d1f75c48403
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
These were soft deprecated in 1.38, it's time to emit deprecation warnings
so we can complete their removal from the public API.
Change-Id: I437ab7dc8af4eb5d336e8074a42a0a54b4c00a4b
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
get_debug_type() does the same thing but better (spelling type names
in the same way as in type declarations, and including names of
object classes and resource types). It was added in PHP 8, but the
symfony/polyfill-php80 package provides it while we still support 7.4.
Also remove uses of get_class() and get_resource_type() where the new
method already provides the same information.
For reference:
https://www.php.net/manual/en/function.get-debug-type.phphttps://www.php.net/manual/en/function.gettype.php
In this commit I'm only changing code where it looks like the result
is used only for some king of debug, log, or test output. This
probably won't break anything important, but I'm not sure whether
anything might depend on the exact values.
Change-Id: I7c1f0a8f669228643e86f8e511c0e26a2edb2948
get_debug_type() does the same thing but better (spelling type names
in the same way as in type declarations, and including names of
object classes and resource types). It was added in PHP 8, but the
symfony/polyfill-php80 package provides it while we still support 7.4.
Also remove uses of get_class() and get_resource_type() where the new
method already provides the same information.
For reference:
https://www.php.net/manual/en/function.get-debug-type.phphttps://www.php.net/manual/en/function.gettype.php
To keep this safe and simple to review, I'm only changing cases where
the type is immediately used in an exception message.
Change-Id: I325efcddcb58be63b1592b9c20ac0845393c15e2
Add a hook to StartUpModule that can modify the source URLs
that get embedded into the startup module JS in the form of
mw.loader.addSource() parameters.
The intended use case is preserving relevant URL information,
especially in the case of the 'local' source which is a
relative URL, when the URL pattern of the load.php URL
that generates the startup module code is different from the
URL pattern of the page that loads that load.php URL.
(E.g. $wgLoadScript is set to a different domain than the
current page, to canonicalize load.php URLs for a site
that's reachable via multiple domains, but then by default
the local source is a relative URL which would be
interpreted relative to the URL of the page that executes
the startup module code, so it would result in calls to
non-canonical load.php URLs).
Bug: T365162
Bug: T371530
Change-Id: I199ab779abd0596b836ae43dcc5f2f2a489c9274
Mostly used find-and-replace:
Find:
/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|)
Replace with:
\3 \1 \4
More could be done, but to keep this patch reasonably sized, I only
changed the most obvious and unambiguously correct cases.
In some cases, I also removed redundant doc comments on the
constructor, and re-ordered the properties to match the constructor.
Change-Id: I3f8427ae4f5d55177ae18986ef15d84d0e7bf6f4
Mostly used find-and-replace:
Find:
/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|)
Replace with:
\3 \1 \4
More could be done, but to keep this patch reasonably sized, I only
changed the most obvious and unambiguously correct cases.
In some cases, I also removed redundant doc comments on the
constructor, and re-ordered the properties to match the constructor.
Change-Id: I819ed771c915293663856c577a481d607b76ed80
This mostly reverts commit 28ad29ea0f.
Checking the validity of the provided email doesn't reveal any
information about any users, and it could help catch genuine mistakes,
e.g. if someone inputs the username in the email field.
Previously if an invalid email was provided, we showed a success
message that is an obvious lie (saying we sent an email to something
that isn't an email address).
Change-Id: Idec437b29b22e5b1e5aaff3846632fbc413a3dcb
This code was partially copied into MassMessage and will hopefully
enable more places that accept arbitrary wikitext to check lint errors.
It also hides the internal details of checking with the Linter
extension's configuration in one place until it can be refactored into
something more acceptable (T360809).
Bug: T368690
Change-Id: Iaeb3ccbd61a2a8cb0d8b3dc8b06a3a10bc8fa653
Edits from temporary accounts are considered anonymous edits.
ApiQueryRecentChanges doesn't correctly reflect this and needs to be
updated to correctly return temporary account edits as anonymous (and
similarly, not to return them when requesting !anon)
- Update the anon|!anon query to accomodate temporary accounts
Bug: T370803
Change-Id: Ica5225422ea53d2aa3a84b86d9c2f14832a34ed4