Pass Authority to WikiImporter constructor, instead of looking at the
user from RequestContext::getMain(), and skipping this check if
$wgCommandLineMode is true.
Maintenance scripts now use UltimateAuthority, to match the original
intent of skipping permission checks, see 2ed55f42 / r96311.
The Authority parameter to WikiImporterFactory::getWikiImporter() is
optional for now for backwards-compatibility. It should become
required later after deprecation.
Change-Id: Iea1d03dcdcbda2f9a9adbff1b0d319efd22c4d86
* Inappropriate @inheritDoc usage. Arguably all @inheritDoc is
inappropriate but these are the ones PHPStorm flags as misleading
due to the method not being inherited.
* Doc comment type does not match actual argument/return type.
* I replaced "@return void|never" with "@return void" since never means
never, it doesn't make sense for it to be conditional. If a method
can return (even if that is unlikely) then @return contains the type
that it returns. "@return never" means that there is no such type
because the method never returns.
* Incomplete/partial/broken doc tags
Change-Id: Ide86bd6d2b44387f37d234c2b059d6fbc42ec962
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
Detect bad xml before starting import to avoid errors on long running
transaction or half-state pages after rollback on error
This is not about validation of the xaml against export.xsd
- Just read the given source by XMLReader to check if everything is fine
with the syntax of the xml, like unclosed tags etc.
- The xml check is part of doImport, because that is already wrappred
in a try/catch and has exception handling in caller code
- No i18n for the technial exception as handled by other code as well,
also the message by libxml would be en always
- Added a seek function to ImportSource, the interface is not tagged as
@stable, so no release notes or backward compatibility
- Moved the XMLReader::open into own function to reuse it, because the
reader has to be reopen after the validation, store the reference to
the source in new class property for the reopen
- Use AtEase to suppress warnings from read of invalid xml (php #64230)
Bug: T277766
Change-Id: Iea70e6c42526cb1efc787b335abe19f59abf4786
This patch injects services into WikiImporter. It also adds
a WikiImporterFactory service for creating WikiImporter
instances.
Change-Id: I2966297e5728fca1ae8280361f1008cef6c6041b
Most of these are found by the not yet released I10559d8.
I remove the type MockObject in some cases when the calling
code really does not need to know if he get's a mock or the
real thing. However, I do this only in places that are very
closely related to the fixes.
Change-Id: I26a4c3c5a8ae141bf56161b52b54bce7e68f2e30