Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
Replaces Content::getSecondaryDataUpdates with
WikiPage::getSecondaryDataUpdates so that aggregation of
data updates from multiple page slots can be handled without
the caller having to care about it.
Also adds a WikiPage::updateParserCache method for convenience.
This is a temporary measure until DerivedPageDataUpdater
(or its replacement) can be exposed directly, at which point
the WikiPage methods will be deprecated.
Also fixes a parameter handling bug in DerivedPageDataUpdater.
Bug: T194043
Change-Id: Idbe7d582b49fcb7c90aea813773b7610ad44b1a8
Per documentation on IDatabase, $conds must be a string or an array.
Passing false for conds is confusing, since it's unclear whether this
should match everything or nothing.
Bug: T188314
Change-Id: I8be1ac4cbdaafc41aadc2a658be8a99b754b0268
Deprecate the second argument to Maintenance::error() in favor of a new
Maintenance::fatalError() method. This is intended to make it easier to
review flow control in maintenance scripts.
Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case passing by reference
Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
A title object must be passed to refreshCategory(), which is created in
the above lines, not the string representation received as a parameter.
bug: T172061
Change-Id: Id579a86a26cb438c1866351064c6887dbcea23b0
We already do this in many places, but there were also still plenty
of getOption(, false) calls. Change these to hasOption() for consistency.
Change-Id: I74f91a5bf5a8036496ab1f493e5862a04d27ec0f
Needed for selective updates of pages using a particular feature.
Intended to be run in production, so needs to scale.
Bug: T149723
Change-Id: If20fb1f91de8d4227def5b07d6d52b91161ed3fd
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.
The old constant is an alias now.
Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
It made perfect sense when I introduced this line in June 2005, but now
that we have <ref> etc., we need to use the normal parser configuration.
Change-Id: I5a32e4e38badff85fe6d7d63c3fa158dc6fd5336
these sometimes lead to issues with database deadlock loops
and probably are not needed here.
Bug: T75456
Change-Id: Iad03f6076d8e319ff02cb26259ec9705105e92a7
* Split tidy implementations into a class hierarchy
* Bring all tidy configuration into a single associative array and
deprecate the old configuration.
* Remove $wgAlwaysUseTidy
This is preparatory to replacement of Tidy (T89331). I used the name
"Raggett" for things relating to Dave Raggett's Tidy, since if we use
"tidy" to mean the new abstract system as well as Raggett's tidy, it
gets confusing.
Change-Id: I77af1a16cbbb47fc226d05fb9aad56c58e8910b5
Since 40e300b827, the last deletion batch is no longer handled
separately, so the wfWaitForSlaves() call added in 7492e90cc6
should no longer be necessary.
Also moved the remaining wfWaitForSlaves() call after the DELETE
query, as is the case in most other maintenance scripts.
Change-Id: I2c3c5ce20f81aed28b4b4c7ecf4eaaca7b9791d1
After checking a chunk of one of the links tables, the script failed
to restore the original chunk start when checking the next table.
Follows-up a1e0051559.
Bug: T107632
Change-Id: I21678bc3c83946f2e62afe3fdc69c7e84678ceeb
This also makes the -e and [start] options apply to --dfn-only, making it
possible to restart the script other than at the beginning if necessary.
Bug: T38195
Change-Id: I828b522039290b5700faa89fb8ad4075e50332e7
Instead of exiting the do...while loop only once a query returns zero
rows, exit whenever fewer rows than the batch size are returned. This
could save quite a bit of time when the highest nonexistent page_id
found is a relatively low one.
Follows-up 40e300b827.
Bug: T44180
Change-Id: I14d2d48c2405fcc0bd05a3181ba6293caef5298c
... instead of making an unbuffered query, which is discouraged in the
doc comment for DatabaseBase::bufferResults().
Also used NOT IN for the antijoin instead of LEFT JOIN...IS NULL; when
combined with DISTINCT, the latter causes MySQL to use a temporary
table rather than an appropriate index, according to EXPLAIN. (Using
GROUP BY instead of DISTINCT also avoids this problem. I don't know why.)
Bug: T44180
Change-Id: Idca85fac7dd7879f9fbef2712b6aa83343099e02
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: I727deec35a712de0f0c676cc87dfa661f1ee965b
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.
Also updated usage in text in documentation and the
installer LocalSettingsGenerator.
Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;
Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
Squiz.WhiteSpace.LanguageConstructSpacing:
Language constructs must be followed by a single space;
expected "require_once expression" but found
"require_once(expression)"
It is a keyword (e.g. like `new`, `return` and `print`). As
such the parentheses don't make sense.
Per our code conventions, we use a space after keywords like
these. We appeared to have an unwritten exception for `require`
that doesn't make sense. About 60% of require/include usage
was missing the space and/or had superfluous parentheses.
It is as silly as print("foo") or return("foo"), it works
because keywords have no significance for whitespace between
it and the expression that follows, and since experessions can
be wrapped in parentheses for clarity (e.g. when doing string
concatenation or mathematical operations) the parenthesis
before and after basiclaly just ignored.
Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
This makes this script actually useful when updating namespaces by
making sure the target registred in the "redirect" is the correct one.
Consider the following example:
- Create a redirect page pointing to a page "Extra:Target"
- Add $wgExtraNamespaces[100] = 'Extra'; in LocalSettings.php
- run refreshLinks.php
Previously the redirect target of that page was not updated and still
pointing to (0, "Extra:Target") which no longer a valid title.
Now it will be updated correctly to point to (100, "Target").
The value of the page_is_redirect field will also be updated to be
sure it has the correct value, which might be wrong when the target
becomes valid or invalid, e.g. by changing $wgInvalidRedirectTargets.
Change-Id: I458ca63550df56ca96b35749daf4e7b866ab9d93