Follows-up I8b1bdb84a969. This is not generated by that script,
the autoload.php file is, but that one has a similar comment
in it already.
Change-Id: Icb44f3dab356820f1e3aa5ba56949219af1b5719
Currently all new classes in core need to be registered
with the autoloader. This is acceptable but inconvenient.
This patch adds a script to read the output of php's tokenizer
to determine the names of all the classes within mediawiki core.
Patches with new or removed classes will just need to rerun
the maint script rather than manually adjusting the arrays.
A full conversion to psr-0 + composer would solve this as well,
but this is a very non-intrusive patch that can get us some
portion of the benefit(reduced manual maintenance) today rather
than months down the line once we figure out all the intricacies
of mediawiki + composer.
Change-Id: I8b1bdb84a9699de79f8b9951fa61e5437d083c55
Add a helper class to assist in collecting profiling information using
XHProf <https://github.com/phacility/xhprof> and a Profiler
implementation to hook it into the existing MediaWiki profiling system.
The Profiler includes support for generating tabular reports similar to
the traditional output of ProfilerSimpleText and ProfilerSimpleTrace or
sending data to a udpprofile daemon as supported by ProfilerSimpleUDP.
It also produces data compatible with the debugging toolbar.
Bug: T759
Change-Id: I16a75cb7636cb5dcef3830d738b2dcd2047d0aaa
This doesn't rely on any other parts of MediaWiki since we can
replace MWException with InvalidArgumentException here.
Change-Id: Id4512b184d24efc6674d486a5d452aa44dc871c6
- Put Profiler, ProfileSection and TransactionProfiler in their own
files and rely on Autoloader to use them (maintenance has been
using the autoloader here for some time--we don't profile the
autoloader manually)
- This reduces overhead in WebStart/doMaintenance by only loading
three functions at profiler initialization and defers until the
first profiling call happens
- Inline callback functions in ProfilerSimpleText rather than having
public static functions.
- Small comment and code formatting changes in various touched files.
Change-Id: Idf27677c068c50b847152c523a33e7f0c33fdeeb
list=deletedrevs has always been an odd one: it pretends to be a prop
module sometimes in taking titles from ApiPageSet, but when the pageset
supplies no titles it acts like a list module. This causes problems
such as bug 71389, and makes the whole thing unnecessarily confusing.
The solution is to split the "prop" and "list" aspects into separate
modules: prop=deletedrevisions when input should come from ApiPageSet
and list=alldeletedrevisions when not.
At the same time, let's take advantage of the situation to clear up some
other bugs. And let's share the revision-formatting code with
ApiQueryRevisions instead of partially reimplementing it.
Bug: 23489
Bug: 27193
Bug: 44190
Bug: 71396
Bug: 71389
Change-Id: I3e960d5c655bc57885d6d4ee227e67104808add7
An interesting experiment, but it was never completely fleshed out
and represents an anti-pattern as the only class that doesn't follow
the Profiler -> ProfilerStandard inheritance.
Since we want to refactor this to split profiling and profiling output
we need this unused but difficult to refactor code gone.
Maybe in the future after things are refactored and someone has the
time or inclination this could be dusted off again.
Change-Id: I1fd8813894e1fe88652b0c17b5ad8f42666bf776
Send wfDebug, wfDebugLog, wfLogDBError and wfLogDBError log messages to
the new MWLogger PSR-3 logger subsystem. Compatibility with the historic
logging operations of wfLogDBError are provided by MWLoggerLegacyLogger
and the MWLoggerLegacySpi logger factory.
Requires the MWLogger system introduced in I5c82299 and the Composer
managed libraries from Ie667944.
Change-Id: I1e5596d590144fbfdfd5f18bc42cf1ef0dbcac12
Allow $wgMWLoggerDefaultSpi to specify a more expressive object creation
by introducing a new ObjectFactory class which can process an array of
instructions to call either an object constructor or a factory method
with an array of arguments. This allows removal of the
$wgMWLoggerMonologSpiConfig global variable in favor of configuration
using $wgMWLoggerDefaultSpi.
New classes introduced:
; ObjectFactory
: Construct objects from configuration instructions.
Change-Id: If56cce5dcb1ad5712e238d6e2dab809a351f79be
This allows use of gender on Special:Log
Old message is kept for use in irc,
a test is added to ensure a unchanged irc message.
Change-Id: I0557a0d2751540cf0d7967333ffd767b934011c6
Use HTMLForm instead of self-built table structure, to be
prepared for use with MediaWiki UI.
Bug: 71446
Change-Id: I5c03dc543b910aab27a26a5a223341be50893cf3
The MWLogger class is actually a thin wrapper around any PSR-3
LoggerInterface implementation. Named MWLogger instances can be obtained
from the MWLogger::getInstance() static method. MWLogger expects a class
implementing the MWLoggerSpi interface to act as a factory for new
MWLogger instances. A concrete MWLoggerSpi implementation using the
Monolog library is also provided.
New classes introduced:
; MWLogger
: PSR-3 compatible logger that wraps any \Psr\Log\LoggerInterface
implementation
; MWLoggerSpi
: Service provider interface for MWLogger factories
; MWLoggerNullSpi
: MWLoggerSpi for creating instances that discard all log events
; MWLoggerMonologSpi
: MWLoggerSpi for creating instances backed by the monolog logging library
; MWLoggerMonologHandler
: Monolog handler that replicates the udp2log and file logging
functionality of wfErrorLog()
; MWLoggerMonologProcessor
: Monolog log processer that adds host:wfHostname() and wiki:wfWikiID()
to all records
New globals introduced:
; $wgMWLoggerDefaultSpi
: Default service provider interface to use with MWLogger
; $wgMWLoggerMonologSpiConfig
: Configuration for MWLoggerMonologSpi describing how to configure the
Monolog logger instances.
This change relies on the Composer managed Psr\Log and Monolog libraries
introduced in Ie667944.
Change-Id: I5c822995a181a38c844f4a13cb172297827e0031
The existing API help, formatted as basically a plain-text document
embedded in XML and with a little bolding and a few links
syntax-highlighted in after the fact, works ok for experienced programmers
but isn't at all newbie-friendly. Further, all the help is hard-coded in
English, which isn't very friendly to non-English speakers.
So let's rewrite it. The help text is now obtained from i18n messages
and output in HTML, with the default display consisting of help for a
single module with links to help for other modules. This, of course,
necessitates deprecating many of the existing help-related methods and
hooks and replacing them with new ones, but backwards compatibility is
maintained for almost everything.
At the same time, action=paraminfo also needs to support the
'description' and other help-related fields being output in wikitext or
HTML, and I11cb063d (to access all modules via the 'modules' parameter
instead of having 'modules', 'formatmodules', 'querymodules', and so on)
is folded in.
And we also add Special:ApiHelp. When directly accessed, it simply
redirects to api.php with appropriate parameters. But it's also
transcludable to allow up-to-date API help text to be included within
the on-wiki documentation.
Note this patch doesn't actually add i18n messages for any API modules
besides ApiMain and ApiHelp. That will come in a followup patch, but for
the moment the backwards-compatibility code handles them nicely.
While we're messing with the documentation, we may as well add the
"internal" flag requested in bug 62905 (although the 'includeinternal'
parameter it also requests doesn't make much sense anymore) and a
"deprecated" flag that's needed by several modules now.
Bug: 30936
Bug: 38126
Bug: 42343
Bug: 45641
Bug: 62905
Bug: 63211
Change-Id: Ib14c00df06d85c2f6364d83b2b10ce34c7f513cc
Requires skins use the 'mw-wiki-logo' class on the logo element for the styles
to apply and to load the 'mediawiki.skinning.interface' module (or implement
their own skin module that uses the ResourceLoaderSkinModule class).
This is backwards compatible with skins using inline styles as the class only
applies when used.
Bug: 56257
Change-Id: I4e6db89a688843ac24539f8fd1b408c0d04881b3
The API output for help and 'fm' formats will soon have need of
including ResourceLoader modules on an otherwise-bare page. The easiest
way to do this is to use OutputPage, but that requires a skin. So let's
add a skin that outputs a basic page without any navigation elements or
other chrome (that may be added later, but that can wait for Design to
decide they want to design it).
Change-Id: Ifa95fae5acaa3cfbf2ca58a15f8d0c51d84b455a
Custom LESS functions are problematic for us for a number of reasons,
as outlined by Timo on bug 67368. We should get rid of them.
The only use case was implementing CSSMin data: URI embedding in LESS,
which used to be impossible due to lessc not preserving comments (bug
54673). However, thanks to new syntax added in f3779e06 we can insert
the annotations in such a way that the compiler won't mess with them.
The same technique is used in OOjs UI since 584ed144.
The LESS-function-based embedding implementation also meant that we
were unable to flip images for RTL (bug 66091 and friends: bug 66773,
bug 68326). The annotation one doesn't have this limitation.
Bug: 67368
Bug: 66091
Bug: 66773
Bug: 68326
Change-Id: I3062346ed63272a1c22b5df27b4cc1de2a699d9a
With the success of prop=redirects, let's create prop=linkshere,
prop=transcludedin, and prop=fileusage.
Let's also add a miser-mode-sensitive 'namespace' parameter to
prop=redirects, since the other three have a 'namespace' parameter using
the new *_from_namespace fields.
Change-Id: Ib650db9988a553771582eed0c183d0cae4b71252
There used to be a bot on commons that did this, but it broke, and
this seems like the sort of thing that should be built in to
MediaWiki anyhow.
In order to do this, it abuses the querycache table somewhat
(Storing non-titles things in the title column).
Also changes the link on Special:Statistics for number of
uploads to link to new page. It seemed appropriate to link
to more detailed statistics instead of to Special:ListFiles.
Change-Id: I9ab768584b02a32b450d5f3981ff775ee07fecfa
This change adds MultiConfig and HashConfig classes,
but does not actually use them anywhere. In a future
change, we can convert DefaultSettings.php into
a HashConfig instance and use MultiConfig as the
'main' config instance.
Bug: 69418
Change-Id: I0ef2fbb86d5c27602d70240219ee08be31e2d09b
* All content handlers that deal with code/data tend to have
English as their page language & pageview language, so moved common
code to the abstract CodeContentHandler class.
* Renamed JSONContent & JSONContentHandler into JsonContent*
Change-Id: I46819a0572ef5becc211d0d82471ff7102edaa3c
This moves most of the Title::moveTo() function into a new MovePage
class, and the entirety of the Title::moveToInternal() function.
No actual code was changed except for requiring a User object in
function arguments instead of relying up on $wgUser, and changes
to "$this" as necessary.
Change-Id: I5479fa8f3920a51ddf789d55edae7dd0d9b24382
BitmapHandler has a lot of generic-ish functionality that could
be re-usable by extension classes (Such as how it organizes
$scalerParams array, or various image magick escaping methods).
However it's combined with a lot of very format specific things,
such as the shell-out call to image magick.
Try to separate out the more generic stuff into
TransformationalImageHandler. In order to do this, I also made
canRotate, autoRotateEnabled, and getScalerType non-static. No
extensions in our repo appeared to be using these methods, and they
don't really make sense to be static (imo).
In particular, I think code duplication can be reduced in
PagedTiffHandler by extending this new class. See comments
on I1b9a77a4a56eeb65.
Change-Id: Id3a8b25a598942572cb5791a95e86054d7784961