Internally it still uses WikiPage. While this change shouldn't have any
effect in theory, this is not guaranteed because WikiPage is not
stateless and if different parts of the code use different instances we
may see unexpected errors. Hence, this patch is limited to the bare
minimum so that it's easier to revert if necessary.
Change-Id: I2c18a62ccc04720a2ef25298515850e91fb288e9
And deprecated aliases for the the no namespaced classes.
ReplicatedBagOStuff that already is deprecated isn't moved.
Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
Modifies incrStatsByContent in order to migrate cache_misses, cache_hits to Prometheus backend
Bug: T359465
Change-Id: I78afac7437bc2849b64f43c23477d702b94e907b
This patch introduces a namespace declaration for the
MediaWiki\Deferred to RefreshSecondaryDataUpdate and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I9ee3282918f8f3d444a12ca32434a15e93952055
It was asked in a patch review to apply fully import
InvalidArgumentException where possible. I was guessing some
of my other already merged patches have but turned out such
thing exists other places style so for the sake of consistency
I've turned rest of inline import of the specific exception at
top of the file.
There are instances of source files that aren't in any namespace but
have fully qualified import which this patch doesn't touch.
Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
This patch introduces a namespace declaration for the
MediaWiki\Json to FormatJson and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
Some of these have been marked in-code as deprecated for a long while,
but haven't ever been announced in the RELEASE-NOTES (and later,
HISTORY) file, so let's mark them up now so we can get the ball rolling
at least.
Per Gergo, the AuthManager one was 'born deprecated' and should only
have been used by humans also reading the deprecation notice given in
the code, and indeed no uses are known to code search, so also emit
deprecation warnings there immediately; others will have to wait until
uses have been migrated.
Change-Id: I0c1c71d8f4293623039302da35d58d2a24367e97
Remove check for false from IDatabase::select as this is not possible
A DBQueryError is thrown (documented since efda8cd3 / I056b7148)
Use IResultWrapper::numRows to check for empty IResultWrapper
This ignores includes\libs\rdbms as QUERY_SILENCE_ERRORS is an internal
option to get false from this function
Change-Id: I4b2fc26ca0e68612f6beadc01e68097a74962c84
Also remove the fallback index and options as it was agreed upon in the
ticket as its needlessly complicates the function and is only used in
SqlBlobStore which can have its own copy of the function
Bug: T354194
Change-Id: I38b179c9bfeb7d2c3e92fa4845dce19558f45a0f
This is inconsistent with the access pattern of other constants in
MediaWiki. it's also confusing (e.g. it's unclear to a newcomer why
UserFactory is implementing IDBAccessObject) and it's prone to clashes
(e.g. BagOStuff class has a clashing constant).
It has been already announced: https://w.wiki/9DAX
Bug: T354194
Change-Id: Ic2357634b8385d65b55db2b557191419b06c40e0
Found via (?<!IDBAccessObject)::READ_
We are planning to deprecate and remove implementing IDBAccessObject
interface just to use the constants.
Bug: T354194
Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
Follows-up I8518e0488 (9c02258a04).
Instead of documenting how to compute the number to manually verify
it, use the expression directly. This should make it significantly
easier to understand, verify, and modify.
Noteworthy:
* Language.php, I kept 31_556_952 as-is because the
calculation would otherwise involve a float. It also has the benefit
of allowing the long durations to build upon that as a given number.
* SqlBlobStore.php, remove this irrelevant default value as it is
unreachable. The only call to new SqlBlobStore is BlobStoreFactory,
which always calls setCacheExpiry. For back-compat and to keep
tests as-is, move to re-used constant between class and config.
Change-Id: I86b034883bd7efdf93b8365b43178af826f1c703
Instead of calling self::READ_* on these constants, just directly call
it.
Since these classes are public and might be relied on directly in other
places, we can't remove the "implements IDBAccessObject" yet but we will
start doing that soon.
Bug: T354194
Change-Id: I3e26b9fc7f93efdfc55a1790a7cdfa5c0d562303
Allows to trigger RefreshSecondaryDataUpdate jobs with a timestamp to
ensure a link update was done after that timestamp.
Since e5655255 it is possible that RefreshSecondaryDataUpdate gets
queued for api action=purge, but RefreshSecondaryDataUpdate only checks
that the links update is done after the last edit, so when jobs get
queued by action=purge, the jobs does nothing.
Ensure that page_links_updated gets updated via action=purge when the
timestamp is before the new freshness timestamp (checked in
RefreshLinksJob::isAlreadyRefreshed).
Bug: T351729
Change-Id: I85aed4c40d430ba6c30c763141f4b821c36e6eaf
This makes the code easier to read to avoid jumps and improves
encapsulation by not allowing the rest of the class having access to the
logic. Of course, if needed then some code can be refactored out again
but for now let's not do YAGNI.
Change-Id: Ic37524e386fc04fd67e33768417ff8425f85b0ca
For readability. Allowed since PHP 7.4.
I searched for integer literals of 6 or more digits, and also changed
some nearby smaller numbers for consistency.
Bug: T353205
Change-Id: I8518e04889ba8fd52e0f9476a74f8e3e1454b678
* Updated ParserOutput to set Parsoid render ids that REST API
functionality expects in ParserOutput objects.
* CacheThresholdTime functionality no longer exists since it was
implemented in ParsoidOutputAccess and ParserOutputAccess doesn't
support it. This is tracked in T346765.
* Enforce the constraint that uncacheable parses are only for fake or
mutable revisions. Updated tests that violated this constraint to
use 'getParseOutput' instead of calling the parse method directly.
* Had to make some changes in ParsoidParser around use of preferredVariant
passed to Parsoid. I also left some TODO comments for future fixes.
T267067 is also relevant here.
PARSOID-SPECIFIC OPTIONS:
* logLinterData: linter data is always logged by default -- removed
support to disable it. Linter extension handles stale lints properly
and it is better to let it handle it rather than add special cases
to the API.
* offsetType: Moved this support to ParsoidHandler as a post-processing
of byte-offset output. This eliminates the need to support this
Parsoid-specific options in the ContentHandler hierarchies.
* body_only / wrapSections: Handled this in HtmlOutputRendererHelper
as a post-processing of regular output by removing sections and
returning the body content only. This does result in some useless
section-wrapping work with Parsoid, but the simplification is probably
worth it. If in the future, we support Parsoid-specific options in
the ContentHandler hierarchy, we could re-introduce this. But, in any
case, this "fragment" flavor options is likely to get moved out of
core into the VisualEditor extension code.
DEPLOYMENT:
* This patch changes the cache key by setting the useParsoid option
in ParserOptions. The parent patch handles this to ensure we don't
encounter a cold cache on deploy.
TESTS:
* Updated tests and mocks to reflect new reality.
* Do we need any new tests?
Bug: T332931
Change-Id: Ic9b7cc0fcf365e772b7d080d76a065e3fd585f80
Previously, we never scheduled HTMLCacheUpdate jobs on file page edits
or creations, but it is necessary when the page's redirect target has
changed, or it's created as a redirect.
(We now do it unnecessarily when a redirect page is edited without
changing the target, but that's more difficult to detect at this
point.)
Bug: T238426
Change-Id: I6775a4fb7239d49de88e22e45082ab474cfaaa8b
Previously, we scheduled recursive RefreshLinks jobs on every file
page edit, but it's only necessary when the page's redirect target has
changed. Optimize this, and only schedule them when the page is or was
a redirect.
(We still do it unnecessarily when a redirect page is edited without
changing the target, but that's more difficult to detect at this
point.)
Bug: T346383
Change-Id: Ie629881c94a7a81ae7bf597aab4587921d1c25ae
In only this code path, $this->pageState['oldRevision'] was left unset.
Other code expects it to be null, but not unset.
Change-Id: I15023834ffbac307924aee4028f3b7fe75fbabeb
I fixed some edge cases in the script that migrates to SQB and it
managed to fix these now.
Bug: T344971
Change-Id: I00cc9a6660d9bd4c64c976121b2121ccd7aae1f0
* Create task-specific methods with simple defaults that require no
mocking or stubbing of any kind, as used by the pure unit tests
where service container (and by extent, storage services) are
disabled.
* Remove all use of global variables, LBFactory, JobQueue,
StatsdFactory, and RequestContext.
Bug: T265749
Change-Id: If85c448d2d1b806e70f641f06263680d49c6eeec
The design principle for SelectQueryBuilder was to make the chained
builder calls look as much like SQL as possible, so that developers
could leverage their knowledge of SQL to understand what the query
builder is doing.
That's why SelectQueryBuilder::select() takes a list of fields, and by
the same principle, it makes sense for UpdateQueryBuilder::update() to
take a table. However with "insert" and "delete", the SQL designers
chose to add prepositions "into" and "from", and I think it makes sense
to follow that here.
In terms of natural language, we update a table, but we don't delete a
table, or insert a table. We delete rows from a table, or insert rows
into a table. The table is not the object of the verb.
So, add insertInto() as an alias for insert(), and add deleteFrom() as
an alias for delete(). Use the new methods in MW core callers where
PHPStorm knows the type.
Change-Id: Idb327a54a57a0fb2288ea067472c1e9727016000
This class is used heavily basically everywhere, moving it to Utils
wouldn't make much sense. Also with this change, we can move
StatusValue to MediaWiki\Status as well.
Bug: T321882
Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3
Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
Interface was deprecated since 1.35 in favor of ExpirationAwareness
or StorageAwareness interfaces. No longer used anywhere, see dependent
patches.
Depends-On: Ida557b3180eb5e7ebae46968142b4f154f26ffbc
Depends-On: I3d6fbf535560655472ade27c37b0e42b3e11a535
Depends-On: I2b0a669d41d9e6a8a859cba314c0e9e4c0ef40d7
Depends-On: I776040c2c8f61e25ae986e93bb1975fdd8bf9dd5
Change-Id: I9c5ffa9f51aec6356e3e27458fd098a37cd754ad
We would like to remove DB access in non-database PHPUnit tests. As a
first step, avoid database usage in tested code when possible. In
particular:
- In NameTableStoreFactory, avoid domain ID normalization if the
provided ID is already false.
- In SpecialDoubleRedirects, do not acquire a DB connection until it's
needed (which is just one place).
- Use editPage() in TitleDefTest instead of a DIY implementation, and
add `@group Database` accordingly.
- Avoid parsing titles in ContentHandler tests that don't need to parse
titles. Among the many dependencies of parsing titles is the interwiki
lookup, which requires DB access.
- Also remove test cases that used the "Gadget" namespace; it doesn't
exist in core, so these pages were actually in the mainspace.
- Mock the database in CategoriesRdfTest. The only two methods that use
the database were already being mocked.
- Add `@group Database` to test classes that are intentionally using the
Database, mainly via getTestUser().
Bug: T155147
Change-Id: I9385fe14cfeb6b7b7378cc322d510034c4ee0711
Using a php parser written on top of ANTLR4, done semi-automatically.
I checked everything and made adjustments.
Bug: T311866
Change-Id: I6150c6909bce8f3dbd745a26380cc0af9d9c547f