| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
callers accordingly
Bug: T245075
Change-Id: I0714b1c5d5a379cfe3ca473b72244d4d6bd1b7b8
|
|
|
|
|
|
|
| |
Follow up to I0d0df86db2e61cdd1769426bfa7bad4c2ae5e977 to fix the
command-line parserTests runner.
Change-Id: If4a979f0f1377302c89d921c24e7ee0673fa3a26
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Split MWDebug::sendRawDeprecated() from MWDebug::deprecated(). The new
function can be used to send arbitrary messages to the deprecation
log, rather than being constrained by the fixed format of
MWDebug::deprecated().
* Split formatCallerDescription() from sendMessage() to allow the caller
of sendRawDeprecated() to do its own caller formatting.
* Use the new function in MWLBFactory::logDeprecation()
* In tests, replace the ugly implementation of hideDeprecated() with one
that works by setting a list of regexes to filter. hideDeprecated()
now filters deprecation warnings that are a string match to the
supplied function. filterDeprecated() can be used to filter a regex,
and is intended to be used to filter warnings sent via
sendRawDeprecated(). The filter list is reset at the start of each
test, instead of leaking across tests as before.
Change-Id: I0d0df86db2e61cdd1769426bfa7bad4c2ae5e977
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Send deprecation messages to $wgDebugLogFile if it is configured.
Previously deprecation messages were marked as "private" and so were
shown only if someone specifically configured the channel in
$wgDebugLogGroups.
Complete suppression of deprecation messages was an accident stemming
from an attempt to avoid duplication of those messages when
$wgDebugToolbar is enabled. However, that duplication is harmless and
perhaps even useful -- we see an HTML deprecation message in the
console, and also a plain text deprecation message in its context in the
toolbar's debug log, which seems fine to me.
Change-Id: I8edb41aa1d8236047b80830dcdda546e326b09ec
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
== Motivation
Mute a log channel, for which the Logger object is injected by
service wiring, for a service that is overridden by default,
such as 'DBLoadBalancerFactory'. For that, calling setLogger()
mid-test would be too late.
== Changes
* Add a test-only method to LegacyLogger that makes it possible
to change its `minimumLevel` attribute, thus making it turn
itself into a NullLogger if raised to infinity. This is the
same principle we use already for disabled log channels when
using MediaWiki normally (see LegacyLogger::__construct).
* Previously, the developer's LocalSettings.php was loaded
which includes the Spi configuration. This meant other Spi's
could be configured which means we might not be dealing with
a LegacyLogger object.
Similar to what we do with ObjectCache and JobQueue already,
make the default Spi in tests the same as the normal MW default.
* Add setNullLogger() which makes use of these two.
Bug: T248195
Change-Id: Ieade3585812de47342259afa765e230fff06f526
|
|
|
|
| |
Change-Id: Ie225ebfc37c824e3167742137bbbc9f64aca5f5e
|
|
|
|
|
|
|
| |
Profiler outputs should instead be configured via $wgProfiler.
Bug: T245835
Change-Id: Ib27ce8d066bde27596e61491750c508b259746f4
|
|
|
|
|
|
|
| |
Follows-up I04628de4152dd5.
Bug: T212738
Change-Id: I718474ec0d9fd29ac2c05477f0f2493615d8aff5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PHP 7.0 makes many error conditions throw instances of the new Error class
which does not extend the known Exception.
The Throwable interface provides a concise and type-safe way of handling
either, e.g. for logging purposes, but HHVM did not support it, requiring
tedious fallback checks.
This commit replaces occurrences of Exception in code paths equally
covered by Throwable, like Exception|Throwable parameter and return types
(also nullable), instanceof guards, duplicated `catch` blocks, as well as
related comments and documentation blocks, with the exception of $previous
parameter descriptions consistent with the manual at
https://www.php.net/manual/en/exception.construct.php
Proper type declarations have been added or reinstated where possible.
Change-Id: I5d3920d3cc66936a350314e2f19c4f6faeffd7c0
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. into class Parser
2. into class LinkHoderArray
3. into class DefaultPreferencesFactory
Add more tests for DefaultPreferencesFactory:
1. testVariantsSupport verifies that converter with variants is used correctly.
2. Test testUserGroupMemberships verifies that membership is used correctly
Bug: T243320, T243321, T243317
Change-Id: I1e5c37e18332d0d32391c74c06e3d84862e48df8
|
|
|
|
| |
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
|
|
|
|
| |
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
|
|
|
|
|
|
| |
$version = true is not supported.
Change-Id: Id08ada32cd0273564c638d242354351333a9f163
|
|
|
|
|
|
| |
Follows-up a4ae47a7b7bb6e4. Untested micro-optimisation.
Change-Id: I94178ee40baf9d1d6dd2cac558ec2e205918964b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Scalar casts are still allowed (for now), because there's a huge amount
of false positives. Ditto for invalid array offsets.
Thoughts about the rest: luckily, many false positives with array offsets
have gone. Moreover, since *Internal issues are suppressed in the base
config, we can remove inline suppressions.
Unfortunately, there are a couple of new issues about array additions
with only false positives, because apparently they don't take
branches into account.
Change-Id: I5a3913c6e762f77bfdae55051a395fae95d1f841
|
|
|
|
|
|
|
|
|
|
|
| |
Repeating the variable name doesn't do anything. Documentation
generators don't need it. It's more stuff to read that doesn't add new
information. And it can become outdated.
Note there are two types of @var docs. When used inline (and not on a
class property) the variable name is needed.
Change-Id: If5a520405efacd8cefd90b878c999b842b91ac61
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reduce the cost of calling LegacyLogger::debug() when there is no debug
log enabled (the normal production case) from 0.8µs to 0.2µs, measured
locally, by duplicating some of the logic from log() and shouldEmit() to
derive a constant "minimum level".
I also introduced constants for the integers, to avoid unnecessary
lookups in self::$levelMapping, and I introduced $this->isDB, to avoid a
hashtable lookup in log(). I fixed a typo in a comment, and removed
"@return null", which was confusing PHPStorm.
Change-Id: I9fc37b8062ff22f85feda9a05821e3d8c9688519
|
|
|
|
| |
Change-Id: I27dc0c8a1a184571ed96abdea22af953510457cd
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is to make it behave in a more object orientied way. The
goal is to make it be easier to allow extensions to mark certain
pages as requiring a different policy (For example, CodeEditor
extension uses a blob: url with a WebWorker. We don't want to
include that on the policy of every page, but allow the extension
to mark it as required whenever needed).
This commit does not change code behaviour in any way.
Change-Id: I4bf53dabb6e6c5446cea99a64db68b300cef2fd4
|
|
|
|
|
| |
Bug: T231636
Change-Id: I61852ba55362ab9ae8cc8c1ab6b27565ce1d08e7
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some of the errors are suppressed because they're phan false positives.
The idea behind this is that they'll be fixed in a future version of
phan, and we'll just have to remove the suppressions.
Note: I'm disabling UnusedPluginSuppression so that we can start suppressing
issues even if they're still disabled. The sniff should be re-enabled
as soon as we upgrade phan.
Bug: T231636
Change-Id: I0f7fa06a9e03fbb86c7a5eb6e50a850bb258a7f7
|
| |
| |
| |
| |
| |
| |
| | |
Remove @since for some private ones as we don't guarantee anything
about private class members.
Change-Id: Ifb898353c02082e9ef69d67f69339345c6cd154d
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This broke after e0cc49ce3971e19, due to the field 'master'
being removed from the log context. The LegacyLogger logic
forwarding these messages to MWDebug (for the debug toolbar)
however, was dependant on.
Users of debug toolbar experienced a silent failure because the
logic in question is very tolerant of missing fields. This is
because it uses those fields to distinguish the 'sql' messages
from channel=DBQuery from other messages in the same channel.
Making that less fragile is outside the scope of this commit.
This commit:
* Restore the basic functionality by making sure MWDebug::query()
gets called again for DBQuery messages.
* Remove the code relating to the 'master' field as this no longer
exists in RDBMS. It also wasn't used anywhere (to be used,
it would need to be read by mediawiki.debug/debug.js).
* Remove unexpanded "{method}" and "{runtime}" noise in the debug
toolbar text. This was introduced by he conversion to PSR-3
logging.. These fields are already rendered separately by
the toolbar and should not be part of the "SQL" column.
To do this, we need to log the $sql bit as its own key, so
I've made this a context field as well.
* Reduce the condition logic in LegacyLogger to only looking for
'DBQuery' and 'sql'. This way, if it breaks again it will
still call the logic within and emit E_NOTICE instead, which
would help detect the issue (and still fallback to at least
showing the queries). Unlike before this commit where it took
quite some time to figure out why it wasn't working.
* The above fixes still weren't enough to get queries to show
up in the Debug toolbar for me. Turns out, this was because
my local setup (mediawiki-docker-dev) uses a master-replica
set up. The setup doesn't use any custom LBFactory config,
just plain $wgDBservers. The logic for turning these plain
settings into LBFactory (in MWLBFactory.php) does kick in,
and does run (unlike if I had custom wgLBFactoryConf).
But, the DBO_DEBUG flag didn't make it through because of
the += operator preferring any pre-existing value my setup
has, which is just `DBO_DEFAULT`.
Merging 'flags' keys seems unsafe in general, but adding
DBO_DEBUG based on $wgDebugDumpSql seems innocent and doesn't
affect other behaviour (it's a case of DWIM).
Bug: T231742
Change-Id: I122bb1a65620a7ae4e1943136c975b63524a5111
|
|/
|
|
|
|
|
| |
First part, mostly doc-only.
Bug: T231636
Change-Id: Id59f585740fa5bfb53c257287121f51a30de38fe
|
|
|
|
|
|
|
| |
This will allow us to remove the phan stubs. The MWDebug part was copied
from Ia92b881a7eeab4b8b53531136fb0dbafb6ec30ba.
Change-Id: Id8a5e267b2eb2d8beda3b1b2c1041000a0a1b17c
|
|
|
|
|
|
|
|
| |
This is for classes with a single undeclared property - aside from
BlockManager: I3f51fd3579514b83b567dfe20926df2f0930dc85 removed the
declaration of $permissionManager without actually removing all uses.
Change-Id: Ic2a95f77071312041be6e0633ea9b5325e98de42
|
|
|
|
|
|
| |
Copied from I014ea7f048862cc8cc387a68bf0f1cc5acbd9c6e.
Change-Id: Ic3216386af173cfb9cbffda0826879829e52ffbb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Remove checks in HTMLFileCache.php and Article.php.
These haven't been needed since the same check was added to Setup.php,
many years ago. When FileCache is enabled, The Setup.php code disables
MWDebug. There is no reason for FileCache to then also disable itself
based on unused config. That means both of them lose.
We now handle this logic in one place: MWDebug::setup().
* In rebuildFileCache.php, turn it off explicitly, just in case.
The previous code there didn't work because finalSetup()
is called after doMaintenance.php includes Setup.php, which
is what checked this config var to decide on MWDebug::init.
On the other hand, it's also always off in CLI mode.
But, let's not depend on that, maybe we decide to enable it on
CLI one day! Just keep it off explicitly here.
Bug: T189966
Change-Id: I45a8f77092249751dc6f276aa5bb67ebf5b4f64c
|
|
|
|
|
|
| |
FormatterInterface defines the return type as mixed
Change-Id: I41735b9fe887f9436cf6294a46eb5419c8da251f
|
|
|
|
|
|
| |
The rest of the codebase is using this code formatting standard.
Change-Id: I4d2ba61757a7e28d40096d9dc5915005c340d4f2
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code was checking for `Exception` to decide whether to produce traces,
so it wasn't providing them for PHP 7's new Errors. The code itself
works fine with any Throwable.
We have to keep parallel checks for Exception too for the time being,
because HHVM as used in Wikimedia production doesn't have Throwable.
Bug: T187147
Change-Id: Iec8a6718beb7ec09e45e332ee5762d0644ce17ab
|
|
|
|
|
|
|
|
| |
The method for getting the declaring class name was not used when
printing the class name, and was incorrect anyway. Use reflection
when on the error path to ensure the correct class name is used.
Change-Id: Ic9cd4319535d5ab877a0563e0433371e1025d985
|
|\ |
|
| |
| |
| |
| | |
Change-Id: Ie5c05fbc88c51d493bc1462005d2f8dde5f72101
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
self::class would have been better here for consistency across
the code base but seems HHVM handles self::class diferrently from
PHP 7, when used inside a trait. The difference is significant to the
tests and thus we keep the result the same by using __CLASS__ instead.
Change-Id: I58b452341a0567f4d6e6636a7e489531a5569d20
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In the array 'loggers' the key '@default' is assumed to be present,
hence be sure it is defined: this is the system default for MediaWiki,
it can be overwritten if desired.
This default php://stderr with level ERROR is inspired from Monolog’s
own default, which is php://stderr with level DEBUG: this is similar
but less violent for the average MediaWiki sysadmin.
Bug: T196906
Change-Id: Id74083fc20ddf906c40e6d149095e8ade4c68572
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a new handler, similar to SyslogHandler, that will be used to
replace udp2log. The main feature of the handler is being able to vary
the 'application name' with each record's channel. This way the channel
can be reconstructed later, e.g. when writing to plaintext files.
See also an overview of the plan here:
https://phabricator.wikimedia.org/T205856#4957430
Bug: T126989
Change-Id: I0c040825b31cd70f197dc8c1d406a103dc0ed1d1
|
|
|
|
|
|
|
|
| |
Basically turning Mediawiki to MediaWiki as all other classes exist
in that namespace
Bug: T217128
Change-Id: I95039a1a54c9900a2f2414b5a6ccce5fb6e5e612
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a unit test fails it is possible, perhaps even likely in some
cases, that some code that was run logged useful information about
how that failure came to be.
Help people out, tell them what happened!
Change-Id: I30bbc31799a65024868678d052fec9aafacc1aff
|
|/
|
|
|
|
| |
Those added in this same release do not need alias methods.
Change-Id: I05feeb9b0b13afe43aea1f95551965489cdbe094
|
|
|
|
| |
Change-Id: I20b7724f0cf2b0221ae27412844e4019ae451b61
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Replace
if ( 42 === $foo )
by
if ( $foo === 42 )
Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| | |
This formatter extends LogstashFormatter to prefix records with "cee token"
used for syslog and JSON structured logging. See also related task for more
context.
Bug: T211124
Change-Id: I3cdeb4c666f54039b5e8ecc67bd4937220333526
|
|/
|
|
|
|
|
|
|
| |
In Monolog\Logger (Logger.php), the logger levels are constants (interger values).
Logger::DEBUG is a constant (int) with value 100 which depicts that error logging
level. Datatype of these values; DEBUG, INFO, WARNING, etc are all integers not
strings.
Change-Id: I1cc67381bc64800241f5f9b7232ffe5419388d8a
|