Adding everything at the end makes the list arbitrarily ordered, and
also invites lots of merge conflicts as new things are added.
Change-Id: I58bcca4fa79140f5d5f2f6ef447e67035cc37aae
Instead of having basically every caller do:
$pf = new PasswordFactory();
$pf->init( RequestContext::getMain()->getConfig() );
Just create a single PasswordFactory via MediaWikiServices and pass that
around. Things that want to use their own config can still pass settings
via the new constructor.
This will eventually let us remove the init() function, removing the
only hard dependency upon MediaWiki, to make it easier to librarize
(T89742).
Change-Id: I0fc7520dc023b11a7fa66083eff7b88ebfe49c7b
Static members of MagicWord have been removed.
Static methods are soft-deprecated and forward to the factory. They
will be hard-deprecated when all callers are removed from core.
MagicWord::clearCache() has been removed. Instead, call
resetServiceForTesting( 'MagicWordFactory' ) on your MediaWikiServices
object.
Change-Id: Ie061fe90f9b9eca0cbf7e8199d9ca325c464867a
Bug: T200247
This, for now, has the focus for holding metadata of each
configuration option inside of MediaWiki (both extensions and core).
It's very close to the Config interface and friends, and uses these
implementations to retrieve the actual value of the
configuration option.
The goal with this change is to implement a basic architecture to
allow to display the values of the curent configuration of the MediaWiki
installation on-wiki (e.g. on a special page). It also provides a
central point, where the currently known options can be fetched
from.
The long-term goal, of course, would be to get a web interface to really
configure the MediaWiki installation. But, this is more like a dream,
then a plan (from the point of view of this commit).
Next steps would be:
* Enable ExtensionRegistry to "register" the configuration options of
extensions, so they're available in the repo (done).
* Find a good way to get mediawiki/core configurations into this repo
* Work out an overall architecture to display the different possible
values. (I think about something like different formatters for types).
Change-Id: I9419508eaa85ffc55520db7f33b3e9530fc99f00
provideGetters is now automatically populated using the
provideGetService method so we don't need to actually add
the service there
Change-Id: I07e8f54e5c4aa7ff22d02312bf51ac8d1cc4b5c2
This allows CommentStore to be added to MediaWikiServices
without the need of an aditional Factory.
This change includes a compatability layer to allow the behaviour
from 1.30 to continue to be used while deprecated.
CommentStore::newKey has been deprecated.
Keys are now passed into the public methods of CommentStore
where needed.
The following CommentStore methods have had their signatures changed
to introduced a $key parameter, but when used in conjunction with
CommentStore::newKey behaviour will remain unchanged:
* CommentStore::getFields
* CommentStore::getJoin
* CommentStore::getComment
* CommentStore::getCommentLegacy
* CommentStore::insert
* CommentStore::insertWithTemplate
Change-Id: I3abb62a5cfb0dcd456da9f4eb35583476ae41cfb
Lets not depend on the big blob that is RevisionStore.
Try to bind to the nice interfaces that we have where possible.
In the future RevisionStore should be split up further into
it's individual interfaces.
It looks like there are some more methods which should be moved
to both RevisionLookup and RevisionFactory.
See draft:
I214c5952d4a0fad55ff4116e90eab9ac3ba54fd3
Change-Id: I8df61374e24abcf4a7e38e53647489b8ecc1fd77
This will allow classes that need MWHttpRequest to inject HttpRequestFactory
and thus make it overridable and testable.
Also made MWHttpRequest abstract class since it doesn't implement
execute anyway. Maybe a good idea to move execute to an abstract
method?
Change-Id: I5c0e035542ff5f791a21a95ed13bed4cea6906d0
This allows Revision::getRevisionText to get
a different BlobStore instance when $wiki is passed in
restoring the behaviour for $wiki before the MCR Revision
overhaul patch was merged.
Ia4c20a91e98df0b9b14b138eb4825c55e5200384
Bug: T183634
Bug: T183631
bug: T183583
Change-Id: Ib0949454e9a003c2965adc1aab38e31fcf121afe
This is a re-submission of I4f24e7fbb68.
As a first major step towards Multi-Content-Revisions (MCR),
this patch turns the Revision class into a legacy proxy for
the new RevisionRecord and RevisionStore classes.
Backwards compatibility is maintained for all but some
rare edge cases, like constructing a completely empty
Revision object.
For more information on MCR, see
<https://www.mediawiki.org/wiki/Requests_for_comment/Multi-Content_Revisions>.
NOTE: once this is merged, verify create/delete/restore cycle on beta,
ideally with emulated replication lag.
Bug: T174025
Change-Id: Ia4c20a91e98df0b9b14b138eb4825c55e5200384
This reverts commit 9dcc56b3c9.
With this patch applied, newly created revisions are sometimes not found
just after submitting an edit, until replicas have caught up.
Our best theory is that it somehow interfere with ChronologyProtector,
but we don't have a good idea how.
Also, as legoktm mentioned, the commit message is terrible and needs fixing.
Change-Id: Idf3404f3fa8f8d08a7fb2ab8268726e2c1edecfe
Follows-up I2874175647e (7fdc3d09a3).
* Avoid "MediaWiki" in class names. If unavoidable, always camelcase.
* Use a more descriptive name, matching the implementing the class ("Buffering").
* Use "I" prefix for consistency with other MediaWiki-provided interfaces.
(Avoid "Interface" suffix, which is foreign to MediaWiki and is only used
in the StatsdClient namespace, which this interface is not in).
Bug: T166354
Change-Id: I06de59122625f9c23e7c1a1bfa69a7ddabbf379e
ParserCache is already a singleton, making it a good candidate for a
service. $parserMemc is an odd global (it lacks the "wg" prefix) and is
ripe for deprecation.
The following are now deprecated:
* $parserMemc global
* ParserCache::singleton()
* wfGetParserCacheStorage()
A ParserCache::getCacheStorage() method was added for cases where direct
access to the underlying BagOStuff object is necessary.
Usage of $parserMemc will emit deprecation warnings through the
DeprecatedGlobal class mechanism. All usage in core was migrated.
Also take this opportunity to inject the $wgCacheEpoch global value into
ParserCache. This will require an update to the FlaggedRevs extension.
Change-Id: I2ac7afff0d8522214329248c3d1cdccd0f72bbd4
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168
Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||
Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
The following changes are added:
- Created MediawikiStatsdDataFactory interface
- Added hasData() method to see if there are any data to send
- Added getData() method to fetch data
- Made service infrastructure use MediawikiStatsdDataFactory interface
- Made wfLogProfilingData() use MediawikiStatsdDataFactory interface
- Added capability to enable/disable buffering collector
Bug: T166354
Change-Id: I2874175647e987996a9a399829b3319674471aaa
The default will remain PHPUnit 4.x due to PHP 5.5 support.
But, we should allow developers to run tests with newer PHPUnit
versions which are noticably faster (especially for code coverage
reports).
* <https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.4.0>
PHPUnit 5 deprecates the getMock() shortcut for getMockBuilder()->getMock().
It instead introduces the shortcut createMock() which has better defaults
than getMockBuilder(). For example, it sets 'disableArgumentCloning' and
other things by default.
Going forward, code should either use getMockBuilder directly and configure
it using the setter methods (instead of the confusing variadic arguments
of getMock) or simply use the new minimalistic createMock method. This patch
backports the createMock method to MediaWikiTestCase so that we can start
using it.
Change-Id: I091c0289b21d2b1c876adba89529dc3e72b99af2
Dependency-inject the MediaWiki-specific parts into a CryptHKDF
instance, which MWCryptHKDF wraps around.
Change-Id: Idff18635cfd8a3d93ea2ca8d56cdbd11eb4d3b2b
* The later resides in /libs with related files.
* Explose MimeAnalyzer as a service.
* Keep MimeMagic::singleton() as a b/c alias.
* MimeMagic::applyDefaultConfig() will bootstrap the service
with all of the old config, extension hook handler, and
detector command shell-out behavior.
Change-Id: Ie2695a52e7a3bcfda9f7fa83659a9ff31b372bc3
Dependency-inject the MW-specific parts of MWCryptRand via
MediaWikiServices into a generic CryptRand class that is in libs/.
Note that this removes the wfGetAllCallers() debug logging from
generate().
Change-Id: I9742735c266ee69fb247199d3c553cd2ad2a3987
$ php maintenance/eval.php
> $wgMessageCacheType = CACHE_ACCEL;
> wfGetMessageCacheStorage();
PHP Warning: Illegal offset type in isset or empty in includes/objectcache/ObjectCache.php on line 93
PHP Warning: Illegal offset type in isset or empty in includes/objectcache/ObjectCache.php on line 125
PHP Notice: Array to string conversion in includes/objectcache/ObjectCache.php on line 133
Caught exception InvalidArgumentException: Invalid object cache type "Array" requested. It is not present in $wgObjectCaches.
#0 includes/objectcache/ObjectCache.php(94): ObjectCache::newFromId(Array)
#1 includes/objectcache/ObjectCache.php(287): ObjectCache::getInstance(Array)
#2 [internal function]: ObjectCache::getLocalServerInstance(Array)
#3 includes/objectcache/ObjectCache.php(181): call_user_func('ObjectCache::ge...', Array)
#4 includes/objectcache/ObjectCache.php(137): ObjectCache::newFromParams(Array)
#5 includes/objectcache/ObjectCache.php(94): ObjectCache::newFromId(3)
#6 includes/GlobalFunctions.php(3430): ObjectCache::getInstance(3)
#7 maintenance/eval.php(78) : eval()'d code(1): wfGetMessageCacheStorage()
#8 maintenance/eval.php(78): eval()
#9 {main}
This reverts commit 6d99fa5824.
Change-Id: I4d756eb6f66318a12d8cbbc1ba546397be8a29bf
This creates a new ProxyLookup service to house the
IP::isConfiguredProxy() and IP::isTrustedProxy() functions. The main
purpose of this refactoring is to make the IP class entirely independent
from MediaWiki, so it can be split into a separate library.
Change-Id: I60434a5f3d99880352bc0f72349c33b7d029ae09
* Refactored LBFactory a bit to make this possible.
* Move newChronologyProtector() up to LBFactory and
make a lazy-loading method instead.
* Move appendPreShutdownTimeAsQuery() up to LBFactory.
* Inject the web request values for LBFactory from Setup.php.
* Remove unused laggedSlaveUsed() method.
Change-Id: Ie8a38a6f4d6359680eb6a5be24a34e30b9816479
* Add getVirtualRESTServiceClient() to MediaWikiServices.
* Support auto-mounting services that are usable by the
main MediaWikiServices instance.
* Support lazy-loading in mount(), where only class/args
are set until the service is needed. This avoids excess
overhead.
Change-Id: I5c22be59664b3f5716c957e2c3d7c8e70d5fdc6c
This will allow further refactoring of override logic in parser tests.
Ideally the factory class would not use $wgMediaHandlers directly, but
that ends up breaking too many tests for now.
Change-Id: I34a63ee7089ff26f86f3dd6f3cd1a37928bc4005
This moves generating of a complex Watchlist and RecentChanges
related query to a WatchedItemQueryService class.
ApiQueryWatchlist class no longer contains any database-related
code.
Bug: T132565
Change-Id: I5a5cda13f8091baa430ac1a8e2176e0efd1ae192
This is a rewrite of Linker::link() to a non-static, LinkTarget-based
interface. Users of plain Linker::link() with no options can use the
LinkRenderer instance provided by MediaWikiServices. Others that
have specific options should create and configure their own instance,
which can be used to create as many links as necessary.
The main entrypoints for making links are:
* ->makeLink( $target, $text, $attribs, $query );
* ->makeKnownLink( $target, $text, $attribs, $query );
* ->makeBrokenLink( $target, $text, $attribs, $query );
The order of the parameters are the same as Linker::link(), except
$options are now part of the LinkRenderer instance, and
known/broken status requires calling the function explicitly.
Additionally, instead of passing in raw $html for the link text, the
$text parameter will automatically be escaped unless it is specially
marked as safe HTML using the MediaWiki\Linker\HtmlArmor class.
The LinkBegin and LinkEnd hooks are now deprecated, but still function
for backwards-compatability. Clients should migrate to the nearly-
equivalent LinkRendererBegin and LinkRendererEnd hooks.
The main differences between the hooks are:
* Passing HtmlPageLinkRenderer object instead of deprecated DummyLinker
* Using LinkTarget instead of Title
* Begin hook can no longer change known/broken status of link. Use the
TitleIsAlwaysKnown hook for that.
* $options are no longer passed, they can be read (but shouldn't be
modified!) from the LinkRenderer object.
Bug: T469
Change-Id: I057cc86ae6404a080aa3c8e0e956ecbb10a897d5
NOTE: This also changes the semantics of MediaWikiServices::resetGlobalInstance
to only reset services instances, not service wiring. The wiring will be copied
from the old global MediaWikiServices instance to the new one.
Bug: T132707
Change-Id: Ie2ca3ff99aa74fffa9eb6c8faccab857dc0874f7