aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Title.php
Commit message (Collapse)AuthorAgeFilesLines
* title: Move Title.php to includes/title/ where related classes areTimo Tijhof2022-11-091-4243/+0
| | | | | | | | | Also silence a random Phan false-positive that for some reason wasn't discoverable until now. Bug: T321882 Bug: T166010 Change-Id: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a
* Various doc fixes about false and null on method arguments/return typesUmherirrender2022-11-031-1/+1
| | | | | | Doc-only changes Change-Id: Ice974b3ba41708859dfe646e94b31c5ebbf26410
* Remove Title::getNotificationTimestampMatěj Suchánek2022-11-011-15/+0
| | | | | | It has been deprecated since 1.35 and it is unused. Change-Id: I2e17ac38c62327477fe22c9b8af1613084cc3133
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-281-0/+1
| | | | | | | | | | | | | | | Redoing I5ea70120d74 but without moving WebRequest that caused issues with phan-taint-plugin. Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequestUpload Bug: T321882 Change-Id: I832b133aaf61ee9f6190b0227d2f3de99bd1717b
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-271-1/+0
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-261-0/+1
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* Reorg: Move StubObject classes in includes to its own directoryAmir Sarabadani2022-10-251-0/+1
| | | | | Bug: T166010 Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
* Use short array destructuring instead of list()Tim Starling2022-10-211-1/+1
| | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* title: Fix 'if' typo in Title::getWikiId docsTimo Tijhof2022-10-131-1/+1
| | | | Change-Id: Ie3d23c1cdf8384e87f47cea6d77fcd20b663df1d
* build: Update mediawiki/mediawiki-phan-config to 0.12.0Daimona Eaytoy2022-10-081-4/+1
| | | | | | | | This patch only adds and removes suppressions, which must be done in the same patch as the version bump. Bug: T298571 Change-Id: I4044d4d9ce82b3dae7ba0af85bf04f22cb1dd347
* Restore negative response cache in getDbPageLanguageCodeFomafix2022-09-061-1/+1
| | | | | | | | | | A null in $this->mDbPageLanguage indicates that there is no value in the database and a further query is not needed. This function was lost in fd3a6952303 but still documented in variable private $mDbPageLanguage. Change-Id: I4d4d9fd0052661bd29885f082b467ed4a0255032
* Update documentation of Title::getDbPageLanguageCodeFomafix2022-09-011-2/+2
| | | | | | The return value was changed from false to null in fd3a6952303. Change-Id: Ic0161d46e8f924ef517891e30137d9f4d535a410
* docs: Clarify that functions returning namespace names include underscores ↵Bartosz Dziewoński2022-08-301-3/+3
| | | | | | | (not spaces) Bug: T316092 Change-Id: I380e529590033e5d34adc37d21e8607feb4fab19
* Title: Add support for links migration in Title::getLinksTo()Amir Sarabadani2022-08-091-9/+17
| | | | | | | | This is only used in action=info and behind misermode so it never breaks in Wikimedia production but it should be fixed before the 1.39 branch cut. Change-Id: Icf8e20ee551c24b918a051e712a88770f447e0e3
* Use canonical parser options when rendering JavaScript/CSS for side effectsC. Scott Ananian2022-07-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the JavaScript and CSS content handlers we render the page "as wikitext" solely to generate categories, toc, etc, and then throw that output away and replace the generated HTML. Simplify the code paths and the caching by using the canonical options which don't split by user language, etc. Three minor issues with the current patch, which can hopefully be addressed in follow ups: 1. WikiPage::makeParserOptionsFromTitleAndModel() has a very cumbersome name and arguably doesn't belong in WikiPage in the first place. T313455 already exists to find a better place for this/way to do this. 2. Title::isConversionTable() requires a downcast of the page reference to a full title object. This method also probably wants to live somewhere else. 3. It really would be nice to combine this more properly with ContentHandler::getParserOutputForIndexing(), but that method uses a ParserOutputAccess object which requires a PageRecord, and we don't have a PageRecord available in fillParserOutput(). Bug: T307691 Change-Id: I081105741b507ed49e19cb878550ba4293e09413
* Hard deprecate Title::getNotificationTimestampMatěj Suchánek2022-06-251-1/+2
| | | | | | It has been deprecated in 1.35 and is unused in Wikimedia code. Change-Id: I48d2d318976afbb52c09abdc2fcb116da2626fee
* Replace deprecated wfReadOnly/wfReadOnlyReasonUmherirrender2022-06-201-2/+2
| | | | | Bug: T283978 Change-Id: I49f8c7bf1162dc834a1708e2e581f6fb264bbd0a
* Remove Title::isNamespaceProtectedMatěj Suchánek2022-06-161-24/+0
| | | | | | It has been deprecated since 1.34 and it is unused. Change-Id: I3f375a8d3aceb3e31c27532c28b190c41e628edf
* ResourceLoader namespace (attempt 2)Tim Starling2022-05-241-3/+4
| | | | | | | | | | | | | | | | | | Move ResourceLoader classes to their own namespace. Strip the "ResourceLoader" prefix from all except ResourceLoader itself. Move the tests by analogy. I used a namespace alias "RL" in some callers since RL\Module is less ambiguous at the call site than just "Module". I did not address DependencyStore which continues to have a non-standard location and namespace. Revert of a241d83e0a6dabedf. Bug: T308718 Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
* Revert "ResourceLoader namespace"Lucas Werkmeister (WMDE)2022-05-161-3/+2
| | | | | | | | | | | | This reverts commit e08ea8ccb9932f9924a613056afcb2d01c8c7b39. Reason for revert: Breaks Phan in extensions, and as far as I’m aware, this change isn’t urgently needed for anything, so the simplest fix is to revert it again for now. After PHP 7.4 it should be safer to try this again (we hopefully won’t need the two “hack” classes by then). Bug: T308443 Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
* ResourceLoader namespaceTim Starling2022-05-161-2/+3
| | | | | | | | | | | | | | | | Move ResourceLoader classes to their own namespace. Strip the "ResourceLoader" prefix from all except ResourceLoader and ResourceLoaderContext. Move the tests by analogy. I used a namespace alias "RL" in some callers since RL\Module is less ambiguous at the call site than just "Module". I did not address DependencyStore which continues to have a non-standard location and namespace. Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
* Merge "Remove references to legacy page_restrictions field in page table"jenkins-bot2022-05-101-19/+4
|\
| * Remove references to legacy page_restrictions field in page tableAmir Sarabadani2022-05-091-19/+4
| | | | | | | | | | Bug: T218446 Change-Id: I4d45de0890b96e00d4b24fc96ceffbf336928bc2
* | Fix many typos in commentsMatěj Suchánek2022-05-101-2/+2
| | | | | | | | | | | | Found using IntelliJ's "Typo" code inspection. Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
* | Title: Hard deprecate `Title::newFromTitleValue()`Derick Alangi2022-05-091-1/+3
|/ | | | | | | | | | | | | | | | I've updated callers to the deprecated code to use the new method and we can completely remove the deprecated code in mw 1.40 The deprecated method delegated to `::newFromLinkTarget()` which is it's direct replacement, so that should be used instead. Depends-On: If799d6a1e722ca80f50b0f12c9b1c9f31a40a860 Depends-On: I276845ccf39ac7a65fca8ba268abbe1e02607a4b Depends-On: I5d7213e9bcd84f5b674136d2d8b13577cbeead83 Depends-On: Idd222cc5ea94ee1215ab6d4c9e06d79c0a95d6aa Change-Id: Ibc723aa30a2282222248669c3c195ecb7dfb2423
* Title: Hard deprecate `Title::getSelectFields()`Derick Alangi2022-04-271-2/+6
| | | | | | Update consumer code to use the new PageStore interface. Change-Id: I050b282d00012baf1c0dc25f1f5af6837d469e93
* Make Title::toPageIdentity use getWikiId()Daimona Eaytoy2022-04-231-1/+1
| | | | | | | | This is currently a noop, but I assume that the behaviour could change in the future. Bug: T306712 Change-Id: I8a8af3d5a8b05edc5e2750d045f87cd51bf23086
* Add more support for read new in links migrationAmir Sarabadani2022-04-121-6/+18
| | | | | | | | | - In Info action and its API counter part - In LinkBatch::constructSet - In Title::getLinksFrom Bug: T304780 Change-Id: I449f041986acdd16feecac818e3579987b4b11be
* Use name constants to access config settings.daniel2022-04-071-6/+7
| | | | | | | | | | | Use name constants instead of string literals in calls to Config::get and ServiceOptions::get, when referring to core configuration variables. This protects against typos and makes the decumentation and schema declaration of the config settings discoverable. This is the first batch, only touching files directly under /includes/ Change-Id: I7252e636c7c86d950d9257b33491af492c6dd5eb
* SECURITY: Add recursion guard to Title::newMainPage()Kunal Mehta2022-03-311-0/+9
| | | | | | | | | | | | | If the on-wiki "mainpage" message is a bare local interwiki (`localiw:`), MediaWiki will try to normalize it to the main page, causing an infinite recursive loop. Once in this state, there's no way to fix it short of editing the database (or applying this patch). The easiest way out of this is to add a recursion guard to fall back to the hardcoded "Main Page" default. Bug: T297571 Change-Id: I91316ecbdbe7c4ad1b7594643aef29a8e1f8fb26
* phan: Remove PhanPossiblyUndeclaredVariable suppressionUmherirrender2022-03-301-0/+2
| | | | | | | | | Make phan stricter about conditional variable declaration Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T259172 Change-Id: I1f200ac37df7448453688bf464a8250c97313e5d
* Replace Title::mDefaultNamespace with a constantDaimona Eaytoy2022-03-261-8/+5
| | | | | | | After Id44bdac0de1fbd9f7feccf27664e9b1cea2abd85, it can be immutable. Bug: T247190 Change-Id: I6ea6cf700fa82d2f758cfed9e270f8cbf6d800dc
* Title: Remove deprecated Title::getDefaultNamespaceTimo Tijhof2022-03-251-11/+0
| | | | | | | | | Follows-up Id8296ca28518a54 (afb44d34db673a1). This is motivated by the TitleFactory refactor (T247190). Bug: T247190 Change-Id: Id44bdac0de1fbd9f7feccf27664e9b1cea2abd85
* Merge "title: Cleanup use of DepreationHelper::deprecatePublicPropertyFallback"jenkins-bot2022-03-251-17/+7
|\
| * title: Cleanup use of DepreationHelper::deprecatePublicPropertyFallbackUmherirrender2022-03-151-17/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The fallback function is not needed when the property exists and there is nothing special in the getter/setter functions. The DeprecationHelper is using $this->$name which works for private properties from within __get/__set Going back to 1.37 for the deprecation warning (I761de85ae5a839e8a695b85ce0fd7200b498da22) Follow-Up: Ifb78d5f310fe45db58fd450c9db3c7af295ae399 Change-Id: I9a6259b1a1d4d7d7e0d390605b659bcb009059ea
* | phan: Disable null_casts_as_any_type settingUmherirrender2022-03-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | Make phan stricter about null types by setting null_casts_as_any_type to false (the default in mediawiki-phan-config) Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T242536 Bug: T301991 Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
* | phan: Disable scalar_implicit_cast settingUmherirrender2022-03-181-0/+1
| | | | | | | | | | | | | | | | | | Make phan stricter about scalar types by setting scalar_implicit_cast to false (the default in mediawiki-phan-config) Bug: T242536 Bug: T301991 Change-Id: Ia2fe30b17804186571722e728578121c8b75d455
* | Fix @since of Title::getId()Alexander Vorwerk2022-03-151-1/+1
|/ | | | | | | Follow-Up: Iaed4871e0d32c67d4fb13e487625527f6a21e9c5 Bug: T303871 Change-Id: I37e7711c01ec7844476872af08d7d57b339512cf
* Merge "title: Restore boolean false Title::getTouched() for nonexistent page"jenkins-bot2022-03-091-2/+6
|\
| * title: Restore boolean false Title::getTouched() for nonexistent pagedaniel2022-03-091-2/+6
| | | | | | | | | | | | | | | | | | Feeding the return value of the DB query through timstamp conversion made it so that false was turned into the current timestamp, causing confusion and cache churn. Bug: T298520 Change-Id: I6e10b21f6b0e40ce7e3403ffc9a41a307e945354
* | Consistently use `@deprecated since` rather `@deprecated`Reedy2022-03-061-2/+2
|/ | | | Change-Id: I301786f35cd6eb9c63fb72e0b64cffa9efd7b86b
* Fix various documentation related to null typesUmherirrender2022-02-261-1/+1
| | | | | | | | The functions returning null or the class property is set explict null Found by phan strict checks Change-Id: I4a271093fb6526564d8083a08249c64cb21f2453
* Title: Optimize invoking newFromText() with empty stringAmmarpad2022-02-091-1/+1
| | | | | | | | | | | Title::newFromText with empty string will always yields null. But the decision to return null is only made after applying various normalization and filtering routines, which will eventually have zero effect on the return value. So we may just return the null early as we do with null itself. Change-Id: Ic277a6e8c8c0b2a0b6af78f6524b80574c4602af
* Optimise Skin::getLanguages()Tim Starling2022-02-081-4/+9
| | | | | | | | | | | | | | | | | | | | 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
* Title: Set context page for `{{PAGENAME}}` etc. in getEditNotices()Bartosz Dziewoński2022-02-021-3/+3
| | | | | | | | | | | | | | The main call to Title::getEditNotices is in EditPage, where the global title used by the message parser is correct. In other Action like DeleteAction this would also be correct. However, when called in API context (eg. ApiVisualEditor), or from a special page that acts as a page action (such as Special:EditMassMessageList or Special:Undelete) then the global title is wrong (somewhat akin to wgPageName vs wgRelevantPageName). Bug: T300184 Change-Id: I242e042317a1e16c8d51edbf7800c8b7d70d468e
* Replace deprecated JobQueueGroup::singleton()Umherirrender2022-01-271-1/+1
| | | | Change-Id: Icdb301d352d302f70fefba9b40df2368cb217fd2
* title: Remove dated comment about inNamespace(), overall doc cleanupTimo Tijhof2022-01-181-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * The Title::inNamespace() method discouraged use of getNamespace() for comparison. This was added 10 years ago in r103893 (commit 3414e91bae), however no such "change" has been made, and the new LinkTarget stable interface and TitleValue class contains the same getNamespace() method, and no warning against its use. My main reason for removing this comment is so that avoid fear against using `in_array()` with TitleValue->getNamespace() which this comment seems to discourage. While Title has plural inNamespaces(), TitleValue does not. This seems fine, as one can simply use in_array for more complex use cases where a range or list is compared against. * Fix Doxygen warnings about invalid or unsupported XML tags such as `<a>`, `<siteinfo>` etc. Rephase or use backtics,. * Fix useless IDE tooltips and Doxygen output by removing empty stubs from method overrides that add no new information, yet obscured the otherwise inherited parent destination which does have useful information. * Clarify that `renderForComment` must not be mixed with other ones. This seems to be how it is intended. Upon realizing that, I think this is unreasonable and should perhaps be removed. For now, I've documented the hack that it seems to exist for. * Consistently use imperative mood when phrasing method docs, and consistently use a brief first line description, and consistently separate it from other paragraphs and annotations with one line break. Change-Id: I7e1819a5d7124c635de84bc64d2371a122195928
* DeprecationHelper: avoid closuresdaniel2021-12-101-37/+19
| | | | | | | | The cost of creating closures adds up, so avoid it if we can be using method names instead. Bug: T297236 Change-Id: Ifb78d5f310fe45db58fd450c9db3c7af295ae399
* Merge "Hard deprecate TitleFactory::newFromIDs and Title::newFromIDs"jenkins-bot2021-11-291-0/+3
|\
| * Hard deprecate TitleFactory::newFromIDs and Title::newFromIDsTChin2021-11-291-0/+3
| | | | | | | | | | Bug: T291288 Change-Id: I1789bccc276ec7c01928775f9bcb8ff301af54ff