aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Title.php
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Add parameter to API modules to apply change tags to log entries"jenkins-bot2017-01-131-4/+10
|\
| * Add parameter to API modules to apply change tags to log entriesThis, that and the other2017-01-121-4/+10
| | | | | | | | | | | | | | | | Adds support for tagging log entries for the block, import, managetags, and move API modules, using a 'tags' parameter. Bug: T97720 Change-Id: I9d75d2cece317a7704c4bc6d734ad3cafe24544e
* | Removed deprecated Title::moveNoAuth functionawu422017-01-011-12/+0
| | | | | | | | | | | | | | (deprecated since 1.25) Bug: T61113 Change-Id: I7a007dd87ea3bcbb1121738c84b0e654ba17ccbf
* | Replaced &$this with $thisawu422016-12-301-11/+25
|/ | | | | | | Replaced &$this in includes/Title.php to avoid error in PHP 7.1 Bug: T153505 Change-Id: I76eaae609a817af42687d87bcf0d13da7ba01c05
* Title: Fix subpage move error reportingBrad Jorsch2016-12-201-10/+15
| | | | | | | | | | | | Title::moveSubpages() sometimes returns a single message-specifier array and sometimes returns an array of such arrays. This is extremely difficult for a caller to deal with. Since nothing in Gerrit other than ApiMove calls this, let's just fix it. Also, it seems that messages were never created for the errors returned by this method. So let's create them. Change-Id: I4e55483c4476a1bb96c87266a4661871776fbf9b
* Merge "Fix type annotations"jenkins-bot2016-12-161-6/+6
|\
| * Fix type annotationsMax Semenik2016-12-151-6/+6
| | | | | | | | Change-Id: Ib72c98358b2f0b3b73b6f105adea47346373d46d
* | Cleanup some incorrect return annotationsErik Bernhardson2016-12-121-3/+3
|/ | | | | | | | | | | | | | Most of these are simply changing annotations to reflect reality. If a function can return false to indicate failure the @return should indicate it. Some are fixing preg_match calls, preg match returns 1, 0 or false, but the functions all claim to return booleans. This is far from all the incorrect return types in mediawiki, there are around 250 detected by phan, but have to start somewhere. Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
* Remove empty lines at end of functionsumherirrender2016-11-051-3/+0
| | | | | | | | It looks like there is something missing after the last statement Also remove some other empty lines at begin of functions, ifs or loops while at these files Change-Id: Ib00b5cfd31ca4dcd0c32ce33754d3c80bae70641
* Add caching to ResourceLoaderWikiModule::preloadTitleInfo()Aaron Schulz2016-10-201-4/+7
| | | | | | | | | | This is one of the top three DB queries showing up in xenon reverse flamegraph profiling. It works via a per-wiki check key that is bumped whenever someone changes a .js or .css page on that wiki. Change-Id: I73f419558864ba3403b4601a098f6aaf84a3e7c1
* Merge "Ensure users are able to edit the page after changing the content model"jenkins-bot2016-09-231-6/+31
|\
| * Ensure users are able to edit the page after changing the content modelKunal Mehta2016-09-221-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible for page restrictions to be dependent upon the content model a page. The best example of this is user JavaScript and CSS subpages. This adds a Title::setContentModel() function which allows mocking a Title's content model for the purpose of permission checks. EditPage and Special:ChangeContentModel were updated to ensure the user can edit the page with the newly proposed content model before making the change. Title::$mContentModel was made private to make sure nothing else mucks around with it. There were no uses outside of Title anyways. Bug: T145316 Change-Id: I28c46f408cadf65ed1868401cd00dc15e5acd2fe
* | phpdoc Title::inNamespaces also allows arrayaddshore2016-09-201-1/+1
| | | | | | | | Change-Id: I201dbaf9c0dee5b47c4edde73ff68b88560e8a0f
* | Replace WikiPage::doEdit() usagesReedy2016-09-151-1/+1
| | | | | | | | | | | | | | Update/add some comments Bug: T145737 Change-Id: Ib3b2b69906074cbb51917dc57204c989fd6c58b2
* | Merge "Add caching to Title::loadRestrictions()"jenkins-bot2016-09-141-44/+44
|\ \ | |/ |/|
| * Add caching to Title::loadRestrictions()Aaron Schulz2016-09-061-44/+44
| | | | | | | | Change-Id: Id9dac9b67cf969cddaaa8d412cb7fd033146f17d
* | Title: Document that Title::compare() can be used for LinkTargetsKunal Mehta2016-09-081-3/+3
| | | | | | | | | | | | It only depends upon functions that are all in the LinkTarget interface. Change-Id: I95e598ea6014ced8f1b947c283dd0b542756b8e2
* | Cache NS_TEMPLATE/NS_FILE titles in LinkCache persistentlyAaron Schulz2016-09-071-0/+1
|/ | | | | | | | Queries from parsing are the top use of selectRow() according to reverse flame graphs on xenon. This does not bother with pages in namespaces less likely to be included. Change-Id: Ica5d6e52c830cd71effff21933b8c64691082c11
* Rename DB_SLAVE constant to DB_REPLICAAaron Schulz2016-09-051-24/+24
| | | | | | | | | This is more consistent with LoadBalancer, modern, and inclusive of master/master mysql, NDB cluster, and MariaDB galera cluster. The old constant is an alias now. Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
* Change "slave" => "replica DB" in /includesAaron Schulz2016-09-051-4/+4
| | | | Change-Id: Icb716219c9335ff8fa447b1733d04b71d9712bf9
* SECURITY: Make $wgBlockDisablesLogin also restrict logged in permissionsBrian Wolff2016-08-221-1/+6
| | | | | | | | | | | | | | Does both Title and user related methods, so it catches things that only call $wgUser->isAllowed( 'read' ), as well as giving a nicer error message for things that use $title->userCan(). Otherwise, the user can still do stuff and read pages if they have an ongoing session. Issue reported by Multichill Bug: T129738 Change-Id: Ic929a385fa81c27cbc6ac3a0862f51190d3ae993
* AuthManager: Always whitelist some special pagesFlorian2016-08-111-1/+1
| | | | | | | | | | | | | Special:UserLogout should be whitelisted, if Special:UserLogin is whitelisted, as otherwise the user is able to login, but not able to logout anymore (given, that the sys-admin hasn't change the $wgWhitelistRead config variable). Special:ChangePassword redirects to Special:ChangeCredentials. Instead of adding this special page, it should be done explicitly in the wiki configuration (LocalSettings.php). For this reason, the whitelist is removed, too. Change-Id: I271efb517bf0ec0022e6fe29673570ca08e8fe1a
* Remove return by reference in Title::makeTitleErik Bernhardson2016-07-291-1/+1
| | | | | | | | This made sense back in php4, but has no useful effect anymore with our minimum php version being 5.5. This also has the effect of searching for 'function makeTitle' now actually finding something. Change-Id: I0ea02a2e7dff285341b0e5b5b7773da78bfaaff3
* Add AutoCommitUpdate class and replace some onTransactionIdle callersAaron Schulz2016-07-211-11/+16
| | | | | | | | | | | * This puts the complex logic here after the commit step for all DBs, making the main multi-DB transaction more likely to be atomic. * Made some cleanups to AtomicSectionUpdate and made it cancel if the transaction is rolled back as it should. * Also cleaned up some closures for PHP 5.4. Change-Id: If2f7bb6b1ba6daf1cfdc934f27c32b0b10431a3d
* Merge "Title::getLinkURL(): Allow expanding PROTO_RELATIVE too"jenkins-bot2016-07-201-3/+4
|\
| * Title::getLinkURL(): Allow expanding PROTO_RELATIVE tooKunal Mehta2016-07-011-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Allow callers to get protocol-relative URLs by passing the PROTO_RELATIVE constant. Since most callers don't pass in $proto, this shouldn't change very much since the default of non-expanded is effectively the same, but expanding to a protocol-relative URL when it is not intended should still be safe. A few callers that explicitly specified the default in core were also updated. Change-Id: I214f17aa6e8e30b647f21f0951fc3a15e87850c7
* | Merge "Don't use $wgContentNamespaces directly"jenkins-bot2016-07-121-2/+2
|\ \
| * | Don't use $wgContentNamespaces directlyKunal Mehta2016-07-121-2/+2
| |/ | | | | | | Change-Id: If8ed1bf7e7c6429c405c956413af07a191ec9c40
* / Provide CategoryAfterPageRemoved hook handlers with deleted page IDsAaron Schulz2016-06-201-1/+0
|/ | | | | | | Since this updates happens post-send or via the job queue, the page object will be for a non-existing or newer page/redirect. Change-Id: I20b583948157dccceca6eb1fbd25121822bf1b2f
* Merge "Language: Introduce new method equals( Language $lang )"jenkins-bot2016-05-231-1/+1
|\
| * Language: Introduce new method equals( Language $lang )Fomafix2016-05-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Use $lang->equals( $wgContLang ) instead of $lang->getCode() === $wgContLang->getCode() Change-Id: Id7ed6a21ce5e2ea2887ec98c7bd9d3eba83d733b
* | Use InterwikiLookup in Title.daniel2016-05-201-4/+17
| | | | | | | | | | | | | | | | This makes the use of the global InterwikiLookup singleton more explicit in the Title class. It does not remove the strong binding between Title and InterwikiLookup. Change-Id: Iaeb7c418af17fe19f170487f5364040da6052699
* | Merge "Limit DELETE in purgeExpiredRestrictions() and use primary key"jenkins-bot2016-05-201-2/+17
|\ \
| * | Limit DELETE in purgeExpiredRestrictions() and use primary keyAaron Schulz2016-05-191-2/+17
| |/ | | | | | | | | | | | | | | | | This should help reduce contention in some cases. If too many rows are expired, subsequent updates will clear them out. Bug: T135470 Change-Id: Iada496d0db9b00e77037320d7c65124a8c8f68c0
* / Title->getContentModel: Get new content model with GAID_FOR_UPDATEMatthew Flaschen2016-05-181-1/+3
|/ | | | | | | | If a new revision has been inserted (e.g. with updateRevisionOn), the content model may have changed. This happens with e.g. undeletion. Bug: T122262 Change-Id: Ia0ed86a9c24809256215418673e9ee8e263d1349
* Avoid unstubbing $wgLang in Title::getLocalURLBrad Jorsch2016-05-161-1/+1
| | | | | | | | | If $query doesn't match the regex, there's no point in unstubbing $wgLang if that's what happens to be the page language. This also avoids it blowing up if $wgLang isn't usable due to MW_NO_SESSION. Bug: T135389 Change-Id: I9a6779c4cc887205215a815db3a765c35f060c42
* Merge "Revert "Split editcascadeprotected permission from protect permission""jenkins-bot2016-05-121-6/+2
|\
| * Revert "Split editcascadeprotected permission from protect permission"Legoktm2016-05-121-6/+2
| | | | | | | | | | | | | | | | | | | | | | This doesn't make sense because 'editcascadeprotected' effectively gives you 'protect' rights. Furthermore, no actual usecase was provided except for a testwiki. This reverts commit da3464badaf9c067a4c3d98448ca72a8324e1e19. Change-Id: I655c1af8f418369c9551db86f24fb6b66c25afdd
* | Merge "Split editcascadeprotected permission from protect permission"jenkins-bot2016-05-121-2/+6
|\|
| * Split editcascadeprotected permission from protect permissionMGChecker2016-05-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, both permissions are summarised in the protect permission. This is unadvantageous for wikis that want to split this permission, for example for the main page: They don't want protection changes by non-sysop users there, but on transcluded pages some less privileged users are allowed to edit. Currently, it is impossible to divide these permissions in a clean way (they can add a hack depnding on action parameter in LocalSettings.php right now). Furthermore, an additional permission is no pain, because by default it is handled the same as protect until now. Note that for sakes of backwards compability I decided to handle editcascadeprotected as a subset of protect instead of removing all permissions to edit cascadeprotected pages (and change the cascade protection state of a page) for users who only have got the protect permission. Furthermore a different model would raise some strange questions about the behaivour of the protection form for users with protect, but no editcascadeprotected. Bug: T101309 Change-Id: I0734d6c26e75d7d7c01cf9750ad0315dd2c85bef
* | Merge "Re add @access protected on Title::__construct"jenkins-bot2016-05-121-0/+3
|\ \
| * | Re add @access protected on Title::__constructaddshore2016-05-071-0/+3
| | | | | | | | | | | | | | | | | | | | | This was removed in: Ibf86d03b5479c47ee72c0dafea6777ef8178fe68 Change-Id: I70fda1399e8e9f3a39ce5b9ffa8c2a9daec51faa
* | | Add TitleParser and TitleFormatter to MediaWikiServicesKunal Mehta2016-05-111-42/+5
|/ / | | | | | | | | Depends-On: Ibfd0a7f98f50506cd8402f966682f320bf715c8a Change-Id: I81d48616afd1ab2bde1a5f1d12f4aefb1c866d43
* / Remove WatchedItemStore::getDefaultInstanceaddshore2016-05-061-1/+4
|/ | | | Change-Id: I0c7d706fabee8d1f6fcfbc4c568f375953de8058
* Title: Update conversion functions for LinkTarget interwiki supportKunal Mehta2016-04-271-2/+6
| | | | | | | | | | Title::newFromLinkTarget() will now take the interwiki component from the LinkTarget object, and Title::getTitleValue() will pass on the interwiki part if there is one. Follows-up 9b1f8b4ca331e45. Change-Id: If1fecc9d71e58c476d6cebe6164cdc95f183048d
* Namespace LinkTarget under MediaWiki\LinkerKunal Mehta2016-04-211-0/+1
| | | | | | And add a GPL file header while we're at it. Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd
* Add LinkTarget::createFragmentTarget() functionKunal Mehta2016-04-211-1/+19
| | | | | | | | | | | | The createFragmentTarget function allows for switching the fragment on a target in an easier way. TitleValue already had a now-renamed createFragmentTitle function (no uses outside of tests), and an implementation was added for Title. This will also help with reducing the amount of public usage of Title::setFragment(), which is deprecated. Change-Id: I1e8ba2f85e748b1b4394fb2f2a1ccce69cf6e3c5
* Specially handle Title objects in Title::newFromLinkTarget()Kunal Mehta2016-04-191-0/+4
| | | | | | | | Every single caller of Title::newFromLinkTarget() already special cases when the LinkTarget object is already a Title, so move that logic into one function. Change-Id: Iba5432ae01c87850e5b34893092427c5b1629188
* Title: Throw if newFromText is given an invalid valueTimo Tijhof2016-04-131-5/+1
| | | | | | | | | | | | | Follows-up 448c7ea03a, 372ded2f, 156bcbec, Ic85d27d. * Removes the logger added in 448c7ea03a. * Turn the warning into an exception. This was difficult previously because non-string values were common. However most of them were all null. Cases of other primitives (type object already throws) have been fixed. Bug: T76305 Change-Id: I62fe3f700d94168ca35c833410171b1c48e6c4f3
* Remove Title::newFromRedirectRecurse()Florian2016-04-031-17/+0
| | | | | Bug: T122754 Change-Id: I8b957eff7f355493ef6850f7a83dcb619ab6be78