1. Remove deprecated support for direct construction of MergeHistory
2. Store reading from the database inside the constructor.
3. Remove ::checkPermissions, deprecated since 1.36
Change-Id: I523d72ab7cb56c76f5d17fb51436fb356441d791
Replaces the removed tests for MovePageFactory and
RollbackPageFactory, which used FactoryArgTestTrait
Change-Id: I53669590c4aa0ca12d0839e5dde9068abbaa59fb
Same as recently deleted MovePageFactoryTest, this
test is not really verifying anything and it's too
hard to maintain
Change-Id: I3a85131f9820deb90e1e96a6f16ce70623bd6ff7
In order to prevent bad titles from entering the database,
PageIdentityValue should not allow instances that have obviously broken
dbeys, just like it does not allow construction for a special page.
Note however that for now, we allow PageReferenceValue to represent
thigns that are not actual pages, such as titles like "User:#1234" which
are used in the block log to represent autoblock targets. Similarly,
a PageReferenceValue can represent a special page.
This patch introduces a convenience method for constructing
PageIdentityValues in a context where it is uncertain whetehr the title
is valid, providing an opportunity to the caller to report in which
context the bad values were found.
In addition, this patch adds some documentation and testing, to clarify
the semantics of methods in PageStore with respect to invalid and non-
proper titles.
Bug: T282070
Change-Id: I8a44d9e73dda8fe38d009847332946809767d0fa
Catching common issues here instead of where the caller expects breaks
log formatting, including complete breakage of Special:RecentChanges.
The doc comment says that validation is the caller's responsibility,
which seems like a good idea to me.
Bug: T282070
Change-Id: Ic7e5c5576564e61906a812d50ea4e48adf5ac998
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
The tests in this file make no sense now that MovePageFactory no longer
exists. Obviously you do not pass all constructor arguments to
PageCommandFactory through to MovePage.
To make it pass against the following commit, I could update the
getExtraClassArgCount(), but that would be necessary pretty much every
time the constructor argument list of either class is changed. There's
no reason to think a difference in argument count is an error anymore.
Change-Id: Id4f4b43d47217ebb0111800d7ccb9855d56f7abb
This explores the idea of a PageReference type which represents a
namespace/dbkey pair.
Every ProperPageIdentity is a PageReference. Some LinkTargets can be
mapped to a PageReference.
Bug: T279522
Change-Id: Id8b0c781fce329adcc4770f4840b2ba0108f6898
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
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
As we convert the RevisionRecord to using Authority,
we no longer need Title instances, so we can convert
that to PageIdentity.
Ideally, we'd part away from using Title at all, but:
1. For foreign wikis PageIdentity has stronger validation,
so calling PageIdentity getId() on Title will break things.
There's still a lot of code depending on lax Title guarantees,
so we keep it.
2. A lot of code still depends on Title, so we try to pass it
through even if we don't nesessarily need to, to save cost
on recreating it later on.
Bug: T271458
Depends-On: I287400b967b467ea18bebbb579e881a785a19158
Change-Id: I63d9807264d7e2295afef51fc9d982447f92fcbd
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
PageIdentity is intended as a lightweight alternative to Title,
similar to LinkTarget, but providing a page ID. It follows the precedent
of UserIdentity.
Bug: T208776
Change-Id: Iaed4871e0d32c67d4fb13e487625527f6a21e9c5
assertEquals( false, … ) still succeeds when the actual value is 0, null,
an empty string, even an empty array. All these should be reported as a
failure, I would argue.
Note this patch previously also touched assertSame( false ). I reverted
these. The only benefit would have been consistency within this codebase,
but there is no strict reason to prefer one over the other. assertFalse()
and assertSame( false ) are functionally identical.
Change-Id: Ic5f1c7d504e7249002d3184520012e03313137b4
This will help make MovePage more testable.
In the course of abstracting the logic out of ParserFactoryTest to
FactoryArgTestTrait so it could be used in MovePageFactoryTest, I made
them all unit tests instead of integration. This required some
modification to the Parser constructor so that it didn't access
MediaWikiServices unnecessarily.
Change-Id: Idaa1633f32dfedfa37516bb9180cfcfbe7ca31aa
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.
The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.
You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml
Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d