aboutsummaryrefslogtreecommitdiffstats
path: root/includes/site
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor global variables to use MediaWikiServices insteadTChin2022-01-101-3/+3
| | | | | | | | | | | | Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI. Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228 * This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it. A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
* Use getWithSetCallback() instead of get() + set()Daimona Eaytoy2021-11-181-7/+5
| | | | | | | 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
* Various updates and fixes to PHPDoc documentationThiemo Kreuz2021-08-091-2/+2
| | | | | | | Some minor updates I collected in my local dev environment the past months. Change-Id: I30d5339bc262d54ba76e2860a3a3e9e5f002fdc3
* Merge "Make following redirects in MediaWikiPageNameNormalizer optional"jenkins-bot2021-07-273-9/+34
|\
| * Make following redirects in MediaWikiPageNameNormalizer optionalAmir Sarabadani2021-07-273-9/+34
| | | | | | | | | | | | | | | | 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
* | Remove some more comments that literally repeat the codeThiemo Kreuz2021-06-181-3/+3
|/ | | | | | | | | | | | | … including PHPDoc tags like `@return <type> $variableName`. A return value doesn't have a variable name. I can see that some people do this intentionally, repeating the variable name that was used in the final `return $var;` at the end of a method. This can indeed be helpful. I leave a lot of these untouched and removed them only when it's obviously wrong, or does not provide any additional information in addition to what the code already says. Change-Id: Ia18cd9f25ef658b08ad25b97a744897e2a8deffc
* Use null coalecing operators everywhere consistenctly.Petr Pchelko2021-06-031-1/+1
| | | | | | Auto-generated with rector. Change-Id: I4f27e10cf029bb067b7bc57d82f7a64e21ea8d42
* Replace uses of DB_MASTER with DB_PRIMARYJames D. Forrester2021-04-291-2/+2
| | | | | | Just an auto-replace from codesniffer for now. Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
* Merge "Use static closures where safe to use"jenkins-bot2021-02-141-1/+1
|\
| * Use static closures where safe to useUmherirrender2021-02-111-1/+1
| | | | | | | | | | | | | | | | | | This is micro-optimization of closure code to avoid binding the closure to $this where it is not needed. Created by I25a17fb22b6b669e817317a0f45051ae9c608208 Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
* | Use ?? instead of isset/array_key_exists where possibleThiemo Kreuz2021-02-101-1/+1
|/ | | | | | | | | | | This patch touches all uncontroversial (I hope) places where a chain of isset(), array_key_exist() and the ternary ?: operator can be replaced with the much shorter ?? feature from PHP 7. ?? does the same. It checks if the element before the ?? is set and not null. When this check fails, the element after the ?? is used. Change-Id: Id612e2782ae928164b26b6f0de676c6c7d8302f3
* Revert "Wrap libxml_disable_entity_loader() calls in version constraint"Reedy2021-01-271-9/+3
| | | | | | | | | This reverts commit a4c69bde130c6109086d555492adc1378b1ca29b. Reason for revert: Needs a bit more thinking about Bug: T268847 Change-Id: I82a7bb2a4ef15adc65717d5ba173c8f3cfb0644c
* Wrap libxml_disable_entity_loader() calls in version constraintReedy2021-01-271-3/+9
| | | | | Bug: T268847 Change-Id: I56684ce7b39aaebe1ae76811b833bc9183bc359b
* Explicitly wrap some XML calls in libxml_disable_entity_loader()Reedy2020-09-201-0/+3
| | | | | | | | | | | | | | | | | | As per https://www.php.net/manual/en/function.libxml-disable-entity-loader.php this is technically unnecessary. >However, as of libxml 2.9.0 entity substitution is disabled by default, >so there is no need to disable the loading of external entities. See also https://github.com/php/php-src/pull/5867 >Since the release of libxml 2.9.0 in 2012 external entity loading is >disabled in libxml by default. This means that using >libxml_disable_entity_loader() is no longer needed. Hopefully helps prevent false positive reports from security scanning tools. Change-Id: I8a09d62a9920fd0bf4a388baa5544a02323bb541
* Fix more PSR12.Properties.ConstantVisibility.NotFoundReedy2020-05-153-11/+11
| | | | Change-Id: I0ccda3d1de29b1044f74ef0972949eb8fbcb707d
* Add flag to force local page name normalization in development envItamar Givon2020-02-181-1/+1
| | | | Change-Id: I5138f6043effab813aacb7b0b408428d3e21d23d
* Miscellaneous documentation updatesDannyS7122020-02-162-2/+2
| | | | | | | Update references from .txt to .md when files have moved, a few other tweaks, no changes to code. Change-Id: I0bfd38c47b9fb0fc11ae98a0a674af66fb4c5a84
* Remove usages of deprecated Language methodsPetr Pchelko2020-02-161-1/+7
| | | | Change-Id: Iad3375b141b1d87c890baec6ecd16ed92f93e699
* Remove `FileBasedSiteLookup` class, deprecated and unusedDannyS7122020-01-031-136/+0
| | | | | Bug: T241356 Change-Id: I252904b6b4c31a0ac42cbfbe7875a23c727150c1
* Merge "site: Make getPageUrl consistently return null"jenkins-bot2019-09-232-7/+7
|\
| * site: Make getPageUrl consistently return nullDaimona Eaytoy2019-09-172-7/+7
| | | | | | | | | | | | | | | | 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
* | phan: Enable PhanTypeMismatchArgument issueUmherirrender2019-09-191-0/+2
|/ | | | | | Bug: T231636 Depends-On: I5de4f8f32a47c3f41c990ffe2ebd091fc23d1a58 Change-Id: I34d65fe3ff1916f2af675f0b1f19641b0cdfadc0
* Update docblocks for methods potentially returning nullDaimona Eaytoy2019-09-152-2/+2
| | | | | | | | | 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
* Unsuppress more phan issues (part 3)Daimona Eaytoy2019-08-311-1/+1
| | | | | | Bug: T231636 Depends-On: I78354bf5f0c831108c8f606e50c87cf6bc00d8bd Change-Id: I58e67c2b38389df874438deada4239510d21654f
* Switch various LoadBalancer::getConnection() callers to getConnectionRef()Aaron Schulz2019-07-121-3/+3
| | | | | | | This is the preferred method as it enforces read-only mode for DB_REPLICA and handles LoadBalancer::reuseConnection() calls automatically. Change-Id: Iab9439ba8e0810fa14c302661ed7a3534f6bfc0d
* Fix types around ILoadBalancer and IResultWrapperUmherirrender2019-07-041-4/+4
| | | | Change-Id: I08531ccc6db046114f3535cfe6c108936dfff0d0
* Remove wgSitesCacheFile and rebuildSitesCache.php (unused)Timo Tijhof2019-03-152-119/+3
| | | | | | | | | | | | | | | | | | | | | This seems to have been intended as optimization for SiteStore, but was never used as far as I can tell. Instead, SiteStore is already cached via LocalServerCache (APC). Keep the FileBasedSiteLookup class for one release cycle in case third parties not indexed by MediaWiki Codesearch are using it. == History * 2013: Report of high memcached usage by Wikibase via SiteStore. * 2014: Lazy-load the data in Wikibase (d3f2e99cb6). * 2014: Implement the file-based cache (via T47532 and 90f6efc360fd5). * 2015: Use local-server cache (APC), per T58602. The file-based code was never used. The related task marked invalid (T47532). Change-Id: I8e2d9edcf3880149f824cc3de37793ca57435b49
* Site: Explicit allow setLanguageCode( null )Fomafix2019-03-121-2/+2
| | | | | | | | | | | $site->setLanguageCode( null ) is already used in DBSiteStore::loadSites and this worked because Language::isValidCode( null ) === true. This change explicit check for null and allow to set null without depending on Language::isValidCode( null ) === true. Change-Id: I0c9fe03cbf1434b0340e61e96360c0aaeb0fe89d
* Drop SiteSQLStore, deprecated in 1.27, unusedJames D. Forrester2019-02-081-61/+0
| | | | Change-Id: I6743417c3aafbba59ac02350e0190fbf688a5a40
* Hard deprecated SiteSQLStore::newInstance()Max Semenik2018-12-081-0/+1
| | | | | | Deprecated in 1.27, no callers. Change-Id: Ia262790cc6804b29fee656d0f53be1374bf04c2f
* Use PHP 7 '??' operator instead of if-then-elseFomafix2018-10-211-5/+1
| | | | Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
* Update composer/spdx-licenses to 1.4.0 and mediawiki/mediawiki-codesniffer ↵Reedy2018-07-261-1/+1
| | | | | | | | to 21.0.0 https://github.com/composer/spdx-licenses/compare/1.3.0...1.4.0 Change-Id: I39f7a1310455159866bfed5224536e800befec0d
* Merge "Simplify PHP by using ?? and ?:"jenkins-bot2018-07-111-1/+1
|\
| * Simplify PHP by using ?? and ?:Fomafix2018-07-101-1/+1
| | | | | | | | | | | | Also remove not necessary surrounding parentheses. Change-Id: I0eb5c9c1bdfb09a800258379cdcefb5fd4d3d21c
* | Fix PhanTypeMismatchDeclaredParamUmherirrender2018-07-071-1/+1
|/ | | | | | Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
* Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag errorsKunal Mehta2018-05-2313-13/+13
| | | | Change-Id: I936c3f5fca1a0061f215e80469f5d882cb32ee29
* Improve normalizePageName documentationLucas Werkmeister2018-04-113-4/+12
| | | | | | | | | 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-083-5/+5
| | | | | | | | | 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
* Use ::class to resolve class names in includes filesUmherirrender2018-01-271-1/+1
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
* Improve some parameter docsUmherirrender2017-09-101-0/+1
| | | | | | Add missing @return and @param to function docs and fixed some @param Change-Id: I810727961057cfdcc274428b239af5975c57468d
* Remove reference to deprecated IDatabase->nextSequenceValue()Brad Jorsch2017-09-011-2/+0
| | | | | | The method was deprecated and made unnecessary in Ib308190c. Change-Id: I1729ac0b3a88270a4c2f064187a2472112aaeb1e
* Merge "Add missing type to @param documentation"jenkins-bot2017-08-111-1/+1
|\
| * Add missing type to @param documentationUmherirrender2017-08-111-1/+1
| | | | | | | | Change-Id: I6b2c9c7af9a281fe457099cc3a336a60a25e74aa
* | update mediawiki-codesniffer to 0.11.0 and fix issuesWMDE-Fisch2017-08-111-1/+1
|/ | | | | | | | - mostly auto fixes - some too long lines fixed - ignore amp space in one case passing by reference Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
* Remove auto-generated "Constructor" documentation on constructorsThiemo Mättig2017-07-102-4/+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 empty lines at begin of function, if, foreach, switchUmherirrender2017-07-011-1/+0
| | | | | | Organize phpcs.xml a bit Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
* CachingSiteStore: Avoid deprecated wfMemcKey()Kunal Mehta2017-05-251-1/+1
| | | | Change-Id: I123b29dd41c6e0f020e0fcc661813addbec92b27
* Add maintenance script to add sites to sites tableFlorian2017-02-261-0/+3
| | | | | | | Also: Add language code validation to Site::setLanguageCode(). Bug: T132937 Change-Id: I763ec65cb06d5250a3886a66eefdde8701b2299c
* Move remaining LoadBalancer classes to RdbmsAaron Schulz2017-02-231-0/+2
| | | | | | The old names are left as aliases. Change-Id: I52a327f2463a2ba7437324047b5b00d28cd1d758
* Add more specific Site[] type hints to SiteStore classesThiemo Mättig2017-01-111-1/+1
| | | | Change-Id: Ie52313861972fd1b269375dfc8f94afdf67bcb9f