Commit graph

1466 commits

Author SHA1 Message Date
jenkins-bot
67a97fced6 Merge "Language: Introduce new method equals( Language $lang )" 2016-05-23 16:03:50 +00:00
daniel
f7f3641909 Use InterwikiLookup in Title.
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
2016-05-20 18:35:56 +00:00
jenkins-bot
3801cd022f Merge "Limit DELETE in purgeExpiredRestrictions() and use primary key" 2016-05-20 02:48:00 +00:00
Aaron Schulz
d58f0155df Limit DELETE in purgeExpiredRestrictions() and use primary key
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
2016-05-19 13:17:31 -07:00
Matthew Flaschen
dc579d27da Title->getContentModel: Get new content model with GAID_FOR_UPDATE
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
2016-05-18 15:47:16 +02:00
Fomafix
796d62d034 Language: Introduce new method equals( Language $lang )
Use

 $lang->equals( $wgContLang )

instead of

 $lang->getCode() === $wgContLang->getCode()

Change-Id: Id7ed6a21ce5e2ea2887ec98c7bd9d3eba83d733b
2016-05-16 22:33:33 +00:00
Brad Jorsch
67881de44e Avoid unstubbing $wgLang in Title::getLocalURL
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
2016-05-16 16:57:41 +00:00
jenkins-bot
279dd4156c Merge "Revert "Split editcascadeprotected permission from protect permission"" 2016-05-12 21:53:41 +00:00
Legoktm
abc68e6378 Revert "Split editcascadeprotected permission from protect permission"
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 da3464bada.

Change-Id: I655c1af8f418369c9551db86f24fb6b66c25afdd
2016-05-12 21:43:06 +00:00
jenkins-bot
c8b0af1546 Merge "Split editcascadeprotected permission from protect permission" 2016-05-12 20:37:00 +00:00
jenkins-bot
6fcabeeb0b Merge "Re add @access protected on Title::__construct" 2016-05-12 19:10:31 +00:00
Kunal Mehta
f1e8d27a91 Add TitleParser and TitleFormatter to MediaWikiServices
Depends-On: Ibfd0a7f98f50506cd8402f966682f320bf715c8a
Change-Id: I81d48616afd1ab2bde1a5f1d12f4aefb1c866d43
2016-05-11 10:18:40 -07:00
addshore
8ce81d0873 Re add @access protected on Title::__construct
This was removed in:
Ibf86d03b5479c47ee72c0dafea6777ef8178fe68

Change-Id: I70fda1399e8e9f3a39ce5b9ffa8c2a9daec51faa
2016-05-07 13:09:10 +01:00
addshore
818984e5cb Remove WatchedItemStore::getDefaultInstance
Change-Id: I0c7d706fabee8d1f6fcfbc4c568f375953de8058
2016-05-06 08:47:37 +00:00
MGChecker
da3464bada Split editcascadeprotected permission from protect permission
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
2016-05-03 21:26:26 +02:00
Kunal Mehta
222f9b48bb Title: Update conversion functions for LinkTarget interwiki support
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 9b1f8b4ca3.

Change-Id: If1fecc9d71e58c476d6cebe6164cdc95f183048d
2016-04-27 14:30:39 -07:00
Kunal Mehta
c9d885f3b4 Namespace LinkTarget under MediaWiki\Linker
And add a GPL file header while we're at it.

Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd
2016-04-21 17:19:10 -07:00
Kunal Mehta
59d838caea Add LinkTarget::createFragmentTarget() function
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
2016-04-21 17:19:04 -07:00
Kunal Mehta
aa21cf32fa Specially handle Title objects in Title::newFromLinkTarget()
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
2016-04-19 22:21:09 -07:00
Timo Tijhof
2e5047646f Title: Throw if newFromText is given an invalid value
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
2016-04-13 00:26:43 +01:00
Florian
b91cbed2ed Remove Title::newFromRedirectRecurse()
Bug: T122754
Change-Id: I8b957eff7f355493ef6850f7a83dcb619ab6be78
2016-04-03 13:31:57 +01:00
Florian
876ae95e63 Remove Title::newFromRedirectArray
Bug: T122754
Change-Id: I2cdeb98c81d4b98ea986bd2f7b23cd93c62c5930
2016-04-02 13:28:37 +00:00
Florian
83e53c7166 Remove Title::newFromRedirect()
Deprecated since 1.21.

Bug: T122754
Change-Id: Iddf1c2d61cafc017bf361b747db38ac1bc5f3f09
2016-04-01 23:47:01 +02:00
Ricordisamoa
1617e7822e Always use 'bool' instead of 'boolean' in Doxygen tags
Just like commit f86a5590aa

Change-Id: Ic9d08bca6524d6bb4baf5170c081ad0f3d738e28
2016-03-24 09:44:09 +01:00
jenkins-bot
7340ddc12e Merge "Title: Fix inaccurate documentation of getUserPermissionsErrorsInternal" 2016-03-24 04:44:21 +00:00
Matthew Flaschen
f30d1337ea Title: Fix inaccurate documentation of getUserPermissionsErrorsInternal
Blocks are checked (checkUserBlock).

Change-Id: I3a164d1003f2bea3e3e07081c9bebfabd884ade9
2016-03-24 04:35:19 +00:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
Siebrand Mazeland
5b119a0e44 Replace uses of join() by implode()
All of core uses implode() consistently now.

Change-Id: Iba50898c64c43f356d1caf8869f484e90d9ff651
2016-03-08 18:24:16 +00:00
addshore
fee0afdc8a Move WatchedItem logic to WatchedItemStore
This also removes assumptions that when a page
in one Namespace should be watched / removed
that the page in the talk / subject ns for the
page should have the same action applied

This should maintain all backward compatability
for the WatchedItem class

This also includes tests written by:
 - WMDE-leszek
 - Addshore

Bug: T127956
Change-Id: Iad9abafe4417bb479151a3bfbee6e1c78a3afe3c
2016-03-08 15:41:22 +00:00
Fomafix
757714bf95 Title.php: Support DB language in getPageViewLanguage()
If a page language in database is set then use the current preferred variant
of this language.

Bug: T117667
Change-Id: Idfe1165346ae0068a4b73de441dc9dfa107b8e8b
2016-02-18 17:48:54 +00:00
jenkins-bot
58cb1f824a Merge "Avoid master queries in Title::getLinksFrom()" 2016-02-18 14:31:18 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Florian
d237380021 Fix not-loaded DbPageLanguage when Title::getPageLanguage() get's called
If the Title object isn't the title of the current viewed WikiPage, the page_lang
field of the database isn't requested. This results in the problem, that
Title::getPageLanguage() always returns the default content language, even if
the page language is different (changed with Special:PageLanguage, if
wgPageLanguageUseDB is true). That is problematic for the Translate extension,
which relies on the correct page language.

This change makes sure, that getPageLanguage() always return the correct page
language. If the page language isn't loaded already, Title::getPageLanguage()
now does a database lookup (if $wgPageLanguageUseDB is true) to get the correct
page language. It will use LinkCache for the page_lang field.

Bug: T121666
Change-Id: I0ae5ea39f7a124ed427ca5dfb26c1a116b27a94e
2016-02-16 20:37:40 +00:00
jenkins-bot
d65fc1eb34 Merge "Add 2 FIXMEs about confusingly named functions" 2016-02-14 16:33:26 +00:00
Kaldari
ea6b78909d Add 2 FIXMEs about confusingly named functions
With the roll-out of the Gadget namespace, these are going to be
especially misleading and likely to cause bugs.

Change-Id: I61f1f56762711fab173bbc54d110a7c48604d464
2016-02-12 18:27:36 -06:00
Aaron Schulz
6ce91360c0 Avoid master queries in Title::getLinksFrom()
All callers only hit this case by accident (e.g. limit/offset)

Bug: T92357
Change-Id: I4b5d1b62b2e564b40c65c82cfd4788093d61fc98
2016-02-08 13:41:57 -08:00
addshore
8ddb6a8bbb phpdoc @return MediaWikiTitleCodec in Title::getTitleParser
This will always return a MediaWikiTitleCodec object.
This is called in Title::secureAndSplit which expects
the method splitTitleString which is only in this
implementation and not the interface

Change-Id: Ibb6cdcf7deb6c1080e320379aa58981e9935ca33
2016-02-03 17:26:13 +01:00
jenkins-bot
920c06e42c Merge "Use LinkTarget in TitleValue only methods" 2016-02-03 13:36:59 +00:00
jenkins-bot
9a3a412f86 Merge "Add LinkTarget interface" 2016-02-03 13:23:08 +00:00
addshore
ab66a4427a Use LinkTarget in TitleValue only methods
Change-Id: Iee4b183ae54457d0c6cd3473f9fed3207742b54f
2016-01-29 12:51:52 +01:00
addshore
1c63abcda3 Add LinkTarget interface
To be used by things that do not care if they are
passed a Title or TitleValue so long as it has a
dbkey, namespace, possible fragment and text

Example uses include:
 LinkBatch::addObj
 MediaWikiPageLinkRenderer methods
 MediaWikiTitleCodec methods
 PageLinkRenderer methods
 TitleFormatter methods

Change-Id: I2aa1a82129bb01155924a8e6a403c7a47391432f
2016-01-29 12:48:21 +01:00
This, that and the other
eda82d60c6 Title::newFromText: Cast integers to strings
This is the cause of the T76305 debug log entries relating to SpecialExport
and Echo.

Bug: T76305
Bug: T116034
Change-Id: I64d629d31be79c4b4702a4298bce68fd544df6e8
2016-01-29 10:52:37 +11:00
Fomafix
6f0caa48c6 Title.php: Avoid wfGetLangObj for Language objects
getPageLanguage() from ContentHandler already returns a Language object.
wfGetLangObj is not necessary.

Change-Id: I556236419e445ce549598dd1752b29f619b0ca3c
2016-01-16 15:57:41 +00:00
Aaron Schulz
ec63f72c79 Add AtomicSectionUpdate deferred update class
This makes it easier to have deferred atomic DB transactions

Bug: T122115
Change-Id: I67afe335f03cc21fdce78abdf3f31fa67a368419
2016-01-14 10:32:39 +00:00
Reedy
f684d17b0e Don't call Title::getInternalURL with 2 parameters.
Unnecessary, and causes a deprecated notice

Change-Id: I823b2a037260d3d50a7b074d25d51c11c165d3b8
2016-01-11 12:50:24 +00:00
Florian
77468269af Remove deprecated Title::userIsWatching
Bug: T122754
Change-Id: Ibb895855aa1bf6b9cbbaf68643362ea485e0427c
2016-01-04 18:08:15 +00:00
Bartosz Dziewoński
f0b6b9da04 Title: Fix typo in variable name
Change-Id: I8da1c995f2da2e7a43c70aeadd28b93e5f3e511f
2015-12-22 19:43:43 +00:00
Aaron Schulz
4302b0419d Rename getSquidURLs() => getCdnUrls()
Change-Id: I433acc7990a5fcefd0d2ff5b14ba33dec0424706
2015-12-11 16:40:35 -08:00
Aaron Schulz
6af3c39c07 Replace "squid" with "CDN" in various comments
Change-Id: Idcc528daf28e119349155d36e30a9bcf61b2e7d5
2015-12-09 17:35:37 -08:00
Aaron Schulz
282c5fa9f3 Rename SquidUpdate => CdnCacheUpdate
Squid is not the only possible CDN

Change-Id: Ie2a2955847c5706e630322bbbab71c9d063b378f
2015-12-09 16:31:17 -08:00