Commit graph

80 commits

Author SHA1 Message Date
jenkins-bot
b7625d63a6 Merge "Introduce ContentHandler::getSecondaryDataUpdates." 2018-09-17 14:06:19 +00:00
daniel
7960d5385f Introduce ContentHandler::getSecondaryDataUpdates.
This adds getSecondaryDataUpdates and getDeletionUpdates
to ContentHandler, and updates WikiPage and DerivedPageDataUpdates
to handle DataUpdates from all slots.

Bug: T194038
Bug: T194037
Change-Id: I75c96318f58a5cdda48484f7040ae41e6f42392a
2018-09-14 16:18:18 +02:00
daniel
4835a75ec5 Use RevisionRenderer for rendering ParserOutput
Bug: T174035
Bug: T174036
Change-Id: I1085b05d635dd954c143c8a398fae909632ba0a9
2018-09-11 15:25:39 +00:00
Brad Jorsch
87dd9db226 Update wikimedia/timestamp to v2.1.1
Also enable some tests for PostgreSQL that are fixed by the new version.

Bug: T195807
Change-Id: Id0d016f620662836b3a17de5f118715c1cbe3e69
Depends-On: I3bd8df5236600963be89602b2a52d0d95d640d66
2018-09-10 15:31:26 -04:00
Gergő Tisza
51602a436c
[MCR] Move getSecondaryDataUpdates to the page level
Replaces Content::getSecondaryDataUpdates with
WikiPage::getSecondaryDataUpdates so that aggregation of
data updates from multiple page slots can be handled without
the caller having to care about it.
Also adds a WikiPage::updateParserCache method for convenience.

This is a temporary measure until DerivedPageDataUpdater
(or its replacement) can be exposed directly, at which point
the WikiPage methods will be deprecated.

Also fixes a parameter handling bug in DerivedPageDataUpdater.

Bug: T194043
Change-Id: Idbe7d582b49fcb7c90aea813773b7610ad44b1a8
2018-09-04 21:50:58 +02:00
daniel
9b6a3dcb1d Add tests for article viewing
Bug: T174035
Change-Id: I06dc78853169812b17e0bde733d9306ccd687564
2018-08-28 19:22:26 +02:00
Kunal Mehta
b4ea2d8c81 Disable PHPUnit tests that fail under postgres
So we can make the job voting, preventing other tests from regressing.
These tests can be re-enabled whenever they're made to pass.

Bug: T195807
Change-Id: I58261dd70eea3581803987a4a7739c7d55558f42
2018-08-01 22:22:15 +00:00
Kunal Mehta
b92565ca18 Disable PHPUnit tests that fail under sqlite
So we can make the job voting, preventing other tests from regressing.
These tests can be re-enabled whenever they're made to pass.

Change-Id: I959710138e1e1b37b6ba69561c2920a78208bf12
2018-08-01 00:19:43 -07:00
daniel
e4adfdc4fe Add test for PageArchive::getPreviousRevision
Regression test for  I4e2031f9625744

Change-Id: Id22984bf7d1c3d6f57e827e9f1283231918b59b1
2018-07-13 12:16:36 +02:00
jenkins-bot
722f51c7e8 Merge "[MCR] Make PageArchive aware of MCR" 2018-07-10 15:04:59 +00:00
daniel
4943c74ac4 [MCR] Make PageArchive aware of MCR
Bug: T194015
Change-Id: I92afda87961860983f080d96fa0616a6fcca64e4
2018-07-10 16:36:57 +02:00
daniel
59ea200662 Avoid losing cached ParserOutput in doEditContent.
Without this fix, the Content would be parsed twice during an edit,
if extensions that hook into EditFilter and similar
pre-parse hooks call WikiPage::prepareContentForEdit.

With this fix, ParserOutput created by prepareContentForEdit is
re-used by doEditContent.

This is a stop-gap solution. The Real Fix (tm) is to stop using
doEditContent, and use a PageUpdater instead.

Bug: T198483
Change-Id: I42123e48de2b087ef98d8a4855ee3aebd7f1de57
2018-07-09 15:24:45 +02:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
jenkins-bot
fa321e4632 Merge "Introduce new schema flags and use them in RevisionStore." 2018-07-06 17:53:44 +00: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
daniel
0d51852087 Regression test for autopatrolling rollbacks
Bug: T198449
Change-Id: Ic280c38ac2ba0a0842c484f671e7e99f50cd54d5
2018-06-29 11:59:51 +02:00
daniel
c7564daa80
[MCR] Rollback for all slots
Bug: T194034
Change-Id: Ifd23bc1cd64ddc090e1c1c26aacda37e8ba7a18b
2018-06-23 15:14:47 +02:00
addshore
0ef66de3cf MCR RevisionStore, multi content mode..
Bug: T174024
Change-Id: Ifabf39e12ba843eb754ad0c029b7d16a311047a5
2018-06-14 17:30:33 +02:00
addshore
125bf7e44f [MCR] RevisionStore, enable insertions for new schema
Enable inserts to the new MCR db schema in single slot mode only.

TODO:
 - RELEASE NOTES

Notes:
 - When in MIGRATION_WRITE_NEW or greater, deleting and then
 restoring a page will result in different data in the revision table.
 For example, if you delete a page that has text_ids present in the
 revision table and restore it, the text_ids will be blank after.
 - When in MIGRATION_WRITE_BOTH or greater the archive table will
 start to ar_content_model entries where previously it would have been
 given NULL. This is due to the old content schema having NULL in the db
 when the default content model is used, but the new schema will always
 have a value, taken from the content_models table

Note: If259b1e1c49ce was squashed into this change.

Bug: T183488
Bug: T174024
Change-Id: Ic2221da30c8f6ac2ba42720fcd568f2d0ed70534
2018-06-14 13:36:08 +00:00
daniel
e8632ab0f6 [MCR] Factor PageUpdater out of WikiPage
This introduces PageUpdater to replace WikiPage::doEditContent,
and DerivedPageDataUpdater, to replace WikiPage::doEditUpdates
and WikiPage::prepareContentForEdit.

See docs/pageupdater.txt for a description of their
functionality.

MCR migration notes:

* The interface of PageUpdater is expected to
remain mostly stable after this patch. Code that has been using
WikiPage::doEditContent can be confidently migrated to using the
new mechanism for revision creation.

* This patch keeps the code inside PageUpdater largely aligned
with the old code in WikiPage, to make review easier to to avoid
mistakes. It is intended to be refactored further, moving
application logic into stateless services.

* DerivedPageDataUpdate is intended as a stepping stone for further
refactoring. Its behavior is designed to be compatible with
callback code that currently relies on
WikiPage::prepareContentForEdit. Much of the code that currently
lives in DerivedPageDataUpdate should be factored out into
services, all behavior relevant to calling code should be exposed
via narrow interfaces.

Bug: T174038
Bug: T196653
Change-Id: If610c68f4912e89af616cdcac1d35a1be3946afa
2018-06-14 13:22:13 +00:00
daniel
e4b775acf1 Suppress addCoreDBData() in tests overriding the revision schema.
Some unit tests for the MCR schema migration change the DB schema
in the test setup. However, addCoreDBData() will not work with the
modified schema. Since these tests don't actually need addCoreDBData()
to do anything, they can simply override it to do nothing.

Without this change, tests for Ic2221da30c and Ifabf39e12ba843
fail with $wgMultiContentRevisionSchemaMigrationStage = MIGRATION_WRITE_BOTH.

Change-Id: I86e140ec981dfa4e904822b1600399c533f9e3d6
2018-06-14 07:41:28 +00:00
jenkins-bot
6bfa7c3754 Merge "Introduce per-schema unit tests for revision storage." 2018-06-07 13:47:00 +00:00
daniel
32e9266d8d Introduce per-schema unit tests for revision storage.
This introduces traits for testing different schema variations.
These are not very useful in this patch, but make it much easier
to add tests for MCR schema migration in subsequent patches.

The code in this patch was previously part of If259b1e1c49ceaa4.

Change-Id: I239572f75bebbc9c731a3e3860c4eff179dc15e4
2018-06-07 13:31:16 +00:00
kaldari
9c387f5036 Record a log entry on page creation
This is controlled by a new config variable, $wgPageCreationLog,
which is set to false by default.

Bug: T12331
Change-Id: Ie3f6cc5ece0134433d5e4a572ea5eb0c3b700b8c
2018-05-29 09:10:40 -07:00
James D. Forrester
0db10b84b0 tests: Assert that the user who deleted a page is logged as such
These tests are rather basic, but they're better than the nothing that
seems to be the current state. Revision deletion is still untested and
suppression is only very lightly tested. More tests should be added.

Bug: T188479
Bug: T188773
Change-Id: Iba0f41ffddc6af45e0a4be86176708160f4821f4
2018-04-26 00:49:00 +00:00
Brad Jorsch
fd3ddd93e2 Fix WikiPageDbTestBase::testNewFromId_returnsNullOnNonExistingId
This test is passing an "integer" that is beyond what even 64-bit PHP
can properly represent as an integer, so it likely winds up passing it
as '7.3574757437438E+19' to the database. MySQL, being MySQL, doesn't
care much, but other DBs do.

Change it to 2**31-1 instead.

Change-Id: Ieba51f034eaa1c3eabb2ada6b1ce876beefd3bff
2018-03-17 22:02:13 -04:00
James D. Forrester
326d655fc9 Drop 'comma' value for wgArticleCountMethod
We have three methods for page counting currently supported for wikitext
non-redirect pages; 'any' counts any page that exists, 'link' counts any
page that has any outbound links, and 'comma' which searches for any ','
in the text having loaded it. This last option is much slower than these
other two, and is only used on a very small number of installations. Now
by dropping support for this method we can simplify this code and so run
it more often. Note that non-wikitext pages already did not support this
count method.

Installations with this setting set to 'comma', or any other string will
now work as if it was configured with 'any'.

Bug: T188472
Change-Id: I965927edcd2485ec4b49b2d80fdf216dbf19520b
2018-03-01 16:37:23 -08: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
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
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
addshore
1583f478da [MCR] Tests for WikiPage::doUpdateRestrictions
Bug: T180989
Change-Id: I75518d5ba34119e88e3e382523583fa8b65bc730
2018-01-04 11:28:01 +00:00
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
Kunal Mehta
2c16290785 Add @covers tags to page tests
Change-Id: Iadb7e8697e9992ca281b7dfe70cf832c82e194de
2017-12-24 23:29:00 -08:00
Umherirrender
5b351e86ea Use another pageid in WikiPageDbTestBase::testInsertOn_idSpecified
integer bigger than 2147483648 is bad on 32-bit php

1) WikiPageContentHandlerDbTest::testInsertOn_idSpecified
Failed asserting that -816015107 is identical to 3478952189.

> echo intval( 3478952189 );
-816015107

Change-Id: Ia2ab870dfe53bef873def3905ae93ea52d4ab2ad
2017-12-15 22:36:06 +00:00
Kunal Mehta
6fbea1aae4 WikiPageTest: Fix typo in @covers
Change-Id: I3f3a3b2a1f5e5aed61cd71db17ae6a6a01fe2ecb
2017-12-06 20:19:25 -08:00
addshore
7a46b709aa Tests for WikiPage::insertOn
Change-Id: I1bf7d19c4baaf0f720fcd6a1d9c16bf7489b5392
2017-12-05 11:29:20 -08:00
addshore
c4878eb281 Tests for WikiPage::updateIfNewerOn
This method is deprecated but due to refactoring
we should still test it.

Change-Id: I171ab731fff48ddd9fa54ef433881154377a2c7f
2017-12-05 11:29:19 -08:00
addshore
11dbd4ec8e Tests for WikiPage::updateRevisionOn
Bug: T180989
Change-Id: I245d9d467e3113bf49e06ee5c725205d4225671a
2017-12-05 11:29:19 -08:00
addshore
2af18246aa Test for WikiPge::insertProtectNullRevision
Bug: T180989
Change-Id: Iffee0bbe9fb18bb6c7f7af10b6405007468ac0b9
2017-12-05 11:29:18 -08:00
addshore
ece8130b6a Tests for WikiPage::newFromID
Bug: T180989
Change-Id: Idb4d7ce8ccc27226b0f00e2127acef6158dd32a9
2017-12-05 11:29:17 -08:00
addshore
d0f584696d Test for WikiPage::newFromRow
Bug: T180989
Change-Id: If630e3e3561ac2017a2b7c82ade842e86f8cb22e
2017-12-05 11:29:17 -08:00
addshore
5b217dfc9b Tests for WikiPage::insertRedirectEntry
Bug: T180989
Change-Id: I677202b22594c7fc8fcf97b805ae69726945f96d
2017-12-05 09:16:46 +00:00
addshore
47db625832 Test for WikiPage::updateRedirectOn
Bug: T180989
Change-Id: I798ded72142503e52395b45fe9ec71a215d5ab92
2017-12-04 13:11:26 +01:00
addshore
ec5d1fd6f9 Add test for WikiPage::updateCategoryCounts
Bug: T180989
Change-Id: Iff4bb885e5d385a7b3ec6169ee9a3e1e82d7d993
2017-12-04 09:46:33 +00:00
addshore
81c156b402 Refactor test for WikiPage::doRollback
This test was not running and a comment said
it was broken.
This patch refactors the test.

Bug: T180989
Change-Id: I46b73371e5fd65860fce6cc101bad6abfa20e91d
2017-12-04 09:46:28 +00:00
addshore
6c3e67f2be WikiPage tests @covers for doDeleteArticleReal & commitRollback
Bug: T180989
Change-Id: I70dcad9d527be4d91a88a14fe9787c53a7cf7d2f
2017-12-04 09:46:23 +00:00
addshore
1ceabc0f64 Split WikiPageTest into ContentHandler & NoContentHandler tests
Follow up to Iccdcd4a4f72c8b1329d36ff2e8699ba6b23c9ae7

Bug: T180989
Change-Id: Ib37a058586c7222ffe3ee5dc5f0e134ee18f0ff7
2017-12-04 10:46:02 +01:00
addshore
45a0481935 Cleanup WikiPageTest
Change-Id: Id95b7153c42ddcd391f966b75f54e00c13d7ce5a
2017-11-30 20:20:11 +01:00
jenkins-bot
fc5dced1ce Merge "Add new core tags" 2017-11-30 18:43:28 +00:00
petarpetkovic
62713be990 Add new core tags
Add tags to types of edits that get automatic edit summaries:
- Making a page a redirect
- Changing redirect target
- Changing an existing redirect into a non-redirect
- Blanking of the page
- Removing nearly all (more than 90%) content
- Rolling back an edit

Bug: T167656
Bug: T73236
Change-Id: Ie7f637fcec5ee659c1086e28e8ba21f470c45160
2017-11-30 10:29:58 -08:00