* Fix getInfoBox to not be a warning box, but an information notice
like it is intended to be.
* Update getInfoBox() to use codex class names, same as showMessage().
* Update getInfoBox() to bold the "Information" title, as per Codex
examples and guidelines, e.g.
https://doc.wikimedia.org/codex/latest/components/demos/message.html#multiline
* Remove infoBox() utility, it was used only once, in getInfoBox().
The `mw-installer-box-*`, `mw-installer-infobox-*` CSS classes
are also unusd now, however there is nothing to remove because
these were already removed in a previous refactor.
* Introduce showWarning(), and apply it to showMessage() calls that
convey non-fatal issues.
Bug: T384524
Change-Id: I6722346ef81a0a9cf8983153271be579905c7898
A constant is not a variable. The type is hard-coded via the value
and can never change. While the extra @var probably doesn't hurt much,
it's redundant and error-prone and can't provide any additional
information.
Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
* In DatabaseInstaller, merge createTables with createManualTables, as
was already done in the PG and SQLite subclasses.
* Sort out separation between data and code in stepApplySourceFile().
Rename it to applySourceFile() and have it take the SQL path instead
of the name of a method that returns the SQL path. Stop splitting the
error messages based on step name.
* Fix query error handling. Errors are not ignored here so there is no
point checking the return value of sourceFile(). Use a cancelable
atomic section and catch the error.
* In PostgresInstaller, move the determineCoreSchema() call from the
createSchema step to a getConnection() helper. Assert that the schema
exists when the connection is requested instead of relying on
previous steps to establish the state.
Change-Id: I5cc8fcd07a5087fa1df651180de8afcc009af6f2
* Remove the scattered enableLB() calls from DatabaseInstaller. The
table creation step should not be responsible for managing the state
of the service container. We have a full installer step called
restore-services, and deferring enableLB() until then only affects
populateInterwikiTable, populateSiteStats, generateKeys and
insertUpdateKeys, which all use local connection management, not
LBFactory. This is a breaking change only for the overrides mechanism,
not for extensions.
* Move DatabaseInstaller::doUpgrade() and its helper outputHandler() to
WebInstaller, since it is specific to web upgrade. Move state
management logic from WebInstallerUpgrade to the new method.
* Fix the excessively narrow width of the upgrade output box, which was
annoying me during testing.
Change-Id: Ica42c4c2e104d5581702e83ae8f9dafadd0053e5
Postgres connection handling gave the caller a way to specify what sort
of domain it needed, whereas the base class was implicitly relying on
the sequence of installer steps to ensure that the current connection
was correctly configured. The PG way of doing this is better for planned
work in this area. Exposing PG-style connection management in the base
class reduces the number of differences between PG and everything else.
Instead of PG's method of having up to three connections open, I am just
holding a single connection open, with state transitions properly
implemented.
Also:
* Deprecate direct access to $this->db.
* Factor out definitelyGetConnection(), a throwing variant of
getConnection().
* Deprecate caling getConnection() with no parameter.
* Remove setupSchemaVars(), since this was a sequence-dependent pattern.
Instead configure schema vars on transition to the create-schema
connection type.
* Use SelectQueryBuilder in databaseExists().
* Remove the pg-commit install step. This commit dates back to
bca55fa58f (March 2007), where in the old installer a commit was
done after all installation. It was moved here in 2010, but now we
have a commit in createTables() serving the same purpose. If we need a
transaction around interwiki insertion, we could do that in the base
class, but that's not what the original code was trying to do.
Change-Id: I073fb57c1b578361ac2a46ecd0cd1312c31747d4
WinCache is an APCu equivalent for use with Microsoft IIS, but in recent
years has been unmaintained and lacks support for PHP 8 and newer.[1]
So, remove support for it as MediaWiki will be raising the minimum
supported PHP version to 8.1.
[1] https://www.php.net/manual/en/install.windows.recommended.php
Bug: T365691
Change-Id: I4d2dc01a9119bb1f858132f0146b894750c1e86d
This is the second patch of a series of patches to remove
ParserOutput::getText() calls from core. This series of patches should
be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e.
This patch replaces the calls to getText where the legacy parser is
called directly by creating a pipeline and invoking it on the generated.
These should probably eventually use the Content framework to generate
output instead of using Parser directly (T371008), which will also allow
them to transparently support Parsoid.
Bug: T293512
Change-Id: I45951a49e57a8031887ee6e4546335141d231c18
In change I625a48a6ecd3fad5c2ed76b23343a0fef91e1b83 I am planning to
make Wikimedia\Message\MessageValue use it, and we try to pretend that
it is a library separate from MediaWiki, so it makes sense to move
MessageSpecifier to the same namespace under Wikimedia\.
Bug: T353458
Change-Id: I9ff4ff7beb098b60c92f564591937c7d789c6684
And deprecated aliases for the the no namespaced classes.
ReplicatedBagOStuff that already is deprecated isn't moved.
Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: Ic4d4dd61de5ab896fb6173eb579c81f164a1e4a3
According to the dictionary, "per" (or more conventionally "as per")
means "according to". Refer OED "per" sense II.3.a. For example:
"No value was passed, so return null, as per default".
In this sentence, we are not specifying the default, we are referring
to the default. This correct usage of "per default" was used nowhere
in MediaWiki core as far as I can see.
Instead we have "per default" being used to mean "by default", that is,
giving the value to use when no explicit value was specified.
In OED, the phrase "by default" is blessed with its own section just
for computing usage:
"P.1.e. Computing. As an option or setting adopted automatically by a
computer program whenever an alternative is not specified by the user
or programmer. Cf. sense I.7a."
There are highly similar pre-computing usages of the same phrase,
whereas the phrase "per default" is not mentioned.
As a matter of style, I think "per default" should not be used even
when it is strictly correct, since the common incorrect usage makes it
ambiguous and misleading.
Change-Id: Ibcccc65ead864d082677b472b34ff32ff41c60ae
This is an alternate for the workaround in I5987c4f1c3 (c98aeff078).
The service class should not need awareness of MW_PHPUNIT_TEST, or
otherwise have a mixed kind-of-yes/kind-of-not DB dependency.
With this patch, DefaultOptionsLookup is reverted to remove the
test-specific workaround in favour of using StaticUserOptionsLookup
in MediaWikiServices::disableStorage.
This is already called by MediaWikiIntegrationTestCase for tests
that don't enable the database.
Bug: T155147
Depends-On: I906450a4ac2dc51cdc536fbc978661b06f62f0a4
Change-Id: I8720d32fcfb18f7468e2c4b82412fe8664e28ddc
DatabaseInstaller had some LSP violations, such as calling undeclared
methods of the supplied Installer object, assuming that it was a
WebInstaller. It was also large.
So, split the web form parts of DatabaseInstaller into separate classes.
We have a class hierarchy for the connect forms, and a class hierarchy
for the settings forms, with a base class DatabaseForm mostly as a place
to put protected helper methods.
Also, have DatabaseInstaller::getConnection() return a special subclass
of Status, so that we can remove many Phan type overrides.
Change-Id: Ie84025f8f70b895fa6882848b9a21ba1750d60e2
* Switch out raw Exceptions, mostly for InvalidArgumentExceptions.
* Fake exceptions triggered to give Monolog a backtrace are for
some reason "traditionally" RuntimeExceptions, instead, so we
continue to use that pattern in remaining locations.
* Just entirely give up on PostgresResultWrapper's resource vs. object mess.
* Drop now-unneeded false positive hits.
Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
This chooser has been removed from the Creative Commons website, and the
URL we are using now redirects to an apparently random 2006 blog post.
There is a new license chooser, with source at
https://github.com/creativecommons/chooser , but it does not support the
kind of embedding we need.
So, remove the feature.
Change-Id: I400777b2ae80198ba1db6bd105de38903afced6f
It is not elegant but it works. Any other solution involved rewriting
all of db updater since the db gets directly injected.
Bug: T314908
Change-Id: Ic9ee73e8e47582abe3f3d79fd107ea2845ee32aa
Why:
- We want developers to have DevelopmentSettings loaded by default
What:
- Define a new `--with-developmentsettings` argument for install.php,
Set it to true in the `composer mw-install:sqlite` invocation
For now, this option is not supported in the web installer.
Bug: T347347
Change-Id: Icba2d614fd1349463fb745ef31f53a3b3834e5ad
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
When the value of the associated array is not used, there is no need to
use array_keys and create internal a copy of the array, just omit the
value with $_ to tell static analyzer that the var is unused.
Change-Id: I5c6d667e98c0167c0573c683f0d617bc1d4ca619
PHP 7.3 and later require PCRE2 version 10.30 or later. The original
PCRE library is no longer supported, so it is no longer necessary to
check for old versions of it.
The check for Unicode support is also useless. As mentioned in the doc
comment, it does not run early enough in the installation process. (And
unlike the original PCRE, PCRE2 cannot be compiled with UTF-8 support
but without Unicode property support.)
That leaves one remaining PCRE check in the installer, which was added
not long ago in eaa534b189 and clearly is applicable to PCRE2. I
changed the error message to refer specifically to the "PCRE2 library",
as well as to the "--enable-newline-is-any" configure option (rather
than a value that is less likely to appear in package and port build
scripts and that had already been changed for PCRE2).
The --skip-compat-checks option is removed from update.php; the script
no longer performs checks beyond those performed by PHPVersionCheck. It
is possible to run environment checks manually from the command line
using install.php --env-checks.
Change-Id: Iab9a28451cfc9dd28fe3394cc24a7dd7cea3fd7e
The global was removed in be3018b but it is not unused,
it is needed to let the require_once put something into the array
Bug: T335626
Change-Id: I0b5b02fe8970ab3d7afa018c615e7cbc14e58512
* 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
Subclasses of Maintenance that can function without database access can
now override canExecuteWithoutLocalSettings to return true.
This is useful for scripts that need to be able to run before or without
installing MediaWiki.
When no config file is present, the storage backend will be disabled.
Any attempt to access the database will result in an error.
NOTE: This makes MediaWikiServices::disableBackendServices() more
comprehensive, to avoid premature failures during service
construction. This change makes it necessary to adjust how the
installer manages service overrides.
The CLI installer is covered by CI, I tested the web installer
manually.
Change-Id: Ie84010c80f32cbdfd34aff9dde1bfde1ed531793