Commit graph

694 commits

Author SHA1 Message Date
Holger Knust
471d2371ab doxygen: Changed Doxygen tags causing warnings during documentation generation
Updated Doxygen markup in several .php files triggering warnings when mwdocgen.php is executed. Removed
obsolete settings MSCGEN_PATH and TCL_SUBST from Doxyfile. The former would generate a warning in 1.8.16
while TCL support was removed in 1.8.18. Since TCL_SUBST was blank anyway, it was removed prior to getting
to .18 in production. Increased DOT_GRAPH_MAX_NODES from 50 to 200 since Doxygen complained about it being
too low for API and Maintenance.

Bug: T248706
Change-Id: I9c67f0807d1b43089d351263d4f591dee5501f36
2020-04-14 03:25:19 +00:00
Timo Tijhof
4eb1e679d5 Setup: Document the responsibilities of entry points
Bug: T189966
Change-Id: If282c21a882094a7d8a601a64de8c6fcc18b659f
2020-04-12 21:22:41 +01:00
Timo Tijhof
c7330ebabc objectcache: Improve wgMainWANCache docs
* Document how wgWANObjectCaches and wgMainWANCache are
  used / should be used.
  Remove outdated mention of event relayers.

* The easiest way I could document the 'other' options that
  wgWANObjectCaches entries can have was by saying which keys
  can't be set and that aside from these and class/cacheId
  they are all passed on.

  However, that wasn't (yet) technically right given we do pass
  class/cacheId on blindly, which might be unexpected for
  subclasses in theory. Explicitly unset those in ServiceWiring
  to avoid any chance of confusion. Also simplify that code
  slightly overall in terms of var names and var re-use,
  and improve error messages a litle bit.

* Test plan for the wanobjectcache-deployment doc ref:

  $ php maintenance/mwdocgen.php \
   --file includes/DefaultSettings.php,includes/libs/objectcache/

  Then open path/to/mediawiki/docs/html/, click on the docs for
  DefaultSettings, and find-in-page to "wgMainWANCache".

Change-Id: I1cfc65c2cc4dbceed6b9777c2b808527a58daeb9
2020-04-02 20:11:20 +00:00
DannyS712
ce800afdd2 Declare $wgUser to be deprecated in version 1.35
Only soft deprecated, removal is in process, see task and subtasks
Still used within core, but thats okay, since its not hard deprecated

Bug: T159299
Change-Id: I0e7e9857a0f6b83c4fd3df6316591c4b01e85106
2020-03-25 06:58:52 +00:00
Timo Tijhof
59f67dafb8 Setup.php: Remove internal $messageMemc variable
Was originally for use by the MessageCache class, which no longer
uses it.

Bug: T243175
Change-Id: I1c62c6bba08fadf52bda4993a4e99df81b02a97f
2020-03-18 17:44:35 +00:00
Timo Tijhof
9a9ae83419 Remove $wgContLanguageCode
Prior to 2004, the site language was configured via $wgContLanguageCode,
derived from that were $wgContLang (object). $wgLanguageCode was just a
cached copy of $wgUser->getOption('language').

In 2004 (r5492, 5537c5b85e, MW 1.3), $wgContLanguageCode ceased to be
supported as a configuration variable. Instead, the site language would
now be configured via $wgLanguageCode instead and the confusion started.
Its value was copied to $wgContLanguageCode for back-compat, and also
because $wgLanguageCode was still also used to store
User::getOption('language') right after initialising $wgContLang.

Sometime between 2004 and 2006, $wgLanguageCode was relieved of this
secondary purpose, as documented in r5492 (5537c5b85, MW 1.8), leaving it
as just a configuration variable for the site language.

Use of $wgContLanguageCode has been removed from Codesearch-indexed repos,
including third-party repos on GitHub.

Bug: T247674
Bug: T189966
Change-Id: Ic91f500d48d772360bf10323a2ed0733c0ea890d
2020-03-17 18:29:20 +00:00
Timo Tijhof
9463b0105b Setup: Move simple shortcuts together in Setup.php and improve docs
I've moved the simple config expansions that don't depend on anything
else in Setup.php together, more compactly.

Change-Id: Iefb7f8ffdca70bcfbf7cbf49f7939747c5ab0d76
2020-03-14 23:10:07 +00:00
Timo Tijhof
81a31e162b Setup: Remove compat for $wgDisableCounters
Deprecated since 2014 in MediaWiki 1.25, and the feature it
controlled was removed from core in 1.26.

The feature is still available via the HitCounters extension,
<https://gerrit.wikimedia.org/g/mediawiki/extensions/HitCounters/>

Bug: T189966
Change-Id: I5e46d1aef1b44b8828bdd1bba644136391cc1c4c
2020-03-14 19:28:00 +00:00
Timo Tijhof
75ccdc6147 languages: Move default $wgNamespaceAliases to MessagesEn.php
These are not configuration but business logic, similar to the
canonical names that are in NamespaceInfo.php, these must always
exist and cannot be altered or unset.

They were previously unconditionally assigned during all requests
in Setup.php and passed down as "site configuration".

Changes:

* Move them to MessagesEn.php where they can be cached and
  processed the same way as other core-provided aliases.

  Document and confirm with tests that this is a mergeable
  attribute that follows the language chain.

* Remove the duplicated code in a few places that was reading
  this variable + Language::getNamespaceAliases(), to instead
  just call the latter and move the logic there, centralised,
  and tested.

  In doing so I noticed that these were applied in an
  inconsistent order. Sometimes the config won, sometimes not.
  There's no obvious right or wrong way here, but I've chosen
  to standardise on the way that Language::getNamespaceIds() did
  it, which is that config wins. This because that method seems
  to be most widely used of the three (it decides how URLs and
  titles are parsed), and thus the one I least want to change
  the behaviour of.

* Document that $wgNamespaceAliases may only be used to
  define (extra) aliases, it is and never was a way to access
  the complete list of aliases.

Bug: T189966
Change-Id: Ibb14181aba8c1b509264ed40523e9ab4000fd71a
2020-03-14 19:27:40 +00:00
Timo Tijhof
e8d9d68b86 Setup: Remove compat for $wgUseSquid and friends
Follows-up f9f8dff40 (MediaWiki 1.34).

Bug: T189966
Change-Id: Ifc0022783e6b5e739d754f5a5060742d5ab42500
2020-03-14 16:59:26 +00:00
Timo Tijhof
50c3a47140 Setup: Move wgSkipSkins appendix to Skin::getAllowedSkins
This isn't a default setting or fallback, it's unconditional
business logic that can't be overidden. This doesn't need to
run on every web request in Setup.php.

Bug: T189966
Change-Id: I708131b111cd2ff0e34c3cc8a4b933eff260b3da
2020-03-13 23:45:12 +00:00
Timo Tijhof
9e44459031 Setup: Improve section docs to better explain the pre-config setup
Also remove some comments that didn't help understand the line
below (e.g. "install header callback" above "HeaderCallback::install")

Bug: T189966
Change-Id: Ib0b413c557f83f8f58683515fcdbf1817fe1f661
2020-03-13 16:27:25 +00:00
Reedy
c030dacfbe Kill off $wgLocalInterwiki
Change-Id: I07e44d1384138704eea979263e45a9853a0ae621
2020-03-07 21:44:46 +00:00
mainframe98
53da96af08 Remove wfGetMessageCacheStorage
There were no callers to this method, outside the $messageMemc
global, which is to be deprecated with T243175. Pending its
eventual removal, its usage has been inlined as the function
was trivial anyways.

Any previous callers were migrated with the convertion of the
MessageCache to a service in 752e7dd707.

Bug: T243176
Change-Id: I79846442512f023dcdf2f1f8c425156589c0421d
2020-02-14 20:09:14 +01:00
James D. Forrester
ec60dbbaea Follow-up 8cd2e13: Setup: Check that 1x key has been set in wgLogos before using
Bug: T232140
Bug: T244370
Change-Id: If1e0a384db6584d8854d7f39313ee62ae8423a7f
2020-02-05 07:44:16 -08:00
jdlrobson
8cd2e13363 Deprecate access of logos directly from config, introduce wgLogos
Add getAvailableLogos static method and wgLogos config variable

Longterm we'll phase out wgLogo and wgLogoHD for this more extendable
config.

wgLogoHD is marked as deprecated. wgLogo continues to function as before
when wgLogos doesn't exist to cause minimum disruption.

From now on all logos should be accessed via getAvailableLogos. Patches
in Minerva and Vector follow. See I00899c16c0325f36b671baf17e88c2b5187b3526,
I569e0d800e147eabc7852567acd140108613f074 and
I013bd0904fe8c55efa49d14e84cf06ec1412896f.

Bug: T232140
Change-Id: I66a971631c623cc94b58eb0e5e5bad804789bf1c
2020-02-04 01:56:20 +00:00
mainframe98
82b56e50e8 Deprecate $wgMemc
Callers should use the LocalServerObjectCache service instead.

Bug: T160813
Change-Id: I0f9725a56413b85929f920542bf89928e719baac
2020-01-20 11:44:21 +01:00
James D. Forrester
0958a0bce4 Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNull
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
2020-01-10 14:17:13 -08:00
James D. Forrester
4f2d1efdda Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUse
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
2020-01-10 09:32:25 -08:00
DannyS712
d50b9592e2 Drop wgSkipSkin, deprecated and unused
Bug: T241342
Change-Id: I38708089a48979dc9816a16050e48ed0c8a7b572
2020-01-02 00:37:48 +01:00
DannyS712
049dd15d4c Drop wgProfileOnly, deprecated and unused
Bug: T241343
Change-Id: I16eed6807bdcae657153221d06c4448da4566371
2019-12-23 00:48:53 +00:00
DannyS712
ce99c5f3aa Remove $wgSysopEmailBans, deprecated in 1.34
Bug: T233116
Change-Id: I72e257454692b29bfcbf4796f457858fc61b93d8
2019-11-01 02:46:45 +00:00
DannyS712
42566fce93 Hard deprecate $wgSysopEmailBans
Bug: T232169
Change-Id: Icfe02595fc92738c279fa6764f955aa00818088d
2019-11-01 01:59:44 +00:00
Kunal Mehta
03078991c4 Disable $wgServer autodetection to prevent cache poisoning attacks
Since MediaWiki 1.18, $wgServer has been automatically set by the web installer
when it generates LocalSettings.php, so this shouldn't be an issue for most
wikis. The CLI installer now supports a --server optional parameter to
specify $wgServer, otherwise it'll be set to 'http://localhost' by default.

Users will see a fatal error pointing them to the on-wiki $wgServer
documentation that I've updated as well.

Originally this functionality was slated for removal in 1.20, but now is
just a good time as any. It also calls into other parts of MediaWiki before
most things are initialized, making it difficult to librarize some code.

Bug: T30798
Bug: T232931
Change-Id: Ia5d616e7fafbab01655067c24c5a3a073b254f21
2019-10-30 15:49:41 +11:00
Daimona Eaytoy
ae424ce5da build: Upgrade mediawiki-phan-config to 0.8.0
This is to ensure that the CI job is working with the new version.

Note: redundant_condition_detection should have worked as expected by
this version, but unfortunately it still has false positives.

Bug: T235049
Bug: T231636
Change-Id: Idaba6584cb5b2ff19b6455c7bbec6b89619ddbff
2019-10-22 09:16:45 +00:00
jenkins-bot
42f58ae012 Merge "Setup: Move wgArticlePath validation to its main consumer (PathRouter)" 2019-10-07 21:58:16 +00:00
Max Semenik
2f749f7cb3 NamespaceInfo: use array constants now that we can
Change-Id: I676a68fdc42ff2f37c7e4a2700b7c0c448155d47
2019-10-05 00:26:56 -07:00
Max Semenik
a647c37843 Setup.php: remove HHVM support
Change-Id: I2fd43887ae996a0e0752032c6f3e8a25a6dd6d20
2019-10-02 21:03:51 -07:00
Timo Tijhof
480b7341f8 Setup: Move wgArticlePath validation to its main consumer (PathRouter)
The variable is also read in a few other places, such as to
export the value from api.php (siteinfo) and load.php (mw.config)
but those requests don't need to be held back by this extra
logic.

Alternatively, if we really want to require this for all consumption,
we should probably let PathRouter provide the value and require
consumers to use it. E.g. services->getPathRouter->getArticlePath,
or something like that.

As easy first step, I'm moving it to PathRouter, called from
WebRequest::getPathInfo which is still called on all index.php
requests for any wiki page action in any namespace (incl Special)
when the wiki uses anything other than the default 'index.php?title='
article path.

Test Plan:
* Set '$wgArticlePath = 'bla';`
* View /mediawiki/index.php/Main_Page, and observe the fatal
  error message (same as before this change).

Bug: T189966
Change-Id: Id06c2557e2addb58faeef0b6f7767a65b8de55a5
2019-09-25 23:06:52 +00:00
Daimona Eaytoy
e5444ea55a docs: Avoid some scalar juggling
Phan can treat scalar types as non-interchangeable with
`scalar_implicit_cast` set to false. This patch fixes some of those
issues (which are in total >1000), namely the ones with alphabetic order
< includes/actions.

Change-Id: Ib1c6573ab899088bc319b9da9ceaffc850da3dbe
2019-09-19 17:21:24 +00:00
DannyS712
3a2c7d1b5d Deprecate $wgSysopEmailBans
Bug: T232169
Change-Id: Iba2493eb2f49d32c5aa1b4da53c9c221847fb125
2019-09-17 08:23:04 +00:00
Daimona Eaytoy
f3262ed390 Add a dedicated Exception for SessionOverflow
Instead of setting a custom property and checking via isset + count.

Change-Id: I087eeb2eee414218bbd6023ad1703fde22292281
2019-09-10 08:27:29 +00:00
jenkins-bot
1880c8401a Merge "Add MW_REST_API and MW_ENTRY_POINT" 2019-09-09 15:29:21 +00:00
jenkins-bot
dbb8aeffe6 Merge "Setup: Move wgActionPath logic to PathRouter" 2019-09-05 19:17:28 +00:00
jenkins-bot
b328ae4a4e Merge "Setup: Move MWDebug logic to MWDebug.php" 2019-09-05 16:58:08 +00:00
jenkins-bot
b6737798b8 Merge "resourceloader: Drop support for low Suhosin 'max_value_length' values" 2019-09-04 21:53:44 +00:00
Timo Tijhof
3ac385a0c3 resourceloader: Drop support for low Suhosin 'max_value_length' values
Move the default of 2000 to DefaultSettings.php, and promote
the installer warning to a hard value.

Recommend that the setting be disabled, or increased to 5000.

Change-Id: Ifb0aadf8b52fd2d5c2a32f55e38eaa9c2600dfb5
2019-09-04 14:25:04 -07:00
Timo Tijhof
64281b6c52 Setup: Move wgActionPath logic to PathRouter
This is only relevant when processing page views or when constructing
Title urls with an 'action' query. Pretty important stuff, and worth
optimising for if we had to choose, but we can defer it in this case
without slowing it down, which is better for everything else.

It also means we don't mutate configuration (beyond setting whole values
as dynamic defaults), which seems desirable, and makes the overall behaviour
easier to test. Handling absence of 'view' should be PathRouter's
responsibility, not Setup.

Bug: T189966
Change-Id: I9c1eea2dcea74be0e283eb2b175268315ced1793
2019-09-04 20:29:03 +00:00
Timo Tijhof
d18e76dbef Setup: Move MWDebug logic to MWDebug.php
* Remove checks in HTMLFileCache.php and Article.php.

  These haven't been needed since the same check was added to Setup.php,
  many years ago. When FileCache is enabled, The Setup.php code disables
  MWDebug. There is no reason for FileCache to then also disable itself
  based on unused config. That means both of them lose.
  We now handle this logic in one place: MWDebug::setup().

* In rebuildFileCache.php, turn it off explicitly, just in case.
  The previous code there didn't work because finalSetup()
  is called after doMaintenance.php includes Setup.php, which
  is what checked this config var to decide on MWDebug::init.
  On the other hand, it's also always off in CLI mode.
  But, let's not depend on that, maybe we decide to enable it on
  CLI one day! Just keep it off explicitly here.

Bug: T189966
Change-Id: I45a8f77092249751dc6f276aa5bb67ebf5b4f64c
2019-09-04 16:33:25 +00:00
Daimona Eaytoy
43cc14657d Unsuppress phan issues, part 8
And also clean up the config.

Bug: T231636
Depends-On: Ie6233561de78457cae5e4e44e220feec2d1272d8
Change-Id: I82a279e1f7b0fdefd3bb712e46c7d0665429d065
2019-09-04 01:02:06 +00:00
Tim Starling
b7ce7aacb0 Add MW_REST_API and MW_ENTRY_POINT
Define the global constant MW_REST_API in rest.php, by analogy with
MW_API. Also generalize this by adding MW_ENTRY_POINT, which contains
the entry script name, "cli" or "unknown". This allows tests such as

  if ( MW_ENTRY_POINT !== 'index' )

which is probably what is really intended by defined('MW_API') in many
cases.

Change-Id: I24099f4cdd170de17afd6e1bbad67c9b204071fc
2019-09-03 11:43:18 +10:00
Daimona Eaytoy
e2e543f7c2 Unsuppress more phan issues (part 5)
Bug: T231636
Depends-On: I6e5fba7bd273219b1206559420b5bdb78734aa84
Change-Id: I50377746f01749b058c39fd8229f9d566224cc43
2019-09-01 09:48:31 +00:00
Timo Tijhof
70cb266480 Setup: Remove debug message for "caches"
This is currently forcing more object cache interfaces to be constructed
than might be needed in a given request. The configuration for these
interfaces is usually quite straight forward or can be trivially
verified from eval.php.

If we do want to log this, I would recommend doing it from the classes
constructor instead e.g. something like:

  LoggerFactory::getInstance('MessageCache')->debug( get_class( $cache ) );

Bug: T189966
Change-Id: I06dc6dfbdf274bb57e9295b0c757b8d52c02acbe
2019-08-31 19:47:43 +00:00
jenkins-bot
ee0be6ef83 Merge "Setup: Remove scopedProfileIn() calls" 2019-08-26 23:36:44 +00:00
Timo Tijhof
743547c20b Setup: Move wgRCLinkDays logic from Setup to ChangesListSpecialPage
This is only needed when viewing SpecialRecentChanges (or a related
page). Move the consuming logic to that class, where it can be
maintained as part of the rest of the code. This also makes it
more testable and makes config easier to work with or load from
elsewhere in the future. Aside from some dynamic default values,
configuration should generally not mutate. If there is some domain-
specific way to consume it, the relevant component should be
responsible for doing so. This also means we defer such logic to
where it is needed, instead of unconditionally for all possible
features that might be used.

Bug: T189966
Change-Id: If17608909711d98ac560b6d64f72ba7913a561a9
2019-08-25 23:19:48 +01:00
Timo Tijhof
5f623ebc10 Setup: Remove scopedProfileIn() calls
To my knowledge this never goes anywhere. These are left overs from
when we used profileIn/profileOut still, which we no longer use
given things like Tideways and XHProf are now recommended for
profiling, instead.

Bug: T189966
Change-Id: Id1bacc951f267dc1d3872aed935afd306adc37b3
2019-08-25 19:26:18 +01:00
David Barratt
5d54ddbd36 Move list of core namespaces to NamespaceInfo
It is sometimes necessary to get an unmodified list of namespaces that are in
core.

Bug: T226657
Change-Id: I8e4ed19db915a1673c27ca5b212d712d079b4bba
2019-08-08 10:49:15 +00:00
James D. Forrester
7b5619adca Hard-deprecate wgProfileOnly, deprecated in 1.23
Change-Id: I1b66931ca0d3ae3e044b14f5b97dd98861ec5e23
2019-07-17 01:40:54 +00:00
James D. Forrester
be07389e2a Hard-deprecate wgLocalInterwiki, deprecated in 1.23
Change-Id: Ib18c3122c4d9b8a50d314f67004cc73b8c14d40e
2019-07-17 01:22:01 +00:00
James D. Forrester
7d127e31d6 Hard-deprecate wgSkipSkin, deprecated in 1.23
Change-Id: Ia1013bea7216603f3b6a8148e0194f1e2a8e9b41
2019-07-15 15:45:09 -07:00