| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use bool instead of string, most caller provided int instead.
The InterwikiLookupAdapter class is strict comparing Interwiki::isLocal
(a bool) with the given $local value, which evaluates always to false
and the expected filter option is not working.
The unit tests is using bool, not the documented string.
The ClassicInterwikiLookup is not affected.
Found by phan strict checks
Change-Id: I63ed9772429c6f5bfe38a9fad190491812866f3f
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces references to DefaultSettings with
references to config-schema.yaml where appropriate.
NOTE: this does not yet change Setup.php. DefaultSettings.php
remains intact and is still being used.
NOTE: this does not remove usages in the installer, see I5d8843a1062fbf
for that.
Bug: T300129
Change-Id: Ie6152cf510c3be61bc22167ca6d90dfc28910a45
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Skin::getLanguages() was consuming 4% of index.php CPU time. In local
testing, it was called three times per page view. So:
* Memoize it, analogous to the nonfunctional code in SkinVector.
* Simplify ClassicInterwikiLookup by removing the option to pass a CDB
file path. This was only ever supported by a WikimediaMaintenance
script. In the unlikely event that someone is using this feature, they
have the same motivation to switch to PHP as we did in T122362.
* Increase the size of ClassicInterwikiLookup's MapCacheLRU from 100 to
1000. This helps greatly in the case when $wgInterwikiCache is false
and more than 100 interwikis are requested and seems harmless
otherwise.
* Optimise Title::getNsText() by assuming that the canonical name of
NS_MAIN is the empty string.
* Rearrange Message::__construct() to avoid duplicate type checks.
Change-Id: I736cb74efc267fd2473a3267471735238217251c
|
|
|
|
|
|
|
| |
This allows the backend to do whatever it can to ensure atomicity, and
is also easier to read, since the intent is obvious.
Change-Id: Ibbfecd92a2c6d9a5997ca37ea101e068bd1e8202
|
|
|
|
|
|
|
|
| |
Use only one place to document the deprecation of hook
interfaces/functions
Bug: T282903
Change-Id: Ie7d2d7a50afe2897e5c2369f473a33ecaa821637
|
|
|
|
| |
Change-Id: Icd58c93bb0cff5b0a4e7b7f02873a271bab8964f
|
|
|
|
|
|
| |
Per todo comments, to avoid using wfGetDB
Change-Id: Ic4a7f9c5bcbfef3042e5ec0606babbd14d3e6124
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The InterwikiLoadPrefix hook isn't compatible with Parsoid, as it is
unidirectional and doesn't support enumerating all valid prefixes
(T270444). Set/reset $wgInterwikiCache to mock the interwiki table
for parserTests and other unit tests instead.
This is a soft deprecation, as the used-in-production
Extension:Interwiki still uses InterwikiLoadPrefix, although not in a
way that would break Parsoid (since $wgInterwikiCache is set in
production).
Bug: T270444
Change-Id: If2507017c99c4ee42c104a0890bc45a84d7239d5
|
|
|
|
| |
Change-Id: I24bf99554f6005bc37d2c5aa4dc0fd18c1585388
|
|
|
|
|
|
| |
loop variable
Change-Id: If090a4603a22166b0e907ba2163f3bf68ae1e3a3
|
|
|
|
|
| |
Bug: T258665
Change-Id: Ifddbf57f8aa2e3eb0d5845601376cbafa08ed407
|
|
|
|
|
|
|
|
|
|
|
| |
For compliance with the new version of the table interface policy
(T255803).
This patch was created by an automated search & replace operation
on the includes/ directory.
Bug: T257789
Change-Id: I17e5e92e24c708ffc846945a136347670a3a20c7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A terminating line break has not been required in wfDebug() since 2014,
however no migration was done. Some of these line breaks found their way
into LoggerInterface::debug() calls, where they mess up the formatting
of the debug log.
So, remove terminating line breaks from wfDebug() and
LoggerInterface::debug() calls.
Also:
* Fix the stripping of leading line breaks from the log header emitted
by Setup.php. This feature, accidentally broken in 2014, allows
requests to be distinguished in the log file.
* Avoid using the global variable $self.
* Move the logging of the client IP back to Setup.php. It was moved to
WebRequest in the hopes that it would not always be needed, however
$wgRequest->getIP() is now called unconditionally a few lines up in
Setup.php. This means that it is put in its proper place after the
"start request" message.
* Wrap the log header code in a closure so that variables like $name do
not leak into global scope.
* In Linker.php, remove a few instances of an unnecessary second
parameter to wfDebug().
Change-Id: I96651d3044a95b9d210b51cb8368edc76bebbb9e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Edited doc comments for hook interfaces to improve
consistency and add type hints.
Bug: T246855
Change-Id: I38fa802463cd6f39bf5946dbbeb1b3ebaea604b2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add hook interfaces which were generated by a script which parses
hooks.txt and identifies caller namespaces and directories.
Hook interfaces are mostly placed in a Hook/ subdirectory
relative to the caller location. When there are callers in multiple
directories, a "primary" caller was manually selected. The exceptions to
this are:
* The source root, maintenance and tests, which use includes/Hook. Test
hooks need to be autoloadable in a non-test request so that
implementing test interfaces in a generic handler will not fail.
* resources uses includes/resourceloader/Hook
* The following third-level subdirectories had their hooks placed in
the parent ../Hook:
* includes/filerepo/file
* includes/search/searchwidgets
* includes/specials/forms
* includes/specials/helpers
* includes/specials/pagers
Parameters marked as legacy references in hooks.txt are passed
by value in the interfaces.
Bug: T240307
Change-Id: I6efe2e7dd1f0c6a3d0f4d100a4c34e41f8428720
|
|
|
|
|
|
| |
codesearch lists 0 usages: https://codesearch.wmflabs.org/deployed/?q=%3A%3A(isValidInterwiki%7Cfetch%7CinvalidateCache%7CgetAllPrefixes)%5C(&i=nope&files=&repos=
Change-Id: Ieea4ee724197d949db31c0430a8460ee273f9aba
|
|
|
|
| |
Change-Id: Ie225ebfc37c824e3167742137bbbc9f64aca5f5e
|
|
|
|
| |
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
|
|
|
|
| |
Change-Id: Id3c88257e866923b06e878ccdeddded7f08f2c98
|
|
|
|
|
| |
Bug: T231636
Change-Id: I1870b6cbeb31e54fde5e675fec51446b330e06c5
|
|
|
|
|
|
| |
The rest of the codebase is using this code formatting standard.
Change-Id: I4d2ba61757a7e28d40096d9dc5915005c340d4f2
|
|
|
|
| |
Change-Id: Id5c5640e05301161dbb7c2be363e32d7d1c9a511
|
|
|
|
|
|
| |
Those added in this same release do not need alias methods.
Change-Id: I05feeb9b0b13afe43aea1f95551965489cdbe094
|
|
|
|
| |
Change-Id: Ia3d843c79fa31fec59a04b92f4619458ae06de62
|
|
|
|
|
|
|
| |
Seeing MediaWiki\Interwiki\{closure} in the logs as caller is not
helpful
Change-Id: I39af68a02d40667e428c7f30c88aacab8a02cd86
|
|
|
|
|
|
|
| |
Brought to you by vim macros.
Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
|
|
|
|
|
|
| |
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff
Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
|
|
|
|
| |
Change-Id: I803df3ef90bf6b602e85ae48f25745f4dc6aab3a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since 129067c907ea65f62, parsing section titles has looked up interwiki
prefixes with InterwikiLookup. In the web upgrader, this triggers
database access, and since that service is disabled, it throws
exceptions, causing parsing to fail.
Work around that by using a dummy InterwikiLookup service that knows
about no interwiki prefixes. Maybe one could be written to just read
from the stock `interwiki.list`, but that's a project for another time.
Bug: T196607
Change-Id: I13485a9af79297b552a1128240cb8597c2ef83d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '
(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)
Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).
Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
|
|
|
|
| |
Change-Id: I936c3f5fca1a0061f215e80469f5d882cb32ee29
|
|
|
|
|
|
| |
@deprecated since 1.27
Change-Id: Ibdd49fdfc0d1511503e1ed2173a592c612996c53
|
|
|
|
| |
Change-Id: Ib4b452f1843ec250c8c1fcc2a738d80726b6135d
|
|
|
|
| |
Change-Id: I494b029de089a07e3b946ee78293a12d5036f63e
|
|
|
|
|
|
| |
InterwikiLookup::invalidateCache does not expected a return value
Change-Id: I5b2ba21ccb42ba9925205eb1645f2152fd51c0a0
|
|
|
|
|
|
| |
Organize phpcs.xml a bit
Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The documented return type was not what existing callers expected,
and not what the default implementation actually returned.
This patch fixes the interface documentation and the behavior of
an alternative implementation.
Change-Id: Ib09bffeba3ddc5b43da1c7c299f1fa946be4e2e2
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The ksort() here was causing the order to be enforced as
alphabetical instead of preserving the original order.
The order usually doesn't matter, except with regards to handling
of duplicates. Due to Parsoid normalising external links to interwiki
links, it has to do a reverse lookup. In doing so it has to decide
which one to prefer. It currently picks the first match from the
API request for meta=siteinfo&siprop=interwikimap, which didn't
match the defined order in the actual Interwiki map due to ksort()
being called in getAllPrefixes().
Sort in this function was originally introduced in 2010 with
commit 844e7c83e4 (2011; r92528; T21838), which is otherwise unrelated
and left no rationale.
The existing unit tests needed to be adjusted slightly as they
assumed alphabetical order. While it appeared they were also defined
in alphabetical order, this was merely the order of the variable
creation. The effective order is preserved within locals and globals,
but overall globals come before locals.
Also removed the duplicate test for Hash and CDB in InterwikiTest
that belongs in ClassicInterwikiLookupTest instead.
Bug: T145337
Change-Id: I7348748801cbdf16c6ceea5b0654fc174b79707e
|
|\ \ |
|
| | |
| | |
| | |
| | | |
Change-Id: I52bef87512f9ddd155d1f4cc0052f6b7a0db5b42
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is used for lookup in a CDB file or PHP static array.
In neither case is the key created by wfMemcKey() or any other
implementation of BagOStuff::makeKey().
This is already broken if:
* An interwiki prefix were to contain characters not supported by
Memcached.
* An interwiki prefix and wikiid together are too long for Memcached.
* If the site has wgCachePrefix configured, which overrides the
wfWikiID() namespace makeKey() normally uses.
dumpInterwiki.php does not use wfMemcKey() either (and should not).
This was simply here as leftover from many rewrites ago, its
only purpose is to create wikiid + prefix joined by colon.
Ref T148958.
Change-Id: I45682133ed593fbb0d66af5a67751f77f15a4a14
|
|/
|
|
| |
Change-Id: I5260ccad99057323d0f3a669a420bbd723363986
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most of these are simply changing annotations to reflect
reality. If a function can return false to indicate failure
the @return should indicate it.
Some are fixing preg_match calls, preg match returns 1, 0 or false,
but the functions all claim to return booleans.
This is far from all the incorrect return types in mediawiki, there
are around 250 detected by phan, but have to start somewhere.
Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
|
|
|
|
| |
Change-Id: Ice98cb0a3127333c045cfb4328081ad5c490c435
|
|
|
|
|
|
|
|
|
| |
Follows:
FormOptions: I29ae63472536f99f7f9546f30d86e7bd324d3094
MediaWikiServices: Ie5fd2c523ceec8cc2656e749928f38909dc4bdf1
InterwikiLookupAdapter: I387dc2ff3f5564fcedde835dec66781d8e9424fd
Change-Id: I8d99d0b559d04083fb83b0fcf45cde95dab32d64
|
|
|
|
|
|
|
| |
This adapter assumes the db name (Interwiki wiki id) equals global ids.
Bug: T135146
Change-Id: I387dc2ff3f5564fcedde835dec66781d8e9424fd
|
|
|
|
| |
Change-Id: I2a547a005955cb9f596ff6927feb7df3d5d91872
|