Commit graph

1253 commits

Author SHA1 Message Date
Timo Tijhof
d814a74b6f benchmarks: Remove some old and trivial benchmarks
These are mainly testing PHP rather MW code, so there isn't so much
to iterate or learn from these periodically.

As a general data point for what to pick one would presumably write a
micro bench from scratch for any of the thousands of possible things
one could think of varations for in the space of built-ins and such.

As a general benchmark for changing server or PHP configuration,
these would not be represenative either way, we'd likely use full
HTTP requests or something like the higher-level Parse and Tidy
benchmarks.

Change-Id: I4e98ae394a49c1f4a247b8d1e79a2ae5f7022d05
2021-08-23 04:15:40 +00:00
Timo Tijhof
e07a279a39 language: Add MediaWiki\Languages\Data namespace to PSR-4 autoloader
Bug: T225756
Change-Id: I7e30a5f5c9f3c36e8a9e3f1fb6ebebb3bbe727ab
2021-08-10 22:00:25 +00:00
Timo Tijhof
f3ef7f7f23 language: Autoload normalize data and remove transformUsingPairFile compat
* Turn normalize data into an autoloadable class and use the class name
  as key instead of a partial file name with a base directory.

* This protected function is not aimed at re-use in extensions,
  has no other usage known to Codesearch. Mark it internal,
  and remove the compat introduced by 31283f34bf.

* Update the now ten-year-old documentation comments that described
  this as "Temporary". The functionality and comment were introduced
  in 2010 by Tim with r60599 (ad19c032b0).
  Ref <https://bash.toolforge.org/search?p=0&q=temporary>.

* Replace the broken wikitech-l archive link with a working one,
  and describe the thread for easier future reference.

Bug: T225756
Change-Id: I004da1f25c19e1095d0917349f2ba8461f9f0715
2021-08-10 21:03:13 +00:00
jenkins-bot
b036ab73aa Merge "Move Language subclasses to includes/" 2021-08-07 21:03:03 +00:00
jdlrobson
dc15f6caa1 SkinTemplateToolboxEndHook is removed
Deprecated in 1.35, removed in 1.37
Existing skins using the hook will not necessarily
break as many of the skins run their own version of the hook.

Extensions using the hook will no longer output links
to the toolbox in the sidebar.

Bug: T256511
Change-Id: I1ba018ced266ac27f3e038ba9102ab54a669df81
2021-08-05 15:45:29 +00:00
Timo Tijhof
7c39f76452 Move Language subclasses to includes/
Depending on which namespace we want these classes to have after
T166010 they could either stay in includes/languages/ (plural) in
their own MediaWiki\Languages\-namespace dedicated to Language
subclasses, or they could go in into a subdirectory like
`includes/language/languages/` if we want to keep them in the same
top-level namespace as other Language classes and services, but in
a more nested namespace.

For now, I've made the smaller change and kept the Language subclasses
in their own directory directly under includes/, not nested further.

Bug: T225756
Change-Id: I01015424707b442853879fd50c97f00215e5c2fa
2021-08-04 23:44:46 +01:00
James D. Forrester
d11c59538a Rename DB primary position interfaces to DBPrimaryPos and MySQLPrimaryPos
And replace all uses.

Bug: T282894
Change-Id: I5222a8568255ac9fa5e2350e2264b8d2ee5eb968
2021-08-02 17:59:39 +00:00
Ammarpad
2e10b1b46c Remove SkinTemplateOutputPageBeforeExec Hook
Bug: T287773
Change-Id: Ieac3ca6a37c7991284851d6124febde0db8bb198
2021-07-30 22:31:27 +01:00
Clare Ming
91cc5389a3 Remove BaseTemplateToolbox hook
Bug: T256509
Change-Id: I9bc4e35e4062a6e77da66de46d0199be583c9d9a
2021-07-28 15:40:49 -06:00
Tim Starling
bc76602493 DBMS-specific ResultWrapper subclasses
Cleanup after the switch of Database::query() to return ResultWrapper
instead of resource.

* Soft-deprecate the IResultWrapper accessors in IDatabase.
* Move relevant DBMS-specific functionality to ResultWrapper subclasses.
  The deprecated methods in IResultWrapper become short and simple.
  ResultWrapper is now abstract (b/c break).
* Move the implementation of fieldName(), numFields() and one of the
  fieldInfo() implementations to the ResultWrapper subclass in order to
  avoid ResultWrapper::unwrap() calls.
* Make Database::doQuery() return a ResultWrapper subclass instead of
  underlying result data, so that the Database parent class does not
  need to be aware of wrapper construction.
* Hard-deprecate ResultWrapper::unwrap(),
  DatabaseMysqlBase::fieldType(), DatabasePostgres::fieldType().
* Fix the inefficient seeking method in SQLite.
* Make FakeResultWrapper extend ResultWrapper with an implementation
  similar to the SQLite one. This is possible because ResultWrapper does
  not depend on IDatabase anymore.
* Resolve fixme in DatabasePostgres: from studying the source,
  neither pg_fetch_object() nor pg_num_rows() can set an error
  retrievable with pg_last_error(). Removed unnecessary warning
  suppression.
* ResultWrapperTest didn't make sense as a unit test anymore, so I
  adapted it as an integration test against the current DBMS.

This change also means that ResultWrapper::key() always gives the
correct offset, even if Iterator methods are not being used.

Bug: T286694
Change-Id: I935835316c0bd7d3d061bd8fde9c9ce99ce756ec
2021-07-21 06:54:26 -07:00
Tim Starling
d3d8dc9965 Schema migration for revison_actor_temp table removal
Introduce a new schema migration stage in which rev_actor is used
directly and the revision_actor_temp table is no longer needed. This
becomes the new "new" stage whereas the previous situation is now
termed SCHEMA_COMPAT_TEMP.

Introduce migrateRevisionActorTemp which copies data from
revision_actor_temp to rev_actor. The code is similar to
migrateImageCommentTemp.php except that it doesn't delete from the old
table.

Partial revert of c29909e59f. That change removed direct
references to $wgActorTableSchemaMigrationStage and made queries
involving revision_actor_temp be unconditional. Such changes need to be
reverted to make the use of revision_actor_temp be conditional again.

In ActorMigrationTest, I compacted provideGetJoin() and
provideGetWhere(), removing most of the duplication between expected
values. I gave all the stages a short name, and mostly used the name in
providers.

Bug: T275246
Change-Id: I7498107dd6433ab7de5bf2e7b3fe2aa5e10e345d
2021-07-14 08:29:04 +10:00
Reedy
cd45c0fc30 Add maintenance script to invalidate a users bot passwords
Bug: T269543
Change-Id: I5848466edf45d4a2d04b52d1643c35fb68b0da08
2021-07-13 15:39:11 +01:00
jenkins-bot
313afcbd2d Merge "Make CentralIdLookup a service" 2021-06-25 13:04:05 +00:00
jenkins-bot
63518e4faa Merge "Remove the AugmentPageProps class, unused" 2021-06-25 07:06:55 +00:00
Sam Smith
3bcf989f72 hooks: Remove deprecated SkinTemplateBuildNavUrlsNav_urlsAfterPermalink hook
The SkinTemplatePreventOtherActiveTabs hook was marked as deprecated in
MediaWiki 1.35.

Bug: T284950
Change-Id: I9a4806047f8d31d59a00e02145906672b85c004c
2021-06-24 17:25:46 +01:00
Sam Smith
a11aceb214 hooks: Remove deprecated SkinTemplateTabAction hook
The SkinTemplateTabAction hook was marked as deprecated in MediaWiki
1.35.

Further, there are no SkinTemplatePreventOtherActiveTabs hook handers in
codebases that we index [0].

[0] https://codesearch.wmcloud.org/search/?q=SkinTemplateTabAction

Bug: T284950
Change-Id: I998bf8ffe6be43ad3eb38b1a9388a35aa94d7685
2021-06-24 17:25:15 +01:00
Sam Smith
99786a9492 hooks: Remove deprecated SkinTemplatePreventOtherActiveTabs hook
The SkinTemplatePreventOtherActiveTabs hook was marked as deprecated in
MediaWiki 1.35.

Further, there are no SkinTemplatePreventOtherActiveTabs hook handers in
codebases that we index [0].

[0] https://codesearch.wmcloud.org/search/?q=SkinTemplatePreventOtherActiveTabs

Bug: T284950
Change-Id: I37c5bdcc8875a23798f641161e53be3e4d073d7d
2021-06-24 17:24:39 +01:00
Petr Pchelko
ae3d709b22 Make CentralIdLookup a service
This commit is a combination of work done by Tgr in
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/571411
and MaxSem in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/594533
It was just easier to create a brand new patch then
rebase old ones.

Bug: T265767
Change-Id: I3930dab70846e95154d9089905c446e721ef4ee7
2021-06-24 08:37:55 -07:00
DannyS712
7523df7d1f Remove the AugmentPageProps class, unused
Added to the release notes as a breaking change,
no deprecation period because there are no known
uses anywhere on codesearch

Bug: T248215
Change-Id: If7368ffdd09ab69f7a40501ef9d8a90660db7f58
2021-06-24 07:01:58 +00:00
DannyS712
983984d5d4 EPIC: Remove the Revision class entirely
Following soft deprecation in 1.31, hard deprecation
in 1.35, and removal of remaining deprecated uses,
the entire Revision class, and the tests for it, can
now be removed. This will be followed by a patch to
clean up old references in comments - this is just
dealing with the code.

There were some other tests in RevisionDbTest.php
for Title::getNextRevisionID and Title::getRelativeRevisionID,
which could have been kept, but since those methods are
tested separately in TitleTest, no need to keep these, so
just remove the entire file.

Also remove the RevisionTestModifyableContent and
RevisionTestModifyableContentHandler classes that were
only loaded for use in RevisionDbTest - not sure how
the stable interface policy applies to classes that
are only loaded within tests, so mention that in the
release notes as a breaking change.

Bug: T247143
Change-Id: I05a297d28b85c7413384979f5c908be318098d9d
2021-06-10 15:57:44 +00:00
Tim Starling
f5d86ec75e Replace usage of custom File properties
Some MediaHandler subclasses were setting custom properties on the File
object in order to cache file-associated state. So:

* Add File::getHandlerState() and File::setHandlerState().
* Put them in an interface, which will be used in a subsequent commit in
  MediaHandler::getSizeAndMetadata().
* Use them in DjvuHandler.
* Provide a trivial implementation of the interface, for use in testing
  and in the subsequent commit.

Change-Id: Ic365384ff13f7898c1203da38c4405abf03d7563
2021-05-27 18:48:06 +10:00
jenkins-bot
be5631743e Merge "WikiImporter: inject services" 2021-05-26 16:45:59 +00:00
ZabeMath
3c978f6fc6 WikiImporter: inject services
This patch injects services into WikiImporter. It also adds
a WikiImporterFactory service for creating WikiImporter
instances.

Change-Id: I2966297e5728fca1ae8280361f1008cef6c6041b
2021-05-24 23:10:07 +02:00
Derk-Jan Hartman
3db119428a Basic JPEG2000 handler
Basic handler for JPEG2000 files. Both jp2 and jpx are supported by
php's image functions.

No support for:
- metadata
- lossy vs lossless thumbnail
- bucketing
- thumbor

Bug: T161934
Change-Id: I1a72d4dfb034f3ae24661db515cf03b35ec18fa2
2021-05-19 12:42:08 -07:00
Ammar Abdulhamid
12870e98c9 Add maintenance script to delete corrupted pages
These are rows in page_table that have 'page_latest' entry with
corresponding 'rev_id' but no associated 'rev_page' entry in revision
table. Such rows create ghost pages because their 'page_latest' rev is
actually missing or moved to a different page now (which possess the -
associated 'rev_page' on revision table now).

https://en.wikipedia.org/wiki/Module:Jct/city/Chinissai
(page_id=41871839) is an example of such pages. Its page_latest rev is
819371998. But this revision has been moved to another page now
(page_id= 56252475), rendering the former inaccessible.

fb58d39 will prevent this going forward (for scribunto content), but we
need to clear the extant pages for module namespace and others caused
by something else.

Bug: T263340
Change-Id: I51abc295e37030ab181d4380f62c30d7998f1b9e
2021-05-17 16:41:53 +10:00
jenkins-bot
cc3b0d6f27 Merge "Create FauxRequestUpload to fake uploads in tests" 2021-05-15 12:20:38 +00:00
daniel
0deb3b0891 Remove aliases for SearchResultPageIdentity
SearchResultPageIdentity and SearchResultPageIdentityValue were
introduced as placeholders for PageIdentity and PageIdentityValue.
They were marked @unstable, and should be unused now. So we can delete
them.

Depends-On: I7a1dfc26d0985e645c785297c849e4c2854c034b
Depends-On: I7e4f6099083ec0eed8878a67ed1b2ee30b5fe43e
Change-Id: I07d6eb019d4570f293ca12035092705b447aa458
2021-05-15 01:45:28 +00:00
daniel
7b832c1fa3 Remove SearchResultPageIdentity interface
SearchResultPageIdentity and SearchResultPageIdentityValue were
introduced as placeholders for PageIdentity and PageIdentityValues.
They can now become aliases.

Bug: T282091
Depends-On: I9b1ab02e0acf12ace107361ea2c443aa543c4880
Depends-On: Ie405ea9539cd18e15b0abb6db6df64ec0135825d
Change-Id: I6eb55c78a0a72be66814f8bc854ba663e7c6f62b
2021-05-10 16:05:45 +02:00
jenkins-bot
eee48dfed0 Merge "Split a base class out of ActorMigration" 2021-05-06 11:48:50 +00:00
Tim Starling
3faf97c78d Split a base class out of ActorMigration
AbuseFilter needs a class which is almost identical to core's
ActorMigration, so I split out the generic facilities into
ActorMigrationBase, leaving the bits specific to core in ActorMigration.

I changed the way fields and tables are specified so that it's easier to
override in subclasses.

Proper injection of ActorStoreFactory in
ActorMigrationTest::testGetWhere() was necessary to avoid a test failure
due to a teardown issue.

Bug: T278917
Change-Id: I3a6486532f2ef360d1fd01b3a609de71d412f739
2021-05-03 15:14:06 +10:00
Reedy
417de8f5c4 Delete maintenance/cleanupAncientTables.php
Bug: T281635
Change-Id: Ia746f301467e62e4544e451ccc7f46f4e2c6380c
2021-05-03 01:07:39 +01:00
DannyS712
7bd7d2a6c1 Remove hooks that use Revision objects
All hooks were previously hard deprecated
in 1.35. Affected hooks:
* ArticleRevisionUndeleted - use RevisionUndeleted
* ArticleRollbackComplete - use RollbackComplete
* DiffRevisionTools - use DiffTools
* DiffViewHeader - use DifferenceEngineViewHeader
* HistoryRevisionTools - use HistoryTools
* NewRevisionFromEditComplete - use RevisionFromEditComplete
* PageContentInsertComplete - use PageSaveComplete
* PageContentSaveComplete - use PageSaveComplete
* ParserFetchTemplate - use BeforeParserFetchTemplateRevisionRecord
* RevisionInsertComplete - use RevisionRecordInserted
* TitleMoveComplete - use PageMoveComplete
* TitleMoveCompleting - use PageMoveCompleting
* UndeleteShowRevision - no replacement

Includes a fix for setting the associated rev id
of page protections, which previously was only done
using $nullRevision which was a Revision object created
if any hooks needed it; those hooks were hard deprecated
and so for WMF prod the rev id was not being set.

Bug: T247143
Depends-On: Idfa345193ae99fb2f1c9a8f8d28d8d540a6e3d62
Change-Id: I519167f76a5a3c1f5410415b2721462a3dcc3ec8
2021-04-30 17:28:20 +00:00
jenkins-bot
5b818d23e7 Merge "rdbms: move DBAL-related classes under /dbal directory" 2021-04-29 18:44:22 +00:00
jenkins-bot
1d7e23e460 Merge "Add script for resolving class names to files" 2021-04-27 14:45:17 +00:00
Aaron Schulz
dcdec1a2b3 rdbms: move DBAL-related classes under /dbal directory
Change-Id: I116e266835c59a9f7d8731614e13c4db5afb975c
2021-04-26 18:08:09 -07:00
Petr Pchelko
ab9ecc0268 Drop hard-deprecated CacheHelper classes
Bug: T249230
Change-Id: I8fb43e862a19031520dda5a147e533becd7eb89e
2021-04-20 12:56:01 +00:00
Petr Pchelko
c925cb1a4a Drop Autopromote class, deprecated since 1.35
Change-Id: Iee9a3e43fc1689dde867ec7349f0347c741abc36
2021-04-19 09:20:36 -07:00
daniel
6627e42284 Add script for resolving class names to files
Use case: for a list of classes used in a specific context such as
MediaWikiServices, list all files containing these classes, so they can
be processed with command line tools such as grep.

Change-Id: I88dbee72dc5a560624f8cc1da0d905460309f624
2021-04-16 11:04:39 +00:00
jenkins-bot
150601f875 Merge "Update updateSearchIndex.php to 2006+ standards" 2021-04-13 23:48:46 +00:00
jenkins-bot
0d547d95ee Merge "Remove checkLess.php" 2021-04-13 21:40:16 +00:00
jenkins-bot
b61fbb0ab5 Merge "rebuildLocalisationCache: Add --skip-message-purge and accompanying script" 2021-04-13 21:28:12 +00:00
gengh
d59983739e Remove checkLess.php
Bug: T279026
Change-Id: I7b7425bd18df05edc8b2716e44fc03152613efbd
2021-04-13 21:13:04 +00:00
Tim Starling
221162b803 Update updateSearchIndex.php to 2006+ standards
* Remove LOCK TABLES. It was probably never necessary, but in any case
  we have transactions now.
* Delete updateDoubleWidthSearch.php, it was for upgrading from 1.17 or
  earlier, which is no longer supported. Revert the move of various
  updateSearchIndex.php functions to Maintenance. Nothing has ever used
  these except updateSearchIndex.php and updateDoubleWidthSearch.php.
* Convert the query to use the new Database:select() method.
* Remove migration from searchUpdate.pos to searchUpdate.wiki.pos, which
  was put there to support upgrades to 1.16.

Bug: T252853
Change-Id: I19bb44a9a46c2ebdb16a777bb462375278b05b7b
2021-04-09 07:35:07 +10:00
Cindy Cicalese
f1dadbb4ca Rename WatchlistNotificationManager to WatchlistManager
Change-Id: Ic9707c6b74180ef111d128f9f00de218d191c175
2021-04-07 18:16:24 -04:00
Timo Tijhof
0af11e2740 rebuildLocalisationCache: Add --skip-message-purge and accompanying script
== Adding --skip-message-purge

Follows-up d91c6627a9. Per CR and Phab comments, I don't think we
can (yet) promise a generic "--offline" mode. This seems too easy to
misuse. Both for users of the script, as well as for future development
to the script. It can fall out out of sync with requirements of the
overall system and leaves no natural place to discover what
responsibilities are being deferred and how the operator should fulfill
those duties.

We know LCStoreDB doesn't work offline, but there are likely other
aspects of this that don't yet work offline for some users. It would
require a much more rigorous refactor (and dropping signifant extension
hooks) to make this reliably offline. I'd welcome a standalone script
using only vendor libs, that does nothing other than scan directories
and build JSON/PHP/CDB files, but that's not what it is today.

What we can do is skip the one operation we know requires a live
DB connection, and (my main motivation for this commit) then document
that skipping it, require the user to perform the purge by other means
instead, since the purge itself is not actually optional.

Also, make this not a WMF-specific option in MW core, by committing
the accompanying script needed for this to work. This was previously
in the WikimediaMaintenance extension as "refreshMessageBlobs.php".

== Keeping --offline (as --no-database)

As far as I know, the purge is the only action we ran into that needed
a database connection, and important to note was that it's not optional.

I think for WMF we did not run into any other logic in our configuration
that uses a database, so --skip-message-purge should suffice. However,
I've kept the option for two reasons:

1. To recognise in some way the business need for WMF to use this
   script in an offline manner, and thus document that the script
   should at least have a way to work offline, even if there may be
   site configurations and extensions that make this impossible, from
   a core perspective we want to (experimentally) try to support this.

2. There is unimportant setup logic that happens in doMaintenance.php
   where the service wiring for LBFactory is activated by default.
   This seems avoidable and technical debt, but at least for now
   we do need a way to skip that, so this option will continue to
   have that effect.

However, I've renamed the option and inverted its promise. This is not
a promise from core *to* the user to offer an offline mode. Rather,
it is a promise *from* the user that they think nothing DB-needy is in
use.

Bug: T268698
Bug: T263872
Change-Id: I7878fdf4a901fb5e75da540293bb9df9fb508c20
2021-04-07 00:36:59 +01:00
Umherirrender
f338645527 Create FauxRequestUpload to fake uploads in tests
And use it in core
Avoid direct use of super global $_FILES

This can breaks all FauxRequest relaying on $_FILES
in tests or production code via FauxRequest::getUpload.
Falls back to $_FILES for the moment

Bug: T48163
Change-Id: I7392acc9bb682ec6b7025dbed0734c142f45c91a
2021-04-06 23:10:43 +02:00
Petr Pchelko
c621548cf8 Convert mail namespace to Authority/UserIdentity
Change-Id: I1e1ea72f94735ddaf66eab29aad1296e1abffb9b
2021-04-01 15:46:09 -06:00
Amir Sarabadani
0dacf7d68d Drop two 1.13 updates
- doCategoryPopulation is not needed nor being called anymore. There's
   not much use for the maintenance script either.
 - doPopulateParentId ditto.

Bug: T272199
Change-Id: Id7fc111b71e8ee9a37a3e2e56849ac5afeea9f9d
2021-03-26 21:34:00 +01:00
jenkins-bot
ad9661c4b8 Merge "Add HTMLTagMultiselectField" 2021-03-26 16:37:37 +00:00
STran
ee93d068d2 Add HTMLTagMultiselectField
Implements HTMLTagMultiselectField, a form field that instantiates
TagMultiselectWidget, the PHP representation of the OOUI's js-based
widget of the same name with the implemented parameters:
* allowArbitrary
* allowedValues

Bug: T278317
Change-Id: I3a6a30506d493be4185f917c577b3837fffd8ae1
2021-03-26 08:15:38 -07:00