Add Database::queryMulti(), which will execute an array of
queries as a batch with minimal roundtrips.
SQLite fallbacks to looping through each statement and
invoking doQuery().
Add QueryStatus class to reduce complexity in Database.
Rewrite doQuery() as doSingleStatementQuery().
Change-Id: I3d51083e36ab06fcc1d94558e51b38e106f71bb9
This maint script computes and displays a wiki's birth date and
birthday in yy, mm, dd format.
Sometimes, one would like to know when a wiki was installed and
potentially the age of the wiki.
Change-Id: If42c74a04491d4331dcd7f6fc00c9460d6e1d51f
Previously, each of the four derived config schema files had to be
regenerated using a separate maintenance script. This change simplifies
regeneration by combining all for scripts into a single command that can
be used to regenerate all relevant files after changing
MainConfigSchema.
Change-Id: I7d38d8a4aede60475c4bdd0053d2e10e298b9843
All revision related classes are namespaced MediaWiki\Revision
instead of MediaWiki\Storage since 1.32. The old namespaced
class names are deprecated and only kept for backwards-compatibility.
Bug: T305784
Change-Id: I48cdc65301a8cd20d2bedd031dbdae33b8c2a34d
We will need parameter handling in the runner as well as in the actual
maintenance script. So pull it out, so we can re-use it.
Change-Id: Ib67667fead8350e0a539323fb05b160f4c2d882e
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader itself.
Move the tests by analogy.
I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".
I did not address DependencyStore which continues to have a non-standard
location and namespace.
Revert of a241d83e0a.
Bug: T308718
Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
DefaultSettings.php has been replaced by MainConfigSchema.
Loading DefaultSettings.php is deprecated.
Code that needs to have access to configuration defaults should use the
ConfigSchema service object.
Bug: T300129
Change-Id: I7b2c0ca95a78990be1cdb9dd9ace92f6dcf1af15
This reverts commit e08ea8ccb9.
Reason for revert: Breaks Phan in extensions, and as far as I’m aware,
this change isn’t urgently needed for anything, so the simplest fix is
to revert it again for now. After PHP 7.4 it should be safer to try this
again (we hopefully won’t need the two “hack” classes by then).
Bug: T308443
Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader and
ResourceLoaderContext.
Move the tests by analogy.
I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".
I did not address DependencyStore which continues to have a non-standard
location and namespace.
Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
- To mitigate passing around Skin god object.
- Provide limited context for components.
- Update relevant classes.
Bug: T301722
Change-Id: Icb7ea7ae5b86a39adf6eb2805b2bf42fb71d3bd0
The first of many changes decoupling SQL building blocks from Database
class.
Bug: T299691
Depends-On: I5d1d5b9b875bced7bda234f45d6d22ed59db4871
Change-Id: I784e78361f5ee629d31c68629d669ee0ddddf929
Instance ownership is supposed to protect LoadBalancer and Database
against unauthorized calls to internal methods other than by the owning
LoadBalancer/LBFactory. This seems like unnecessary complexity. It was
introduced for T231443 and T217819, but the link was speculative and in
the end it didn't help to fix or isolate those bugs. Since then it has
caused a production error (T303885) and an intermittent CI failure
(T292239).
Instead, split the ILoadBalancer interface, introducing
ILoadBalancerForOwner, which contains the methods which are only safe
to call by LBFactory or by the caller of LBFactory::newMainLB(). This
allows phan to statically detect inappropriate calls to internal
methods.
Ownership was used for convenience for two things unrelated to its
original purpose:
* Suppressing calls to ScopedCallback::newScopedIgnoreUserAbort() when
the caller has already called it. But nested calls are apparently
harmless, so I just called it unconditionally.
* Suppressing exceptions from Database::close(). I extended the
behaviour for owned instances to apply to all instances, so even
unowned instances will no longer throw on close.
CodeSearch suggests nothing in extensions is calling these methods with
an owner parameter. One extension (Wikibase) overrides a method with an
owner parameter in a test mock class and so needs to be simultaneously
updated.
Depends-On: Ib03aba9d8f5f05b875a321d00b14483633a636a8
Change-Id: I27ba4973d24d759c88b3868c95e7db875801ca0c
This is the first step to split parts of Database that doesn't require a
connection and are used for query parts.
Bug: T299691
Change-Id: I140aa4328865994499926f898233867ce383908c
Rename canRecoverFromDisconnect() in order to better describe
its function. Make it use the transaction ID and query walltime
as arguments and return an ERR_* class constant instead of a bool.
Avoid retries of slow queries that yield lost connection errors.
Track session state errors caused by the loss of named locks or
temp tables (e.g. during connection loss). Such errors will prevent
further queries except for rollback() and flushSession(), which must
be issued to resolve the error.
Add flushPrimarySessions() methods to LBFactory/LoadBalancer
and use it in places where session state loss is meant to be
safely aknowledged.
Change-Id: I60532f86e629c83b357d4832d1963eca17752944
Changes:
* Internal SkinTemplate::getSearchInputAttributes method is removed
* Skin::makeSearchInput and Skin::makeSearchButton are hard deprecated.
Methods moved to SkinTemplate to support skins using BaseTemplate
(this avoids deprecation warnings in Timeless)
* Correct the function signature for Skin::getRelevantTitle and the
caller in Linker to take into account the use of getTitle and the
possibility of a null return.
Bug: T301723
Change-Id: I0906cd1582b93c741b93503562ec0fe37d80d948
Add TransactionIdentifier class, similar to AtomicSectionIdentifier,
that represents applications-side tokens for transactions. Move the
string ID logic there.
The transaction tokens can be used to determine whether rollback()
alone is sufficient to recover from a connection loss. This will
be done in a follow up patch.
Change-Id: I9c68b0c5a23800001fca49cabd6cc38fce4d5c00
This is moved from TemplateData, but the interface isn't quite right.
Filed T304899 to improve it in the future.
Bug: T304740
Change-Id: Iadd1ed70b72fc282bd5addfc1654aa73322ea470
This hook was formerly defined by Extension:Linter and invoked by
Parsoid, but as this part of Parsoid is moving into core the hook
should now be defined by core as well.
Bug: T304740
Change-Id: Iffd073e510202e5766632cc01d3585815289b7b4
* This is the first step of migrating Parsoid integration code into
core and transitioning Parsoid from an extension to a pure library.
* Parsoid already has conditional code to skip loading Parsoid's
copy of its classes, but it relies on the existence of ParsoidServices.
Technically ParsoidServices isn't needed once Parsoid is migrated to
core -- users can just use MediaWikiServices instead -- but we need
to temporarily add ParsoidServices as a marker class during the
transition.
This version of Parsoid's ServiceWiring comes from Parsoid commit
898c813fd832b3f2d7b5a37f60bd65e8368ce18f.
Bug: T302118
Change-Id: I0b388d93143a782c2c3b72e46407572e5c586e4a
Also remove the unmaintained kafka-php package from the from "suggested"
and "dev" composer dependencies, as this is now no longer used.
Change-Id: If5668974f417b627df95bce47db18d46fa03327c
This further removes files that are not maintenance scripts from this
directory. It isn't used outside of tests, either.
While at it, rename this to a PSR-4 namespace consistent with some of
the other test-only classes.
Change-Id: Ibc49617631f17a5e9489789a90a7b8537340ead3
We can generate a class that contains constants for all config variable
names. This removes the need to rely on string literals when calling
Config::get, and it provides a place for documentation that integrates
better with IDEs than the markdown file.
Change-Id: I817dc14c4ce8fc0a29d9c07e8fd393c4f359cade
Instead of maintaining the config schema as a yaml file, we
maintain it as a set of constants in a class. From the information in
these constants, we can generate a JSON schema (yaml) file, and an
php file containing optimized arrays for fast loading.
Advantages:
- PHP doc available to IDEs. The generated markdown file is no longer
needed.
- Can use PHP constants when defining default values.
NOTE: needs backport to 1.38
Change-Id: I663c08b8a200644cbe7e5f65c20f1592a4f3974d