Mixing Handlers with Helpers doesn't look nice for consistency
reasons. Helpers should be in their own place (grouped) in the
Handlers directory as they're really "helpers for the handlers".
Change-Id: Ieeb7a0a706a4cb38778f312bfbfe781a1f366d14
The anonymous function was equivalent to just specifying 'wfMessage'.
Same as in I355504984d343a2c7c469759f791612c5b6d6556 in Wikibase.
Change-Id: Ib94b7cceabce25ca95374d944255c7197e6a476a
Follows-Up: Ica0740049f0a3e8ec764903c5b71825e4d628a3f
Pages with content models not supported by Parsoid before already
had dummy parser output written to PC but we still got an internal
server error because the output didn't have a render key.
This patch fixes the issue and when we try to render page with
unsupported content models, we get the dummy parser outputs.
Bug: T311728
Change-Id: I49ebbfc0475fb296f2a906ce7dce237641fb375b
Was introduced in I10af85b2da96568cfffd03867d1cb299645fb371 for
backward compatibility with VisualEditor extension.
Change-Id: I180c5d95d1056cd2b5d2126b0622c5316dbf9c7b
Currently it is documented that mParent in HTMLFormField may be null.
This can happen if the form element is constructed manually via
new, instead of the normal way via HTMLForm methods.
As it stands, much of the code assumes that mParent is always set
despite the documentation. Lets mark creating form fields without
parent set as deprecated. The current situation seems like a
recipe for bugs, and after the deprecation period this would allow
us to simplify some of the HTMLFormField code.
Bug: T326456
Change-Id: Ica0740049f0a3e8ec764903c5b71825e4d628a3f
Depends-On: I15a39605e3eec8a5c265c4a331039fa906eda036
Notable changes:
* In SqlBagOStuff::getConnectionFromServerInfo, only two loggers were
injected. The rest implicitly got a NullLogger due to being absent.
These are now effectively unsilenced.
* Database::__construct() required almost all parameters, even the
loggers. I've wanted to move some of DatabaseFactory into the ctor
here for a while. In order to make this change not a breaking
change, the new 'logger' parameter is optional with NullLogger as
default. This allowed some of the test cases, which were simply
passing NullLogger, to be fixed by passing nothing instead of
passing the new option name.
The Database class is behind a dozen layers of indirection for
real use, so this will still be injected just fine (DBF, LB, LBF,
MWLBF, etc.).
* In LegacyLogger, the handling for $wgDBerrorLog was previously
limited to DBConnection and DBQuery. This now includes errors
from other (generally, newer) parts of Rdbms as well, which were
previously missing.
This only affects sites (typically CI and dev setup) where
$wgDBerrorLog is used, as opposed to the more common
$wgDebugLogGroups by-channel configuration.
* TransactionProfiler gets its logger injected in a rather odd way,
via entrypoints (MediaWiki.php, ApiMain.php, and MaintenanceRunner)
as opposed to service wiring. This is kept as-is for now.
* In LBFactoryTest, in particular testInvalidSelectDBIndependent2,
there are cases that intentionally produce failures of which
the result is then observed. In CI we assert that dberror.log is
empty so instead of adding the missing logger fields to that
LBFactory instance, the only one set (replLogger) is removed.
The alternative is to set 'logger' now, which would naturally
cause CI failures due to unexpected entries coming through to
non-mocked error log.
Bug: T320873
Change-Id: I7ca996618e41b93f488cb5c4de82000bb36e0dd3
Simplify mocking common cases of the content handler factory
only support specific content models.
Change-Id: Ib7f4099a2b1655b1bfb4d90f03105c27d17042ed
The motivation is to restore parsoid support for the content models
defined in the Proofread extension.
Bug: T246403
Change-Id: I33d269e42fede28139f7c923504326a77d11ee13
This introduces an interface HtmlOutputHelper that is implemented
by both HtmlMessageOutputHelper or HtmlOutputRendererHelper based
on the page we're dealing with.
Bug: T323558
Change-Id: I1fb8dcc5cc05ce3f32f3c1862b88045f1c8e612b
If HtmlOutputRendererHelper can't produce output because the page
doesn't exist, don't crash. Return a 404 instead.
Bug: T325205
Change-Id: I6a713025e2eb447ed61de8949c820bd9cda7594e
When parsoid was dealing with content for content models that it does
not support, the corresponding pagebundle used `null` as the version
which will break when converting the it to JSON.
This patch fixes this by just using a version which is not specified
like 0.0.0
A better fix would be for page bundle to not explode when the version is
set to null. The other real fix is for Parsoid to not ask for rendering of
pages that are not wikitext.
Bug: T325137
Change-Id: Iff1ce432d1b2d30f3f74c53a0602c11034db5874
Logging linter data should be enabled automatically by
HtmlOutputRendererHelper.
This change enables linting data for requests coming in via the
v1/page/{title}/html endpoint.
Change-Id: Idafd29784ec712547e36fea88a8c159784b97f2b
The previous attempt at restoring call to the ParserLogLinterData hook
had the undesirable effect of bypassing parser cache. This change
optionally enables the call to the lind data hook without disabling
parser cache.
This patch us working under the assumption that we only need to log lint
data for canonical parses.
Follow-Up to I1f69498ef75
Change-ID: I39ab54ca6e9f9a6a58b59cdd6feea07638fc908f
While RESTbase insists on getting Parsoid renderings for any content
model, don't waste CPU cycles trying to render garbage. Just output
dummy content. Nobody should ever see it.
Bug: T324711
Change-Id: I407171a5f515b594603b287a7a9e49f54e837161
Allow automatic retry if the first query fails due to the
connection having already been lost. Hide packet warnings
in doMultiStatementQuery(), which can occur due to dropped
connections.
Make queryMulti() actually mark the transaction or session
as corrupt when needed,
Improve executeQuery() handling of empty $sqls arrays.
Pass the full SQL statement array to beginIfImplied().
Add re-connection tests for queryMulti().
Related documentation changes:
* Clarify affectedRows()/insertId() documentation.
* Update queryMulti() documentation to mention exceptions.
* Add comments about avoiding direct BEGIN/COMMIT/ROLLBACK.
These should be avoided in queryMulti() as well.
Bug: T322689
Change-Id: I51d213acccfacc48674dbcf08c177cd9872c6e15
If variant conversion is not supported by Parsoid, fallback to using
the old LanguageConverter.
We still call parsoid to perform variant conversion in order to add
metadata that is missing when the core language converter is used.
Bug: T318401
Change-Id: I0499c853b4e301f135339fc137054bd760ee237d
Depends-On: Ie94aaa11963ec1e9e99136af469a05fa4005710d
ChangeProp is currently requesting a parsoid parse for all page updates,
regardless of content model. Parsoid renderings of non-wikitext content are
unusable, so we shouldn't bother the parser cache with them. This is
especially true for wikidata items.
Bug: T324711
Change-Id: I6f6325f2b8581dfcc9a8bcd97281ccf4caa7e8f1
This allows parsoid render anything, even if the output is garbage.
This is a quick fix pending the real solution (T311728).
Bug: T324711
Change-Id: If4e4eb8582ab8a62f592394820b30c1b28fb1216
getRevisionId is documented to return 0 for fake revisions, but it was
returning 0 for the current revision as well. This patch makes a clear
distinction, with 0 meaning current (like elsewhere in the code), and
null meaning a fake revision.
This patch includes a fix for redirect handling in ParsoidHandler::wt2html.
This fix is needed here because it previously relied on getRevisionId()
to return the actual revision ID; this would fail, since getRevisionId()
will return 0 when the current revision of a page is requested.
Change-Id: I33d1ab54023c6ac96c6bb5e4750b980e381cb464