Commit graph

25 commits

Author SHA1 Message Date
James D. Forrester
64898405cb build: Upgrade mediawiki-codesniffer from v35.0.0 to v36.0.0
Change-Id: I8905d0d69738a1cd6997c104080fdf128d315e8b
2021-04-29 13:00:15 -07:00
DannyS712
a18ae1e738 CommentStoreTest: use mock languages where possible
For tests that don't actually require the language
(i.e. don't create or insert new comments)

Change-Id: Idcbe75620a05c4eea61e22a9e1d2258d2fd8d468
2021-03-12 09:20:18 +01:00
Thiemo Kreuz
91f8f7eb7e Turn CommentStore::$tempTables into a constant
It's private, and no code writes to this array. It is a
constant, just not implemented as one.

Change-Id: Ida13ce8ccc99802a8c673e06411955e5c74a417f
2021-02-16 09:42:30 +01:00
DannyS712
cb5bcac4ff Remove CommentStore::newKey, deprecated and unused
Bug: T241957
Change-Id: If074df75e4c739a633e9d7f6578c34130264e89d
2020-02-20 02:00:15 +00:00
Thiemo Kreuz
9c57ea2b7f Replace complicated assertions with assertIsString() and such
This patch tries to make assertions in tests more readable by using more
self-documenting assertions as provided by modern PHPUnit versions. Among
a few others, these two main changes are done:

* I found a lot of assertions with the expected value being the *second*
parameter. I did not changed all of them. Only some that can be replaced
with assertNull() and such.

* I try to replace all `assertTrue( is_…() )` with dedicated assertions.

Change-Id: I1fc72188fbd0edacf13886e7f9a9eacbd85f13c2
2020-01-28 19:17:58 +00:00
Aryeh Gregor
0de9c47b50 Remove Language::factory and getParentLanguage use
Change-Id: I11f8801ef47ec1a1f63d840116e69667e6f3ae3c
2019-10-27 12:34:28 +02:00
James D. Forrester
83d76f4cb5 phpcs: Enable MediaWiki.Commenting.PhpunitAnnotations.ForbiddenExpectedException* and make pass
Change-Id: I63f97497714a32236268be6965c5e181dade6c58
2019-10-14 12:48:48 -07:00
Brad Jorsch
b8efacc227 CommentStore: Accept SCHEMA_COMPAT_* constants
Extensions doing an actor and comment migration at the same time will
likely want to use the same constants for each, and that will most
likely be using write-both/read-old and write-both/read-new for the
middle stages rather than write-both/read-both and write-new/read-both
as implemented by the MIGRATION_* constants. See Ie29fd05 for example.

This patch changes CommentStore's internal logic to work correctly when
passed write-both/read-old or write-both/read-new.

Bug: T233449
Change-Id: Iebec80f969ad1c4f9f51a4f25656319cca32b0dd
2019-09-26 11:17:50 +00:00
Umherirrender
c242c67803 Add missing use for IMaintainableDatabase
Change-Id: I00b30466fa6044988768493586993c3db253c975
2019-02-20 20:57:18 +01:00
Lucas Werkmeister
d5ed0163f2 Fix CommentStoreComment RawMessage construction
If a CommentStoreComment is constructed without a Message argument, then
the RawMessage it uses instead should specify the comment text as a
plain-text parameter, not as a regular parameter: we don’t want any
syntax in the text to be interpreted at the Message level.

Change-Id: If14debde2bceae695c8955604ee96bd5005d8b66
2019-02-13 11:17:10 -05:00
Brad Jorsch
0abb9338f8 Mostly drop old comment schemas
This removes most of the pre-CommentStore text columns, and the
$wgCommentTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_comment remains in the code, as on Wikimedia wikis the revision
table is too large to alter at this time. A future change will combine
that with the removal of rev_user_text, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

CommentStore's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process.

Bug: T166733
Change-Id: I1479c73774e01ead1490adf6128f820c09bce9d4
2019-02-07 16:59:27 +11:00
Brad Jorsch
d099bb6f95 Drop the image_comment_temp table
It is no longer used.

Bug: T188132
Change-Id: Ic8efeddc030f48e82ba861926121b64eca37d169
2018-11-14 15:04:31 -05:00
Brad Jorsch
7a422138a7 Migrate image descriptions from image_comment_temp
image_comment_temp was always intended to be temporary, until an
expensive schema change on Wikimedia Commons's image table could be
done. Now that that has been done, stop writing image_comment_temp and
add a migration script to copy existing data into img_description_id.

Ic8efeddc will remove the reads from image_comment_temp and drop the
image_comment_temp table.

Bug: T188132
Change-Id: Iab5f521577a415b2dc213b517ee8a0dca4fdd0aa
2018-10-02 10:30:00 -04:00
James D. Forrester
733704ed82 CommentStore: Hard-deprecate newKey()
Not used by any extensions known to Wikimedia git.

Change-Id: I3c07ad6db9d88feddad1cf29d4794fef622298ea
2018-09-20 10:15:39 -07:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
daniel
33258e04d1 Introduce new schema flags and use them in RevisionStore.
NOTE: this changes the numeric values of the MIGRATION_XXX constants!
Order is preserved.

Bug: T197619
Change-Id: I16db7dd5799ab98c1cb12e7cd1e0b2da83b366fc
2018-07-02 17:20:14 +02:00
Brad Jorsch
27c61fb1e9 Add actor table and code to start using it
Storing the user name or IP in every row in large tables like revision
and logging takes up space and makes operations on these tables slower.
This patch begins the process of moving those into one "actor" table
which other tables can reference with a single integer field.

A subsequent patch will remove the old columns.

Bug: T167246
Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50
Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
2018-02-23 10:06:20 -08:00
Reedy
39f0f919c5 Update suppressWarning()/restoreWarning() calls
Bug: T182273
Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
2018-02-10 08:50:12 +00:00
addshore
e5879da149 Pass $key into CommentStore methods and use MediawikiServices
This allows CommentStore to be added to MediaWikiServices
without the need of an aditional Factory.

This change includes a compatability layer to allow the behaviour
from 1.30 to continue to be used while deprecated.

CommentStore::newKey has been deprecated.
Keys are now passed into the public methods of CommentStore
where needed.
The following CommentStore methods have had their signatures changed
to introduced a $key parameter, but when used in conjunction with
CommentStore::newKey behaviour will remain unchanged:
  * CommentStore::getFields
  * CommentStore::getJoin
  * CommentStore::getComment
  * CommentStore::getCommentLegacy
  * CommentStore::insert
  * CommentStore::insertWithTemplate

Change-Id: I3abb62a5cfb0dcd456da9f4eb35583476ae41cfb
2018-02-05 15:34:12 +00:00
Brad Jorsch
5c228f5a18 Have CommentStore limit the maximum character length of comments
I92954c9 accidentally allowed comments, when CommentStore is enabled, to
be the full 65535 bytes available in the database field. This was never
intended.

There is not yet any consensus in T6714 or T6715 on just how long the
longer comments should be, for now we'll set 1000 because Tim says so.
Note this doesn't change the UI to actually allow more characters and
will only take effect once $wgCommentTableSchemaMigrationStage is raised
above MIGRATION_OLD.

Note this also doesn't make the limit configurable. That too can be done
later if needed, again along with whatever changes are necessary to the
UI to account for a variable limit.

Change-Id: I7e0c55619210ebab467436f0bb915271c0a7ccdc
2017-10-10 20:59:52 -04:00
jenkins-bot
a17d459d4b Merge "Handle comment truncation in CommentStore" 2017-09-05 18:39:21 +00:00
Brad Jorsch
6ec1a31502 Handle comment truncation in CommentStore
Since the caller doesn't (and shouldn't) know whether CommentStore is
using the old or the new schema, it should leave truncation of comments
to CommentStore.

Change-Id: I92954c922514271d774518d6a6c28a01f33c88c2
2017-09-01 15:03:45 -04:00
Brad Jorsch
01a10dba5a Remove reference to deprecated IDatabase->nextSequenceValue()
The method was deprecated and made unnecessary in Ib308190c.

Change-Id: I1729ac0b3a88270a4c2f064187a2472112aaeb1e
2017-09-01 12:28:39 -04:00
Brad Jorsch
91b86399b1 Fix various PostgreSQL failures
* Fix schema for image_comment_temp.
* Provide values in CommentStoreTest::provideInsertRoundTrip() for
  columns where the PG schema doesn't have a default value but the MySQL
  schema does.
* Call nextSequenceValue() from CommentStoreTest::testInsertRoundTrip().
* Correctly handle $options being the string 'FOR UPDATE' in
  DatabasePostgres::selectSQLText()
* Correctly handle the initial table in DatabasePostgres::selectSQLText() FOR
  UPDATE mangling.
* Correctly handle aliases in DatabasePostgres::selectSQLText() FOR
  UPDATE mangling.

Tests in PG are still going to be broken thanks to the fact that
nextSequenceValue() and insertId() can't be separated by another
nextSequenceValue()/insertId() pair. That should be taken care of by
T164898/T164900.

Change-Id: Ia770a003ca9170ab8bcc1436d8afe30700e00ada
2017-08-30 17:18:29 -04:00
Brad Jorsch
11cf01dd9a Add comment table and code to start using it
A subsequent patch will remove the old columns.

Bug: T166732
Change-Id: Ic3a434c061ed6e443ea072bc62dda09acbeeed7f
2017-08-30 15:05:00 +10:00