Commit graph

1333 commits

Author SHA1 Message Date
Brad Jorsch
002a277901 Do not allow a user to delete a page they can't edit
This was probably overlooked in the past because usually the only users
who can delete pages also have permission to edit the relevant
protection levels.

Change-Id: Ibe28a69c9fbab00b81c53b1643df722a3f1fbf19
2014-08-10 22:11:48 +01:00
jenkins-bot
bfc3710111 Merge "Don't include images/categories when behind a local interwiki prefix" 2014-08-09 11:51:07 +00:00
Erik Bernhardson
64c208a27d Docs: Add note that you might want Title::getLinkURL
While there are valid use cases of Title::getLocalURL, it is safer
to use Title::getLinkURL in most instances.  Additionally developers
won't accidentally their fragments that way.

Change-Id: I1bf567ba9c38103d39a883e8ea3a60f9f2082181
2014-08-01 14:21:45 -07:00
This, that and the other
9883b2471c Don't include images/categories when behind a local interwiki prefix
This solution is somewhat imperfect, as the logic being added here to
MediaWikiTitleCodec really belongs in the parser. However, given the
current state of this code, this is the cleanest possible solution at
the moment.

Modified the existing release note for this.

Bug: 68802
Change-Id: I38309186bdcad23f49e23beb26daaf3ef5bceea1
2014-08-01 18:20:51 +10:00
umherirrender
1c68a1ee86 Cleanup some docs (includes/*.php)
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
2014-07-24 19:42:24 +02:00
umherirrender
7ff005407e Remove colon after @deprecated/@param/@todo/@note
Change-Id: I4e66dad85eecf7e8e03ac760af900395e1bc11b6
2014-07-24 11:30:25 +02:00
Aaron Schulz
b8c038f678 Redo WhatLinksHere query and add a *_from_namespace field to link tables
* Also tweaked the query so MySQL avoids doing a page_name
  index scan when it should start with the link table index
* Added population script (triggered by update.php)
* Also removed uniqueness from some indexes where it is redundant
* Renamed two confusing variables

Bug: 60618
Change-Id: Icca99b6ae0ef76cb77695faf82c615516191da36
2014-07-21 12:04:56 -07:00
withoutaname
52167c9d7f Remove deprecated Title::userCanRead()
Change-Id: I574babf4534c849d1e1491724ea537d53ea1d1d5
2014-07-21 06:00:19 +00:00
umherirrender
53c420e278 Fixed spacing
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma

Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
2014-07-20 21:41:41 +02:00
umherirrender
2b021dc48a Fixed spacing
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif

Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
2014-07-19 23:12:10 +02:00
withoutaname
c62d2aa555 Fix incorrect function call scope in Title.php
Calls to getTitleParser() and getTitleFormatter() were using $this->
but the functions were declared static.

Change-Id: If21be84c68725b2afe181229cb697b948d26d6c6
2014-07-16 15:17:47 -07:00
umherirrender
db2be3a574 Remove Title::getEscapedText() (deprecated since 1.19)
Change-Id: I54dfbe024fee9e82f99a394f7f41141761375ca4
2014-07-10 18:57:29 +02:00
umherirrender
39dd07658d Remove Title::escapeFullURL() (deprecated since 1.19)
Change-Id: Ie3f50fa38b92294ffb67daaaba8560a640bf2eeb
2014-07-09 17:26:36 +00:00
umherirrender
3dc98960cb Remove Title::escapeLocalURL() (deprecated since 1.19)
Change-Id: I588e1946f6dc9200261469ae8134f7cf885bba3f
2014-07-09 17:25:20 +00:00
umherirrender
ed7e83e772 Remove Title::escapeCanonicalURL() (deprecated since 1.19)
Change-Id: Ib451c25643e65c5812046324d998f5286b36d21d
2014-07-09 19:22:49 +02:00
umherirrender
1e10fcca50 Remove Title::updateTitleProtection() (deprecated since 1.19)
Change-Id: I7ebfa106ef72a4aa6659332210e3401bfa02cafc
2014-07-09 01:41:19 +02:00
umherirrender
0c1b1f8cfb Remove @private/@public/@void where visibility already set
When private is set php side on the function, no need to have it in the
param docs.

Change-Id: Ieaeac99c131b7360b1f324244d8be6f9ff854dd2
2014-07-04 22:41:05 +02:00
Alexandre Emsenhuber
a7de863d3a Don't use isset to check for null
Change isset() checks for variables that are always defined.

Change-Id: Ic96b9661d94742909c0d6b62a8eb2f6a038a774f
2014-07-04 21:20:22 +02:00
Kunal Grover
50144cd02a First version of Page Language selector
Special page PageLanguage to set the page language of a page.
To enable the feature, set $wgPageLanguageUseDB to true
and assign the 'pagelang' user right to a user group.

Bug: 35489
Change-Id: I0f82b146fbe948f917c1c5d29f7469644d797e80
2014-06-27 23:27:07 +00:00
Brad Jorsch
da4442cd74 Fix documentation for Title::getCascadeProtectionSources and others
The documentation for Title::getCascadeProtectionSources was rendered
nonsensical in r79682, and somehow several following "documentation
cleanup" revisions failed to notice this while cleaning up this same
documentation string.

Fixing that led to fixing Title::getRestrictions and
Title::getAllRestrictions as well.

Change-Id: I48638e370c01fe5ef8ad7d3ebf7fb9aa4385bad7
2014-06-03 12:56:08 -04:00
Aaron Schulz
fc30f03dd3 Reduce Title::invalidateCache contention a bit
* Lots of deadlocks seems to happen on page deletion,
  where the ID is likely 0 (this also has the worst locks)

bug: 37519
Change-Id: I028783a998946615b93e1425c6f69e00afd7b1bb
2014-05-28 02:34:57 +00:00
Jackmcbarn
65282b39c7 Check category-move-redirect-override in content language
When testing whether category-redirect-move-override is disabled, do it in
the content language rather than the user language.

Change-Id: Id1f03240c203f32a12953f49a075cfd5c25f0f31
2014-05-24 00:18:53 -04:00
Siebrand Mazeland
c0c39640e4 Make phpcs-strict pass on includes/ (5/~10)
Change-Id: I259f3f11cfc22f3ed1693f9ebd5bd80491b8a6e8
2014-05-11 19:35:32 +00:00
Siebrand Mazeland
2daa1fab7a Make phpcs-strict pass on includes/ (3/~10)
Change-Id: Ibf86d03b5479c47ee72c0dafea6777ef8178fe68
2014-05-11 19:28:07 +00:00
Alexandre Emsenhuber
de923b99bf Remove useless variable from Title::newFromText()
Instead of setting and returning it directly, we
might as well return null directly...

Change-Id: Icbde20fe0f6a064dd58018d6543b03def7203a84
2014-05-10 13:31:20 +02:00
Jackmcbarn
9b840c281c Fix incorrect comment
Fix a comment incorrectly referring to user pages instead of category
pages. Follow-up to Ic93616a54c8e98e3dc71daee3c92c466d64daffc

Change-Id: I74533658c32647f77e3d8d54a05e9835e1c37952
2014-05-09 23:04:31 -04:00
Jackmcbarn
f14e48f4f9 Allow moving category pages
Allow category pages to be moved. This is to preserve attribution of the
page only and does not cause pages in the category to recategorize to the
new one. A warning explains this when such a move is attempted. The new
right move-categorypages is required to do this, which is assigned to user
and sysop by default (the same as other move-related rights). The message
category-move-redirect-override can be used to cause custom text to be
placed on the "old" category page in lieu of a redirect.

Bug: 28569
Bug: 5451
Change-Id: Ic93616a54c8e98e3dc71daee3c92c466d64daffc
2014-05-09 18:12:25 +01:00
umherirrender
df9fc5c923 Pass user and user_text to Revision constructor
This avoids the use of $wgUser in Revision constructor and makes the
dependency on the global visible.

Change-Id: Ief79c9769d28a1adb16abab8da1ec01984d9ef92
2014-04-28 17:20:30 +00:00
umherirrender
26e705f808 Add $user param to Revision::newNullRevision
This avoids the use of $wgUser in Revision constructor and makes the
dependency on the global visible.

Change-Id: Ib67bd706a3c4ef081f475406e9aa1094c42222ef
2014-04-28 18:59:20 +02:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00
umherirrender
097ce0b24b Fixed some @params documentation (includes/Title.php)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
2014-04-23 11:15:28 +02:00
jenkins-bot
45e0034abb Merge "Consistently use '@deprecated since <version>'" 2014-04-17 06:12:11 +00:00
Chad Horohoe
d6c4ab9390 Get rid of Title::indexTitle and Title::getIndexTitle()
Nothing used them other than SearchUpdate, nor should they.
Move implementation there and make it private.

Change-Id: Iafc6f6d59487bd8c53cb99b2147815b2d70ead83
2014-04-16 11:03:42 -07:00
Bartosz Dziewoński
59002d8935 Consistently use '@deprecated since <version>'
Variants included 'in <version>', 'as of <version>' and just the
version number.

Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.

Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
2014-04-15 22:18:19 +02:00
umherirrender
a889ad1227 Document new param of Title::countRevisionsBetween
Follow-Up: Ie51a491ff5d22c2d84934e83d4b3f690c9dbd595
Change-Id: I61483f50512027559c4c3b63c49602b8aea755fd
2014-04-10 19:58:34 +02:00
Aaron Schulz
57731929ab Added limit to countRevisionsBetween() for sanity
* This was causing dozens of DB query timeout errors at WMF

Change-Id: Ie51a491ff5d22c2d84934e83d4b3f690c9dbd595
2014-04-07 15:18:19 -07:00
umherirrender
edbd8ea6b3 Fix [missing] variables in @param docs
Two places found without variable, one without $ and one only missed a
space before $

Change-Id: Iacd7c386d57223f3a112b59cd11383ef5c0ac2f1
2014-04-06 20:11:30 +02:00
daniel
154bcdc63f Introducing TitleValue
TitleValue is intended to be a light weight alternative to the Title
class. Any operations on TitleValue are implemented in separate
service classes, like TitleFormatter and PageLinkRenderer. See
<https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue>
for more information.

This change updates SpecialCategories and SpecialLinkSearch to use
TitleValue instead of Title, to demonstrate how TitleValue would be
used, and how the necessary services can be injected and applied.

The intention is to improve testability and reusability; these
advantages will however only become apparent with further refactoring
of the respective special pages. This will be done in follow-up
changes.

More work will be needed to migrate essential functionality from
Title and Linker classes into the respective service classes,
MediaWikiTitleCodec and MediaWikiPageLinkRenderer.

Change-Id: I8eef5a165de4ffcacfbc4911fdacdb15d502fff4
2014-03-28 18:42:17 +00:00
This, that and the other
6cbdf65b4f Add $wgLocalInterwikis to handle multiple local prefixes
This is akin to $wgSkipSkin/$wgSkipSkins. It is quite plausible for a wiki
to have more than one self prefix (e.g. enwiki has w: en: wikipedia: and
maybe others).

Some recent changes code seems to use $wgLocalInterwiki for quite unclear
purposes:
- I removed the line using $wgLocalInterwiki from the RecentChange
  class, as the 'lang' field of $mExtra is not used anywhere in core code.
  Extensions may use it, but it would seem more appropriate for them to
  use something like $wgDBname (or indeed to consult $wgLocalInterwikis
  directly) if they need to identify a particular wiki.
- In the IRC formatter, the first prefix in the array is used (if set).
  Appropriate documentation is added to DefaultSettings.php.

Related to bug 954 comment 3.

Bug: 954
Bug: 955
Change-Id: I9dbb566385b464402c5e78510b95dd2ffb4d9489
2014-03-12 13:32:07 +01:00
jenkins-bot
aebff73222 Merge "Include the reason when firing the TitleMoveComplete hook" 2014-02-18 11:17:52 +00:00
Sam Smith
6f1061562e Include the reason when firing the TitleMoveComplete hook
As with the ArticleDeletionComplete hook, include the reason for
moving the title (article) when firing the TitleMoveComplete hook.

See I98703f99a47d5786b7a567df954ba09f6d8862ff for a supporting use
case.

Change-Id: I875446dddacff7e5a52a0b6e577e6a46a9ae2e6f
2014-02-17 14:30:15 +00:00
Federico Leva
c2812ac081 Tweak documentation for Title::getLocalUrl
Because I was confused by the docs when I tried to use it.
https://gerrit.wikimedia.org/r/#/c/109945/1/specials/SpecialTranslationStash.php

Change-Id: Ic19704c6a57b633bb5ef1c8a06db9a562e67c6c9
2014-02-15 01:12:05 +00:00
umherirrender
ca7c098134 Use TablePager on Special:ProtectedPages (using log_search)
Adding the pr_id to log_search table and use a join to get the user,
timestamp and comment from the logging table. For logs without the pr_id
a placeholder text is shown.
The code for page protection is changed from a replace to delete/insert
to have for each pr_id a log_id and not reusing pr_ids which was used
for the first protection on a protection change.
The log_deleted field is checked to avoid showing revision deleted data
from the logging table.

This is a alternative patch for
Ie40057398a7829c698df3d68813006798a72dccb
and Iade82653999ca770586762b3c1383f73dfe3a5ee to avoid a schema change
on table page_restriction.
Idea by Aaron Schulz.

Change-Id: Ia0dc5895ec672896fe4b75c2e0f76da2474bd6e4
2014-02-13 20:48:53 +01:00
umherirrender
e11588d604 Remove outdated todo from Title::userCanRead
Was already done with r102187

Change-Id: Iceaceca7cfbd272f7d218c3ad2b9860b746dcac0
2014-02-07 22:24:46 +01:00
Jack Phoenix
cd7b045d1a Fix PHP Fatal error: Call to undefined method Title::getPrefixedTitle().
Apparently certain API action=move requests made it here to trigger the
fatal.

Follow-up to r47039.

Change-Id: I5807ad6278b760d08f84e2fe171c7b0aad80d2f7
2014-02-02 21:28:30 +02:00
jenkins-bot
1f84a574e3 Merge "Improve clarity of diff-multi message" 2014-01-31 17:24:00 +00:00
jenkins-bot
7ed38c8487 Merge "Little change of readability in Title::secureAndSplit" 2014-01-25 00:41:54 +00:00
jenkins-bot
039c0e2677 Merge "More use of Title::hasFragment" 2014-01-24 23:57:41 +00:00
umherirrender
1c1ae05fa2 Add hints to two function comments in Title.php
Change-Id: I47627892c6450396cfb658ddef7617046fdf4209
2014-01-24 22:35:52 +01:00
umherirrender
14e6f7efe1 Little change of readability in Title::secureAndSplit
Move init of mArticleId to bottom, where other fields are filled and
change ternary operator to a simple if for better readability.
Break a double assignment in two statements.

Change-Id: Ib61435e62e883142dd0c5dcb40e0e50e7ca18439
2014-01-24 22:30:33 +01:00