- Add Skin::getOptions and Skin::getPortletLinkOptions, which are used
to provide skin options to mw.util.
- Add SkinFactory::getSkinOptions, which is used by
Skin::getPortletLinkOptions.
Depends-On: Ib23360e3439abc828404c1de8e0906915ee7d8b6
Bug: T289163
Change-Id: I801e7d583cb0b0c7da51f4da503268be736bb60c
Some methods in the PageUpdater's class implements the fluent interface
design pattern. Use the fluent interface where need be.
Change-Id: If76a4b8c5070c20ed40038a4ee78e2d677de5180
For both LinkTarget and PageReference, just extract
namespace and dbkey and pass those in the array
of parameters to Job::__construct().
Allows a bunch of simplification to WatchedItemStore.
Bug: T291531
Change-Id: Id150d0c62af38d4b3d17e5698866127c6e04717e
On mobile and possibly desktop via (`$wgFooterIcons`), trying to acccess
the copyright icon returns an array instead of a string. An exception is thrown
since the indexing is done on a string.
Throwing an error: TypeError: Return value of BaseTemplate::getCopyrightIconHTML()
must be of the type string, array returned.
The returned array looks like this (when I test):
["copyright"]=> array(1) {
["copyright"]=> array(3) {
["url"]=> string(47) "https://creativecommons.org/licenses/by-sa/4.0/"
["src"]=> string(44) "/core/resources/assets/licenses/cc-by-sa.png"
["alt"]=> string(39) "Creative Commons Attribution-ShareAlike"
}
}
So getting the icon, we need to index src, hence the patch. Let me know
if I'm wrong here. Also, have a look [[Manual:$wgFooterIcons]], you'll see that
default value is an empty array instead of a string:
$wgFooterIcons = [
"copyright" => [
"copyright" => [],
],
]
This made MF to not be able to load locally and the patch fixes it.
In addition, we can just pass `$config` as we have above rather than request
the for it again and again.
Bug: T291325
Change-Id: Icb42342e83f2bc61922ab991bcec66aa5e7b5646
ContentHandler::getContentText() is deprecated and should be
replaced with Content::getText() for TextContent instances.
Change-Id: I556d3d3f64fafd1d54c4a0c5021efaff2d9c3ce8
NOTE: some test cases where removed as they're exactly doing the
same thing as the ones above.
Bug: T291268
Change-Id: I8fa8bafc892dbc84f2aab2549d453d6f39835d33
In order for us to keep backward compatibility, cast the page identity
back to a Title in: `buildTextboxAttribs()` and use within the code.
Change-Id: Ia55251ee7f730636d6e85bf069734ff462119f0d
Since $wgSkipSkins is meant to only 'remove skin from preferences',
it should not affect parsing with them.
So these skins need to be allowed here.
To achive this, this patch adds getInstalledSkins() method to SkinFactory
to provide the complete. The method supersedes getSkinNames() which does
the same thing but with ambiguous name.
Description of getAllowedSkins() has been corrected as it was slightly incorrect.
Bug: T237856
Change-Id: I0889b823d27f1a2830cc0205f5a21ed4de744e08
This is done without a deprecation process since the function is
@internal and completely unused outside of core.
Bug: T291341
Change-Id: I4b074f83f9be67b5b5bc2d33b2a6a55bb109a2b3
Unicode characters out of the BMP (starting at U+10000) have in a
JavaScript string two UTF-16 surrogates.
On uppercase of the first character of a title this must be supported.
This change also adds test cases to verify this.
Bug: T291321
Change-Id: I88c4ddbd39000aa09455f67ca8435ce704b98bf8
This patch adds a service as a replacement for MWGrants. This is done
as it allows proper dependency injection of used services and
configuration settings.
This was previously committed as Iac52dba15f and reverted because it
introduced recursive service instantiation.
To avoid this recursive service instantiantion all UI related methods
get moved to a new GrantsLocalization service, instead of the GrantsInfo
service.
Bug: T253077
Change-Id: Ib900bc424fc272ec709d272dcaff71398fa856f8
Nothing in the code expects things to be on the left/right, it was just
a naming convention. However, it caused some issues because CSSJanus
flips the attributes in the stylesheet for RTL languages.
So just use more descriptive names that also avoid issues with RTL
languages.
Bug: T290731
Change-Id: I8a383cd1e3981dc8a826ff60eee523d9f71d1d3d
```
function check($txt) {
echo sprintf("er=%+5s, ini=%+5s # $txt\n",
error_reporting(), intval( ini_get( 'error_reporting' ) )
);
}
function turningItOffAndOnAgain() { // have you tried...
check('... enter');
$old = error_reporting(42);
check('... off');
error_reporting($old);
check('... on');
}
error_reporting(2);
check('start'); # er=2, ini=2
turningItOffAndOnAgain();
check('toggled'); # er=2, ini=2
@turningItOffAndOnAgain();
check('silence-toggled'); # er=2, ini=0
```
PHP correctly reflects the silenced state during the silenced state,
the same as our AtEase library.
PHP also correctly ignores changse to error_reporting while being
silenced. That is, it always restores it back to how it was regardless
of what a confused nested function may have done.
Where it fails is that it doesn't seem to sync the INI setting, which
caused this PHPUnit check to cause test failures.
While this an upstream bug, it was also a mistake on my part to
write the PHPUnit check based on the ini_get value. That's not the
idiomatic way to check the current state and apart from these two
lines of code, it seems nothing in any of our Codesearch-indexed
code bases, including third party, do this.
Bug: T291278
Change-Id: Ic3e66cb2e5b2b44b9997d323abbc87b7f8fe3c41
Also remove the "@unstable" annotation from DeletePage.
Methods without known usages were hard-deprecated, the others
soft-deprecated.
Bug: T288758
Bug: T288759
Change-Id: I30c62572fd533526779a8ade3ab178f35bebb522
This ensures that a DerivedPageDataUpdater is initialized earlier during
the edit process, so it can be used by hooks to access the state of the
ongoing edit.
This patch also cleans up PageUpdater a bit to make the internal information
flow more consistent with the idea that PageUpdater is acting as a
builder for a new revision.
Change-Id: I99abb7bdffb2b5ff5979ba5b1e56d39dba4cd3dc
WikiPage is not the right spot to compute all the revert
related stuff - we already figure out manual reverts when
building the EditResult, lets figure out rollbacks and undos
in there as well.
Change-Id: I9fdc5f24c1db1eb0452b90bf4af1ef5ffbce6cb8
In both cases the typehints were changed to the new interfaces. For the
ArticleDelete hook, the replacement has no $error param and requires the
caller to set a fatal status if it wants to abort.
Bug: T288758
Change-Id: I9540f6ab2075bcf56bd4fdc79c611c883246cdce
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is
$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;
Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.
Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
Follows-up I8808cad03418 which added this option, but I neglected to
actually test it. When trying it out with a patched wmf-config on
a mwdebug server, the following issue surfaced:
> Fatal TypeError: Argument 1 passed to XhprofData::__construct() must
> be of type array, null given, called in ProfilerXhprof.php:90
This is because ProfilerXhprof::disable() actually has its own state
tracking which refuses to even try calling tideways_xhprof_disable()
unless its state says it was in control of enabling it.
Remove this check and reduce the class to just abstracting the calls
to the PHP extension.
Also, remove the useless null return which is incompatible with the
callers to this function as evidenced by above Fatal TypeError.
The PHP extensions already default to an empty array, which is now
documented.
Test Plan:
* Local wiki with php-tideways installed, on this pach applied.
Note that MediaWiki-Docker now has php-tideways pre-installed!
* In LocalSettings, configure profiling as per
<https://www.mediawiki.org/wiki/MediaWiki-Docker/Recipes/Profiling>
$wgProfiler = [
'class' => ProfilerXhprof::class,
'output' => 'text',
];
* At load.php?forceprofile=1, there are valid percentages (100% "main").
* Add `tideways_xhprof_enable();` and `$wgProfiler['running'] = true;`
to LocalSettings.
The percentages are still valid, and the profile is now longer
with additional coverage of early code such as MediaWikiServices.
* Switching to master, there is a fatal error with these settings.
Bug: T247332
Change-Id: Iaad88a0c46d39aee1374e5b02a77251bfa4c6f09
=== Why
* More speed
In debug mode, the server should regenerate the startup manifest
on each page view to ensure immediate effect of changes. But,
this also means more version recomputation work on the server.
For most modules, this was already quite fast on repeat views
because of OS-level file caches, and our file-hash caches and
LESS compile caches in php-apcu from ResourceLoader.
But, this makes it even faster.
* Better integration with browser devtools.
Breakpoints stay more consistently across browsers when the
URL stays the same even after you have changed the file and
reloaded the page. For static files, I believe most browsers ignore
query parameters. But for package files that come from load.php,
this was harder for browsers to guess correctly which old script URL
is logically replaced by a different one on the next page view.
=== How
Change Module::getVersionHash to return empty strings in debug mode.
I considered approaching this from StartupModule::getModuleRegistrations
instead to make the change apply only to the client-side manifest.
I decided against this because we have other calls to getVersionHash
on the server-side (such as for E-Tag calculation, and formatting
cross-wiki URLs) which would then not match the version queries that
mw.loader formats in debug mode.
Also, those calls would still be incurring some the avoidable costs.
=== Notes
* The two test cases for verifying the graceful fallback in production
if version hash computations throw an exception, were moved to a
non-debug test case as no longer happen now during the debug
(unminified) test cases.
* Avoid "PHP Notice: Undefined offset 0" in testMakeModuleResponseStartupError
by adding a fallback to empty string so that if the test fails,
it fails in a more useful way instead of aborting with this error
before the assertion happens. (Since PHPUnit generally stops on the
first error.)
* In practice, there are still "version" query parameters and E-Tag
headers in debug mode. These are not module versions, but URL
"combined versions" crafted by getCombinedVersion() in JS and PHP.
These return the constant "ztntf" in debug mode, which is the hash
of an empty string. We could alter these methods to special-case
when all inputs are and join to a still-empty string, or maybe we
just leave them be. I've done the latter for now.
Bug: T235672
Bug: T85805
Change-Id: I0e63eef4f85b13089a0aa3806a5b6f821d527a92
This is in preparation for making all version hashes the empty string
in debug mode, which will make things faster to work with, but also
helps solve T235672 in an easy way client-side without having to
add additional complexity to the mw.loader client that is specific
to debug mode.
Bug: T235672
Change-Id: I43204f22dfbcf5d236b35adc5b35df3da8021bad
The skin methods serve BaseTemplate so are moved there. The associated
hook is seldom used so deprecated.
Bug: T290583
Change-Id: I166241fc88b98603f8d5489643eda984f49bad66