aboutsummaryrefslogtreecommitdiffstats
path: root/includes/site/MediaWikiSite.php
Commit message (Collapse)AuthorAgeFilesLines
* Make use of the ??= and ?? operators where it makes sensethiemowmde2024-08-261-4/+1
| | | | | | | | This touches various production classes and maintenance scripts. The code should do the exact same as before. The main benefit is that the syntax avoids any repetition. Change-Id: I5c552125469f4d7fb5b0fe494d198951b05eb35f
* Fix various version mention for class_aliasUmherirrender2024-07-051-1/+1
| | | | | | | | Versions are changed in 8e940c4f214ff7d17b53f51c6a46a5cf7fc2c92e, but that makes the version wrong Follow-Up: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0 Change-Id: Iae43725b8e0fffc4d44bf57f6227334b41290bd9
* Typo fixesfrankie2024-04-231-1/+1
| | | | | | | Two small typo fixes for dev environment and gerrit setup. Bug: T362742 Change-Id: I92399002019a8df51731f8c927ca606f91211b51
* Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-191-3/+1
| | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* Namespace remaining files in includes/siteJames D. Forrester2023-12-141-2/+8
| | | | | Bug: T353458 Change-Id: I38da09f28cd68add721ba7b05f351acb56515d95
* Namespace Site and SiteListAmir Sarabadani2023-12-141-0/+1
| | | | | Bug: T353458 Change-Id: I31f7cba42c02701e462eb3ed6bcc3928d438c1ef
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* Various doc fixes about false on method arguments/return typesUmherirrender2022-11-101-1/+1
| | | | | | Doc-only changes Change-Id: I5177f582ae7ee70c357e9389fed14819faf79463
* site: Hard-deprecate MediaWikiSite::getFileUrl() without $pathLucas Werkmeister2022-11-101-1/+3
| | | | | | | | | All callers available in codesearch pass in a $path (and for all callers except getFileUrl()’s own test, that path is 'api.php'); omitting the path hasn’t worked correctly for almost ten years (see change I5ed7e169c9, commit 779df10df7). Change-Id: I50819efb66fd72f2b5a1cd83d5cdd3a148742299
* site: Switch new code from MWException to RuntimeExceptionTimo Tijhof2022-11-081-2/+1
| | | | | | | | | | | | Follows-up I5ed7e169c9753 (779df10d, T319219) which introduced a new use of MWException, as per T86704. While at it, also remove a few unhelpful `@throws` annotations that do nothing other than save an outdated IDE scan of what throw statements internally exist. These aren't meant to be caught and thus aren't of use to consumers of these docs as per T321683. Change-Id: I4ef964342de80eb2c1dec99cd6258727e6cd1a2c
* site: Use common terms in docs for script path and article pathTimo Tijhof2022-11-081-31/+25
| | | | | | | | | | | | Its unfortunate that this class has encoded these unusual terms in its stable API but we can at least use more common terminology and document what these things actually are. Virutally every word in the explaination "a full file path [is] a site url and relative file path", meant something different from its usual meaning, namely the full URL to an entry point script under /w/. Change-Id: I15f1c9d56f61e622734bb3ddc304025ad4bfc169
* site: Annotate CachingSiteStore as `@internal` and perform minor cleanupTimo Tijhof2022-11-051-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | * Recognise CachingSiteStore as the internal class that it is. * Clean up the file header and move ingroup annotation, similar to other commits under <https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle>. The one here was particularly odd as it placed the license inside the class doc block rather than the file doc block. * Remove unused $cacheKey and $cacheTimeout constructor args. They were also not covered by any unit tests. * Avoid use of `empty()` as per <https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP> * Use a more conventional cache key in CachingSiteStore, keeping the dynamic part for a later segment and keeping the first segment explicitly tied to a single concrete key group. This also improves ergonomics of cache statistics e.g. in Grafana and makes the cache key easier to locate in codesearch/grep, and more recognisable, e.g. starting with the code component ("site"). Change-Id: I541ad62551ab76127d70ef665272fd1d590ab556
* Fix Site::getPath() + MediaWikiSite::getFileUrl() confusionLucas Werkmeister2022-11-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Site::getPath() has returned null since change I08ffa6a970 (commit a00337c3f8), almost ten years ago; I think on the whole it’s safer to fix the prose documentation and keep the @return and actual returned value as they are, rather than the other way around. MediaWikiSite::getPageUrl() compared the $filePath to false instead of null, so the comparison would always be true; but on closer inspection, I think this code was supposed to check $path, not $filePath, in the first place. The only reason this didn’t come up so far is that all known callers pass in a custom path (specifically, all non-test callers pass in 'api.php'), so the $path = false default was never used. To avoid a deprecation warning in PHP 8.1 when passing a null $filePath into str_replace(), throw in that case instead – the function isn’t documented to return string|null, and none of the callers seem prepared to handle a null return as far as I can tell, so throwing seems better than returning null. Tests that produce a null $filePath need to be fixed to complete the Site object (compare Wikibase change If20688411e). Bug: T319219 Change-Id: I5ed7e169c9753486c765fd816d1b21016c5c1def Depends-On: If20688411e3f0108b0c0ba3b91e5cc264b70a208
* Make following redirects in MediaWikiPageNameNormalizer optionalAmir Sarabadani2021-07-271-4/+9
| | | | | | | | If you want to normalize a page title without following the redirect, you basically have to re-invent the wheel. Let's DRY it this way. Bug: T278962 Change-Id: I61080ff0f35199784f4629f61272fb27bac787aa
* Fix more PSR12.Properties.ConstantVisibility.NotFoundReedy2020-05-151-2/+2
| | | | Change-Id: I0ccda3d1de29b1044f74ef0972949eb8fbcb707d
* Add flag to force local page name normalization in development envItamar Givon2020-02-181-1/+1
| | | | Change-Id: I5138f6043effab813aacb7b0b408428d3e21d23d
* site: Make getPageUrl consistently return nullDaimona Eaytoy2019-09-171-3/+3
| | | | | | | | This was pointed out in Ia8443e575c22f47a6d8c63038f4e7ac36815fc27. The method checks if $url is false, but that's never the case because getLinkPath returns string|null. Change-Id: I7850bff928f861d796879301ba0b4e575919407e
* Update docblocks for methods potentially returning nullDaimona Eaytoy2019-09-151-1/+1
| | | | | | | | | These were discovered by setting `null_casts_as_any_type` to true in phan, and filtering by `PhanTypeMismatchReturnNullable`. Of course there are others, some of which are false positives, but we cannot suppress them now (or the UnusedSuppressionPlugin will complain). Change-Id: Ia8443e575c22f47a6d8c63038f4e7ac36815fc27
* Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag errorsKunal Mehta2018-05-231-1/+1
| | | | Change-Id: I936c3f5fca1a0061f215e80469f5d882cb32ee29
* Improve normalizePageName documentationLucas Werkmeister2018-04-111-1/+4
| | | | | | | | | Even though it wasn’t documented in the interface, MediaWikiPageNameNormalizer::normalizePageName returns false for pages that do not exist on the remote site. Too many users already depend on this feature to remove it, so at least document it properly. Change-Id: Ic2ba86b81bba86b868a6697aa57fdd46432c0d7d
* Fix (MediaWiki)Site::normalizePageName return typeThiemo Kreuz2018-04-081-2/+2
| | | | | | | | | I checked all callers of these methods and almost all of them expect the method to return false. It looks like this return type was known at some point, but got lost. Let's add it back. Bug: T191634 Change-Id: I43484835b8f26e07ada6a2b1452a99ccc6d9b438
* Remove auto-generated "Constructor" documentation on constructorsThiemo Mättig2017-07-101-2/+0
| | | | | | | | Having such comments is worse than not having them. They add zero information. But you must read the text to understand there is nothing you don't already know from the class and the method name. Change-Id: I994d11e05f202b880390723e148d79c72cca29f0
* Remove MediaWikiSite::newFromGlobalId (deprecated since 1.21)Florian2016-04-011-14/+0
| | | | | | | Isn't used anymore anywhere. Bug: T122754 Change-Id: I95b20c005721837dcbf9ab979674ac09c460cdd0
* Factor page name normalization out of MediaWikiSiteMarius Hoch2016-01-041-136/+10
| | | | | | | | | Into a new MediaWikiPageNameNormalizer. The code has been copied over almost 1:1, I only left the phpunit test special handling in MediaWiki site. Change-Id: I008cadd29a2aa1f21098339b895c35a100959b04
* build: Update mediawiki/mediawiki-codesniffer to 0.5.1Paladox2016-01-021-3/+2
| | | | | | | | | Two rules are ignored for now to allow us to upgrade: * MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures * Generic.ControlStructures.InlineControlStructure.NotAllowed Also ignore the .git folder. Change-Id: I1b149c72b27be54e22e369999ad0c41c2d1fc2b4
* Some bugzilla.wikimedia.org -> phabricator.wikimedia.org changesumherirrender2015-09-241-2/+2
| | | | | | | | Changed some old bugzilla links to new phabricator links in comments, test data and error message. This reduces the need for redirects from old bugzilla to new phabricator from our source code. Change-Id: Id98278e26ce31656295a23f3cadb536859c4caa5
* Use wikimedia/utfnormal library, add backwards-compatability layerKunal Mehta2015-03-241-1/+1
| | | | | | | | This drops support for the custom utf8 normal PHP extension in favor of the intl extension. Bug: T90825 Change-Id: Ifbaeb2ef684217cf6187ccc4fb4d303f89608300
* Profile all external HTTP requests from MWChad Horohoe2015-03-031-1/+1
| | | | Change-Id: Ie980b080da2ef21ec7d9fc32f1accc55710de140
* Fixed spacingumherirrender2014-07-201-1/+1
| | | | | | | | | | - use tab as indent instead of spaces - Added space after closures "function" - Added spaces around string_concat - Added newline inside empty blocks - Removed four spaces after comma Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
* Pass phpcs-strict on includes/site/Siebrand Mazeland2014-05-091-12/+16
| | | | Change-Id: Ibc3f29e21dd5bcfd5ea641a58f8d3f641948741d
* Merge "Add 'since <version>' to @deprecated annotations"jenkins-bot2014-04-221-1/+1
|\
| * Add 'since <version>' to @deprecated annotationsBartosz Dziewoński2014-04-151-1/+1
| | | | | | | | Change-Id: Ief96d55aa95f657a38a62ae3dde1ef7a415ff675
* | Fixed some @params documentation (includes/*)umherirrender2014-04-191-6/+6
|/ | | | | | | | | 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: Iced714bca004756b461b66067a49a925a7e3b877
* docs: Remove odd colons after @todoTimo Tijhof2013-05-151-2/+2
| | | | | | | | | | Most were this way already: https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html Ran a find/replace on the odd ones. Also made them all lower case. Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
* Get rid of wfScript in MediaWikiSite::normalizePageNameTobias Gritschacher2013-04-151-1/+1
| | | | | | | wfScript should not be used to construct URLs for calls to other wikis Bug: 47242 Change-Id: Id5aaa58f10d513e082b217aeb8d88b8228341a48
* Use wfAppendQuery to append a queryumherirrender2013-04-121-1/+1
| | | | | | | | Also pass a array to wfAppendQuery, which than does the urlencoding. Prefer a wfScript() over the global or string Change-Id: Icada534cb4c99c9441938a2e8dcbc11a142360c6
* fix some spacingumherirrender2013-03-251-1/+1
| | | | | | | | | | | * Removed spaces around array index * Removed double spaces or added spaces to begin or end of function calls, method signature, conditions or foreachs * Added braces to one-line ifs * Changed multi line conditions to one line conditions * Realigned some arrays Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
* Fixed @param tags to conform with Doxygen format.Tyler Anthony Romeo2013-03-111-1/+1
| | | | | | | | | | | Doxygen expects parameter types to come before the parameter name in @param tags. Used a quick regex to switch everything around where possible. This only fixes cases where a primitve variable (or a primitive followed by other types) is the variable type. Other cases will need to be fixed manually. Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
* fix some spacingumherirrender2013-03-071-1/+0
| | | | | | | | Added/removed spaces around logical/arithmetic operator Reduced multiple empty lines to one empty line Removed wrong tabs before comments at end of line Removed too many spaces in assigments Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
* Use American English spelling for behaviorSiebrand Mazeland2013-03-041-1/+1
| | | | | | Spotted in ipbreason-dropdown by Shirayuki. Change-Id: I576ed4bc0abe5ab980aaee3fb9f9e4b43087311f
* remove space before semicolonumherirrender2013-02-091-1/+1
| | | | Change-Id: Ic0d890f5e27cec017c7f7910a67d53b2edf82079
* Design improvements to sites codejeroendedauw2013-01-221-10/+21
| | | | Change-Id: I08ffa6a97093abbe85169f664b97498c5f39bf8e
* Follow-up I214a988e (42a8daa): move documentation to the correct blockAlexandre Emsenhuber2012-11-191-5/+5
| | | | | | These lines belongs to the whole file, not only to that class. Change-Id: Ib61eae1e8f7d50d29a929c6034ede08a851105c9
* (bug 26280) all files should have GPL headerAntoine Musso2012-11-181-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MediaWiki is licensed under GPL so we should really add the header to our PHP code unless reusing code licensed differently. Tested using: ack-grep --php -L 'This program is free software' \ includes/ maintenance/ mw-config/ resources/ skins/ Output the following files: includes/ExternalEdit.php (public domain) Various other licenses: includes/json/Services_JSON.php includes/libs/CSSMin.php includes/libs/IEContentAnalyzer.php includes/libs/JavaScriptMinifier.php includes/libs/jsminplus.php includes/normal/Utf8Case.php includes/objectcache/MemcachedClient.php File autogenerated from a GPL file and Unicode data: includes/ZhConversion.php A few lines coming from stack overflow: maintenance/mwdoc-filter.php Message files do not have any license :-/ Change-Id: I214a988edfa9e2dfcc762612a0f7d47eee8bcb74
* rm unused $egWBRemoteTitleNormalization var from MediaWikiSite.phpaude2012-10-261-4/+2
| | | | Change-Id: I8151b79f97ac7fea547a974ad64d404ff881a2e2
* miscellaneous doxygen warningsAntoine Musso2012-10-221-2/+2
| | | | | | | | | | | | | * @licence -> @license * Protects inline HTML by using double quotes, our inline comments uses elements such as <h1> or <firstnameLastname@gmail.com> * Commands in lowercase (@TODO -> @todo, @NOTE -> @note) * removes @abstract and @static since doxygen detects them from PHP code. * various undocumented function parameters * typos in parameters declarations Change-Id: I62ad6fc124c355bf31acc780b9614a59cf79a421
* (Bug 40652) Reject invalid titles as sitelinksjeblad2012-10-161-1/+6
| | | | | | | | | | Titles are usually reported as "missing" if they are not found, but if the title contains invalid characters the title is reported as "invalid". This changeset will make the page name normalization also check if the "invalid" marker is set. Change-Id: I86d432e8ea00c97891fb7849468caac6120252c6
* Update @since tags from 1.20 to 1.21jeroendedauw2012-10-121-12/+12
| | | | Change-Id: Iea7bad4367782ee8baa676921625b44dc2b7c45f
* Added sites functionality, a much more generic and flexible version of the ↵jeroendedauw2012-10-121-0/+320
existing interwiki code This code is meant to replace the current interwiki code, but does not do so just yet. It is however used by the Wikibase extension. This allows us to try out some more things and have the code stabilize more before we migrate over existing interwiki functionality. Change-Id: I23c47c2c3909a1500350fb560a5f2ec654e2c37e