Commit graph

431 commits

Author SHA1 Message Date
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Niklas Laxström
4741900b5e Escape unescaped messages shown on a diff page
Change-Id: I05c07625a2dbb3c5d3ab46d1cfafeaed6a248bba
2014-12-18 20:01:32 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
cacycle@gerrit.wikimedia.org
ef55b2c7b5 Add hook for custom difference engine (WikEdDiff)
The new Extension:WikEdDiff is a custom inline difference engine.
There is currently no hook to integrate custom difference engines.
This patch adds a new hook called 'GetDifferenceEngine' in
/includes/content/ContentHandler.php in function
'createDifferenceEngine()'.

Passed variables:
$context: IContextSource context to be used for diff
$old: Revision ID to show and diff with
$new: Either a revision ID or one of the strings 'cur', 'prev' or 'next'
$refreshCache: If set, refreshes the diff cache
$unhide: If set, allow viewing deleted revs
&$differenceEngine: output parameter, difference engine object to be used
for diff

If the hook handler returns false, a valid difference engine object is
returned in the passed-by-reference variable $differenceEngine.
If the handler returns true, the default engine is used as fallback.

The specified diff engine class will typically be an extension of the
class DifferenceEngine (includes/diff/DifferenceEngine.php) with
modifications, e.g. of function generateTextDiffBody() and
__construct() (without deprecated parameter $rcid).

Also fixes a missing declaration in DifferenceEngine that is required for
extending this class.

Bug: 71916
Change-Id: I9da63c1ceb339bfeba7beddc712be51977b95f65
2014-11-13 18:02:29 +00:00
Ebrahim Byagowi
36372030d4 i18n: Use native digits on 'difference-missing-revision'
Change-Id: I19cd68562690c4ab8b077681d0f3d18d4286a5cd
2014-09-26 19:53:59 +00:00
Daniel Evans
6c2262319b add mw-diff-* classes to view diff page header links
Wrap links in page revision diff header with classes like page revision history
entry links.

Bug: 44242
Change-Id: I0066827bd57c2d40b4b8bd5634cb46c5ce306f28
2014-08-16 01:21:39 +01:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
umherirrender
02dc9da399 Cleanup some docs (includes/[a-d])
- 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: I7b65fe04db431342cc58b469dc48f41a50c4e891
2014-07-24 19:42:45 +02:00
umherirrender
abfa0d7854 Standardize @todo
Always use lowercase @todo
Changed some "@FIXME" to "@todo FIXME: "

Change-Id: I016d1f9511e6f3bbd22427f0fffeccd77ab5e0db
2014-07-23 22:27:20 +02:00
Bartosz Dziewoński
108d4aa2ba Article: Add RL modules for the ParserOutput when showing CSS/JS page
It previously added only the page HTML, which meant that ResourceLoader
modules associated with the page and other metadata was lost. This
affected the new way of doing things in SyntaxHighlight (Idf4ad439).

We still do not show categories, language links and other things
on the pages (although internally they behave just like in wikitext)

Also needs a fix in DifferenceEngine because our code sucks so much.

Bug: 64859
Change-Id: I5867985693b27ccc9195fddde8b922e67463e836
2014-06-20 19:48:25 +00:00
Krinkle
811a6172b3 Merge "Removed unneeded spaces and colons in @param and friends" 2014-04-08 18:05:38 +00:00
umherirrender
725d9d125d Removed unneeded spaces and colons in @param and friends
Also 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: Ic36c8c7820a6c2d603f1138130670c6bf6a1ca59
2014-04-08 16:02:49 +00: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
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
aude
6a5c9bd28b Add visibility to DifferenceEngine methods
Change-Id: I415719442ca1778be36f173067d4b090fbe9265a
2014-03-06 15:34:51 +01:00
Thiemo Mättig
6806400129 Added and updated Doxygen comments in content handler and diff namespaces
Reasons for touching this are:
* "@param type $var" were mixed in a lot of places. Both works but the
  MediaWiki coding conventions suggest that specific order.
* Things like String and Bool aren't objects and shouldn't be uppercase.
* Tried to fill missing types in "@param $var".
* Tried to fill missing descriptions in "@return type" when I could.
* Removed duplicate descriptions if a @see is sufficend.
* Removed useless descriptions ("isUsefull returns true if usefull").
* Removed useless @return void.
* Replaces mixed[] with array (does have the exact same meaning).
* Tried to find better replacements for "varargs", phpDocumentor
  suggest $var,...
* Order should be @since, @param, @throws, @return, @see. This is the
  order Doxygen renders this.

There is always more to do but I think this is already much better
than before. Please feel free to put more change sets on top of mine
or request more changes by adding comments.

Change-Id: I05262ce06caabf79f68772302524ac91bbead1c6
2014-03-06 11:17:41 +01:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
jenkins-bot
1f84a574e3 Merge "Improve clarity of diff-multi message" 2014-01-31 17:24:00 +00:00
jenkins-bot
f726bbf6e7 Merge "Add oldRev parameter to DiffRevisionTools hook" 2014-01-29 01:44:01 +00:00
Jackmcbarn
25b83169c8 Add oldRev parameter to DiffRevisionTools hook
Add a third parameter to the DiffRevisionTools hook, containing the old
revision.

Bug: 57721
Change-Id: I6ee956c5b9901033f618d7e4d09f8f416f3d72cb
2014-01-28 20:43:55 -05:00
Jackmcbarn
874fed9306 Improve clarity of diff-multi message
When one user has made all of the intermediate revisions in a diff,
make it clear whether or not this is the same user that made the
latest revision.

Bug: 59833
Change-Id: I7db9a02ae8bc7a8e092fcdc257b5e17595de02b4
2014-01-09 10:10:35 -05:00
Brad Jorsch
d8b1b79ea4 Move redirect rendering into WikitextContent
There's no good reason for everything that wants to render a page to
have to test whether the page is a redirect and then call
Article::viewRedirect to get the fancy rendering instead of using the
ParserOutput. This logic can easily be moved into
WikitextContent::getParserOutput so callers can just use the
returned ParserOutput.

At the same time, we can handle "#REDIRECT [[File:Foo]]" and
"#REDIRECT [[Category:Foo]]" the way people expect, by recording the
link in pagelinks rather than imagelinks/categorylinks (although this
means fixing ImagePage's bug about assuming anything in imagelinks that
is a redirect is a redirect to the image too).

And we can finally fix bug 14323, too.

Bug: 14323
Bug: 17259
Bug: 27621
Bug: 42642
Bug: 50488
Change-Id: Id44d566a7ca35a1b9579d0c0e947877c980b0686
Followup: I1c7582d1bf7ec4184a45b00154e3dd5b39dd444b
Followup: I3653b608941813a73281f4f0545bea2487d43964
2014-01-07 09:18:22 -05:00
Siebrand Mazeland
9cd43cd01a Replace inline tab with space
Spotted by Umherirrender in
https://gerrit.wikimedia.org/r/#/c/96554/1/includes/diff/DifferenceEngine.php

Change-Id: I363a3299d61e2cfb7c31db9c293a2c7e73fcef44
2013-11-21 18:32:38 +00:00
Siebrand Mazeland
c13d478e9b Break long lines in includes/diff/
Change-Id: I778079edb147623f54f6140e11e25120b04c382e
2013-11-20 20:22:36 +01:00
Siebrand Mazeland
abefd2c07e Update formatting for includes/diff
Change-Id: Id032a32ca6ebea3daf5313a05602c5e98603d983
2013-11-20 20:11:57 +01:00
Siebrand
60fa0e1c3b Revert "DifferenceEngine cleanup"
This reverts commit 1f423cc609.

Change-Id: I2254eb37376063a081ad89481654b735fb0360b1
2013-11-11 16:35:19 +00:00
Max Semenik
1f423cc609 DifferenceEngine cleanup
* Remove mPrefixes from variables
* Turn a define into class const

Change-Id: I80874627df9dffae596f8f7cb3ca28f19ba1f167
2013-11-09 04:21:32 +04:00
Max Semenik
651c43140f DifferenceEngine minor fixes
* Function docs
* Remove useless variable assignment

Change-Id: I292e1391e0c24399b2c203b9f7fe7c58df089ad0
2013-11-02 02:28:13 +04:00
Siebrand Mazeland
e61cb8218b Update docs and declare visibility on class props
Change-Id: Ib0f02202d075d4a56dc4e37b08d7ac9399e8c86c
2013-11-01 12:35:27 +01:00
aude
607bcd6c63 Put get diff body cache key into own function
This allows derivative DifferenceEngine classes to
generate cache keys in a different format, as appropriate.

(e.g. for Wikibase, allow diffs to be cached by language
and fully localized)

Bug: 55667
Change-Id: I22bf4e70f86da832a86baf6790ad4a403fce4bf1
2013-10-31 10:27:55 +00:00
Bartosz Dziewoński
dfc3e3df90 Correctly update wl_notificationtimestamp when viewing old revisions
== Prelude ==
wl_notificationtimestamp controls sending the user e-mail
notifications about changes to pages, as well as showing the "updated
since last visit" markers on history pages, recent changes and
watchlist.

== The bug ==
Previously, on every view of a page, the notification timestamp was
cleared, regardless of whether the user as actually viewing the latest
revision. When viewing a diff, however, the timestamp was cleared only
if one of the revisions being compared was the latest one of its page.

The same behavior applied to talk page message indicators (which are
actually stored sepately to cater to anonymous users).

This was inconsistent and surprising when one was attempting to, say,
go through the 50 new posts to a discussion page in a peacemeal
fashion.

== The fix ==
If the revision being viewed is the latest (or can't be determined),
the timestamp is cleared as previously, as this is necessary to
reenable e-mail notifications for given user and page.

If the revision isn't the latest, the timestamp is updated to
revision's timestamp plus one second. This uses up to two simple
(selectField) indexed queries per page view, only fired when we
do not already know we're looking at the latest version.

Talk page indicator is updated to point at the next revision after the
one being viewed, or cleared if viewing the latest revision. The
UserClearNewTalkNotification hook gained $oldid as the second argument
(a backwards-compatible change). In Skin, we no longer ignore the
indicator being present if we're viewing the talk page, as it might
still be valid.

== The bonus ==
Comments and formatting was updated in a few places, including
tables.sql and Wiki.php.

The following functions gained a second, optional $oldid parameter
(holy indirection, Batman!):
* WikiPage#doViewUpdates()
* User#clearNotification()
* WatchedItem#resetNotificationTimestamp()

DifferenceEngine gained a public method mapDiffPrevNext() used
to parse the ids from URL parameters like oldid=12345&diff=prev,
factored out of loadRevisionIds(). A bug where the NewDifferenceEngine
hook would not be called in some cases, dating back to its
introduction in r45518, was fixed in the process.

Bug: 41759
Change-Id: I4144ba1987b8d7a7e8b24f4f067eedac2ae44459
2013-10-27 17:47:53 +00:00
Chad Horohoe
d0c8ba037c Remove wfDl() and cleanup everything it touched
wfDl() is a wrapper around dl(), which is an evil function and
basically only works from the command line of Zend. Luckily
no extension has ever used this thing, so let's just remove it
outright.

For comparison, here's a list of places it does not work:
- hhvm
- php as apache module
- php compiled with zts support
- safe_mode
- Basically any shared host that cares about security

Most callers are using it to check for extension support and are
actually failing gracefully when wfDl() returns false. In these
places we're just going to use extension_loaded().

While we're at it, clean up some of the test skip logic in the
media tests so we can bail as early as possible if we know we
can't complete the test.

This also immediately removes $wgLoadFileinfoExtension. It's been
enabled by default since 5.3 and falls back gracefully when the
support isn't available.

Change-Id: Ieb430dfc74483731dde51d6e20fa700d641ba1f4
2013-10-09 10:51:35 -07:00
jenkins-bot
3b6f122867 Merge "Show the revision ID on error message when content is missing on difference page" 2013-09-17 17:20:22 +00:00
Alexandre Emsenhuber
ea8ac38e45 Show the revision ID on error message when content is missing on difference page
Currently if the revision exists but its content is not found, it will make
loadText() return false; which in turn will make a call to showMissingRevision()
from showDiff(). However since the revision exists; it will not match the
condition in showMissingRevision() and thus an error message will appear without
any revision ID.

Change-Id: Idd8a5f20a3c082a3b02bd77557e0f4dc4c66e876
2013-09-17 06:52:14 +00:00
Alexandre Emsenhuber
17f2fe778f Removed unneeded else branches in DifferenceEngine
The "if" always exit, so there is no need to use else branches;
also added blank lines for better readability.

Change-Id: I7d8321652a90fbba99e53fa0c1fe018492883b8a
2013-09-17 06:51:05 +00:00
jenkins-bot
3884fa4e5f Merge "Don't ask users to mark own page creations as patrolled" 2013-09-16 19:22:29 +00:00
umherirrender
d50199ddce Add class around diff-empty and add it as notice
Add the moment the message is added within a class=diff-multi,
which is not true.

Bug: 53168
Follow-Up: I458fb688b0001fb674ece65b3fdabf56fc658a29
Change-Id: Ic3040ceca4ff1459181c84f041490e9e72b12802
2013-08-25 17:06:49 +02:00
jenkins-bot
ae1274fd28 Merge "DifferenceEngine: Remove broken comment" 2013-07-22 11:44:03 +00:00
Marius Hoch
038602f9bc Don't ask users to mark own page creations as patrolled
Bug: 51224
Change-Id: I2d38c25b547a8735da135955854584aa02b4394d
2013-07-20 21:31:59 +02:00
umherirrender
2bdb4895f9 diff: Display "(No difference)" instead of an empty diff
This makes it easier to see the fact, because without a hint, the user
can mean, that there is something missing, but here the missing is okay
and for that, the message is helpful.

Change-Id: I458fb688b0001fb674ece65b3fdabf56fc658a29
2013-07-17 20:40:35 +02:00
MatmaRex
cd5f0d63fa Show change tags on diffs
This adds two very simple queries for every diff page view.

It could be made to only add one (loading tags for both revisions at
once), but it would be a little ugly.

It could even be made to add zero, but this would require either
rewriting and duplicating a lot of code here and constructing
Revisions by hand or making the Revision itself know about its tags.

Bug: 25824
Bug: 49602
Change-Id: Ic2ae58c703db7ceee5de4b320229d8c93810a73b
2013-07-06 23:02:31 +02:00
jenkins-bot
7844c9a058 Merge "DifferenceEngine: Don't display empty header row" 2013-06-26 22:13:06 +00:00
MatmaRex
df98350345 DifferenceEngine: Remove broken comment
Added in r99038 (0b0705f3), seems to only include the beginning of
some sentence.

Change-Id: I5a62b178613b192ebe886637c358f8b1d4198bf9
2013-06-10 20:15:34 +02:00
MatmaRex
7599f1a49b DifferenceEngine: Don't display empty header row
This prevents a gap from appearing, and the resulting code will be
slightly cleaner as well.

Shouldn't matter in core, but does matter for extensions displaying
diffs like AbuseFilter.

Change-Id: I9e3e74226a23c0a18db091bc1550b694d9d08118
2013-06-10 19:43:47 +02:00
Marius Hoch
fc5bcf1147 Remove revision patrol links from normal page views
Users want and expect it this way, per bug 49123

Follow up to I1e24733c

Bug: 49123
Change-Id: Ib4d72179e4029f0c089c3147bdf4bd6daac0374e
2013-06-09 03:45:21 +02:00
Marius Hoch
aa0308e3b9 Fix edit patrolling in multi Diffs
In multi diffs we had a "wrong" value for rc_last_oldid
set (not the directly previous revision but the one
selected by the user). Due to that there weren't any
unpatrolled recentchanges rows found. As that is cached
in memcached these rows stay unpatrollable forever.

Bug: 49019
Change-Id: I5d6111032dba7d102e30d85718639697f44c036e
2013-06-02 15:23:09 +02:00
Kevin Israel
e3c3dfba85 Check if API enabled before loading dependent JS modules
Affects whether these modules are loaded:

* mediawiki.searchSuggest ($wgEnableAPI only)
* mediawiki.page.watch.ajax ($wgEnableAPI, $wgEnableWriteAPI,
  'writeapi' right)
* mediawiki.page.patrol.ajax (same as above)

Checking of $wgUseAjax has not been removed where it was
already present, in case some users have set the variable
to false to disable these specific features.

Bug: 30213
Change-Id: If2ec219cfbb94e7c9718c58b9b54a508d0e0c656
2013-05-28 20:30:11 -04:00
Marius Hoch
c451b320e3 Patrol overhaul phase 1: Remove rcid parameters
I've changed the logic in Article::showPatrolFooter to be able
to fetch the recent changes id and to only show the patrol link
in case the change hasn't yet been patrolled.

In case recentchanges patrolling is enabled this will try to
create a patrol link for the revision the user is currently
viewing. If only new page patrolling is enabled it tries to
create a patrol link for the first revision of the page.

Furthermore I've removed the passing around of &rcid parameters
within MediaWiki as those had several issues (some even security
related) and were only a workaround to protect the DB from some
queries, which is no longer needed.

This has already been partly implemented in a different manner in
r45778 but had to be reverted in r46542 due to performance issues.
This version shouldn't cause such issues as I'm only adding one or
two indexed database queries per page view.

I've written this new version of the patch with mostly
performance in mind and even tested the database queries it uses
against the replicated databases of enwiki on the toolserver. I'm
pretty sure this can't be implemented any faster without creating
a new index on the recentchanges table.

As I was on it I've implemented RecentChange::isInRCLifespan which
checks whether the given timestamp is new enough to may have a RC
row. That way we can avoid some DB queries for timestamps which are
older than the max RC age.

Fixes bugs:
(bug 15936) New page's patrol button should always be visible
(bug 35810) ! N pages non-patrol-able
(bug 36641) Patrol page link shows on non-existent revs

Change-Id: I1e24733cafbfdc51b7a5a9a1c1baf948e760fe1a
2013-05-25 12:04:01 +02:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
Most were this way already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html

Ran a find/replace on the odd ones. Also made them all
lower case.

Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
2013-05-15 06:23:40 +00:00
umherirrender
dbd0b590e9 else if -> elseif
Also fixed some spacing while at it
Added some braces for one line statements

Change-Id: Iebfa2b17091509daabc76248121c7763e2295d20
2013-04-17 16:52:47 +02:00
Chad Horohoe
4be6236352 Remove externaledit/externaldiff preference
Change-Id: Ic3791d188688f556753ab5556a4d9733bbf2e85e
2013-04-11 09:20:36 -04:00
MatmaRex
a8fbbcf98d Remove the "Quickbar" feature and all things related to it
"Quickbar" was a feature of the Standard and CologneBlue skins that
allowed the sidebar to be displayed on left or right side of the page,
floated or fixed, and hidden on diff pages.

Standard was removed (Ia6d73c2d), and CologneBlue doesn't support this
anymore (bug 41246), so all things quickbar can now be safely removed.

* Removed user prefs option + interface
* Removed related messages
* Removed code for this in SkinLegacy
* Removed dead code in DifferenceEngine and Language

Change-Id: I5e6f7d48d6904a052a3a11547d3ebe6161463018
2013-04-07 04:08:05 +02:00
Alexandre Emsenhuber
df5265e14d Fix case of some Title methods
Change-Id: I37ce7fe392f4941c500fa0a88007664501d7e338
2013-03-27 14:36:05 +01:00
Alex Monk
ddee066b41 Fix Ifb93e49b
This commit caused a PHP notice if you tried to use diff=prev with an
oldid which was the first revision of the page.

Change-Id: I4c4ccb9a0c8d82e104723a2e72f1c699e2fc249b
2013-03-13 15:43:27 +00:00
Kaldari
930955762a Adding hooks for thank you notification links
These will allow Echo to add a 'thank' link next to the 'undo' links

Change-Id: Ifb93e49b30bb325ecd17ece9f36bcd83c63a2563
2013-03-12 10:37:39 -07:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
Reedy
e028051140 Add a handful of missing @return
Change-Id: I21b218e6694600a2d2df4dd0a6b2b5cd2e10f1f9
2013-02-16 17:51:13 +01:00
umherirrender
f97a3a4027 fix some spacing
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd
2013-02-04 19:59:14 +00:00
Marius Hoch
a53fe6f080 (bug 39397) Only show rollback links if they work
To only show rollback links if they work I had to patch Linker
to have a function (Linker::rollbackData) which can verify
that the editor isn't the only editor of the page. Furthermore
it is checked that the user name or the text of the revision
we might rollback to isn't deleted. Due to the fact that I've
altered the already existing method which showed how many edits
a rollback will revert for that, this wont affect the performance.

Change-Id: I5d1adec993370c39ae8c5c712edd919d456441c6
2013-01-09 17:04:44 +01:00
Siebrand Mazeland
c4e761089c Update docs for DifferenceEngine::getDiff()
Previous docs were incorrect and misleading.

Change-Id: I6403c7c7c3b9803cc7e10cc45999244ff78dc14d
2012-12-05 15:21:58 +01:00
Siebrand Mazeland
a2d605afc3 Add type hint
Change-Id: If529cfbf568a10e8cea184fa229959701268ebcb
2012-12-05 00:38:59 +01:00
Marius Hoch
d1debff476 (bug 7851) Implement mediawiki.page.patrol.ajax
Implement AJAX patrolling with the new mediawiki.page.patrol.ajax
module, which makes use of the API via mediawiki.api.

During the patrol process a spinner (created by jquery.spinner)
shows up and after it a suitable message gets shown via
mediawiki.notify.

Depending on whether we had success or not the link then turns up
again or the brackets completely disappear just like on a normal page view.

On top of adding the module, I've changed the following:
- Added the patrol token to the ResourceLoaderUserTokensModule.
- Registered messages 'markedaspatrollednotify' and
  'markedaspatrollederrornotify'.

Change-Id: I472357566dda0ab572c20e2e4b87508b0f2f4c73
2012-11-13 23:09:38 +01:00
daniel
c2172d45e4 Beware that getContent() may return null
Before the introduction of the content handler, missing content was
signified by getText() returning null instead of a string. null will
work much like an empty string in most contexts, so in many places,
it was not checked explcitely whether the conent was null.

Now, when getContent() returns null, this often caused a fatal error,
because the code would access whatever getContent() returned as an object,
without checking whether it was null (because no such check was performed
previously, when the content was represented as a string).

This check introduces explicite checks for getContent() returning null
in the most essential core classes.

Change-Id: I551a90b0b67b8edc7570ca5d252ecc1de903f097
2012-11-09 19:45:12 +01:00
Niklas Laxström
aeffc7979c Message documentation update for DifferenceEngine
Change-Id: I404cbf07238bbe532432bcb9dd573bdec2a95b5e
2012-10-15 13:51:37 +02:00
daniel
09c607f7b9 Silence warnings about deprecation by ContentHandler.
The introduction of the ContentHandler caused quite a few functions and hooks to
become deprecated. Usage of these has been removed in core, but is still present
in extensions. Extensions should be fixed after ContentHandler has settled in a
bit, but for now we need a way to silence the warnings.

Change-Id: Ia223243222675f778e8f8c32923f956790db0b4f
2012-10-12 14:56:02 +02:00
Liangent
15cd7d64f1 Show redirects correctly on diff pages.
Change-Id: Ic3c2d6cff016a8fecdde511e2d14b30426737c8a
2012-10-11 05:08:19 +00:00
daniel
bb51a58e57 Cleanup of Wikidata branch.
This cleans up several issues raised in comments to I3b2dad3a,
mostly style and merge artifacts.

Change-Id: I99f5e300a671db1353db151cd187ffd2e4478d03
2012-10-08 17:34:47 +02:00
daniel
c546fae8ed merge latest master into Wikidata branch
Change-Id: Id4e0f40c03679c13d8934a6add99b5cd86d0437d
2012-10-08 13:58:54 +02:00
umherirrender
20291cd166 Pass user object to some Revision::getText/Title::userCan calls
Also passed some $wgUser direct (when already there), so it is seen by
someone, that the user should be passed to that method.

Change-Id: Id4d5504a05ea34d80d59262ad3aef28f09c807a6
2012-10-05 16:25:01 +02:00
daniel
7db9491d89 set mediawiki version number
Change-Id: I3479776bd3bb25c4d75d07e62ede2ad989025c5b
2012-10-05 15:03:24 +02:00
daniel
c8c95a52f4 Fix JS and CSS diffs
Change-Id: I8801d49af258141ba97e88e719f87105fdc01a35
2012-10-04 12:11:56 +02:00
daniel
b6b686c13b merged master
Change-Id: I0ef7c7f33a5dc5855f38b20c03ddc5306f38ec66
2012-09-19 12:34:10 +02:00
Alexandre Emsenhuber
be0878fd3a Use WikiPage::makeParserOptions() where possible.
- This is needed to for I90965346 ((bug 37453) Move
  $wgDisable(Lang|Title)Conversion to ParserOptions)
  because that change sets an option based on the Title,
  and I don't want to duplicate that to all ParserOptions
  that need it.
- Refactored ApiParse to have a WikiPage object available
  and changed some part to take advantage of having this
  object available. Also used ApiBase::getTitleOrPageId()
  to reduce code duplication.

Change-Id: Iec98e472af9c43d940f77261367a796b0d7b4b54
2012-08-31 23:16:03 +02:00
daniel
72952a082c merged master some more
Change-Id: I53f349e42336ce0426ea1aff939853b3cd728aeb
2012-08-29 15:37:17 +02:00
daniel
ee007485b8 Merge "cleaned up comments in DifferenceEngine" into Wikidata 2012-08-28 11:42:18 +00:00
Alex Monk
65150ca53e (bug 39680) Convert valign to CSS vertical-align
Also convert align to CSS text-align/float

Change-Id: Ia7da2b51b7fdeee443def8cb06c63a422d89f6f1
2012-08-27 21:36:01 +01:00
daniel
a66eb27653 cleaned up comments in DifferenceEngine
Change-Id: I939fa563a66357efb8eae8d8f60bf0ba08cd05eb
2012-08-21 16:26:14 +02:00
daniel
74fe09ed4d Bug 39509: Function for running legacy hooks.
ContentHandler::runLegacyHooks can be used to run hooks that don't
supprot Content objects yet. runLegacyHooks will issue a warning and take
case of serialization/unserialization of the content as appropriate.

Changeset 2: rebased.

Change-Id: I31109061110f87c38bdeebf30d520c8e1241bb29
2012-08-20 22:00:52 +02:00
daniel
0139923580 fixing long lines
Change-Id: Iebcd40a1a37a3a93cc571fa2c2b0a87f53dc97a4
2012-08-20 21:33:07 +02:00
daniel
29719f846b merging latest master
Change-Id: I36b7f2f63ab8c08f8412d521dc68ea45c8b67711
2012-08-20 16:55:28 +02:00
Aaron Schulz
eb183bac87 Revision and WikiPage cleanup with IDBAccessObject interface.
* Replaced WikiPage::DATA_FROM_* constants with IDBAccessObject ones.
* Renamed IDBAccessObject constants a bit for visual consistency.
* Removed AVOID_MASTER parameter and replaced calling instances with READ_NORMAL.
  Instead of getting page_latest from the master and the revision from a
  slave, just get it all from the master in one RTT. Most callers used
  AVOID_MASTER (and now READ_NORMAL), so this case is barely hit anymore.

Change-Id: Ifbefdcd4490094b38e49bbb46c95fdb71b5c9e1a
2012-08-08 16:34:08 +00:00
Alexandre Emsenhuber
d24a4d7f10 Use a better message when a revision is not found.
This comes from
https://translatewiki.net/wiki/Thread:Support/MediaWiki:Missing-article
that asks for a link to the deletion log in the
'missing-article' message.

Instead of simply changing that message I replaced
it with two news messages 'missing-revision' when trying
to view an old revision and 'difference-missing-revision'
when showing a difference. This removes the "lego"
construction of 'missing-article' with 'missingarticle-rev'
and 'missingarticle-diff' submessages.

I had to keep current messages since they are still
used in extensions.

Change-Id: Ibe60c84cfea922a78b3ad22cc48185a109cd617d
2012-08-06 10:53:53 +02:00
daniel
c0b50eb47d merged master
Change-Id: I6afafe971afb3f38fc8f1e66ba409283b8a698f8
2012-08-02 11:01:22 +02:00
Liangent
4cb8033d79 Replace hard coded parentheses
Change-Id: I8ca697a3bdae4f693b626f2d2da15ad28dce937d
2012-07-27 22:57:34 +08:00
daniel
d87135d706 merged master
Change-Id: Iad12ee382d6aeb1fab6fefb611d290b74865ea4b
2012-07-23 22:07:18 +02:00
Alexandre Emsenhuber
026e8534c6 Add a context parameter to Liker::generateRollback() and Linker::buildRollbackLink() and updated callers.
This allows both methods to not always rely on global object, but also to use the local context when possible.

Change-Id: Id10f55ed9b18c889afd8d9937d9f35acb376cce4
2012-07-05 23:10:03 +02:00
Tim Starling
fcd74e5dd3 Merge "Reduced some master queries by adding flags to Revision functions." 2012-06-28 05:11:04 +00:00
Aaron
8288b34eae Reduced some master queries by adding flags to Revision functions.
* The main Revision functions now allow various QoS and locking flags.
* Added tiny DBAO interface add made Revision implement it.
  Since a lot of objects will need (or have) the same functionality.
* Use "self" keyword in Revision class consistently.
* Made Revisison::newFromConds() private.

Change-Id: I3139956999218a2bb44b5c845b8079e33b2328bb
2012-06-27 20:59:20 -07:00
daniel
237ee32ccc allow getParserOutput to be overwritten in DifferenceEngine
Change-Id: I66fbd42c2ada05d5891f2738139b80c0090ecb1b
2012-06-25 13:44:32 +02:00
daniel
4775a690b5 made DifferenceEngine::getRevisionHeader() protected, so we can override it.
Change-Id: Ic429cd0c039c0eb0487e149f9bb79c469b3635b3
2012-06-18 16:57:22 +02:00
daniel
a830943203 Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into Wikidata 2012-06-14 12:43:43 +02:00
Mark A. Hershberger
99fdc6e838 Bug 24985 use $wgTmpDirectory when available
We had two way to get a temporary directory:

 - $wgTempDirectory: more or less stable accross sessions
 - wfTempDir(): set through environnement variable and could potentially
   vary from a session to another one thanks to tempnam()

This patch makes wfTempDir() to always use the global $wgTempDirectory
first when it is available. Thus explicitly overriding tempnam() or any
environnement variable such as TMP or TEMP.

Hence, people who don't have access to a system wide directory
specificed by their environnement (such as /tmp) can specify an
alternative straight from the MediaWiki configuration.

The patch remove references to $wgTmpDirectory and replace them with
calls to wfTempDir().  Make wfTempDir() use $wgTmpDirectory first.

The default setting of $wgTmpDirectory was removed in favor of having it
initialized through Setup.php by calling wfTempDir.

Note: this may also address Bug 36475 - Generating thumbnails does not
work when there is no access to /tmp

Change-Id: Ifdc79e9c5d95f978025b237a5eeb95fd75092f46
2012-06-13 21:30:22 +02:00
daniel
2757fc7b1c fix indent, cleanup comments 2012-06-12 11:12:19 +02:00
daniel
01f36b721f merged latest master 2012-05-14 23:24:18 +02:00
Nikerabbit
03ecf97aec Merge "(bug 33928) make diff title page more relevant" 2012-05-11 09:05:44 +00:00
Alexandre Emsenhuber
4471b93253 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I604ed8ddc572e89001e49df6740ab42307bc0330
2012-05-08 14:51:21 +02:00
Amir E. Aharoni
6564620d2a (bug 33928) make diff title page more relevant
Original patch by Nischay Nahata.

Patchset2: amended commit message to be shorter and clearer.
Patchset3: use wfMessage()->text() instead of default parse()
Patchset4: remove unneeded tabs.
Patchset5: added git difference-title to maintenance/language/messages.inc .
Patchset6: moved OutputPage::setPageTitle() calls to DifferenceEngine and added difference-title-multipage message
Patchset7: Fixed an error in messages.inc from the last changeset
Patchset8: Removed the diff page subtitle according to Brion's
           suggestions. Note: I am doing this almost a month since
           committing the original patch. Rebasing proved to be too
           tricky, so I tried to cherry-pick the original commit
           in a new branch. Apparently, Git identified it. If this
           works as planned, it must be a miracle.
Patchset9: removes unneeded changes to message files

Change-Id: I4e6363529a1e77a3f5267ec6871e8dea0354f043
2012-05-02 14:05:13 +02:00
daniel
cd5860da57 docu cleanup; marked contenthandler stuff as @since 1.WD 2012-04-26 13:24:13 +02:00
Jens Ohlig
10e91851b2 Merge branch 'master' into Wikidata
Conflicts:
	.gitreview
	includes/Article.php
	includes/AutoLoader.php
	includes/EditPage.php
	includes/LinksUpdate.php
	includes/WikiPage.php
	includes/installer/Ibm_db2Updater.php
	includes/installer/MysqlUpdater.php
	includes/installer/OracleUpdater.php
	includes/installer/SqliteUpdater.php
	maintenance/refreshLinks.php
2012-04-11 14:24:29 +02:00
Daniel Kinzler
61ce97e8c1 minimize use of textual page content, clean up hooks for custom page rendering 2012-04-04 19:59:51 +02:00
Daniel Kinzler
7648bb282a prepare DifferenceEngine for subclassing 2012-04-04 19:59:37 +02:00
Daniel Kinzler
aaadcd0eb3 EditPage to use Content objects 2012-04-04 19:58:20 +02:00
Daniel Kinzler
c6eaef6681 reworking EditPage to use the content object - work in horrible progress 2012-04-04 19:57:30 +02:00
Aaron Schulz
4630a07741 Reverted r113803: makes already messy class messier (a bit to much) 2012-03-14 17:55:59 +00:00
Alexandre Emsenhuber
f23a4e1f84 Be consistent in the interface and use Title::quickUserCan() instead of Title::userCan() to show items in the interface so that when the user is blocked or the page is cascade protected there is not a part of the interface saying you can edit the page and another part not. 2012-03-14 10:46:59 +00:00
Alexandre Emsenhuber
0d6b594bf2 Don't create new Revision and Title object if we can use the ones that we already have 2012-03-14 09:52:34 +00:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00
Alexandre Emsenhuber
4ef1cc76ec Use the context's WikiPage object if the title of the new revision is the same as context's title; avoids a duplicated database query to load the WikiPage 2012-01-15 22:00:04 +00:00
Alexandre Emsenhuber
585141ece9 * Use Linker::getRevDeleteLink() where possible to remove code duplication
* Pass the User object to Revision::userCan() in Linker::getRevDeleteLink()
* Return the result Linker::revDeleteLinkDisabled() in Linker::getRevDeleteLink() instead of storing it in a variable that will not be used
2011-12-28 18:41:36 +00:00
Alexandre Emsenhuber
2629c3649f * Added revision's timestamp to OutputPage along with revision ID; avoid a DB hit in Skin::lastModified() when showing parser cache's content. This changed with the removal of $wgArticle in Skin since now it's a different WikiPage object and thus WikiPage::setTimetstamp() call is useless (but still kept).
* Added ParserOutput::(get|set)Timestamp() and the $mTimestamp member; avoid messing with isset()
2011-12-10 16:30:40 +00:00
John Du Hart
216d661d3b Bug 29524 - Rename RequestContext::getLang to getLanguage
I'll be amazed if this doens't break any tests.
2011-11-21 16:13:21 +00:00
Alexandre Emsenhuber
dd58309f1a * Added WikiPage::getParserOutput() and changed Article::getParserOutput() to use it
* WikiPage::getParserOutput() requires a ParserOptions object (and optionally the revision ID) instead of an User object, removes an hidden dependency on $wgLang. For this reason, WikiPage::isParserCacheUsed() now also uses a ParserOptions object instead of an User object (doesn't change anything in the code except the variable name and it's not called in extensions)
* Moved PoolWorkArticleView to WikiPage.php and added an entry in the AutoLoader and moved output-related stuff directly in Article::view() so that in can be shared with WikiPage::getParserOutput() (removes code duplication, etc.)
* Added the revision ID to the PoolCounter key so that it knows which revision is being parsed and doesn't wait for another parse operation with same options but different revisions
* Removed Article::doViewParse(), Article::tryDirtyCache() and Article::getOutputFromWikitext() since they are now integrated in PoolWorkArticleView and Article::view() and there are no callers in extensions. This also fixes a bug since Article::doViewParse() will get another ParserOptions instance with special options set in Article::view() not be repercuted.
* Updated DifferenceEngine to use the new system
* Updated docs/memcached.txt to correct method names
2011-11-17 20:21:54 +00:00
John Du Hart
93e50f7eed Following r100264, update usages in core 2011-11-16 04:37:17 +00:00
Alexandre Emsenhuber
d3fdaac14b Fix for r103001: using the object is actually a good idea 2011-11-14 18:31:44 +00:00
Alexandre Emsenhuber
4124539a4d Update DifferenceEngine::renderNewRevision() to run the 'ArticleViewCustom' hook and create a WikiPage object and do "normal wikitext" processing only when really needed 2011-11-14 18:28:01 +00:00
Alexandre Emsenhuber
2b78de3f02 Made DifferenceEngine use a context instead of global variables and updaters calls to constructor in core 2011-11-10 13:06:52 +00:00
Platonides
9b283db803 Follow-up r102521
Remove $wgUseExternalEditor globals.
2011-11-09 23:35:30 +00:00
Alexandre Emsenhuber
588539858c Some updates to EditPage and ExternalEdit:
* Made ExternalEdit use a context
* Updated DifferenceEngine to use ExternalEdit to send the diff stuff to reduce code duplication
* Introduced ExternalEdit::useExternalEngine() to check whether to use the external edit or diff (except for the action, section and oldid which are still checked in Wiki.php) to remove code duplication; external diff can now also be controlled with externaledit or internaledit URL parameters
* Use $wgContLang to get the name of the "Special" namespace instead of user's language
* Modified the line breaks in the comment on the top of the control file so that the URL is on its own line
* Updated extension to call EditPage::edit() instead of EditPage::submit(), the latter will just call the former
* Updated extension to let core handle itself the ExternalEdit mode instead of doing this themself
2011-11-09 15:31:55 +00:00
Alexandre Emsenhuber
f8e2b347a5 * Changed OutputPage's handling of subtitles to use an array and implode it with "<br />" so that callers don't have to bother whether there's already a subtitle when adding new ones
* Make OutputPage::setSubtitle(), OutputPage::addSubtitle() and OutputPage::appendSubtitle() accept a Message object in addition to a string
* Added new method OutputPage::addSubtitle() to replace appendSubtitle() and marked it as deprecated
* Clear the subtitles when showing an error page
* Always show the subtitle from Article::viewRedirect() when showing a page; left the parameter for use in EditPage
* Make Article::setOldSubtitle() add two subtitles and has to set "display:inline;" for the three possible divs to avoid too many spacing
* Removed the six different backlink subtitles and added one new message 'backlinksubtitle' to replace them and added OutputPage::addBacklinkSubtitle() to factorise common code
* Changed EditPage's view source to show "View source for <Page>" with the same backlink in subtitle for consistency with other back links and page titles
2011-11-08 18:01:22 +00:00
Alexandre Emsenhuber
381309f474 * Merged Title::userCanRead() check in Title::getUserPermissionsErrors()
* (bug 26020) Setting $wgEmailConfirmToEdit to true no longer removes diffs from recent changes feeds
* Added second parameter to Title::userCan() and Title::quickUserCan() to allow callers to pass the User object to use for checks; this changes Title::userCan()'s second parameter from "do expensive queries" flag to User, but all callers should have been updated in r102183
* Updated callers that might throw a PermissionsError to use getUserPermissionsErrors() instead and pass the error array to the exception
* Refactored duplicate code in missingPermissionError()
* Moved Title::isNamespaceProtected() a bit upper and Title::userCanRead() near Title::userCan() to have related functions in the same location
* Some minor refactoring in permission-related functions in Title
2011-11-06 19:59:46 +00:00
Alexandre Emsenhuber
3801a3cd28 * Made OuputPage::showPermissionsErrorPage() show a different messages for 'read', 'edit', 'create' and 'upload' actions to saying "You need to log in to do this action" when 1) The user is not logged in 2) The only error is a permissions error (no block or something else) and 3) The error can simply be avoided by logging in
* This replaces OuputPage::loginToUse() functionnality, made it simply throw a PermissionsEror exception and updated all calls in core
* Same for the check in SpecialUpload::execute(), EditPage::userNotLoggedInPage() and EditPage::noCreatePermission()
* Throw the same exception in EditPage::attemptSave() whether the user is logged in or not and let OuputPage::showPermissionsErrorPage() decide which message to display
* Replaced call to deprecated OutputPage::blockedPage() in SpecialUpload
* Displayed messages are the same as now, except the title is always "loginreqtitle"
* 'nocreatetitle' and 'uploadnologin' messages are still used by extensions, so I kept them, but the message 'whitelistedittitle' is not used anymore and has been removed
2011-11-05 19:51:05 +00:00
Platonides
d581e9dd5a Removal of unused globals 2011-10-27 20:48:09 +00:00
Alexandre Emsenhuber
b212bace90 Per Nikerabbit's comment on r100621:
* Removed OutputPage::setPageTitleMsg() and OutputPage::setHTMLTitleMsg() and make OutputPage::setPageTitle() and OutputPage::setHTMLTitle() accept a Message object
* Updated core calls (including some that I missed last time because of non-matching case)
* Added Message::setContext() and use it in RequestContext so that I don't need to duplicate the call in OutputPage
* Yes, I'm calling $this->msg() on places and then setting the context one more time in OutputPage::setPageTitle() or OutputPage::setHTMLTitle(), but at least I won't be confused about which objects $
2011-10-27 20:23:16 +00:00
Max Semenik
95ec650786 Revert r93246: besides the problems pointed out at CR, it also causes bug 31403, wreaking havoc on large wikis 2011-10-07 13:58:16 +00:00
Alexandre Emsenhuber
a2b914d852 Fix for r99038: this was in the wrong part of the if statement 2011-10-05 19:59:39 +00:00
Alexandre Emsenhuber
0b0705f370 Big cleanup to DifferenceEngine:
* Call Linker methods statically
* Factorised a lot of duplicate code, such as "Mark patrolled" links, revisions headers, etc.
* Removed showFirstRevision() and made that case be handled through the normal showDiffPage(). In such case, the header will look like a normal diff page, except it is centred. For this, addHeader() will now center the "new revision" header if the string passed to the "old revision" header and the diff is empty. getDiffBody() will also return an empty string if $mOldRev is false.
* Showing only one revision when the previous was not found will also ask to unhide the revision is deleted as in normal case
* Backed out code that generates the revision header from loadRevisionData() so that this function does not make a mix of backend and UI stuff. Factorised the code in getRevisionHeader().
* Lazy-load page's language and revisions IDs (in case of "prev", "next", etc. are passed) instead of doing that in constructor.
* Made a good part of links compatible with Special:ComparePages, such as navigation links, "undo", etc. that links to the title corresponding to the revision and not the given title in the constuctor.
* "Current revision as of" can also be displayed on the old revision, useful when comparing two current revisions in Special:ComparePages
* Removed navigation, undo and rollback links when comparing two different pages, this can confuses users thinking they are comparing two revisions of the same page. Also clicking on a "undo" link in such case will give "revision not found".
* Check if the user can read the revisions before sending a external editor file
2011-10-05 19:55:04 +00:00
Robin Pepermans
b926eb0074 Mark $mDiffLang protected, and rename function to setTextLanguage per Nikerabbit on r92956 2011-09-04 16:09:58 +00:00
Roan Kattouw
24f6e5f721 Use canonical URLs in sitemaps, diff stuff and external edit stuff 2011-08-19 17:33:41 +00:00
Alexandre Emsenhuber
ba84011526 * Changed OutputPage::$mIsArticle flag to be false by default. A lot of actions don't change that flag when they should, since about only action=view should have it to true.
* Put OutputPage::$mIsArticleRelated declaration just below $mIsArticle's one since they are related
* Made DifferenceEngine consistent with action=view, i.e. setting that flag to true when displaying any version of the page, current or not
* Made Skin::getCopyright() always use history_copyright when displaying an old version, regardless to the diff parameter
* Changed some checks from namespace != NS_SPECIAL && action=view to isArticle() so that they don't get executed when e.g. throwing an Exception (or similar things)
2011-07-27 13:14:28 +00:00
Happy-melon
c3e096c6e5 (bug 15641) prevent blocked administrators from accessing deleted revisions. 2011-07-26 20:54:41 +00:00
Robin Pepermans
8fc646cf08 DifferenceEngine: introduce setDiffLang() to change the language in which the diff text is written.
Translate: set the the diff text according to the source language, on Special:PageTranslation and the translation messages. (Also fix direction of CSS class mw-translate-fuzzy).
2011-07-23 19:03:54 +00:00
Platonides
2e3f7a97fd Profiling errors. r92106 missed a wfProfileOut
r92118 added a wfProfileIn but not all returns were covered. Also changed its spaces to tabs.
2011-07-19 19:05:23 +00:00
Aaron Schulz
75fc6592ba Fixed profiling error 2011-07-13 22:57:04 +00:00
Leo Koppelkamm
455661a73c Moving skins/common/diff.css to mediawiki.action.history.diff.css and updating some old comments in the process. Also moved one vendor-prefixed attribute in fron of the standard one. Extension follow in a second 2011-07-08 17:59:42 +00:00
Robin Pepermans
7c624542f0 (bug 6100; follow-up to r91315) Being bold and removing $wgBetterDirectionality (and dependent wfUILang) in core, as most or all work is finished.
Also:
* Introduce classes mw-float-end, mw-float-start so we don't have to use inline css depending on wfUILang()/$wgLang (see HistoryPage and SpecialFileDuplicateSearch)
* Add direction mark to protection log
* Remove specialpageattributes as it is obsoleted by this commit (also fixes bug 28572)
* Add two direction marks in wfSpecialList, which makes ltr links on rtl wiki (and vice versa) display nicely as well (only on those special pages however)
* Revert r91340 partially: use mw-content-ltr/rtl class anyway in shared.css. Both ways have their [dis]advantages...
* Set the direction of input fields by default to the content language direction (except buttons etc.) in shared.css
2011-07-06 02:26:06 +00:00
Aaron Schulz
8e39791496 Removed some dead code (useless since r87806) 2011-07-02 09:12:08 +00:00
Sam Reed
9b850aa604 Minor revert to r91246 2011-07-01 02:28:08 +00:00
Sam Reed
bdc31bb9bc Change usages of $wgUser->getSkin() in special pages to use $this->getSkin()
Fix trailing whitespace
2011-07-01 02:25:19 +00:00
Alexandre Emsenhuber
48192cfe7c Follow-up r90334 and r90337: made DifferenceEngine::addHeader() non-static to be able to use $this->mTitle instead of $wgTitle 2011-06-29 10:51:15 +00:00
Platonides
71a0ad0101 Follow up r90334.
Removes the space after the class name in $wgBetterDirectionality = false,
I think it is clearer to have the variable to hold the classes, instead of the *additional* classes.
Renamed to be clearer and be camelCase.
Added redundant htmlspecialchars() and spaces.
2011-06-19 18:53:55 +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
Robin Pepermans
9077baef30 Follow-up to r90265: directionality improvements as part of bug 6100 (under $wgBetterDirectionality):
* Correct directionality when viewing diffs
* Correct arrows for Pager
* CSS/JS pages always 'en' (LTR)
* Messages on Special:Allmessages have lang and dir attributes based on the selected language
2011-06-18 13:12:52 +00:00
Sam Reed
bdf84cb20e Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits, so hopefully reviewable in CR...
2011-06-17 16:03:52 +00:00
Sam Reed
94bf573c03 Remove some unused variables, add/improve some documentation 2011-06-01 16:27:46 +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
Roan Kattouw
0ee7b5c2ea Kill diff.js with fire. It only applies to versions of Gecko that were released before Nov 2002, which is waaaay beyond what we support, or what anyone could conceivably be using in this day and age. 2011-05-14 23:49:29 +00:00
Brion Vibber
0c8ecd43bc * (bug 21279, bug 28820) Workaround for standard diff links to deleted revs; Special:Undelete links to deleted rev when allowed.
Adds links to Special:Undelete to view the requested revisions onto the 'revision data not found' error message, if they can be found via ar_rev_id and the user has permission to deletedhistory.

Follow-up to r87804; allows the 'diff' links on log entries for Special:RevisionDelete actions on deleted revs referenced by rev-id to continue to go someplace semi-sane.
Could benefit a more transparent forwarding -> bug 28820.
2011-05-10 01:17:01 +00:00
Sam Reed
15df9a9d5c Kill off the long deprecated $wgInputEncoding and $wgOutputEncoding globals 2011-05-06 22:09:47 +00:00
Sam Reed
c8079f0b81 * (bug 27185) API: Add Special:ComparePages 2011-05-01 21:56:02 +00:00
Chad Horohoe
716fd5bd76 (bug 28610) unsegement is not a word 2011-04-19 14:04:00 +00:00
Alexandre Emsenhuber
b5966436ea No need to call wfSuppressWarnings() and wfRestoreWarnings(); wfDl() already does this 2011-04-11 16:52:51 +00:00
Alexandre Emsenhuber
2300787fdc dl() -> wfDl() 2011-04-10 14:21:37 +00:00
Aaron Schulz
b845e4899a Follow up r85467: changed some countRevisionsBetween/countAuthorsBetween callers to pass in objects, which avoids queries 2011-04-05 23:28:39 +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
Alexandre Emsenhuber
2fecd3ac70 Use Html::element() to generate the element; the url and the title attribute are now build only when really necessary 2011-03-12 13:45:12 +00:00
Sam Reed
8230d93a43 Explicitally define variables 2011-02-19 21:44:20 +00:00
Sam Reed
8b1bdb6e68 Remove unreachable line in DifferenceEngine
Documentation for ObjectCache.php

Remove unused variables from CompareParsers and PreprocessDump
2011-02-18 01:06:04 +00:00
Trevor Parscal
a8b81f9a8d Grouped diff and history modules together to help reduce cache invalidation. Loaded diff styles statically. This should help with bug #27418, but I suspect there are more cases where we need to do this sort of thing before the bug is truly resolved. 2011-02-15 22:14:03 +00:00
Mark A. Hershberger
b4cee86beb w/s fixups 2011-02-12 04:06:22 +00:00
Platonides
57e0786ec3 More wfProfileOut()ing 2011-02-10 16:04:19 +00:00
Daniel Friesen
3d220be8d6 Completely remove support for legacy style skins. All legacy skinning options are now part of a SkinLegacy/LegacySkinTemplate pair that inherits from the normal SkinTemplate setup. Also ported our three built in skins to use the new legacy classes. ( ;) if you want to kill legacy skins now, you only have to svn rm 4 files) 2011-02-04 04:18:05 +00:00
Happy-melon
e147220482 Add IDs to various revdel notices for skinning. 2011-01-05 21:25:04 +00:00
Tim Starling
ccfe5ad97b Fix for bug 26561: clickjacking attacks. See the bug report for full documentation. 2011-01-04 06:12:33 +00:00
Alexandre Emsenhuber
683dcdc83a Fix fatal error from r78264 2010-12-12 20:45:32 +00:00
Sam Reed
0de35fc275 Followup r75763, fixup wrong change of deprecated method
No need to do separate htmlspecialchars et al, Xml::expandAttributes
2010-12-12 18:35:19 +00:00
Aaron Schulz
0bb1fb5cbd * Removed redundant revdelete msg above content
* Show bottom patrol link even if hook replaces preview content
* Hook doc tweaks
* Assorted minor cleanups
2010-12-11 05:32:48 +00:00
Priyanka Dhanda
5d95c385be If we only want to show the diff this should make it faster. Sort of related to to bug 25757 2010-12-10 22:47:16 +00:00
Priyanka Dhanda
3b23590869 Reverting r77516. It ain't gonna work 2010-12-06 18:21:41 +00:00
Priyanka Dhanda
8e47474df6 Fixes bug 26163 - Missing categories and iw links on diff pages. 2010-12-01 00:12:43 +00:00
Antoine Musso
e060167c57 Stylize. No differences when using: svn diff -x -wu 2010-11-27 19:01:51 +00:00
Aaron Schulz
19ec266f5a getDiffBody() cleanups:
* marked it explicitly public
* cleaned up return types on failure
* broke long lines
2010-11-18 20:34:02 +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
Alexandre Emsenhuber
f8f6417965 * (bug 24833) Files name in includes/diff/ are now less confusing
Diff.php                -> WikiDiff3.php, more descriptive
DifferenceEngine.php    -> WikiDiff.php, for consistency with the above and to make way for the file below
DifferenceInterface.php -> DifferenceEngine.php, since it contains the DifferenceEngine class
2010-11-07 16:28:11 +00:00
Derk-Jan Hartman
86baf59b9c Avoid unnecessary linebreaks in difflines. Fixes bug 25725 2010-11-01 00:14:21 +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
Derk-Jan Hartman
cf881ba76d Switch the hyphen in diff output to actually minus signs. 2010-10-29 18:52:59 +00:00
Derk-Jan Hartman
53bc659170 Add a nbsp to each empty "diff-marker".
Fixes Bug 25697
Prevent collapsed table row if both pre and post lines in the diff are totally empty.
2010-10-29 18:28:44 +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
Chad Horohoe
9e6c7cc8ef Get rid of PHP4-style constructors 2010-08-30 16:52:51 +00:00
Alexandre Emsenhuber
fb36e6ac3e * standardised file headers
* added a basic description
* added @file
2010-08-08 11:55:47 +00:00
Aryeh Gregor
74a21f3bd1 Remove most named character references from output
Recommit of r66254 to trunk.  This was just

find extensions phase3 -iname '*.php' \! -iname '*.i18n.php' \! -iname 'Messages*.php' \! -iname '*_Messages.php' -exec sed -i 's/&nbsp;/\&#160;/g;s/&mdash;/―/g;s/&bull;/•/g;s/&aacute;/á/g;s/&acute;/´/g;s/&agrave;/à/g;s/&alpha;/α/g;s/&auml;/ä/g;s/&ccedil;/ç/g;s/&copy;/©/g;s/&darr;/↓/g;s/&deg;/°/g;s/&eacute;/é/g;s/&ecirc;/ê/g;s/&euml;/ë/g;s/&egrave;/è/g;s/&euro;/€/g;s/&harr;//g;s/&hellip;/…/g;s/&iacute;/í/g;s/&igrave;/ì/g;s/&larr;/←/g;s/&ldquo;/“/g;s/&middot;/·/g;s/&minus;/−/g;s/&ndash;/–/g;s/&oacute;/ó/g;s/&ocirc;/ô/g;s/&oelig;/œ/g;s/&ograve;/ò/g;s/&otilde;/õ/g;s/&ouml;/ö/g;s/&pound;/£/g;s/&prime;/′/g;s/&Prime;/″/g;s/&raquo;/»/g;s/&rarr;/→/g;s/&rdquo;/”/g;s/&Sigma;/Σ/g;s/&times;/×/g;s/&uacute;/ú/g;s/&uarr;/↑/g;s/&uuml;/ü/g;s/&yen;/¥/g' {} +

followed by reading over every single line of the resulting diff and
fixing a whole bunch of false positives.  The reason for this change is
given in <http://lists.wikimedia.org/pipermail/wikitech-l/2010-April/047617.html>.
I cleared it with Tim and Brion on IRC before committing.  It might
cause a few problems, but I tried to be careful; please report any
issues.

I skipped all messages files.  I plan to make a follow-up commit that
alters wfMsgExt() with 'escapenoentities' to sanitize all the entities.
That way, the only messages that will be problems will be ones that
output raw HTML, and we want to get rid of those anyway.

This should get rid of all named entities everywhere except messages.  I
skipped a few things like &nbsp that I noticed in manual inspection,
because they weren't well-formed XML anyway.

Also, to everyone who uses non-breaking spaces when they could use a
normal space, or nothing at all, or CSS padding: I still hate you.  Die.
2010-05-30 17:33:59 +00:00
Mark A. Hershberger
edc744dcd9 * remove function_exists calls for things that functions that always
exist under supported versions of PHP
** assert() is always defined for DifferenceEngine()
** mail() is always defined for UserMailer()
** is_executable() is defined for Windows from PHP 5.0.0 on
2010-05-19 05:33:27 +00:00
Aaron Schulz
1c4e82f84d Moved UI diff stuff into its own DifferenceInterface file 2009-09-30 15:36:55 +00:00
Aaron Schulz
942a84716a * Split off deletedrevision (view only) right and give it to sysops
* Allow show/hide link on top revision just like history
2009-09-28 03:09:48 +00:00
Tim Starling
51e9917aa8 Fix for bug 20601: disable debug output. It can be re-enabled by patching. 2009-09-16 03:48:29 +00:00
Niklas Laxström
22f142a99c Recommit r53710 without the hack for preventing style sheets being added multiple times (is not possible with OutputPage::addStyle in the first place) 2009-08-24 05:37:40 +00:00
Brion Vibber
82b80fc483 Revert r53710 "* Allow suppressing "line 1" from the diffs, which can get quite annoying with many diffs"
Use of static variable here means that running multiple diffs during one request may mess things up. It should rather check if it's been added in $wgOut already.
2009-08-21 22:01:16 +00:00
Aryeh Gregor
3f3b9d28a2 Show change flag tooltips everywhere, not just RC
Follow-up to r54242.  Pointed out by Umherirrender on CodeReview.
2009-08-04 00:28:20 +00:00
Chad Horohoe
a2462d8fcd * (bug 16311) Make recent change flags acronyms instead of spans. Also move this crap to common, we don't need identical declarations in 5 different skins. 2009-07-29 22:15:52 +00:00
Niklas Laxström
bc43f524f7 * Don't add 200 extra css/js requests when showing 100 diffs
* Allow suppressing "line 1" from the diffs, which can get quite annoying with many diffs
2009-07-24 11:06:27 +00:00
Aaron Schulz
2a763847ca Enable show/hide link on diff to cur (consistency) 2009-07-18 02:51:41 +00:00
Siebrand Mazeland
8bc003e538 * follow-up to r51301: also add separated date and time as parameters for 'currentrev-asof' for consistency
* replace use of deprecated makeKnownLinkObj() by link()
* use array type parameter instead of string to escapeLocalUrl(), getFullURL() and getFullUrl() for readability
* change return type of htmlDiffArgument(). CHECKME: Should this method be private? (not used anywhere in SVN at the moment)
* break a few long lines with parameters
2009-06-06 15:09:19 +00:00
Tim Starling
9a1bfc924b Fix for r49412, possible fatal errors. 2009-06-03 16:33:08 +00:00
Purodha B Blissenbach
00a913cecd Message 'revisionasof' - date and time separated as of request by user "Der Umherirrende" at
http://translatewiki.net/w/i.php?title=Support&oldid=1243738#split_date_and_time
2009-06-01 20:45:46 +00:00
Tim Starling
bc35951c93 In Special:RevisionDelete:
* Refactored to remove massive duplication
* Removed page parameter and associated contextPage member variable, doesn't seem to do anything.
* Put ID lists into a single ids parameter and member variable instead of having one for each type.
* Fixed inappropriate call of Title::newFromUrl(), always wrong
* Don't pretend to use the return value from functions that don't return anything, this reduces readability.
* Use the table names for deleteKey/typeName values, they look more like English
* Use protected not private
* Remove requirement for log type to be specified in the target
* Use POST for RevisionDelete entry forms, to avoid URL size limits and issues with non-PATH_INFO URLs
* Don't purge all pages that use the given file
* LocalFile::purgeCache() already calls purgeHistory,() no need to do it again. But do call purgeDescription(). 
* Removed token from unhide=1 links, unnecessary
* Tokens are necessary on file streaming links, added them
* Fixed private data leakage due to incorrect use of LocalRepo::newFromArchiveName(). Non-existent placeholder file was returned which meant that $oimage->userCan(File::DELETED_FILE) was always true. Pass the archive name to tryShowFile() instead of the storage key.
* Using ls_field='oi_timestamp' is not correct, oi_timestamp refers to the timestamp of the revision in question, whereas the key that is stored is the timestamp of the previous revision (i.e. the timestamp in oi_archive_name). oi_archive_name would be more correct, although only half the field is used.

Elsewhere:
* Added missing message filehist-missing
* Fixed double asterisk in Status::getWikiText()
* Fixed escaping of the target parameter to Special:RevisionDelete from ImagePage
* Deleted FileStore.php. Deprecated in filerepo refactor except for get()/export() but somehow resurrected by RevisionDelete. Hopefully this will be the end of it. New interfaces will be added for wfStreamFile() in a later commit.
* Added convenience function File::getStorageKey(), factored out of Special:Undelete
* Added convenience function Revision::newFromArchiveRow(), factored out of Special:Undelete and Special:RevisionDelete
* Fixed notice in Special:Upload, uninitialised $pageText

FIXME: current revision can be suppressed on undeletion causing an unauthenticated unsuppress. Comments indicate this is a known issue. I fixed the parser cache pollution in this case but not the rest.
2009-06-01 11:37:06 +00:00
Niklas Laxström
d3b61fea7c Escaping fixes 2009-05-22 09:35:48 +00:00
Chad Horohoe
02e9f413eb Cleanup to r50310 & 50313: Don't use @ on chmod() and dl(), use wfSuppressWarnings()/wfRestoreWarnings() 2009-05-19 16:34:49 +00:00
Alexandre Emsenhuber
2a82a66505 fix E_PARSE from r50310 2009-05-07 16:51:45 +00:00
Chad Horohoe
389f46dfbe (bug 16925) Diffs no longer silently fail when $wgExternalDiffEngine is set to 'wikidiff' or 'wikidiff2' but extension is not installed. Should now gracefully fall back to the PHP diff. 2009-05-07 16:00:29 +00:00
Aaron Schulz
318783dc36 * Workaround ugly Safari/Chrome handling of <col> tags for hidden diffs (bug 18538)
* A few code style tweaks
2009-04-21 06:21:27 +00:00
Chad Horohoe
78b1818dbe No more $wgTitle in the diff engine. 2009-04-11 18:23:06 +00:00
Aaron Schulz
4b9187e598 Add convenience links for bug 18068 2009-03-22 13:26:27 +00:00
Roan Kattouw
2b9be47063 (bug 17863) Fix regression from r47890 that broke Show changes on the edit form; do this by skipping over revision loading as well as text loading when custom texts are set using setText() 2009-03-09 11:00:12 +00:00
Roan Kattouw
5349ea2dd8 * API: (bug 13209) Add rvdiffto parameter to prop=revisions
* Add $wgAPIMaxUncachedDiffs (default 1) which controls how many non-cached diffs will be served per request
* Tweak DifferenceEngine.php a bit to make cache status accessible, and remove a useless 'parseinline' which broke diff generation in the API
2009-02-28 13:25:21 +00:00
Aaron Schulz
b99b877508 Bug 17241 The diffonly URI parameter should cascade to "Next edit" and "Previous edit" diff links 2009-02-24 23:17:08 +00:00
Raimond Spekking
aa0f3bbaeb Move <div>...</div> from message text to program code for consinstency with all other messages. 2009-02-22 11:32:33 +00:00
Aaron Schulz
2437a0a1a0 (bug 5776) Add extra patrol link on bottom for diffs 2009-02-12 14:45:10 +00:00
Aaron Schulz
0821fa7da9 Added missing Revision::FOR_THIS_USER flag 2009-02-09 22:41:02 +00:00
Aaron Schulz
ad708b10eb Tweaks for bug 17060
* Don't show links to deleted revs in history for anyone (consistency)
* Always hide deleted content from all users; it can be viewed via (show/hide) links
2009-02-09 22:27:25 +00:00
Aaron Schulz
6bfaecba3b * Tweaks for bug 17052:
** Made radio button default selection fallback to the next one for deleted revs
** Use deleted diff message rather than showing an ambiguous "empty diff"
* Code style tweaks
2009-02-09 07:42:54 +00:00
Aaron Schulz
ebddcaca6a (bug 17104) Remove [Mark as patrolled] link for already patrolled revisions 2009-01-24 22:50:28 +00:00
Alex Z
b5d624f1c0 (bug 17055) Use a CSS class ('mw-revdelundel-link') for RevisionDelete "(show/hide)" links rather than hardcoded <tt><small>, reduce some code duplication by creating Linker::revDeleteLink() to make the links. 2009-01-18 21:07:09 +00:00
Aaron Schulz
8075446c1c Use getRawUserText function, since this is just there to trigger index usage for patrol link query 2009-01-15 17:33:13 +00:00
Aaron Schulz
e9fefecaed Fix for r45723 2009-01-14 00:39:43 +00:00
Aaron Schulz
92b51089ac Cleaned up single rev page diffs (bug 11527) 2009-01-14 00:26:21 +00:00
Aaron Schulz
220c59be9a (bug 16923) New parameter value diff=review for the URL 2009-01-07 21:09:18 +00:00
Aaron Schulz
82c0328abf Tweak r45314: just return out 2009-01-02 15:56:33 +00:00
Aaron Schulz
19024619f6 (bug 9243) Avoid exit to make MW handle page exceptions properly 2009-01-02 11:36:52 +00:00
Alexandre Emsenhuber
8c14e2df88 * Like r44911 but for MediaWiki:Difference message: switching from raw HTML to wiki text
* Whitespaces tweaks
2008-12-23 17:14:33 +00:00
Aaron Schulz
39bd0c75d5 Use more thorough Title->userCan('patrol') 2008-12-17 07:17:59 +00:00
Siebrand Mazeland
0a9af4a884 Consistent casing for addHTML() 2008-11-06 22:20:29 +00:00
Jack Phoenix
3eb0e98e2c adding AbortDiffCache hook to allow canceling the caching of a diff 2008-11-06 21:41:07 +00:00
Tim Starling
90ed80443e (bug 12586) Use wfHostname() everywhere, remove $wguname and $wgNodeName. Use getenv('COMPUTERNAME') on Windows. 2008-10-06 07:30:38 +00:00
Tim Starling
7410147d02 Fixes for r41154 and r41155:
* Boolean parameters are widely accepted to reduce readability. Replaced the new boolean parameters with class constant parameters instead. 
* Re-added Revision::revText(), for backwards compatibility
* The getUser()/getUserText() changes near line 1223 of SpecialUndelete.php were incorrect, $file is an ArchivedFile not a Revision, and doesn't have any $isPublic parameters.
2008-09-24 09:44:45 +00:00
Aaron Schulz
804deee936 rev_deleted security improvements as well as fix for rawpages 2008-09-22 14:37:05 +00:00
Aaron Schulz
81e7adc6ad Remove Revision::revText() and move functionality to getText() 2008-09-22 14:24:18 +00:00
Raimond Spekking
e9ad9393cf Move the timestamp into the message of the current revision link to make the link consistent with the link to the previous version on the left side 2008-08-27 18:23:03 +00:00
Raimond Spekking
b4e72cf141 Fix for r40041. PHP strict notice. Thanks to Ialex 2008-08-26 20:23:53 +00:00
Raimond Spekking
657831a2f5 * Add tooltips to rollback and undo links
At least on de.wiki the users with the review right have the rollback right too. They are confused about the difference rollback/undo. Hope that helps a bit
2008-08-26 20:06:57 +00:00
Chad Horohoe
0524aef5b6 * Add all HTMLDiff-related classes to the autoloader.
* Move all stuff @ingroup DifferenceEngine to /diff
* Split off Node and friends to Nodes.php to make HTMLDiff.php shorter.
2008-08-25 20:19:00 +00:00
Renamed from includes/DifferenceEngine.php (Browse further)