Commit graph

1099 commits

Author SHA1 Message Date
Niklas Laxström
94367450a2 Don't load all languages just to check whether message is known.
I'm pretty sure I already fixed this once in the past.
2011-09-22 14:04:08 +00:00
Aaron Schulz
4068bb0e85 Clear findFile() process cache of file moves (issue came up with bug bug 31056) 2011-09-21 21:32:24 +00:00
Robin Pepermans
3fc94ebd11 Re-do several things of r96798 in preparation of re-doing the rest (there's a bug somewhere that needs fixing).
* Do additional validation and is_array() check in LanguageConverter
* Make redirects be in content language again (remove from Title->getPageLanguage())
* Pass title object from ParserCache to ParserOptions->optionsHash
2011-09-20 15:55:08 +00:00
Niklas Laxström
c49610741d Added LinkCache::addGoodLinkObjFromRow, since addGoodLinkObj is not going to work much longer when new parameters are added 2011-09-20 15:19:18 +00:00
Niklas Laxström
58fb966795 Fixing bug 30973. Strip off subpages when determining the username who the current page belongs to. 2011-09-19 11:49:22 +00:00
Sam Reed
a3d2755660 Revert r91561 2011-09-16 16:55:39 +00:00
Niklas Laxström
c48b41201a Revert r96798 - makes parser go infinite loop somewhere 2011-09-14 11:23:58 +00:00
Niklas Laxström
a8593d6eb1 Fix variable name typo in r96847 2011-09-14 10:00:30 +00:00
Robin Pepermans
f72a9bfe43 * Some documentation
* Use Title->isMainPage() in Article->view()
2011-09-12 21:26:08 +00:00
Niklas Laxström
e7f3210ef3 Start producing new style move log entries 2011-09-12 14:58:41 +00:00
Robin Pepermans
9a6efcc3e4 (Bug 30364) LanguageConverter should depend on the page content language instead of the wiki content language. Remains largely the same, except for extensions using the PageContentLanguage hook like Translate and WikimediaIncubator.
* Made variant tabs hidden on special pages (has no or sometimes wrong/inconsistent effect there; plus it's mainly in the user language)
* Made redirects be in content language again (remove from Title->getPageLanguage())
2011-09-11 17:56:27 +00:00
Roan Kattouw
9d59856a95 Followup r96180: remove unused global $wgCanonicalServer 2011-09-05 10:55:54 +00:00
Daniel Friesen
87e5fc82f8 Followup r96180, I can't believe I did't notice I accidentally killed the hook name.
While I'm at it, add missing $variant parameters to every 'Get*URL' hook in Title.
2011-09-05 08:31:51 +00:00
Daniel Friesen
0b46f1d616 Use wfExpandUrl+PROTO_CANONICAL inside of getCanonicalURL instead of just prepending the url so this does not break on interwiki and action=render 2011-09-03 13:17:55 +00:00
Roan Kattouw
81fcd98a08 In Title::resetArticleID(), clear all entries in the LinkCache instead of just the ones for bad title stuff. resetArticleID() seemed to assume it was only called for titles that come into existance, but that's not correct: it's also called for titles that go out of existence, and titles whose redirect status changes. Noticed this because $nt->getRedirect()'s return value was wrong in my TitleMoveComplete hook. 2011-09-01 09:23:20 +00:00
Daniel Friesen
2b84c8e8e2 Followup r95947, undo accidental revert of r95946. 2011-09-01 08:34:29 +00:00
Roan Kattouw
082a5fa6e1 Fix indentation in r95396 2011-09-01 08:21:50 +00:00
Daniel Friesen
3f37423e4e Add Title::isSubpageOf to use when you want to make tests like $title->isSubpageOf( $someUserpage ); 2011-09-01 07:49:37 +00:00
Sam Reed
3e928b4d33 Tidy up w/c
Remove trailing whitespace, add some documentation
2011-08-31 14:47:08 +00:00
Roan Kattouw
41ac01dfc8 Followup r95753 per CR: prevent extensions from making isMovable() return true for interwiki titles and immovable namespaces 2011-08-31 12:18:02 +00:00
Roan Kattouw
6f1fee123b Fix a message key typo in r41961 (!!), which didn't matter before because the relevant code (and the message) wasn't reachable. 2011-08-30 11:39:43 +00:00
Roan Kattouw
89a7657063 Add TitleIsMovable hook so extensions can create new namespaces in which pages can't be moved. RL2 needs this for the Gadgets_definition namespace 2011-08-30 11:21:24 +00:00
Roan Kattouw
7e15b7c97d Fix bug in r94995: getCanonicalUrl() doesn't append the fragment. This is correct behavior for getInternalUrl() (which the code was based on) but not for getFullUrl() (which is what I'm swapping getCanonicalUrl() in for in certain places). Was exposed by a unit test in CodeReview breaking on me when I tried to use canonical URLs in e-mail notifications. 2011-08-28 15:15:42 +00:00
Platonides
061f4f07a6 Unused variables.
$wgContLang in CategoryPage was probably removed with the better directionality improvements.
$wgServer, $wgRequest in getFullUrl() unused since r94375
Other variables added in r95396 iwtransclusion merge.
2011-08-27 18:28:04 +00:00
Raimond Spekking
058fb12307 fu r95396 Fix function name 2011-08-27 08:26:08 +00:00
Happy-melon
d00052ebde Undo r85392 ('revert' is a strong word since a lot has changed in the intervening ten thousand revisions, but the effect is the same). 2011-08-25 21:03:52 +00:00
Sam Reed
44020e254c Merge the iwtransclusion branch back into trunk
Hexmode fixed broken unit tests in revisions after last time
2011-08-24 13:03:03 +00:00
Roan Kattouw
fbc65f8972 Per CR on r44412 and my promise in the commit summary of r94990, stop abusing $wgInternalServer (intended for Squid URLs) for IRC/e-mail URLs and introduce $wgCanonicalServer for these purposes instead. This revision introduces two new hooks for WMF hacks, in exchange for making the core code saner.
* Introduce $wgCanonicalServer, which should typically be a fully qualified version of $wgServer but in practice can be anything that you'd like to be used in IRC/e-mail notifs
** Default value is $wgServer, expanded to http:// if protocol-relative
** This means you can easily set HTTPS as the 'default' protocol to use in IRC and e-mail notifs by setting $wgCanonicalServer to https://example.com
* Introduce Title::getCanonicalURL(). Similar to getInternalURL(), including a hook for WMF usage (which will be needed as long as secure.wikimedia.org is used)
** Also add escapeCanonicalURL(). Due to some ridiculous accident of history, the other escapeFooURL() functions don't have a $variant parameter; I decided not to follow that bad example
* Reinstate the spirit of r44406 and r44412: instead of calling getInternalURL() (or getCanonicalURL()) and regexing the title parameter out, obtain the path to index.php using $wgCanonicalServer . $wgScript and append params to that. Sadly, we need to add a hook here to support the secure server hack for WMF, but that's the price of saner code in this case
* Introduce the {{canonicalurl:}} and {{canonicalurle:}} parser functions, which work just like {{fullurl:}} and {{fullurle:}} except that they use getCanonicalURL() instead of getFullURL()
* Use {{canonicalurl:}} in the enotif_body message, fixing bug 29993 (protocol-relative URLs appear in e-mail notifications)
2011-08-19 11:23:17 +00:00
Roan Kattouw
3b35a3d2ec Followup r94754: move protocol expansion from getIRCLine() to inside getInternalUrl(); these internal URLs should always be fully qualified. Effectively this means that if $wgServer is protocol-relative and $wgInternalServer either isn't set or is also protocol relative (but it really shouldn't be the latter!), we'll add http:// to URLs used for Squid purging and in IRC lines. If people want those to be https:// instead, they can set $wgInternalServer accordingly.
We should really, really break the connection between internal URLs used for Squid purges and URLs used for IRC, and use the latter in e-mails as well. This was briefly discussed in the CR comments on r44412 and I'll be working on that today.
2011-08-19 08:56:39 +00:00
Sam Reed
afa82f68b2 * (bug 30450) Clear page_props table on page deletion
Also clear them on a move over redirect

Modified delete() calls in doDeleteArticle to pass __METHOD__ for the function name
2011-08-18 23:37:04 +00:00
Alexandre Emsenhuber
77a3987052 Moved wfGetIP() to WebRequest::getIP():
* Changed all calls in core to the latter
* Also marked wfGetForwardedFor() as deprecated
* Moved wfGetIP() tests to WebRequestTest
2011-08-18 20:03:30 +00:00
Daniel Friesen
14f758d2c1 Followup r94375; Use PROTO_RELATIVE so that when $wgServer is a protocol relative url we don't potentially polute the cache if getFullURL is called by an extension that outputs to cache. getFullURL includes a #fragment so it's more likely that extensions outputting urls in situations that don't support protocol relative urls are using getLocalURL and expanding it. 2011-08-14 14:07:12 +00:00
Daniel Friesen
17289de2db Touch up Title::get[Full|Local]URL. This concept of "if not an existing interwiki getFullURL calls getLocalURL" and "if external (interwiki) getLocalURL calls getFullURL" is ridiculous. In fact if mInterwiki just happens to not be '' and not exist, you create infinite recursion and php dies.
Instead of having getFullURL and getLocalURL call each other, move the interwiki workload into getLocalURL, and make getFullURL simply call getLocalURL then expand it (use the wf method in case it's already a full url) and append the fragment to it.
2011-08-12 19:55:03 +00:00
Daniel Friesen
0139030f2b Improve the ability for extensions to participate in how MediaWiki handles url paths:
- Allow extensions to hook into WebRequest::getPathInfo and add to or alter the way titles are extracted from paths
- Add a $variant argument to the GetLocalURL hook; It's always had $query, but never had $variant. As a result extensions using GetLocalURL never new if getLocalURL and have the possibility of trying to change the url in cases where they shouldn't and as a result breaking links on wiki with language variants.
- Add GetLocalURL::Internal hook for non-interwiki links. These kinds of links internally use a ugly hack for action=render and an extension using GetLocalURL can be buggy in render mode if they don't re-implement the same ugly hack that MW does. This ::Internal hook runs before the hack does so extension authors don't need to be exposed to our ugly hacky code.
- Add GetLocalURL::Article hook specifically for url tweaks to pretty urls (ie: Only when we would apply $wgArticlePath); This hook avoids the need for extensions that only want to tweak pretty url output. This hook avoids the need to make a bunch of tests for things like !$title->isExternal(), $query == '', and $variant === false which getLocalURL does and could potentially change in the future making wider GetLocalURL hooks change in function requiring extension updates.
2011-08-12 19:23:43 +00:00
Daniel Friesen
d5dfd2b066 Update Interwiki::getURL's first argument so that it's properly urlencoded when replacements are made.
Scanning all of core and all the extensions we have in svn, it doesn't look like anyone makes any calls to Interwiki::getURL using the argument so this should be safe enough to clean up the api.
Also update Title::getFullURL to make use of the first arg now.
2011-08-12 14:10:37 +00:00
Victor Vasiliev
d636fac2d8 Allow extensions to add pages with non-wikitext display by adding two new
hooks (generalizing the code already used for CSS/JS pages).
2011-08-11 17:21:31 +00:00
Robin Pepermans
3bb3e4793c Add 2 @since and add documentation for PageContentLanguage hook 2011-08-11 14:52:57 +00:00
Aaron Schulz
9d9b5af04d Made moveToInternal() check result of Article::insertOn (related to bug 26223) 2011-08-10 18:32:22 +00:00
Chad Horohoe
9787928b47 Reverting r84309 (New pages log doesn't remove/update item after suppression redirect). Per the patch author and committer's own admission, this doesn't seem like the correct fix. I haven't dug into it deeply, but I tend to agree. Reverting to the status quo rather than have this make it into a release half-baked. Reopening bug 17463 so this can get some more discussion (also this definitely needed RELEASE-NOTES) 2011-08-05 17:03:35 +00:00
Roan Kattouw
7ed75c87ca Introduce a hook so extensions can customize what's considered to be a CSS/JS page. This is needed for the Gadgets extension in the RL2 branch 2011-08-02 15:40:27 +00:00
Sam Reed
183d2dab37 Back out r93533, r93531, r93530
Breaks unit tests as below, not going to be able to fix them before I disappear for the evening, so might aswell leave trunk clean

ArticleTablesTest testbug14404

Error:
ArticleTablesTest::testbug14404
Undefined offset: 0

/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/ArticleTablesTest.php:31
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60

ParserTests testParserTest #552 - testParserTest with data set #551

Failure:
ParserTests::testParserTest with data set #551 ('RAW magic word', '{{RAW:QUERTY}}', '<p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
</p>', '', '')
RAW magic word
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-<p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
+<p><a href="/index.php?title=Template:RAW:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:RAW:QUERTY (page does not exist)">Template:RAW:QUERTY</a>
 </p>

/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/parser/NewParserTest.php:545
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60
2011-07-30 15:56:54 +00:00
Sam Reed
dc9d39887e Merge iwtransclusion branch into trunk 2011-07-30 15:30:01 +00:00
Aaron Schulz
d4337ba10e * Follow-up r93093: set the touch key for page moves too
* Tweaked related WikiPage.php comments
2011-07-29 16:44:22 +00:00
Roan Kattouw
f450e4eb8c Revert r93237 ("use User::getBlock() accessor rather than accessing $mBlock directly ..."): breaks a test (specifically TitlePermissionTest::testUserBlock()). From what I can tell it looks like the test case is expecting the text of the infinite-block message, but got a Message object instead 2011-07-27 22:28:59 +00:00
Happy-melon
bd8da57b32 Follow-up r93234: use User::getBlock() accessor rather than accessing $mBlock directly. Also fixes r85951 CR, and remove code duplication in Title::checkUserBlock(). 2011-07-26 19:58:26 +00:00
Alexandre Emsenhuber
b5af0466b2 * Made Skin::userCanPreview() use Title::getUserPermissionsErrors() instead of Title::userCanEditCssSubpage() and Title::userCanEditJsSubpage() so that the checks are the same as EditPage's ones
* Marked Title::userCanEditCssSubpage() and Title::userCanEditJsSubpage() as deprecated since these were the lasts calls to that functions (core and extensions)
* Get the action parameter from Skin::userCanPreview() instead of requesting it from the callers
2011-07-21 10:37:43 +00:00
Alexandre Emsenhuber
799e813a61 Make Title::isNamespaceProtected() require the $user parameter, the only call to it is in the file itself 2011-07-20 16:49:02 +00:00
Platonides
0391f16560 Follow up to r91561: Use the canonical class names. 2011-07-19 19:00:09 +00:00
Bryan Tong Minh
1fb5d73612 First steps for bug 14801: add backend support for per-namespace permissions to core. This extends $wgGroupPermissions syntax from $wgGroupPermissions[$group][$right] = bool to $wgGroupPermissions[$group][$right] = array( NS_X => bool ). This is safely backwards compatible; the booleans are still fully supported, and any unset namespace will default to false.
* User::getRights(), User::isAllowed() and User::getGroupPermissions now optionally accept a namespace parameter. If not set, it will check whether the user has the right for all namespaces.
* Anything that uses Title::getUserPermissionsErrorsInternal() automatically supports per-namespace permissions. This includes Title::getUserPermissionsErrors and Title::(quick)UserCan.
* Fix tests that set User::mRights

The next step would be to change all User::isAllowed() to Title::quickUserCan or pass the namespace to User::isAllowed().
2011-07-16 16:09:00 +00:00
Ryan Kaldari
781517571b better method descriptions 2011-07-15 17:54:50 +00:00
Brian Wolff
5ce6ddebb4 (Bug 19725) Do not include suppressed edits in the "View X deleted edits" message, and when doing prefix search of special:undelete.
I'm not 100% sure this is the right thing to do, see the bug for the details. But basically this doesn't include an edit in the count if its text is hidden and its hidden from admins. (Not sure if it should not be included only if everything is hidden). Its also weird to show people different things depending if they have suppress rights, without really indicating that.

Minor db note: This causes the query to no longer use a covering index. I don't think that matters but just thought i'd mention.

p.s. The upload page show deleted edits link is broken right now, (from before) I'll fix in a follow-up.
2011-07-06 16:47:29 +00:00
Brian Wolff
bf1df55887 (bug 29680, bug 22911) Add GetDeaultSortkey hook in order to override default sortkey used on pages (default is {{PAGENAME}})
Some people want it to default to subpage or to fullpagename this hook would let
them do what they want :)
2011-07-06 00:38:40 +00:00
Aaron Schulz
893d84b6aa * Fixed getLatest() check in Article
* Added Title::loadFromRow() function and made WikiPage::loadPageData() use it; avoids raw Title field accessing
* Added Revision::newFromPageId() function and changed WikiPage::loadLastEdit() to use it. This makes it try a slave first instead of always hitting the master. It also makes it more consistent with getLatest() for sanity.
* Made WikiPage::loadPageData() use accessor for Title::mRestrictionsExpiry
2011-07-01 23:33:34 +00:00
Alexandre Emsenhuber
e7eaf43077 Added some GPL headers 2011-06-28 18:21:59 +00:00
Robin Pepermans
9f9047290f Directionality and language improvements as part of bug 6100 (under $wgBetterDirectionality):
* Make TOC numberings be in the page content language instead of wiki content language.
* Update getPageLanguage() and add a hook (for bug 9360/28970).
* Show redirects (when viewing a page with &redirect=no) in the user language direction (not essential but nicer imo).
2011-06-24 22:10:39 +00:00
Robin Pepermans
b05ae5eacf Per comment by Platonides on r90337: use wfGetLangObj() instead of Language::factory() and this->mPageLanguage is not needed 2011-06-21 09:45:06 +00:00
Platonides
2879cc3890 Use [] instead of { } for accessing string characters 2011-06-19 21:05:26 +00:00
Robin Pepermans
ca6fcb7e3f Address comment by Platonides on r90320:
* undefined variable $list in CategoryPage.php
* move code in ParserOptions to a new member of Title class, which falls back to $wgContLang
2011-06-18 14:49:01 +00:00
Sam Reed
8bfd19b451 Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits (3/3), so hopefully reviewable in CR...
2011-06-17 16:05:35 +00:00
Sam Reed
5749cfa480 * (bug 21107) Split error "customcssjsprotected" into separate messages for JS and CSS 2011-06-05 18:29:43 +00:00
Brion Vibber
c37da68754 Revert r87964: destroyed standard segregation of non-view action links outside of $wgArticlePath, which would have created huge extra search spider traffic to sites and put more bogus URLs into indexes.
This also reverts some convenience functions that were being added at the same time (??) to attempt to parse local links from JS.
2011-05-23 19:03:17 +00:00
Krinkle
eb359ba901 Adding fixme note for bug 29088. 2011-05-22 10:40:57 +00:00
Sam Reed
e514478ba5 Fix function level comments that start with /* not /** 2011-05-21 19:35:16 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Antoine Musso
efd83c55fc merge in prettyURL patch
This is basicly a merge of r84386 & r84491, see their commit messages for
more details.

r84386 makes wikilinks nicer by updating the URL forge implemented by r2621
r84491 fix an issue with the (un)?watch links. getParamValue should not be
used to guess 'title' or 'action'
2011-05-13 11:41:17 +00:00
Aaron Schulz
888e7790a8 (bug 28667) "old title gets two review log entries after move". Fixed this by firing the revisionfromedit hook on the new title, which makes a bit more sense. 2011-05-07 10:24:38 +00:00
Aaron Schulz
80aa7b5d63 Notice: Use of undefined constant GAID_FOR_UPDATE - assumed 'GAID_FOR_UPDATE' in D:\www\MW_trunk\phase3\includes\Title.php on line 3085 2011-05-07 09:55:18 +00:00
Sam Reed
f985524076 More versions added to @deprecated tags
Couple of inbound calls fixed up

Some ancient code removed as it's been marked deprecated
2011-05-06 21:50:18 +00:00
Paul Copperman
83d79be8da Fix Bug 28354: Edit tab is shown as "view source" for blocked users, which breaks squid caching
* Skip user block checks for Title::quickUserCan(). This restores the behavior from 1.16 rsp. before r65504.
* Remove unnecessary check for "$short && count($errors)", this is already handled by getUserPermissionsErrorsInternal().
2011-05-03 13:18:57 +00:00
Sam Reed
9566baf112 Followup r86367, don't make constructor protected just yet, few underlying callers still about
Need a way to do a blank title without using the constructor (Title::newBlank() maybe?)

* (bug 28608) Fatal error: Call to protected Title::__construct()
2011-04-19 10:40:32 +00:00
Sam Reed
0bf458ec62 Apply phase3 related Title fixes. With one minor addition, Title constructor marked as protected, "just in case"...
Patches by Yuvi Panda

From (bug 28583) Remove all /* private */ declarations in MediaWiki core
2011-04-18 23:20:21 +00:00
Happy-melon
b7e2cdba69 (bug 28583) chase down and beat to death external calls of functions marked /*private*/, and make those declarations actually binding. Patch by yuvipanda. 2011-04-18 19:03:14 +00:00
Happy-melon
1a80d46370 Rename Special:Resetpass to Special:ChangePassword. "pass" is vague and unintuitive, "reset" is only half of the page's function, and I'd quite like "Special:ResetPassword" for a much cleaner implementation of the 'enter-something-to-be-sent-a-reset-email' interface for bug 28244, bug 13015, etc. Diff looks much worse than it is because I had to update 95 language files... 2011-04-17 20:29:24 +00:00
Happy-melon
2c9cfd7cce Refactor the factory/i18n/list/etc static methods from SpecialPage into their own class; there's no reason we need to be parsing them in every single SpecialPage subclass. Leave all the methods as stubs in SpecialPage.php; if we required PHP 5.3 they could be replaced by a a __callStatic() magic method, but that doesn't work on PHP 5.2.
Also make a few changes to the functions available.  SpecialPageFactory::resolveAlias() now takes an optional subpage and returns array(<name>,<subpage>).  Similarly merge getPage() and getPageByAlias().  There were many examples of (extensions particularly) making dubious assumptions about the presence or absence of subpages or canonical-ness.

I didn't deprecate SpecialPage::getTitleFor() as it's got over six hundred calls.  I'm rather undecided on the best position of getPage()/executePath().  Although the latter needs cleanup anyway.
2011-04-17 11:31:11 +00:00
Niklas Laxström
635334ba0b Move $rxTc initialization next to where it is used 2011-04-14 11:37:03 +00:00
Paul Copperman
f7e6dfb4a3 Various fixes for PHPUnit tests:
* Block.php: Set mExpiry to the value we store in the database, so that Block::equals() returns true. Fixes BlockTest::testInitializerFunctionsReturnCorrectBlock.
* In Title::checkUserBlock(): Convert message parameters to plain strings to make strict comparisons work. Fixes TitlePermissionTest::testUserBlock().
* ApiBlock.php: Follow-Up r85166, add 'Confirm' parameter to data array. Fixes ApiBlockTest::testMakeNormalBlock().
* ApiQueryTest.php: Use $wgMetaNamespace instead of $wgSitename	to account for customizations.
* RandomImageGenerator.php: Use default value for constructor param to prevent fatals.
* ApiTestCaseUpload.php: 
** Fix undefined variable $fileName.
** Remove stray ini_set statements, they don't belong there. Especially ini_set( 'error_reporting', 1 ) will effectively disable all reporting, which makes errors hard to track.
* ArticleTablesTest.php: Put testbug14404() in group Broken, as the fix for the bug has been reverted in r83868.
2011-04-07 14:54:38 +00:00
Platonides
c6c92be5c6 Revert r68358. Causes bug 27474.
Added parser test. Added another parser test for what it seems to try to account for 
but that in fact doesn't change when trying to achieve, since ids don't seem to be 
affected when flipping $wgHtml5 and $wgExperimentalHtmlIds (so r68358 seems useless).
2011-04-05 22:38:37 +00:00
Aaron Schulz
624dfd884e * Cleanups to getFirstRevision and getEarliestTime
* Rewrote countRevisionsBetween/countAuthorsBetween to avoid assuming rev_id is in chronological order
* Made countAuthorsBetween use $limit+1 automatically for convenience; updated callers
2011-04-05 20:42:45 +00:00
Happy-melon
5fc6bb9f16 Fix for catchable fatals thrown on invalid titles, follow-up to miscellaneous Context commit pulled out of a hat (let's go for r85252). We must always have a Title object, even on invalid titles, for the purposes of not melting the Skin. The previous method was to make that a barely-existent half-title from SpecialPage::getTitleFor( 'Badtitle' ), where that is a special page which is not actually defined, but exists in the localisation alias lists. Instead, subclass Title as an explicit BadTitle which we can test for. The badtitle error page, which has empty string for its name in all forms, would probably be quite a good test of our JavaScript error checking. 2011-04-04 23:09:21 +00:00
Tim Starling
7bb50c630a The beginnings of HipHop compiled mode support. It works now for parser cache hits.
* Work around HipHop issue 314 (volatile broken) and issue 308 (no compilation detection) by adding some large and ugly compilation detection code to WebStart.php and doMaintenance.php.
* Provide an MW_COMPILED constant which can be used to detect compiled mode throughout the codebase.
* Introduced wfIsHipHop(), which detects either compiled or interpreted mode. Used this to work around unusual eval() return value in eval.php.
* Work around lack of ini_get() in Maintenance.php, by duplicating wfIsHipHop(). 
* In Maintenance::shouldExecute(), accept "include" as an inclusion function name, since all kinds of inclusion give this string in HipHop.
* Introduced new class MWInit, which provides some static functions in the pre-autoloader environment.
* Introduced MWInit::compiledPath(), which provides a relative path for invoking a compiled file, and MWInit::interpretedPath(), which provides an absolute path for interpreting a PHP file. Used these new functions in the appropriate places.
* When we are running compiled code, don't include files which would generate duplicate class, function or constant definitions. Documented the new requirements on the contents of Defines.php and UtfNormalDefines.php.
* In HipHop compiled mode, it's not possible to have executable code in the same file as a class definition. 
  ** Moved MimeMagic initialisation to the constructor.
  ** Moved Namespace.php global variable initialisation to Setup.php.
  ** Moved MemcachedSessions.php initialisation to the caller in GlobalFunctions.php.
  ** Moved Sanitizer.php constants and global variables to static class members. Introduced an accessor function for the attribs regex, as a new place to put code formerly at file level. 
  ** Moved Language.php initialisation of $wgLanguageNames to Language::getLanguageNames(). Removed the global variable, marked "private" since forever.

* In two places: don't use error_log() with type=3 to append to a file, HipHop doesn't support it. Use file_put_contents() with FILE_APPEND instead.
* Work around the terrible breakage of class_exists() by using MWInit::classExists() instead in various places. In WebInstaller::getPageByName(), the class_exists() was marked with a fixme comment already, so I replaced it with an autoloader solution.
2011-04-04 12:59:55 +00:00
Happy-melon
33534edfbd (bug 15641) tweak Title::checkUserBlock() so that Title::getUserPermissionsErrors() more comprehensively prevents blocked users from performing various actions; particularly prevents blocked admins from protecting or deleting their own talk page. 2011-03-30 12:53:13 +00:00
Brian Wolff
2d64c69910 (follow-up 79778) Make $wgLang->truncate function consider the length of the ... (ellipsis message) in the truncation length.
The length of this message varries by localization, so the previous solution of telling truncate to truncate 5 bytes
less than needed is not good since this will be too little or too much.

Updated places where its used. Some places I left as is, as it looked like the new behaviour would work fine for them to.
(for example, the autosummary feature - it was cutting off at 200 bytes, which is no where near 250 limit, so I presume that
was for asethic reasons rather then to fit as much in before the db limit).

Will do another commit for extension callers in a moment.
2011-03-24 02:54:11 +00:00
Sam Reed
6d355786d5 Fix variable typo introduced in r83282 2011-03-21 21:26:16 +00:00
Happy-melon
6dbcdc1be0 Blame hashar for this giant commit; he teased me for making so many smaller ones earlier... :D
* Internalise $mAddress/$mUser, $mBy/$mByName, $mEnableAutoblock, $mId as getTarget(), getBlockers(), isAutoblocking(), getId().  
* This required editing AbuseFilter and CheckUser backwards-incompatibly, so push the rest of the changes out to those extensions.
* Attack the evil 14-parameter constructor and gratuitously-confusing newFromDB( $notVeryImportantParameter, $moreImportantParameter)
* Reimplement the hack for bug 13611 in a slightly less fragile fashion; could still do with further cleanup, but then again the login frontend is its own can of worms... :S
* Remove transitionary getTargetAndType() and newFromTargetAndType() methods
* Some optimisation in parseTarget()
* Fix the broken phpunit test mentioned in r84251
2011-03-21 19:12:41 +00:00
Platonides
5755b84aa2 (Bug 26223) Concurrently moving an article to different titles leaks a redirect revision with no page.
Just the GAID_FOR_UPDATE fixes the issue in my tests, but without the transaction there's still potential for inconsistencies.
2011-03-21 16:46:17 +00:00
Aaron Schulz
91fb54d0f9 Reverted r84386; breakage too severe 2011-03-20 21:30:24 +00:00
Antoine Musso
5da14533aa Makes wikilinks nicer when possible
This patch mostly impact Title:getLocalUrl() with two changes:

1) Abstraction:

$wgActionPath related code is now in Title::resolveActionPath(). It now
interprets query parameters using an array which is easier to read than
playing with a regexp and the evil $matches[].


2) Tweaking:

Change the 7 years old (r2621) URL forge:
  "{$wgScript}?title={$dbkey}&{$query}"
  => /w/index.php?title=FOO&q=2

To a nicer
  "str_replace( '$1', $dbkey, $wgArticlePath )"
  => /wiki/FOO?q=2


Additional changes:

* Parser tests were modified to reflect the changes.
* PHPUnit TitleTest amended to test getLocalUrl() (add more!!)
* When using wgActionPaths, makes sure the 'view' action is a sane default
2011-03-20 14:57:49 +00:00
Mark A. Hershberger
bd3be62048 Fix for Bug# 17463: New pages log doesn't remove/update item after suppression redirect
Except for some whitespace changes, this is Baowolff's patch from http://bug-attachment.wikimedia.org/attachment.cgi?id=8312 which I am applying in the spirit of “apologize later”.

Baowolff writes:

    Don't show new page entries in Special:newpage for supressed redirects.

    Patch to remove the new page entry from Special:RecentChange and
    special:newpages, if the new page gets moved with redirect supressed.


    I'm not a 100% sure this is a good idea. This will only suppress the initial
    new page line in the RC (And newpages), and won't supress any other edits to
    the page. Does this behaviour really make sense? (Thats not rhetorical). It
    seems somewhat different from deleting a page, where none of the content is
    relevent, but when you move a page, the edits don't go away, they're just in a
    new title.

    I suppose we could just change the new page entry in the RC to point to the
    other page, but that seems rather wrong too.

    So anyhow, not sure what the right approach is.
2011-03-19 04:24:15 +00:00
Happy-melon
91e7b5a93c More cleanup in Block.php. Push Block::encodeExpiry() and Block::decodeExpiry() deeper into the callstack, to DatabaseBase for encode and Language for decode. The vast majority of callers of these functions are not handling block expiries, but expiries generally, particularly page protections. 2011-03-18 19:15:56 +00:00
Happy-melon
81852ea1a6 Allow User::isAllowed() to take varargs. "is allowed X or Y" is by far the more common multiple permission check in core, so this is now the behaviour of isAllowed( X, Y ); also add isAllowedAll(...) for testing "is allowed X and Y". Has the nice side effect of adding visibility to a very old function. 2011-03-18 14:48:21 +00:00
Brian Wolff
7b82b3fd24 (bug 28020) Moving pages causes the cl_sortkey thats appropriate for one of the categorylinks, to be set for all of them.
But the cl_sortkey_prefix are kept to the right value for the cl_sortkey's that are set to the wrong value, totally messing things up.

End result is: Have a page, with some categories having different sortkeys, move that page, now all the categories have the same
sortkey, but still have their original prefix, so linksupdate things the sortkey is correct. End result is null edits don't fix
the sortkey, nothing but removing and re-adding category will reset sortkey to correct value.
2011-03-14 02:19:28 +00:00
Happy-melon
3d161feebf Follow-up r83755: @deprecated @since is wrong, doesn't have the expected semantic meaning. 2011-03-12 18:14:33 +00:00
Tim Starling
8411b6df62 Set $wgInternalServer to false by default, and fall back to $wgServer in the referring code. This avoids having squid updates break when $wgServer is set in configuration but $wgInternalServer is neglected. For immediate deployment, tested locally. 2011-03-08 06:38:15 +00:00
Alexandre Emsenhuber
2c6fdc8051 * NS_SPECIAL should not have any applicable restriction type
* Removed some trailing whitespaces
2011-03-05 19:49:24 +00:00
Bryan Tong Minh
4c043d581d Follow-up r83282: Re-add the lost $this->getNamespace() == NS_FILE, forgot to test the code for normal pages. 2011-03-05 14:47:11 +00:00
Bryan Tong Minh
3e44674229 Move the file related parts of Title::isValidMoveOperation to its own function, Title::validateFileMoveOperation 2011-03-05 14:44:28 +00:00
Alexandre Emsenhuber
e325245df7 Missing line break in wfDebug() call 2011-03-01 08:55:13 +00:00
Sam Reed
e1f5c11aee More bits of documentation 2011-02-27 15:23:41 +00:00
Bryan Tong Minh
48b63f4bb0 Follow-up r82853: Filter out create restriction from SpecialProtectedPages and Api. Added Title::getFilteredRestrictionTypes() for this purpose. 2011-02-26 16:29:48 +00:00
Bryan Tong Minh
f664cf10ef (bug 27700) The upload protection can now also be set for files that do not exist.
Sort of follow-up to r79655, adds create to $wgRestrictionTypes in DefaultSettings.php as well and removes it when not applicable.
2011-02-26 13:51:46 +00:00
Ryan Schmidt
6bac96af7e * random redirect-related fixes:
** automatically add redirect=no to all links on the redirect page in Article::viewRedirect.
** properly check if redirects are enabled if $wgMaxRedirects < 1 (moved check from Title::newFromRedirectArray to Title::newFromRedirectInternal).
2011-02-22 16:39:17 +00:00
Niklas Laxström
7694c67c99 * (bug 17160) Gender specific display text for User namespace
Second attempt for this thing..
2011-02-12 20:40:40 +00:00
Mark A. Hershberger
b4cee86beb w/s fixups 2011-02-12 04:06:22 +00:00
Brion Vibber
0344a7787e * (bug 27333) Fix repetitive last-seen time queries on page history
Title::getNotificationTimestamp() is called for every line in HistoryPager, to compare against the revision's timestamp to determine if it's a new edit since the viewer's last visit to the page.
The function kept an internal cache within the Title object to avoid having to make the query over and over in this situation, but in the case that it returns null, the cached entry would be accidentally ignored on the next round due to use of isset() to check for the array entry. (Most of the time it's great, but if the value of the key actually *is* null, isset() returns false.) Switched to array_key_exists(), which doesn't have this false negative. Now only one query gets issued for this on a history page, even if the answer is null.
2011-02-12 01:10:48 +00:00
Platonides
49074e8a56 Yet more additions of wfProfileOut() 2011-02-10 16:39:53 +00:00
Alexandre Emsenhuber
136f4c06fa Deprecated wfMsgWeirdKey(), use wfMessage() instead. Moved getDefaultMessageText() from Article to Title so that it can be used there instead of duplicating code. No usage in extensions. 2011-02-05 15:11:52 +00:00
Happy-melon
e6e9b4ea20 Follow-up r79682: more documentation tidying 2011-02-02 11:00:09 +00:00
Platonides
82eab17c16 Update comments to take into account r80443 and r80614 changes, per CR. 2011-01-28 22:27:52 +00:00
Sam Reed
728dc12f64 Fixup query fail from r80936 2011-01-26 23:13:20 +00:00
Sam Reed
7d1e4bef11 Followup fixme on r80861,
Do cl_from <> 0 check not in SQL, remove order by.

Fixup casing error noticed also
2011-01-26 20:03:38 +00:00
Alexandre Emsenhuber
51c6afc751 * Replaced $wgMessageCache by MessageCache::singleton(); since we only use one instance of this class (as for ParserCache, LinkCache)
* MessageCache::singleton() calls wfGetMessageCacheStorage() directly instead of using $messageMemc, just in case this would be called before that variable is set
* Per TimStarling: also removed deprecated methods in MessageCache class: addMessages() and related, [get|set|enable|disable]Transform(), loadAllMessages(), loadMessageFile() and some others. Same for the legacyData stuff in LocalisationCache that was only used by MessageCache::addMessages() and related. 
* Converted remaining extensions
2011-01-26 15:42:04 +00:00
Sam Reed
2e7a059abb Fixup usage of raw sql in Title
Followup r80856, add missing __METHOD__
2011-01-24 15:30:35 +00:00
Sean Colombo
93763f9759 Minor fix to capitalization in some documentation. 2011-01-23 01:59:24 +00:00
Tim Starling
e00465ab66 In getCategorySortkey: strip tabs and line feeds from the user-supplied category sort key, to avoid conflicts with our usage of LF. In UCA, tab is the only character that can sort above LF. 2011-01-20 05:18:39 +00:00
Tim Starling
eaeea84b44 * Introduced a non-dummy collation for $wgCategoryCollation, namely UCA with default tables.
* Added a maintenance script which generates a list of first letters. Unified Han are omitted for performance, and because they shouldn't be used as headings anyway. A future collation specific to Chinese would provide the KangXi radicals as "first letters".
* Provided a precomputed list of first letters. Used Unicode 6.0.0 data and ICU 4.2. 
* Moved collation functionality from Language to a Collation class hierarchy with factory function. Removed the recently-added methods from Language and updated all callers.
* Changed Title::getCategorySortkey() to separate its parts with a line break instead of a null character. All collations supported by the intl extension ignore the null character, i.e. "ab" == "a\0b". It would have required a lot of hacking to make it work.
* Fixed the uppercase collation to handle non-ASCII characters, redundantly with r80436. I don't think it's necessary to change the collation name as was done there, so I reverted that in the course of my conflict merge. A --force option to updateCollation.php might be nice though.
2011-01-17 14:02:22 +00:00
Daniel Friesen
2f933fedba Fix bug 14267 by adding support for a MediaWiki:Mainpage-nstab.
Additionally, *cough* *cough*:
* Add a Title::isMainPage helper for the fairly common $title->equals( Title::newMainPage() ); test.
* Update wfMessageFallback to also accept an array of message keys instead of requiring them listed as arguments to the function.
* Move the bulk of wfMessageFallback code into Message.php instead of leaving it in GlobalFunctions.php
* Change the wfMessageFallback implementation so that the Message class handles the fallbacks themselves eliminating any side effects caused by the fact that wfEmptyMsg always used usedb=false, language=userlang when one might actually use a different language or usedb setting in the message object that actually returned the text (this may be considered a wfEmptyMsg regression in 1.18).
* Make blank "" message contents fallback like nonexistant messages do.
* Re use the new tabAction array handling used to support mainpage-nstab in the talk and view tabs instead of making wfEmptyMsg calls directly in SkinTemplate.
2011-01-14 08:32:10 +00:00
Platonides
f8135c6487 Follow up r79759. Title::loadRestrictionsFromRows called by LiquidThreads 2011-01-06 22:19:42 +00:00
Platonides
f5543bfa3f Address my r76242 fixme.
Remove invalidateTitleProtectionCache().
Set $mTitleProtection to the proper value when we change it instead of forcing a reload via the protected_titles table.
Make Title::loadRestrictionsFromRows() private since it is only called by the private loadRestrictionsFromResultWrapper() and nobody should be fiddling with such title internals anyway	 (follow up to r54527).
Removed the invalidateTitleProtectionCache() from getCascadeProtectionSources() since that function only deals with titles which do exist. There's nothing to invalidate there.
2011-01-06 21:26:20 +00:00
Happy-melon
52ffdb9d1c Documentation format 2011-01-05 23:08:13 +00:00
Bryan Tong Minh
c425479416 Follow-up r79655: array_diff makes in_array unnecessary 2011-01-05 19:58:09 +00:00
Bryan Tong Minh
718ff89310 (bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected pages to be queried via the API and Special:ProtectedPages, and allowing disabling upload protection by removing it from $wgRestrictionTypes. 2011-01-05 19:17:36 +00:00
Ilmari Karonen
6c9c1a2caf merge the nearly identical Title::moveToNewTitle() and Title::moveOverExistingRedirect() to a single Title::moveToInternal() method 2011-01-03 20:32:04 +00:00
Brian Wolff
ff5394caed (Bug 26410) In an internal link, a plus sign is treated as a space if the link
has a % sign in it, but interperted as a + if no % sign is present.

This changes how the parser interperts links slightly. However:
*I can't imagine anyone is relying on this behaviour
*Things should be consistent. a + sign shouldn't magically change meaning
if there is a % sign somewhere else in the link.
*Pages are allowed to contain % signs in their title, and + signs,
you should be able to link to such pages just by typing there name without
resorting to %2B.
*If you have a page named foo%+ having [[{{PAGENAME}}]] link to a different
page seems inherently wrong.
*The previous behaviour seemed accidental.
2010-12-24 09:53:08 +00:00
Aaron Schulz
2358734b63 Fixed doc 2010-12-17 05:14:50 +00:00
Alexandre Emsenhuber
bfe73169d9 Checking namespace restriction with $wgUser while calling Title::getUserPermissionsErrors() with anoter User object is really not a good idea 2010-12-13 22:33:08 +00:00
Alexandre Emsenhuber
afdace4b91 Fix comment: Article::insertNewArticle() -> Article::doEdit() and Article::insertOn() 2010-12-13 15:16:05 +00:00
Roan Kattouw
03d31a07fa Redo r78254 without the syntax error 2010-12-12 16:18:08 +00:00
Platonides
25bb0cc4b8 This is not an array, but a parameter. Revert r78254. Is the precommit hook not working?
PHP Parse error:  syntax error, unexpected T_DOUBLE_ARROW in includes/Title.php on line 3752
2010-12-12 16:15:35 +00:00
Roan Kattouw
28235de1cd Folllowup r72866: use array syntax for rev_page = foo condition 2010-12-12 15:55:03 +00:00
Tim Starling
07bb8ce5b5 Remove some of the rubbish that has been accumulating in the default LocalSettings.php for years, especially code as opposed to configuration data:
* Don't set $IP. The entry point already sets it, so there's no point. Users can still set it if they can figure out a way to do it without breaking things.
* Don't include DefaultSettings.php. Doing that is code, not configuration, and it can easily be done in WebStart/Maintenance. Some non-standard entry points in extensions may be broken by this. That's their fault for being non-standard. Backwards compatibility is preserved thanks to require_once().
* Introduce $wgInvalidateCacheOnLocalSettingsChange, which when set, causes $wgCacheEpoch to be updated in the way that it previously was in the default LocalSettings.php.
* Don't set $wgLocalInterwiki to some nonsense value (possibly including spaces and punctuation in the new installer). It should be only for actual interwiki prefixes. Since most wikis don't have them, I set this to false by default and adjusted the referring code to accept this. 
* Removed the guard for web invocation with $wgCommandLineMode set. This ancient code is redundant with modern protections in doMaintenance.php. 
* In DefaultSettings.php, fixed fold terminator placement near $wgLoadScript
* Add a web entry point guard. That's one piece of code which really is necessary.
2010-12-06 15:00:56 +00:00
Sam Reed
885669819e Explicitally do function documentation, rather than "see somewhere else" 2010-12-04 23:42:25 +00:00
Victor Vasiliev
bbad085453 * Show "skin does not exist error" only when the skin is inputted in the wrong case. This seems to be the original intention. Otherwise it renders the warning on the completely legitimate subpages with user scripts.
* Deprecate isValidUserCssJSSubpage() as having a very confusing title. User scripts *are* valid user JS subpages.
2010-11-25 23:12:05 +00:00
Sam Reed
c15c1c6abb More reversion of r77297, 2 of 2 commits to keep it readable in CR (hopefully) 2010-11-25 22:24:28 +00:00
Antoine Musso
6fe29c9c30 revert r76464
* mixed style changes and variable removing
* logic changes
* useful comments removed
2010-11-25 20:01:34 +00:00
Mark A. Hershberger
c68cf0c28a followup r65504 — actually check that we hav errors before returnning from checkUserBlock when short circuited. 2010-11-24 19:52:59 +00:00
Aaron Schulz
3cb06693a9 * Moved author count check to new Title::countAuthorsBetween() function
* Added static DifferenceEngine::intermediateEditsMsg() function
* diff-multi msg use by FlaggedRevs wasn't updated after $2 param was added. Fixed this.
* Minor cleanups to getMultiNotice()
2010-11-18 00:08:37 +00:00
Sam Reed
b6a919e547 Followup r76612, nfi what a stromg is 2010-11-13 12:50:50 +00:00
Sam Reed
a54a1ee178 Fixup some more documentation 2010-11-13 00:47:51 +00:00
Sam Reed
10ecfeb03b Various unused variables, add some braces
Explicitally define some variables used in hook type calls
2010-11-10 19:49:04 +00:00
Antoine Musso
6a38730329 Follow up r65500 : invalidate Title protection cache. 2010-11-07 11:54:48 +00:00
Sam Reed
7a789626fd Fix minor semi colon fail from r75767 2010-11-01 00:10:00 +00:00
Sam Reed
39c005ca79 bug 25517 Assignment in conditions should be avoided/ http://www.mediawiki.org/wiki/Manual:Coding_conventions#Assignment_expressions 2010-11-01 00:07:17 +00:00
Platonides
eda718909c Remove unused globals. 2010-10-31 15:35:01 +00:00
Philip Tzou
e6c51a4143 1. Revert the complicated redirection I made in r59754;
2. Add more Accept-Language XVO cache name for IE;
3. Use hreflang to specify canonical and alternate links, it's search engine friendly
   when a wiki has multiple variant languages.
2010-10-28 16:58:39 +00:00
Platonides
c5f29c3845 Keep it in Title.php Having it on Defines would allow to use it wrong.
Follow up r75379 (r74035, r74034)
2010-10-26 14:08:33 +00:00
Sam Reed
8b03a013a1 Fix some method documentation
Fix some typos

Some explicit class members
2010-10-20 18:50:33 +00:00
Platonides
d09f081aa2 $wgUser is never a Stub since r70970. 2010-10-17 22:47:24 +00:00
Sam Reed
6b3b915353 Big attack on unused variables... 2010-10-14 20:53:04 +00:00
Sam Reed
a2589ff8c6 Assignment in loop conditions suck
while ( $row = $dbw->fetchObject( $res ) ) { to foreach ( $res as $row ) in includes

Add some braces
2010-10-13 23:11:40 +00:00
Platonides
642b658424 Space 2010-10-10 14:45:00 +00:00