- 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
This makes the data stored by LinkCache compatible with PageStoreRecord,
so we can use LinkCache inside PageStore.
This causes PageStore to make use of local caching as well as WANObjectCache.
Note that getPageById() does not yet benefit from cache, but does
populate the cache.
Bug: T278940
Change-Id: Icc27a0d9299a3e4ce45521daef87ad06ec06f064
Returns an actual working ReadOnlyMode object
based on a ConfiguredReadOnlyMode and a mock
load balancer
Change-Id: I429c8e81343c24c536718b3fc112e797afbc05a2
After we updated the page row in WikiPage::updateRevisionOn(), some
fields in our mTitle – specifically, mLatestID, mLength, mRedirect,
mContentModel – are probably outdated. Use Title::loadFromRow() to
update them.
I put the loadFromRow() call very early in the block – specifically,
before the updateRedirectOn() call – because updateRedirectOn() already
potentially passes the WikiPage’s title into another class (LocalRepo),
and I want to minimize the risk of other code observing the outdated
Title (even though LocalRepo doesn’t currently use any fields that might
have become outdated).
Bug: T283654
Change-Id: Iacdacfd58a3e336e2d58dd7508d42d5afbb74500
JobRunner catches all exceptions and hides them in the status array,
meaning that it is not obvious when a job fails during a test case.
So, introduce MediaWikiIntegrationTestCase::runJobs(), which runs jobs
and asserts various things about the returned status array.
Depends-On: I4f4790c5d16a0767790eeff202e0be8fcdaeda93
Depends-On: I118f9e3f8950fd82d7b02baed6705b29fd6ab7d5
Change-Id: I63603aa158f77df4b40add096cb248f3b24979f4
The following methods no longer support Revision parameters:
- CategoryMembershipChange::__construct
- ContentHandler::getUndoContent
- DerivedPageDataUpdater::prepareUpdate
- DifferenceEngine::getRevisionHeader
The following methods were removed entirely:
- Title::countAuthorsBetween
The following methods return arrays that formerly include
a 'revision' key that would emit deprecation warnings when
accessed and return a Revision object. The Revision object
has been removed from the arrays, and the 'revision-record'
key should be used to get the relevant RevisionRecord instead:
- PageUpdater::doModify
- PageUpdater::doCreate
- Parser::statelessFetchTemplate
The ParserOptions `templateCallback` option is a callback
that is called in Parser::fetchTemplateAndTitle() and should
return an array - the 'revision' key to that array used to
be a Revision object and was used if no 'revision-record'
was returned - it is now ignored.
Bug: T247143
Change-Id: I163ada88d649c75697aff4fa31a3a3c0bdef78b7
- EditPage::$mBaseRevision
- EditPage::getBaseRevision()
- Title::getFirstRevision()
- LinksUpdate::setRevision()
- LinksUpdate::getRevision()
- Article::$mRevision
- Article::getRevisionFetched()
- WikiPage::getOldestRevision()
- WikiPage::getRevision()
- ContribsPager::tryToCreateValidRevision()
To make things easier, instead of rewritting
the Revision tests that were using WikiPage::getRevision,
just delete them, its not worth the effort to rewrite
them since the class is going away. For the WikiPage
tests, replace uses of getRevision with getRevisionRecord,
manually converting to a Revision object where needed
Bug: T247143
Change-Id: I52bc1f49649f8bd25797e3f7a090bec9c63ac2d1
It's the same and makes the test code much more readable, I
would like to argue.
Because of the was I split all the changes I made into smaller
patches this patch contains some other changes in the same
lines where I could not split them off. E.g. removal of
->any(), which is the default anyway and doesn't do anything.
Change-Id: Ib297b989d4aec33b31a4e33fe9d5032865b39be0
Ended up using
grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g'
special-casing setMethods( null ) -> onlyMethods( [] )
and then manual fix of failing test (from PS2 onwards).
Bug: T278010
Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
Title::getPageLanguage has complex logic to determine the effictive
language of the page. PageRecord is a storage layer primitive and should
not haveknowledge of such logic, nor should PageStore.
The effective content language of a page needs to be determined
programmatically, see discussion on the ticket.
Bug: T278591
Change-Id: Ic26f6f7690499b3dd87982e3822881fd473cfd68
Bad redirects in the database led to fatal errors when attempting to
resolve the redirect when visiting the page. This patch does three
things to address this:
* change Title::isValidRedirectTarget to actually check whether the
target is a valid title.
* change WikiPage::recorddRedirectEntry to reject invalid redirect
targets
* change WikiPage::getRedirectURL to ignore invalid redirect target
that may be present in the database.
Bug: T278367
Change-Id: Ib17ebfb99fa17b846302438c675a968a1ec0f488
WikiPage::getTouched() must return the updated touched date
after the WIkiPage was used to make an edit.
Change-Id: I40060d6932d6d715bb549932439c9b8c0521f4b3
PageRecord is intended as a lightweight alternative to WikiPage,
similar to RevisionRecord.
Bug: T272421
Bug: T272422
Depends-On: Ia34cc8fa795b6b27832982fc22fa237ee36339b4
Depends-On: I39a984c9f3132f755f7d8984b789d05ad080d7b4
Change-Id: Ib3c9b22e0c0b7c97e6c230f2fecf0663b4c68cc6
MediaWiki::initializeArticle() would copy the title from
WikiPage::getRedirectTarget() into the RequestContext. But if the
redirect table contained an invalid title, an object would be returned
anyway, and the invalid title would later break various callers.
Many callers were assuming that if WikiPage::isRedirect() returns true,
then WikiPage::getRedirectTarget() will return a Title. Fair enough, it
is confusing to have two levels of rigor for a data value within a
class.
So:
* Make WikiPage::isRedirect() simply call getRedirectTarget()
* Add a new method WikiPage::getPageIsRedirectField() which preserves
the old behaviour. Call its associated property mPageIsRedirectField.
* Make getRedirectTarget() use makeTitleSafe() instead of makeTitle().
* Remove the call to Title::isRedirect(). We have our own cache of page
data and don't need Title's help with this.
* Remove mIsRedirect without deprecation. CodeSearch finds no usages.
Instead we have a lazy-loaded validity flag mHasRedirectTarget paired
with mRedirectTarget.
* page_is_redirect is now a necessary but not sufficient condition for a
page to be a redirect by WikiPage's definition of the concept.
Bug: T261347
Change-Id: I12542fc899cdec39694440c5cf2505c115e4635d
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
This patch touches all uncontroversial (I hope) places where a chain
of isset(), array_key_exist() and the ternary ?: operator can be
replaced with the much shorter ?? feature from PHP 7.
?? does the same. It checks if the element before the ?? is set and
not null. When this check fails, the element after the ?? is used.
Change-Id: Id612e2782ae928164b26b6f0de676c6c7d8302f3
This is a step towards introducing PageRecord.
We allow WikiPage to be a "non-proper" PageIdentity for now,
but this should be changed to a ProperPageIdentity as soon as
possible.
Bug: T272424
Change-Id: I194c55ec757e655117bccfeb7d6f5d8487b559e5
Signed-off-by: daniel <dkinzler@wikimedia.org>
WikiPage should not try to create pages with invalid titles. This may
lead to data corruption.
The change in I03969883fc0b326dd2374d7f8e24c1d5a650d5fa should
make the new test pass.
Change-Id: I713c7b14dae86aa7b544bb613e6d5869a049f8b7
WikiPage represents a page that can be created and edited.
WikiPage should not be constructed on Titles that represent things like
special pages or section links. Any such usage should be deprecated.
Bug: T272424
Change-Id: I03969883fc0b326dd2374d7f8e24c1d5a650d5fa
This reverts commit 8f46ef5ff4.
This has seemingly broken FlaggedRevs and thus a bunch of repos.
Bug: T272170
Change-Id: I67de3dbbbc9163aae937f710ecb0e40db0d483a0
This reverts commit 36f1adf670.
This has seemingly broken FlaggedRevs and thus a bunch of repos.
Bug: T272170
Change-Id: I26c6fd656c75a6b209fb17965dc9109edf68642b
This allows Title and WikiPage objects to be compared with PageIdentity
and LinkTarget instances consistently.
Change-Id: I1bbd15d17d046359393ecfc1acd2778273260a95
This makes it so methods that take a WikiPage can be narrowed to a
PageIdentity, and prepares WikiPage for the introduction of the PageRecord
interface.
Bug: T208776
Change-Id: Iab8bd75a1948873baab9c91c76f966d606b23c0f
Emit deprecation notices in the constructor
if falling back to $wgUser, and fix core
calls
Bug: T246861
Depends-On: I51117931d527a3bdda468b48de577a7faafbcd69
Change-Id: Ibd0a8ffd0494c17a378cc43e6b6164166130adf4
This patch adds a method named WikiPage::doUserEditContent() as an interim
replacement to existing deprecated ::doEditContent() method. The new
method requires $user to be passed as a parameter and no longer supports
passing in the unused $serialFormat parameter. The new method otherwise
behaves identically compared to the old doEditContent() method.
Bug: T255507
Change-Id: Ibc0052b27a6d3cda3eb9663b95b4f45116dcc9f1