* Rename $offset to $extraConds
* Pass the limit as an integer instead of an options array
* Fix unnecessary extra parameters
* In JS, fix URL encoding
* In JS, show the link again on error so that the user can retry, and so
that it doesn't appear as if the end of the list was reached.
Bug: T249977
Change-Id: Ifaf8d1e9537da9245a7340c76af9c975f1fb643f
Update SQL query option to use timestamp for search.
Update "undelete logic" to load data by parts according to history
limit constant. Create module with js and styles for "load more"
button, use ajax call to get next revisions data.
Bug: T249977
Change-Id: I102b6ea1109733d032223e4fa187f934cf128740
* Unnecessary regex modifier. I agree with this inspection which flags
/s modifiers on regexes that don't use a dot.
* Property declared dynamically.
* Unused local variable. But it's acceptable for an unused local
variable to take the return value of a method under test, when it is
being tested for its side-effects. And it's acceptable for an unused
local variable to document unused list expansion elements, or the
nature of array keys in a foreach.
Change-Id: I067b5b45dd1138c00e7269b66d3d1385f202fe7f
Just methods where adding "static" to the declaration was enough, I
didn't do anything with providers that used $this.
Initially by search and replace. There were many mistakes which I
found mostly by running the PHPStorm inspection which searches for
$this usage in a static method. Later I used the PHPStorm "make static"
action which avoids the more obvious mistakes.
Bug: T332865
Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
For MessageContent::getTextForSummary(), the behaviour is exactly
the same;
For WikiPage::insertRedirectEntry(), the trailing ellipsis would
prevent landing on the position of the anchor;
For UserOptionsManager::saveOptionsInternal(), I also found the
trailing ellipsis is unnecessary, follow-up to commit 2a51865.
Bug: T326696
Bug: T207876
Change-Id: I2ec1878147cb0447794d2404db632733f83164cd
When UseInstantCommons is true the tests with file redirects failing due
to http request to commons.
Needs to reset ForeignFileRepos, because UseInstantCommons is a dynamic
config and already evaluated when tests running
Change-Id: I1a2059e578229210a1e3789bf76fa3dfaa7b6ed3
PageUpdateStatus provides clean access the the newly created
RevisionRecord.
Depends-On: Ia08c586198082ea47e8313d0d41835f9830fb29e
Change-Id: Id6963842321c4eaa3d7d029ad0b769f73433c103
In the JavaScript and CSS content handlers we render the page "as
wikitext" solely to generate categories, toc, etc, and then throw that
output away and replace the generated HTML. Simplify the code paths
and the caching by using the canonical options which don't split by
user language, etc.
Three minor issues with the current patch, which can hopefully be
addressed in follow ups:
1. WikiPage::makeParserOptionsFromTitleAndModel() has a very cumbersome
name and arguably doesn't belong in WikiPage in the first place.
T313455 already exists to find a better place for this/way to do this.
2. Title::isConversionTable() requires a downcast of the page reference
to a full title object. This method also probably wants to live
somewhere else.
3. It really would be nice to combine this more properly with
ContentHandler::getParserOutputForIndexing(), but that method
uses a ParserOutputAccess object which requires a PageRecord,
and we don't have a PageRecord available in fillParserOutput().
Bug: T307691
Change-Id: I081105741b507ed49e19cb878550ba4293e09413
This ensures that assertions work in a uniform way,
and provides meaningful messages in cause of failure.
Change-Id: Ic01715b9a55444d3df6b5d4097e78cb8ac082b3e
There is a common and reasonable need for longer lines in tests.
The nudge for shorter lines doesn't seem valuable here. The natural
breaks will likely still fall in 80-100 given the enforced practice
for non-test code, e.g. whether through habit, or 80-100 column markers
in text editors, or the finite width of diff and code review
interfaces.
Change-Id: I879479e13551789a67624ce66f0946d2f185e6ee
getPageCount() method return `cat_pages`, a value that makes sense
on database table but is currently non-intuitve in object context
where there's a value that better deserves the name. This makes it
necessary for callers to repeat same logic to get the content pages
count and a comment to explain the behavior.
In this patch, getMemberCount() is added. It returns the total
member count as getPageCount(), by default, does now.
getPageCount() now takes a parameter and two public constants are
provided for that; Category::COUNT_CONTENT_PAGES return count of all
memebers to retain existing behavior, Category::COUNT_CONTENT_PAGES
will return only content pages.
In future there'd be no need for the parameter. Content pages will
be returned always. Total member count is already accessible with
getMemberCount().
Also improve return type doc of getId() and getName()
Bug: T299350
Change-Id: I63c711ebc697c1a131a50910c854f956d4021254
This makes the query working on postgres and sqlite
assertSelect generates a query like:
SELECT COUNT(*)
FROM `unittest_redirect`
WHERE rd_from = 2
ORDER BY COUNT(*)
Which seems problematic on both rdbms
Bug: T195807
Bug: T197734
Change-Id: I6a687bb9a40b05c380bac0d1a32e13589485ac7f
Count should rarely be anything other than number. Most callers
have to manually cast to integer after calling these methods[1]
Although boolean false is internally cast to 0, explicit int
for both success and failure is better here.
[1] https://codesearch-beta.wmcloud.org/search/?files=&i=nope&q=-%3EgetPageCount%5C%28
Change-Id: Ia7965835a6929b0f91453211233e188c755d8b9f
Add a new helper to MediaWikiIntegrationTestCase, since deleting pages
seems to be pretty common in tests.
Some calls to WikiPage::factory were also updated to use WikiPageFactory.
Change-Id: I5b5100273a00ac292a1900022ca79708fa254347
PreparedUpdate represents an in-progress edit. It can be used to access
information about the edit from hooks that do to have access to the
PageUpdater. Ideally, the PreparedUpdate or PageUpdater would be passed
to the hook as a parameter. Handlers of legacy hooks may use
WikiPage::prepareUpdate() to access it.
Bug: T242249
Needed-By: I23324a31e06e7e6f28077085c0ade05db63e9a35
Change-Id: Id5ba40a21cc4547205adf2f3a1f725c3a69c24d8
The concept of a redirect chain didn't really work for a value of
max redirect > 1. In the ideal world, we just want to have a source
which points to target (source -> target) discarding the concept of
a redirect chain completely.
Having something like: source -> target -> target1 -> target2 doesn't
really work well with the current database design.
NOTE: Support for $wgMaxRedirect will be removed soon hence
deprecation without interfaces for replacement.
Bug: T290639
Change-Id: I469de6f85e405e8ddbe7abaa5b99b77cb9cf415d
Avoid triggering a parse in DerivedPageDataUpdater::getPreparedEdit().
Defer the internal getOutput() call till when something actually tries
to access the timestamp property.
Bug: T277788
Change-Id: I899d9966214b36ebcd660aaf7c2da399e35be92e
For now, let's just proxy the title object and set the
interwiki but to make things nicer, we should not provide
a title via setUp(), we should use providers.
Bug: T275763
Change-Id: I761de85ae5a839e8a695b85ce0fd7200b498da22
Unused except for DeleteAction, which now uses a custom query (similar
to the one in ContentHandler::getAutoDeleteReason). Passing the
parameter is hence hard-deprecated, and it will be removed in 1.39.
Also escalate the exception logging from wfDebug to error, since we want
to know what exceptions are being caught.
Bug: T288282
Change-Id: I91ed9574da68bc7ff36e968f016da390b6d295ed
Use ContentRenderer::getParserOutput instead.
Extensions defining a content model should override ContentHandler::fillParserOutput.
Update tests.
Bug: T287158
Change-Id: I1c71a8429806f1813a39f5807256b2eb9fb9901f
Some methods in the PageUpdater's class implements the fluent interface
design pattern. Use the fluent interface where need be.
Change-Id: If76a4b8c5070c20ed40038a4ee78e2d677de5180
Also remove the "@unstable" annotation from DeletePage.
Methods without known usages were hard-deprecated, the others
soft-deprecated.
Bug: T288758
Bug: T288759
Change-Id: I30c62572fd533526779a8ade3ab178f35bebb522
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is
$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;
Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.
Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
- 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