Commit graph

1563 commits

Author SHA1 Message Date
Fomafix
464f0c72a5 Remove multiple spaces in PHP files
Change-Id: Id9c26ec5ca730a9536f8fdccb8853eb03cbe87a4
2017-04-12 17:27:19 +02:00
zppix1
0a6f7f5796 Remove "editusercssjs" user right
Deprecated since MediaWiki1.16

Change-Id: Ic9851d53affe0f4ece7a79f541ec5cb39133b109
2017-04-11 14:54:43 +01:00
Brian Wolff
55035e01e5 SECURITY: Do not allow users to undelete a page they can't edit or create
If the page exists, it only checks edit rights, otherwise it
checks both edit and create rights.

This would only matter on wikis that have a non-default rights
configuration where there are users with undelete rights but a
restriction level enabled that prevents them from creating/editing
pages (or they otherwise aren't allowed to edit/create)

It should be noted that the error messages aren't used in the
normal UI currently, but they could be in the future, and
extensions could potentially be using them (The backend functions
return them, but the UI functions in Special:Undelete ignore
them)

Bug: T108138
Change-Id: I164b80534cf89e0afca264e9de07431484af8508
2017-04-06 13:44:55 -07:00
Brian Wolff
14beae88b5 SECURITY: Do not directly redirect to interwikis, but use splash page
Directly redirecting based on a url paramter might potentially
be used in a phishing attack to confuse users.

Bug: T109140
Bug: T122209
Change-Id: I6c604439320fa876719933cc7f3a3ff04fb1a6ad
2017-04-06 13:42:38 -07:00
jenkins-bot
d1380bfdd1 Merge "Implement WikiPage::getOldestRevision() in terms of Title::getFirstRevision()" 2017-03-30 18:36:34 +00:00
jenkins-bot
142e89424e Merge "Make Title::getFirstRevision() ignore the rev_timestamp index" 2017-03-29 16:23:38 +00:00
Roan Kattouw
09f14cba52 Implement WikiPage::getOldestRevision() in terms of Title::getFirstRevision()
They were both doing the same thing, except that getOldestRevision()
checks the master if the revision is missing on the replica.

Change-Id: I21a118c6cd5c98fb846a0a2765574c0dbdbf7220
2017-03-29 11:53:08 -04:00
Roan Kattouw
dee457713b Make Title::getFirstRevision() ignore the rev_timestamp index
We want the page_timestamp index to be used in this case, but sometimes
the rev_timestamp is chosen which leads to bad performance.

Also update WikiPage::getOldestRevision() which uses the exact same query.
I'll implement one in terms of the other in a follow-up commit.

Bug: T159319
Change-Id: I7c5c0a9b1af99ce2b5f4bdcc99710d8400ca8bcf
2017-03-29 11:40:12 -04:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
jenkins-bot
17eba67ef3 Merge "Change Title::getPreviousRevisionID (and next) to ignore PRIMARY" 2017-03-28 15:09:28 +00:00
Bartosz Dziewoński
8dd52aa4dc Title: Remove outdated comment in loadRestrictionsFromRows()
It has been refactored, and decodeExpiry() is now a method of Database.

Change-Id: I357b303317c877be944474db1331855adb1eb8fd
2017-03-14 02:37:40 +00:00
Jcrespo
80b9ad3a8a Change Title::getPreviousRevisionID (and next) to ignore PRIMARY
Both Title::getPreviousRevisionID and Title::getNextRevisionID
have bad performance under certain versions of MySQL/MariaDB
when the page has many revisions (in the order of dozens of
thousands). This is good enough in most cases.

However, on a contributions slave, where it has an explicity
defined extended secondary key with the primary key, the
performance is really, really bad, performing a full table scan.

By ignoring the PRIMARY KEY index, contributions slaves go from the
worst case to the best case, while not affecting the plan of regular
slaves. It is believed that more recent versions of MySQL chose the 
right indexes automatically, because they can use the extended primary
key automatically, without adding it explicitly. If that doesn't
happen, we can consider adding it explicitly to the regular slaves,
too.

In any case, not using the PRIMARY gives always a much better or at
least the same performance (this never causes a regression, unlike
FORCE'ing a specific index).

Bug: T159319
Change-Id: Ibb6e5240b87bd8e2d680fc4d58fcb3db1a4721cc
2017-03-10 08:07:37 +00:00
Brad Jorsch
e89b499351 Fix Title::loadRestrictions() for create-protected titles
Title::loadRestrictions() returns restriction levels, not the
corresponding user rights. These are mostly identical except for the
backwards-compatibility levels "sysop" and "autoconfirmed".

For create protection it calls Title::getTitleProtection() to fetch
them, but Ic5026384 changed that to return rights. Split that function
into two, an internal method that returns restriction levels for
loadRestrictions() to call and the public method that converts levels
into rights.

Bug: T85108
Change-Id: I3ea4cb9c5e37b746402744dd7a883763ee07195a
2017-03-02 17:09:30 +00:00
jenkins-bot
aa3319c4c0 Merge "Miscellaneous indentation tweaks" 2017-02-28 18:38:36 +00:00
Bartosz Dziewoński
ecdef925bb Miscellaneous indentation tweaks
I was bored. What? Don't look at me that way.

I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.

Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
2017-02-27 19:23:54 +01:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +00:00
This, that and the other
73224f4f8b User group memberships that expire
This patch adds an ug_expiry column to the user_groups table, a timestamp
giving a date when the user group expires. A new UserGroupMembership class,
based on the Block class, manages entries in this table.

When the expiry date passes, the row in user_groups is ignored, and will
eventually be purged from the DB when UserGroupMembership::insert is next
called. Old, expired user group memberships are not kept; instead, the log
entries are available to find the history of these memberships, similar
to the way it has always worked for blocks and protections.

Anyone getting user group info through the User object will get correct
information. However, code that reads the user_groups table directly will
now need to skip over rows with ug_expiry < wfTimestampNow(). See
UsersPager for an example of how to do this.

NULL is used to represent infinite (no) expiry, rather than a string
'infinity' or similar (except in the API). This allows existing user group
assignments and log entries, which are all infinite in duration, to be
treated the same as new, infinite-length memberships, without special
casing everything.

The whole thing is behind the temporary feature flag
$wgDisableUserGroupExpiry, in accordance with the WMF schema change policy.

The opportunity has been taken to refactor some static user-group-related
functions out of User into UserGroupMembership, and also to add a primary
key (ug_user, ug_group) to the user_groups table.

There are a few breaking changes:
- UserRightsProxy-like objects are now required to have a
  getGroupMemberships() function.
- $user->mGroups (on a User object) is no longer present.
- Some protected functions in UsersPager are altered or removed.
- The UsersPagerDoBatchLookups hook (unused in any Wikimedia Git-hosted
  extension) has a change of parameter.

Bug: T12493
Depends-On: Ia9616e1e35184fed9058d2d39afbe1038f56d7fa
Depends-On: I86eb1d5619347ce54a5f33a591417742ebe5d6f8
Change-Id: I93c955dc7a970f78e32aa503c01c67da30971d1a
2017-01-27 09:24:20 +00:00
rlot
99800a9e03 Removed deprecated ContentHandler hooks.
Plus removed unused "ContentHandler::runLegacyHooks"

Bug: T154498
Change-Id: Ie398fd4e06d3e286fe8e24112d0c8b4ac7d883dc
2017-01-18 21:19:17 +00:00
jenkins-bot
892b17237b Merge "Add parameter to API modules to apply change tags to log entries" 2017-01-13 17:42:04 +00:00
This, that and the other
f3f2df07ec Add parameter to API modules to apply change tags to log entries
Adds support for tagging log entries for the block, import,
managetags, and move API modules, using a 'tags' parameter.

Bug: T97720
Change-Id: I9d75d2cece317a7704c4bc6d734ad3cafe24544e
2017-01-12 16:30:17 -06:00
awu42
c3f7cebf69 Removed deprecated Title::moveNoAuth function
(deprecated since 1.25)

Bug: T61113
Change-Id: I7a007dd87ea3bcbb1121738c84b0e654ba17ccbf
2017-01-01 18:13:33 +00:00
awu42
529d946e69 Replaced &$this with $this
Replaced &$this in includes/Title.php to avoid error in PHP 7.1

Bug: T153505
Change-Id: I76eaae609a817af42687d87bcf0d13da7ba01c05
2016-12-30 11:55:28 -05:00
Brad Jorsch
d5423f43d0 Title: Fix subpage move error reporting
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
2016-12-20 13:41:36 -05:00
jenkins-bot
8e622749cf Merge "Fix type annotations" 2016-12-16 17:18:00 +00:00
Max Semenik
f23a964170 Fix type annotations
Change-Id: Ib72c98358b2f0b3b73b6f105adea47346373d46d
2016-12-15 14:11:12 -08:00
Erik Bernhardson
d67197fa11 Cleanup some incorrect return annotations
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
2016-12-12 10:15:05 -08:00
umherirrender
34fe90ac52 Remove empty lines at end of functions
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
2016-11-05 11:55:10 +01:00
Aaron Schulz
0852a000a5 Add caching to ResourceLoaderWikiModule::preloadTitleInfo()
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
2016-10-20 20:54:11 +00:00
jenkins-bot
3d653e8ab5 Merge "Ensure users are able to edit the page after changing the content model" 2016-09-23 06:16:11 +00:00
Kunal Mehta
2108c55ec5 Ensure users are able to edit the page after changing the content model
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
2016-09-22 22:22:48 -07:00
addshore
a36e01c63a phpdoc Title::inNamespaces also allows array
Change-Id: I201dbaf9c0dee5b47c4edde73ff68b88560e8a0f
2016-09-20 13:34:14 +01:00
Reedy
3c27ff94fa Replace WikiPage::doEdit() usages
Update/add some comments

Bug: T145737
Change-Id: Ib3b2b69906074cbb51917dc57204c989fd6c58b2
2016-09-15 21:25:32 +01:00
jenkins-bot
bae9c5aca6 Merge "Add caching to Title::loadRestrictions()" 2016-09-14 19:14:40 +00:00
Kunal Mehta
5d52874ddf Title: Document that Title::compare() can be used for LinkTargets
It only depends upon functions that are all in the LinkTarget interface.

Change-Id: I95e598ea6014ced8f1b947c283dd0b542756b8e2
2016-09-08 21:58:55 -07:00
Aaron Schulz
8ebec93fea Cache NS_TEMPLATE/NS_FILE titles in LinkCache persistently
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
2016-09-07 00:20:26 -07:00
Aaron Schulz
62b9d21ccc Add caching to Title::loadRestrictions()
Change-Id: Id9dac9b67cf969cddaaa8d412cb7fd033146f17d
2016-09-06 05:52:00 -07:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
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
2016-09-05 22:55:53 -07:00
Aaron Schulz
16266edff3 Change "slave" => "replica DB" in /includes
Change-Id: Icb716219c9335ff8fa447b1733d04b71d9712bf9
2016-09-05 21:01:01 +00:00
Brian Wolff
b675be2083 SECURITY: Make $wgBlockDisablesLogin also restrict logged in permissions
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
2016-08-22 18:41:01 -07:00
Florian
f2598a0b21 AuthManager: Always whitelist some special pages
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
2016-08-11 18:35:28 +02:00
Erik Bernhardson
968f846834 Remove return by reference in Title::makeTitle
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
2016-07-29 13:30:32 -07:00
Aaron Schulz
3c21f0e8e5 Add AutoCommitUpdate class and replace some onTransactionIdle callers
* 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
2016-07-21 05:24:28 +00:00
jenkins-bot
0124c6ce75 Merge "Title::getLinkURL(): Allow expanding PROTO_RELATIVE too" 2016-07-20 21:56:21 +00:00
jenkins-bot
7dd1914e73 Merge "Don't use $wgContentNamespaces directly" 2016-07-12 23:26:38 +00:00
Kunal Mehta
8091e9c6db Don't use $wgContentNamespaces directly
Change-Id: If8ed1bf7e7c6429c405c956413af07a191ec9c40
2016-07-12 15:50:29 -07:00
Kunal Mehta
5e11a28e7a Title::getLinkURL(): Allow expanding PROTO_RELATIVE too
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
2016-07-01 11:31:56 -07:00
Aaron Schulz
a81d467f8c Provide CategoryAfterPageRemoved hook handlers with deleted page IDs
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
2016-06-20 12:40:03 -07:00
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
Aaron Schulz
afbff42aca Make CDN purge calls use DeferredUpdates
* Using addUpdate() makes sure purges are coalesced and
  de-duplicated.
* Also removed incosistent $wgUseSquid checks. If CDN caching
  is not used, then $wgSquidServers will just be empty anyway.

Bug: T119016
Change-Id: I8b448366f037f668385d252f9d68289b71d1a707
2015-12-04 19:09:03 +00:00
Timo Tijhof
06ba31d267 Title: Convert cache from MapCacheLRU to HashBagOStuff
Change-Id: I0d4c21be1356216970d9ad424ffc848f82778e50
2015-11-09 23:29:19 +00:00
jenkins-bot
2a6d5b5092 Merge "Title: Add warning if newFromText is given non-string/non-null value" 2015-11-05 22:08:35 +00:00