Commit graph

89 commits

Author SHA1 Message Date
Ori Livneh
1b6f70089d Introduce ProfilerOutputStats
* Associate Profiler objects with a request context by adding a $context
  property with a getter and a setter.
* Introduce ProfilerOutputStats, which writes profiling data to the stats
  buffer associated with the current request context.
* Make it the Profiler class's responsibility to enforce $wgProfilerLimit.
* Deprecate $wgProfilerLimit in favor of the (more aptly named, IMO)
  $wgProfiler['threshold'] config setting.
* Tidy up Profiler instance creation code in Profiler::instance().
* Add Profiler::getOutputs, which returns an array of ProfilerOutput instances
  which are configured for the current profiler and whose canUse() method
  returns true.
* Make ProfilerStub not log by creating a stub ProfilerStub::logData() method
  which does not call the parent. Previously the parent class checked if $this
  was an instance of ProfilerStub and returned early if so.

Task: T90623
Task: T85641
Change-Id: Icf644ad3435c1f30d0a49957a97b481808a3153d
2015-04-02 01:32:46 +00:00
Bryan Davis
7ab9e6ed0c Remove MWLoggerMonologSamplingHandler
The Monolog\Handler\SamlingHandler class available since Monolog v1.12.0
is an upstreamed equivalent of MWLoggerMonologSamplingHandler.

Requires: I8790da95fd658234e35b2d846af35993ebcd80e9
Change-Id: I3841cbab95382a66098d90f5570fa0bf3521578a
2015-03-27 20:27:32 +00:00
Alex Monk
ec2330f7f9 Move WikiEditor's special character data and messages into core for use in other extensions
Using a ResourceLoader module to send the data to the client

For I3fafc561

Message changes:
wikieditor-toolbar-characters-page-.* -> special-characters-group-
wikieditor-toolbar-characters-(endash|emdash|minus) -> special-characters-title-

Bug: T91608
Change-Id: If9c5cdbe077e8796e1ebae99f759331251b5c4b1
2015-03-27 17:40:09 +00:00
umherirrender
50b1cd2fbc Remove never thrown UploadStashNotAvailableException
Also move creation of UploadStash to main entry point of the special
page to avoid use of context before it is set (by called getUser).

Change-Id: Ibcb17b6ee1b853d807f91104ba428b307e9a5208
2015-03-25 19:29:49 +00:00
Kevin Israel
cbfd6cff6d Remove unused class DBObject
This was left over from a previous attempt at Oracle support,
which was removed in 1.10 (r19196 / ccf91e827a).

Change-Id: I5f9b82fffc0b4f84286b697be8d504020fe22547
2015-03-23 20:09:47 -04:00
jenkins-bot
65294205a1 Merge "Split SiteLookup interface from SiteStore" 2015-03-19 11:32:27 +00:00
aude
aded554d70 Split SiteLookup interface from SiteStore
* SiteLookup interface is added, and SiteStore extends
  it. (any SiteStore type hints can be changed to use
  SiteLookup if all they need is lookup functionality)
* Memcached based SiteStore code is split from the
  database SiteStore, and SiteSQLStore is deprecated.
  If no caching is desired when using a SiteStore, then
  use a SiteDBStore instance, instead of passing $source
  parameter in SiteStore::getSite and SiteStore::getSites.
* SiteListFileCache renamed to FileBasedSiteLookup and
  implements SiteLookup.

Bug: T77990
Change-Id: I36b599884c211580ea6806a8a190c65c4f9087cf
2015-03-18 21:31:48 +01:00
Timo Tijhof
6b03627584 Regenerate autoload.php
Follows-up 87dfc20b1e.

It recently started generating dirty output because
BufferingStatsdDataFactory was manually placed – in a different
position than script would (i.e. not alphabetical).

Change-Id: I030a6ec9eb6f3a9b6cb54c9646acf2a898b93a80
2015-03-17 01:08:01 +01:00
jenkins-bot
0c9dc0f8f9 Merge "Ignore phpcs in autoload.php" 2015-03-16 22:00:51 +00:00
Timo Tijhof
e5f0884ec4 Ignore phpcs in autoload.php
Causes 20 warnings for line length
https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs-HEAD/13849/console

As being autogenerated, migth as well ignore so we can have
mediawiki-core pass.

Change-Id: Iedbe527456144c9b09b7ba93a8ce67edf0b47015
2015-03-16 19:09:28 +01:00
jenkins-bot
d3efb28185 Merge "Clean up $wgSQLiteDataDir handling and removed standalone sqlite class" 2015-03-16 17:22:10 +00:00
jenkins-bot
3823118cd8 Merge "Introduce the Restbase Virtual REST Service class" 2015-03-10 17:08:14 +00:00
Ori Livneh
87dfc20b1e Add StatsD metric logging
This patch adds a metric data service object to the IContextSource interface,
with full support for StatsD meters, gauges, counters and timing metrics, via
the liuggio/statsd-php-client, which this patch also introduces.

Usage example:

    $stats = $context->getStats();
    $stats->increment( 'resourceloader.cache.hits' );
    $stats->timing( 'resourceloader.cache.rtt', $rtt );

The metrics are flushed to a StatsD server, which may be specified via the
'StatsdServer' configuration key. If no such configuration key exists, the
metrics are discarded.

The StatsD client supplants MediaWiki's StatCounter class. wfIncrStats()
will continue to work, but it will delegate to the StatsD data object.

Change-Id: Ie10db1c154d225971398e189737de7c560bf0f90
2015-03-09 16:57:14 -07:00
Marko Obrovac
b13bd0996c Introduce the Restbase Virtual REST Service class
Restbase, the REST content API service, is to be queried instead of
Parsoid by current Parsoid users (most importantly VE). This patch
introduces the Restbase virtual REST service class and transparently
maps Parsoid calls into Restbase ones if parsoidCompat is set when
creating the service object.

Additionally, $wgVirtualRestConfig is introduced in DefaultSettings.php. This
is a first step towards global service configuration and management.

Bug: T89066
Change-Id: I4d4043e5052327bbd789331f1c05b607c45fe7cb
2015-03-09 22:05:58 +01:00
Aaron Schulz
46cf4f1e30 Clean up $wgSQLiteDataDir handling and removed standalone sqlite class
* The data directory can now be set via the construction params
* A standalone factory method now replaces the subclass
* Also made mDatabaseFile protected

Change-Id: I1791fd4f630e5c121fa7f68f473411a7c12d0c97
2015-03-09 18:35:24 +00:00
Aaron Schulz
8e3721a2b9 Added EnqueueJob class that handles routing jobs to queues
Bug: T89308
Change-Id: Iadb34f24d8bbe94c0f9f119e530c0bbe1060df0a
2015-03-04 13:55:54 -08:00
Stanislav Malyshev
750e4eb9d9 Allow dumping raw xhprof data for consumption by xhprof GUI
Change-Id: Iab90cef1c61b92ffc6d46a6bc93a03cf7bc2adb9
2015-03-04 01:29:02 +00:00
jenkins-bot
0d604ca809 Merge "resourceloader: Implement '$pages' parameter to ResourceLoaderWikiModule constructor" 2015-03-03 22:52:22 +00:00
jenkins-bot
5a00a50635 Merge "Removed pointless memcached JobQueueAggregator class" 2015-03-03 20:56:02 +00:00
Aaron Schulz
b15ac8eb48 Removed pointless memcached JobQueueAggregator class
* On a basic/default install there is only a single wiki 
  and nothing uses this. Larger wikis would want to use redis.

Change-Id: Ie5bf1a644ae60b2c6ca72b165fa5510113717611
2015-03-03 20:46:52 +00:00
Kunal Mehta
870f50d45c resourceloader: Implement '$pages' parameter to ResourceLoaderWikiModule constructor
This makes it easier for subclasses to use ResourceLoaderWikiModule. Currently
many subclasses of this simply need to override the getPages() method.

UserModule and SiteModule keep their getPages override due to the set of pages
being dependent on context.

Change-Id: I388531398671afacfec36c6c5746d72267b5bdac
2015-03-03 17:17:02 +00:00
aude
df3ac3d09e Introduce HashSiteStore, mainly for use in tests
HashSiteStore comes from Wikibase (see I783bd95), where it was
called MockSiteStore.

This enables some phpunit tests, related to Site objects, to no longer
depend on a database, memcached or other external storage. This makes
tests faster and more simple.

Bug: T90874
Change-Id: I048d37bd2aaa5f17c9fe16b2855df8bf9fe7bc8c
2015-02-27 10:14:48 +01:00
jenkins-bot
bd5fd843d6 Merge "Always decode Blob objects from Database::addQuotes" 2015-02-25 21:17:06 +00:00
Brad Jorsch
b5ac439ee6 Run maintenance/generateLocalAutoload.php
I thought a unit test was supposed to fail if this hadn't been run, but
I3936417b and I40fd6aaa recently got merged despite it.

Change-Id: Idb9b4b77a4a1c82ed74ec829fad8c12a9c39af09
2015-02-25 13:18:27 -05:00
Kunal Mehta
1e3888de00 Start moving objectcache into libs/
The base BagOStuff class and some of the implementations are
not dependent on MediaWiki and can be in the libs folder.

Change-Id: I299f9abb778abc65a70461a2aff3015c02a1f04d
2015-02-25 00:22:50 -08:00
Aaron Schulz
3817818aca Add a ReplicatedBagOStuff class
Bug: T88634
Change-Id: I1f7cccd6ac376055ff2b84641ff38a85571c65b0
2015-02-23 05:09:08 +00:00
jenkins-bot
8888bac668 Merge "Migrate block log to new log system" 2015-02-22 00:46:35 +00:00
Kevin Israel
ec314922b5 Remove maintenance script dumpSisterSites.php
This script would perhaps better belong in the SisterSites extension, as noted
on the extension's MW.org description page. However, that extension was never
actually developed to a usable state (first commit was r16390, no substantial
changes since) or imported into Git, so apparently the feature (or at least
its implementation) is of only limited, possibly historical interest.

Change-Id: Ia4c3b0316815f06b7e82f013edfd1798ed07d9a3
2015-02-20 10:09:53 -05:00
jenkins-bot
b767edc892 Merge "Maintenance script for exporting site definitions" 2015-02-20 11:16:18 +00:00
daniel
ca3be1e13d Maintenance script for exporting site definitions
Bug: T87178
Change-Id: I40fd6aaa8f47bad3d595d5c190036bf04d13c12a
2015-02-20 12:09:34 +01:00
jenkins-bot
0b10f2191e Merge "Maintenance script for importing site info." 2015-02-20 10:45:16 +00:00
jenkins-bot
94d47e4979 Merge "API: Add authz features for RESTBase" 2015-02-20 05:51:56 +00:00
kaldari
2ec0272218 Adding TemplateParser class providing interface to Mustache templates
The TemplateParser class provides a server-side interface to cachable
dynamically-compiled Mustache templates. It currently uses the
lightncandy library to do compilation (which is already included in
the vendor repo).

Also converting NoLocalSettings.php to use it as a proof-of-concept.

Bug: T379
Change-Id: I28cd13d4d1132bd386e2ae2f4f0d1dd88ad9162b
2015-02-19 17:41:45 -08:00
Brad Jorsch
4b8b0358eb API: Add authz features for RESTBase
The RESTBase team has requested the ability to check the validity of a
CSRF token and to interface with Title::userCan().

The former is accomplished by the new action=checktoken module. The
latter by a new parameter ('testactions') to the existing prop=info.

Bug: T88010
Change-Id: I2530f1315ec93f5be9fb437137992150fdc305f2
2015-02-19 16:45:03 -05:00
daniel
85e2086369 Maintenance script for importing site info.
Bug: T87176
Bug: T87183
Change-Id: I3936417bc79e08cf3d04270158a6e483b5515246
2015-02-18 18:39:14 +01:00
jenkins-bot
cdcc32a059 Merge "Removed deprecated RefreshLinksJob2 class" 2015-02-12 22:38:10 +00:00
Aaron Schulz
e3da87e3f2 Removed deprecated RefreshLinksJob2 class
Change-Id: Id5659c7fe0c6ebcbee0ef435ee4a95c1033cda47
2015-02-12 14:19:06 -08:00
jenkins-bot
2b547c4eea Merge "Add Monolog handler for syslog UDP transport" 2015-02-12 21:12:24 +00:00
jenkins-bot
e6696ed611 Merge "Handle missing width nicely in thumb.php" 2015-02-11 09:09:54 +00:00
jenkins-bot
23650785ef Merge "Moved RecentChange::purgeExpiredChanges to a job" 2015-02-10 21:32:55 +00:00
Gergő Tisza
769e7e339e Handle missing width nicely in thumb.php
Bug: T88508
Change-Id: I2cbe4ab914a9edba71461b194151938feeafeb11
2015-02-10 19:40:49 +00:00
jenkins-bot
3db3d168fd Merge "Common interface for ImportStreamSource and ImportStringSource." 2015-02-10 10:54:43 +00:00
daniel
891cc28a97 Common interface for ImportStreamSource and ImportStringSource.
ImportStringSource is handy for testing, but was unusable due to type hints
against ImportStreamSource. Introducing a common interface implemented by both
fixes this.

Change-Id: I820ffd8312789c26f55c18b6c46be191a550870a
2015-02-10 11:35:55 +01:00
Bryan Davis
f058574fcd Add Monolog handler for syslog UDP transport
The stock Monolog\Handler\SyslogUdpHandler only works with a specifically
tailored Formatter class and it's output cannot be fed directly into
Logstash's syslog input. This handler implements RFC 3164 in a way that
can be used with any Formatter and parsed directly by Logstash.

Bug: T88870
Change-Id: Ib098d5cb8fe9643742360bf51b54fc0e27996c0f
2015-02-09 22:38:26 -07:00
Aaron Schulz
c15caa6d53 Split StatusValue out of Status class and put it in /libs
* Deprecated useless FileRepoStatus class

Change-Id: I015635a9bf080ef6d98b2cff49b949c4378a859f
2015-02-10 00:39:05 +00:00
umherirrender
c891ff00ed Migrate block log to new log system
This allows use of gender on Special:Log.
Old messages are kept for use in IRC.
A test was added to ensure an unchanged IRC message.

Bug: T57402
Change-Id: Ibc7fcaa5a952ff90d42a6477da4baa429f3de64b
2015-02-07 21:02:10 +01:00
Aaron Schulz
ac8d6b3538 Removed old SqlBagOStuff alias
Change-Id: I6fdd8791713ce9ed67473065332266c217284974
2015-02-06 02:03:04 -08:00
This, that and the other
878523f622 Creation, deletion and improved management of change tags
This allows users with the `managechangetags` right to create tags for
use by wiki users. (Currently there is no way for editors to apply tags
to their edits; that's to come in a later patch.)

Extensions can reserve tag names for their own use, even if they do not
define them or mark them as active.

Tag managers can also delete tags with <= 5000 uses. Currently, if a tag is
misspelt ("vandlaism") or no longer wanted (testing of OAuth, etc), the
wiki is stuck with it forever. This change allows users with the
"managechangetags" right to delete change tags from the database,
including removing them from all revisions to which they are applied.

Obviously this is a powerful thing to be able to do, but I view change
tags as a "light" kind of interface, useful for revision patrolling and
spam/vandalism fighting but not something that necessarily needs to hang
around forever. It's not a big deal for this kind of data to be thrown
away without being archived anywhere.

Tags defined by an extension can only be deleted if the extension allows
it.

Changes to tags are logged in the new "tag management" log. There's even
a nice API module, just for fun.

Bug: T20670
Change-Id: I77f476c8d0f32c80f720aa2c5e66869c81faa282
2015-02-04 14:14:18 -05:00
Erik Bernhardson
7fd481c770 Always decode Blob objects from Database::addQuotes
The current API for Database::encodeBlob/Database::addQuotes requires
the code that is outputting binary data to have a database handle, so
that it may call Database::encodeBlob to get either a plain string or
a Blob object back. All database implementations other than MySQL
return a Blob object from Database::encodeBlob.

This is a rather inconvenient API, it tightly couples the creation of
binary data with the Database object unnecessarily.  If all database
objects accept a Blob via Database::addQuotes then code can simply
wrap its arguments in Blob and know that any database it ends up at
will be properly handled.

This patch changes the default implementation of Database::addQuotes
to recognize a Blob object was passed in, and use Blob::fetch to turn
it back into a string.  Database implementations other than MySQL all
handle this Blob object already.  The postgresql implementation had
to be adjusted slightly. Now when it sees a Blob object that it did
not create it will encode that appropriately.

Bug: 72367
Change-Id: I12fb4bd339be19137fffba2e47a70741382f6a8c
2015-02-02 17:43:12 +00:00
Kunal Mehta
4675950b19 StringUtils: throw InvalidArgumentException and move into libs/
Bug: T87863
Change-Id: Iac5bd958c27cad834e35930d0b99adb75c60411b
2015-01-29 10:30:57 -08:00