Commit graph

9298 commits

Author SHA1 Message Date
jdlrobson
f9be83e310 Deprecate Skin::getCopyrightIcon. Skin::getPoweredBy, SkinGetPoweredBy hook
The skin methods serve BaseTemplate so are moved there. The associated
hook is seldom used so deprecated.

Bug: T290583
Change-Id: I166241fc88b98603f8d5489643eda984f49bad66
2021-09-14 20:53:46 -07:00
jenkins-bot
d018c4f6ed Merge "rdbms: Add more return typehints" 2021-09-14 20:51:25 +00:00
jenkins-bot
a7e6a04334 Merge "Remove Title from signatures in CategoryViewer" 2021-09-14 19:04:18 +00:00
DannyS712
5da80e9abf UserDef: creating from id 0 should be unknown user, not context ip
The User class sets the name to be the context ip when creating based
on id 0, and the switch to UserIdentity(Value) matched that behavior,
but its likely unexpected for callers - treat 0 the same as other
ids that don't correspond to existing users by returning a
UserIdentityValue with an id 0 and the name "Unknown user".

Bug: T288311
Change-Id: I9763e4c1e17de8930e0f982ea868405db20a8efd
2021-09-14 03:25:40 +00:00
DannyS712
46ef24f70a UserDef: use TitleParser instead of Title objects
Migrate away from the Title object, use
TitleParser::parseTitle() which returns a
TitleValue which is enough. Will be followed by
switching UserDefTest to a unit test, but in a separate
commit.

Change-Id: Ia756964861c4e0f3edea89f6beec2643243ca741
2021-09-14 03:25:36 +00:00
DannyS712
9308ee9cf8 UserDef: no need to return full User objects
Maintain the existing behavior for creating based on a user
id or name that does not correspond to an existing user:
* if creating a User object based on the id 0, User::loadFromId()
will load the defaults with the name being set to false, and
User::getName() will convert that false to the ip of the current
request. We probably don't want UserDef to be doing that, but
this behavior should be changed separately - at the moment
we are just matching the existing behavior (see the prior commit
which adds tests to confirm the behavior isn't changing)
* if creating a User object based on an id that cannot be found
in the database, User::loadFromDatabase() will load the same
defaults, *except* that it will set the user name to "Unknown user"
* if creating a User object based on a name, User::getId() will,
if the id isn't already known, return 0 if the name matches
UserNameUtils::isIP() or ExternalUserNames::isExternal(). However,
the User object is currently only created based on a name after
passing an ExternalUserNames check, and the creation with
RIGOR_VALID prevents it from being an ip. Thus, the existing
code will call User::load(), which will check the database or
fallback to 0 if the user does not exist.

When creating a User from an id that does not exist, User::getId()
will return that id, until after the object tries to fully load,
after which it'll return 0 for the id. Since we cannot replicate
this with UserIdentity (switching the id to 0 only after getName()
is called for the first time) we set the id to always be 0, which
is more accurate. This is the only change in behavior.

We will remove the use of the context ip in a follow-up that will
switch to using "Unknown user" instead.

Accordingly, we will use a UserIdentityLookup as well as
manual construction of UserIdentityValue objects to match this
behavior.

Bug: T288311
Change-Id: Ida80c5d04d721fafa8d66f656dbd346c6cf643eb
2021-09-14 03:25:31 +00:00
Volker E
565b14c234 resourceloader: Remove -moz- vendor prefix from SkinModule css
Our basic support has been updated and Firefox supports replacement
`resolution` since version 8 or 16, depending which data source
one checks.
WebKit's support is a bit more complex and it seems like safest bet is
to leave its vendor prefix in for now.

Bug: T277803
Change-Id: I752f0b67672759824099b4b78892d143344e766f
2021-09-14 00:22:00 +00:00
jenkins-bot
80a054d35f Merge "Remove stub threshold feature" 2021-09-13 19:50:48 +00:00
jenkins-bot
c4b17ee3bb Merge "Drop action api token methods deprecated in 1.24" 2021-09-13 16:47:49 +00:00
Petr Pchelko
5afc62f258 Remove stub threshold feature
Bug: T284917
Change-Id: I5c9ea04a9deca136bb7210f07200d18f97fd6686
2021-09-13 09:26:38 -07:00
Aryeh Gregor
ceda8ac60e Remove Title from signatures in CategoryViewer
Co-authored-by: Daniel Kinzler <dkinzler@wikimedia.org>
Change-Id: Ie880482fe58b96809fdfd08ebf0825bdcf1d19d1
2021-09-13 16:14:06 +00:00
Petr Pchelko
8d7201894c Drop action api token methods deprecated in 1.24
Removes deprecated API endpoints and modules for dealing with
CSRF tokens.

Note: i18n messages are removed in a followup for ease of revert.

Bug: T280806
Depends-On: Ic83f44587db119ff2e3e6d5ff33a10894e0695e7
Change-Id: I58aedec6942ac5d3c21574cb0072f00ef365098c
2021-09-13 15:22:16 +00:00
Umherirrender
ce77d66ac6 Fix indent of line comment
Change-Id: Iff689d700a4891ffae647d0d9ee2d0d486a9eafe
2021-09-11 20:56:18 +02:00
jenkins-bot
5a53d57449 Merge "LinkCache: soft deprecate addGoodLinkObj()" 2021-09-10 17:22:02 +00:00
jenkins-bot
7ece0e7afd Merge "Title: Make use of BacklinkCacheFactory service" 2021-09-10 14:31:23 +00:00
daniel
855988fd0e LinkCache: soft deprecate addGoodLinkObj()
addGoodLinkObj() has many optional arguments, but omitting them actually
means corrupting the cache.

Nearly all existing callers are in tests.
So LinkCacheTestTrait::addGoodLinkObject() was created only
for testing. It is better to have this method in the
trait, because building the row directly in each test
would make these tests brittle against schema changes.

The only usage in WMF production code was in WikiPage and has been
fixed.

Bug: T284955
Change-Id: I03a2bd9ed64fcc0281ee29a286c8db395a9e03d9
2021-09-10 16:00:02 +02:00
jenkins-bot
6ae92c0c73 Merge "Improve DeletePage tests" 2021-09-09 21:10:39 +00:00
jenkins-bot
1efeefe017 Merge "PageStore: Use LinkCache" 2021-09-09 20:04:47 +00:00
jenkins-bot
150a589ecf Merge "Title: restore behavior of getCascadeStrictionSources" 2021-09-09 19:41:48 +00:00
jenkins-bot
77a25b1568 Merge "Introduce TitleUrlTests" 2021-09-09 19:26:29 +00:00
Derick Alangi
db43511e6a Title: Make use of BacklinkCacheFactory service
Change-Id: I48161585de6f329ec4037156234e0b07b3b837e6
2021-09-09 14:04:02 +01:00
jenkins-bot
9bb32a1f20 Merge "Add BacklinkCacheFactory Service" 2021-09-09 11:41:33 +00:00
jenkins-bot
6c353b4deb Merge "tests: Extract pure unit tests from TitleTest integration test" 2021-09-09 09:25:02 +00:00
jenkins-bot
74870b117a Merge "tests: Merge test cases of TitleMethodsTest into TitleTest" 2021-09-09 09:21:33 +00:00
Derick Alangi
96bc83e8eb Add BacklinkCacheFactory Service
Bug: T279433
Change-Id: I2943935e2d8148fce4457f76eca0234be72a5a5a
2021-09-09 09:58:52 +01:00
Reedy
4dae3b1a06 Rename four config variables to avoid 'blacklist' term
As part of our wider work on modernising and making more welcoming the
language we use within and around MediaWiki, now is a good time for us
to rename these configuration variables:

 - $wgFileBlacklist is now $wgProhibitedFileExtensions
 - $wgMimeTypeBlacklist is now $wgMimeTypeExclusions
 - $wgEnableUserEmailBlacklist is now $wgEnableUserEmailMuteList
 - $wgShortPagesNamespaceBlacklist is now $wgShortPagesNamespaceExclusions

Bug: T277987
Depends-On: I91e065c58fda144a722a41cf532e717f962d7a64
Change-Id: I558a8b20d67d48edccce0d065aec2d22992e9dda
2021-09-08 23:32:29 +01:00
Jdlrobson
4de7250830 Logos defined with pixels should be scaleable in browsers
This reverts commit bc200b6a1a reapplying
the patch. It has been modified slightly to temporarily work
with the beta cluster's unsupported configuration.

Bug: T207038
Change-Id: Ie86a5b59fbf93a400796a4cac3724207830092b5
2021-09-08 14:10:10 -07:00
Thcipriani
bc200b6a1a Revert "Logos defined with pixels should be scaleable in browsers"
This reverts commit 33ac451d3d.

Reason for revert: /wiki/Special:Version TypeError: Argument 1 passed to ResourceLoaderSkinModule::getRelativeSizedLogo() must be of the type array, boolean given, called in includes/resourceloader/ResourceLoaderSkinModule.php on line 600

Change-Id: Iddeb33d6165169dc106e9beb3e4a703a4b97eeb6
2021-09-08 20:13:32 +00:00
jdlrobson
33ac451d3d Logos defined with pixels should be scaleable in browsers
Bug: T207789
Change-Id: I358d2aa4b7e08a6507c87277dcfd29413efd0d6c
2021-09-08 18:32:37 +00:00
Daimona Eaytoy
1f86010f0f Improve DeletePage tests
Should have decent coverage now.

Bug: T288758
Change-Id: I2342f2072cd9c6d50831b9c3e7dd36f4a5e1c8e4
2021-09-08 17:37:52 +00:00
Derick Alangi
7d12da5595 tests: Extract pure unit tests from TitleTest integration test
-> Fixed TODOs such as adding test cases for namespaces that are
   not in `$wgNamespacesWithSubpages` in `testGetSubpageText()`.

-> Re-arranged provider methods to come before the test case as
   already in the files for consistency.

Change-Id: Ice2b3a07ea2ddd20417cbe87da93065e1812619e
2021-09-08 17:59:59 +01:00
Derick Alangi
043c2d5589 tests: Merge test cases of TitleMethodsTest into TitleTest
Change-Id: I31bfd91f393f7f69335687a4e7ca830f4831e2f3
2021-09-08 17:59:59 +01:00
jenkins-bot
5df94ae30e Merge "Make DeletePage a real service" 2021-09-08 16:56:39 +00:00
daniel
abc2179820 Title: restore behavior of getCascadeStrictionSources
The behavior of getCascadeStrictionSources was changed by Ia73ea587586cb69eb5
to conform to the documented behavior: it would always return false as the
first element of the return value if there were no cascading restriction sources,
as specified in the documentation.

Hopwever, the previous behavior was to return an empty array in that
case, unless the $getPages parameter was false. That behavior seems more
senible, and there is existing code that relies on it.

This patch restores the previous behavior and updates the documentation
instead.

Bug: T218395
Needed-By: I31ca0a8987f9694bc3b312a48c2c111ceda6fa3e
Change-Id: I1f24703b80566220ac6fe8ee500e838ed7fd29af
2021-09-08 17:22:17 +02:00
James D. Forrester
a362b2cff0 CollationTest: Be more specific with @covers
Change-Id: I1470fbf55efb401867d1cc0e53ef1a66b9a1f21c
2021-09-08 13:46:58 +00:00
Daimona Eaytoy
73f0ae36a3 Make DeletePage a real service
- Switch do actual DI
- Add some more parameters for needed dependencies
- Create a factory interface, implement it in PageCommandFactory and add
  wiring for it.
- Add new unit tests for DeletePage; unfortunately, this requires
  conditionally disabling some code during tests due to dependencies on
  legacy code that hasn't been migrated yet. I believe that these
  temporary hacks are acceptable, since they allow us to use real unit
  tests immediately.
- Adjust WikiPageDbTest: the two logging tests were identical as of
  Ie0d9da2c8d273c93301921e1e108d9ffb381b8a5; and then the logging part
  could just be part of the "main" test.
- Add integration tests for DeletePage. For now, these are all copying
  their WikiPageDbTest counterpart. More tests will be added soon™.

Bug: T288758
Change-Id: I2fb79ed905ce621cb87f0658983d97148948da28
2021-09-08 11:43:04 +00:00
daniel
737d733aff Introduce TitleUrlTests
Change-Id: I26e2e06ed3aa179a0b517d5df032ebf659fefd6e
2021-09-08 07:48:45 +00:00
jenkins-bot
d74de7f9eb Merge "Make WikiPage a ProperPageIdentity" 2021-09-07 19:48:14 +00:00
jenkins-bot
79615a43c1 Merge "Drop wgAjaxEditStash, deprecated in 1.36" 2021-09-07 16:45:22 +00:00
jenkins-bot
8ff1e8e74b Merge "Remove PasswordCannotMatchUsername password policy" 2021-09-07 15:24:31 +00:00
Derick A
7ebf05256a tests: Cover more methods in the Title::class (increase code coverage)
The methods that have been covered in this patch are listed below:
~ Title::hasFragment()
~ Title::getFragment()
~ Title::setFragment()
~ Title::isMainPage()
~ Title::equals()
~ Title::getPrefixedURL()
~ Title::prefix()
~ Title::__toString()
~ Title::getFullText()

Bug: T241406
Change-Id: I51ffadb52e7eef822e9e619e5132513dc1501f9b
2021-09-07 13:58:38 +00:00
Daimona Eaytoy
613a874635 rdbms: Add more return typehints
See full rationale at I59068cfed10aabf6c6002f9e9312a6ef6e7e9441.
Using IDatabase for now instead of DBConnRef for better BC.

Change-Id: Ie75aaf46ba91779e8706b10efeefa9580857f489
2021-09-07 08:23:36 +00:00
Reedy
7a17473dd1 Remove PasswordCannotMatchUsername password policy
Bug: T242768
Change-Id: Ied6fe389a1ce6c66cbf558d2f3867fb12245ff8a
2021-09-06 14:55:12 +00:00
jenkins-bot
02f7392231 Merge "Make ReadOnlyModeTest a pure unit test" 2021-09-05 21:07:05 +00:00
jenkins-bot
3f12217fe6 Merge "Hard deprecate User::getBoolOption()" 2021-09-04 20:17:00 +00:00
Alexander Vorwerk
3f06dfb475 Hard deprecate User::getBoolOption()
deprecated since 1.35

Bug: T277600
Change-Id: I54cea0dc589dc5bb7ed3b4ecceaa62b693b104d7
2021-09-04 09:52:06 +02:00
Umherirrender
5b3d3ef802 collation: Create CollationFactory service
Use ObjectFactory specs for collation classes
Avoid the language construction in the factory class,
make it a detail of the implementation of each class

Follow-Up of Ifc96f851e6091ce834dbaf0e91695c648a42169c

Bug: T286079
Change-Id: Ib581f64aec8619986fb8dd49ceee0524d59a1b84
2021-09-04 02:46:06 +02:00
Umherirrender
2e4ee47c3d Cleanup mixed space/tab line indent
Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
2021-09-04 00:52:31 +02:00
James D. Forrester
3983572c49 ILoadBalancer: Rename forEachOpenMasterConnection to forEachOpenPrimaryConnection
Bug: T282894
Change-Id: I4892084aba6c7fdfbeccec42de88b9f23490b61c
2021-09-03 13:05:23 -07:00
James D. Forrester
02d04502c9 Switch uses of ILoadBalancer::approveMasterChanges to ::approvePrimaryChanges
Bug: T282894
Change-Id: Iba3aa865d49af2836f3c6af15de307a289a32a2b
2021-09-03 09:59:56 -07:00