Commit graph

1211 commits

Author SHA1 Message Date
jenkins-bot
ddeadfc49b Merge "Prevent OutputPage::addWikiText and friends from causing UNIQ fails" 2014-06-26 09:25:19 +00:00
Brian Wolff
4e6b0e4f4d Prevent OutputPage::addWikiText and friends from causing UNIQ fails
If you transclude a special page, OutputPage::addWikiText can cause
problems. This prevents that from happening, by using a new object
if currently in a parsing operation.

Bug: 14562
Bug: 65826
Change-Id: I7c38fa9e2fbd270e45f73f522612451e77ab8cbb
2014-06-25 15:16:14 -03:00
Kevin Israel
1402236c4b Remove use of OutputPage::addParserOutputNoText()
Simply clicking "Show preview" on the edit page triggered a deprecation
warning.

Also removed the wfDeprecated() call from the method, which is still used
in a few WMF-deployed extensions without a corresponding open change.

Follows-up e8f1fede77.

Change-Id: I2cfdc84b92cf13478b9f462028d525e4ec14fdf2
2014-06-24 04:53:44 -04:00
Bartosz Dziewoński
e8f1fede77 OutputPage: Add addParserOutputContent() for more fine-grained control
We previously had addParserOutput(), which added everything and did
some other magic, and addParserOutputNoText() which, as the same says,
added everything but the text.

I renamed addParserOutputNoText() to addParserOutputMetadata() and
created two more functions:

* addParserOutputText(): This is almost identical to adding the raw
  HTML, but calls the OutputPageBeforeHTML hook like other
  addParserOutput*() methods.

* addParserOutputContent(): Like addParserOutputText(), but also adds
  the ResourceLoader modules and variables associated with the parser
  output. This is important especially for some extensions like
  TemplateData or SyntaxHighlight which add styles to the page to
  enhance the display.

Change-Id: Iead541886fd1ccdbdf1cb06af71b34cd04644985
2014-06-20 19:31:17 +00:00
Jack Phoenix
6849fde6cb Apparently for certain (API) requests $this->getTitle() doesn't return a valid Title.
Usually these are API siteinfo requests (api.php?action=query&meta=siteinfo). In that case, this code used to produce a fatal ("Call to a member function getPageLanguage() on a non-object").

Change-Id: Ifb6f99fe554890ff2719220f58d1b6c1a7a95ddc
2014-06-11 23:00:24 +03:00
Daniel Friesen
0f6609447e Drop support for old skins that don't use head element
These skins have been obsolete since 1.16 and aren't supported well at this point.
This deprecates those skins and begins deprecation of the creation of <head> contents
with only chunks of OutputPage stuff. The entire head should be created by OutputPage.

This also deprecates some old methods responsible for returning raw chunks of html for the head:
* getScript
* getHeadItems

Output of HeadItems is also tweaked. Previously there was no newline added
after each item, now there is. Most of the callers of addHeadItem don't use
their own newline and as a result end up on one line.

Change-Id: I13e25cc8d8fc3aa682f23b019a2fda0e809a5f64
2014-05-31 15:30:19 +02:00
Adam Roses Wight
6bfe8bc13a opportunity to reuse Title::getEditURL()
This will be helpful if we want to make changes to the edit URL in the future.

Change-Id: I6e877d23b041a2bd1672ae804e06bf6a52e16c9f
2014-05-19 10:06:42 +00:00
Bartosz Dziewoński
c3aa5ef597 Create Parser::stripOuterParagraph to avoid code duplication
We've had the logic for stripping the outer <p/> element in three
separate places. The version in OutputPage was missing the '$' at the
end of the regex, that was most likely a mistake caused by the
duplication.

Also, extend the logic in order not to generate invalid HTML if the
input contains more than one <p/> tag. Added tests for this and the
previous behaviour.

https://www.mail-archive.com/mediawiki-api@lists.wikimedia.org/msg03188.html

Change-Id: I6bb3597898324556df912a23a7ffc9ff250b8f58
2014-05-15 12:20:19 -04:00
Siebrand Mazeland
df49428b90 Pass php-strict for OutputPage
Change-Id: Ia5d03277fff543ca672dc8efc7eaaeca4888ac23
2014-05-11 16:50:02 +00:00
Matthew Flaschen
44287314f8 Change X-UA-Compatible from <meta> tag to HTTP header
Derk-Jan Hartman suggested this to remove a HTML validation error.  As he
noted, the HTTP header is also more effective, since it works on
intranets, and is not sensitive to ordering issues within the <head>.

See http://stackoverflow.com/questions/6156639 .

Bug: 62885
Change-Id: I2214abcb1badbbaca48427a31d1218c9db9a6af7
2014-04-30 03:44:04 +00:00
Bartosz Dziewoński
59002d8935 Consistently use '@deprecated since <version>'
Variants included 'in <version>', 'as of <version>' and just the
version number.

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

Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
2014-04-15 22:18:19 +02:00
umherirrender
829886b10a Fixed some @params documentation
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: I64e8cfe478cb0ba438f40b0631d6e9049cdab567
2014-04-14 12:59:19 +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
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
Timo Tijhof
0088c506bb resourceloader: Refactor module links output
Changes:

* Removed hardcoded logic in OutputPage regarding modules
  being "enabled".
  Previously we would always output state=loading and use
  $wgAllowUserJs (and others) to decide whether to output
  state=ready or makeResourceLoaderLink.

  Now, we no longer unconditionally output state=loading and
  simply always call makeResourceLoaderLink. That method takes
  care of checking whether modules are enabled and non-empty
  and returns state=ready when that is the case.

  This cleans up cases where the duplicated and incomplete logic
  in OutputPage thought the module was non-empty but turned out
  to be empty and thus would output both state=loading and later
  state=ready for the same module.

* Clean up documentation for makeResourceLoaderLink (inconsistent
  ordering of type hint and $var, and @return was missing the fact
  that the returned html can also contain <link>).

* makeResourceLoaderLink now returns an array of html and module
  states. This allows the consumer of this method to combine the
  states in 1 larger script tag on top of multiple
  makeResourceLoaderLink calls (e.g. one state script followed
  by multiple <script src=load.php>).
  This isn't to reduce html output, but to make sure we inform
  mw.loader about modules before the <script src=load.php>.
  If we were to mix/alternate the state script and load.php
  requests (which are blocking in html), it is possible for those
  scripts to request other modules. We need to prevent duplicate
  loading of modules we already know are going to be requested
  by the HTML output futher down.

* Removed spurious new line.

Example of change in HTML output:

* The output has been reduced from:
  - loader.state( site: loading, user: loading, user.groups: loading )
  - loader.load( .. )
  - <script src="load.php?modules=site ..">
  - loader.state( user: ready, user.groups: ready )

  to:
  - loader.state( site: loading, user: ready, user.groups: ready )
  - loader.load( .. )
  - <script src="load.php?modules=site ..">

Change-Id: I91754ce5fae3d05b4bfa7372372eba81ee2fc579
2014-04-04 01:57:29 +00:00
jenkins-bot
2e09c35678 Merge "Suppress section edit links with action=render" 2014-03-26 18:23:01 +00:00
Alexandre Emsenhuber
153abd52fd Correct the destination of checkLastModified debug messages
- OutputPage: if $wgCachePages is set to false, then it can be shown
  back to the user
- AjaxResponder: don't send back to the user (for consistency with the
  other calls to wfDebug(), and this can't be displayed to the user)

Change-Id: I17794016cfaef65ee3df3b82ceb8cb3a32ac7c67
2014-03-14 22:33:21 +00:00
MaxSem
65caa90c19 Suppress section edit links with action=render
action=render is often used to pull the rendered HTML of an article
for inclusion in a different context. More often than not, the edit
links are not desired in that context.

This reverts commit a04b5d5dcb
and redoes Iab02cbd42f2f93f0f5264a74691ae1b84f296f12.

Bug: 19415
Change-Id: I26213653c017c2e19a6f6799f3ea0676ff8524d1
2014-03-12 18:27:01 +00:00
umherirrender
542d2e8a90 Add ParserOutput::addJsConfigVars
The OutputPage has variables for modules, moduleScripts, moduleStyles,
moduleMessages and the config vars, but the ParserOutput is missing the
last one.

With ParserOutput::addJsConfigVars it is possible to add scripts and it
config vars at one place and have not use the MakeGlobalVariablesScript
hook or other ways to get the needed javascript variable in the output.

Change-Id: I6ad61cca76805f6b9d76e053c98c7509c323d5da
2014-02-16 20:35:49 +00:00
Alexandre Emsenhuber
f09172d9b8 Put line breaks after each element in OutputPage::headElement()
Change-Id: I4e7715a354e9d599fb2c77c09ac72a55462aaa5d
2014-02-06 15:15:42 +01:00
Alexandre Emsenhuber
a7a0883019 Enhance the destination control parameter of wfDebug() and wfDebugLog()
- The parameter is now a string, making is more understandable than
  boolean values
- It takes the same values in both wfDebug() and wfDebugLog() (except
  for 'private' which is only used in the latter)
- This adds a new possibility to wfDebugLog() to log the message either
  on the specific log or the general one, but not to the debug toolbar
- Old boolean values are still recognised for backward compatibility
- Also send the messages passed to wfDebugLog() to the debug toolbar
  when they are written to a specific log and not restricted to logs
- Updated the calls of and wfDebug() and wfDebugLog() with the last
  parameter to change it into a string
- Renamed MWDebug::sendWarning() to MWDebug::sendMessage() and added
  $group parameter to it; will not break anything since that method
  is marked as private
- Changed the call to wfDebug() from MWDebug::sendMessage() to use
  wfDebugLog() with 'log' as thrid parameter, so that those messages
  can be logged separately from the main log and they don't show up
  a second time on the "debug log" tab of the debug toolbar

Change-Id: I1be09d4c1d3408ed5b26a5db02691c17c0ec0926
2014-02-04 19:56:24 +00:00
Matthew Flaschen
527f9eeb85 Document OutputPage->mDoNothing
Change-Id: Id1d30ec29fb219a95532432cd8fc76209f3baa8f
2014-01-30 12:11:33 -08:00
Dereckson
601d65b201 OutputPage::showErrorPage raises a notice if arguments are incoherent
The method has the following signature:
OutputPage::showErrorPage( $title, $msg, $params = array() )

$msg can be a string or a Message object.

If it's a string, a Message object is built, with $params as parameters.
If it's a Message object, $params is ignored.

The core now triggers a notice in the case a call is made with $msg an instance
of Message object, and a (non-empty array) $params argument is given.

Change-Id: I227a416f088fc1acd6a04345ed0e24d06f967ecc
2014-01-29 17:06:01 +01:00
Dereckson
8ee0ef4a7c Improve OutputPage::showErrorPage method documentation
- Added the most usual case of call
- Fixed the incoherence between -Object and -Obj

Change-Id: I81207f4ef46a43529974e3ada194f2948a1e9017
2014-01-29 15:37:10 +00:00
yaron
f30c062cbf Fix to avoid IE "compatibility view"
Bug: 25378
Bug: 49548
Bug: 54343
Change-Id: I1e94128e8578e3ac3ab7a64bbc0431a454085d02
2013-12-23 21:41:58 +00:00
dr0ptp4kt
36983d11fb Add support for skins to set attributes of <html> element.
* Useful for device/profile-specific stuff (e.g., manifests)

Change-Id: I65f4d3454ae52a25fe4c6e9f2119129425b3de7a
2013-12-18 10:43:11 -08:00
01tonythomas
3f0b8c88c3 Removed 'Disable browser page caching" user preference
It is  a very advanced user preference with little usage and is often misleading.
Updated Release Note.

Bug: 52809
Change-Id: I43f6205df53c7a38717c60a2d7d144307feb58a4
2013-12-07 14:02:44 +05:30
Parent5446
1fe3b4a9d2 Revert "Add $robotPolicy parameter to SpecialPage::setHeaders()"
This reverts commit 8c7541da3b.

Bug: 57883
Change-Id: I582088528286ff34da164fa4457dd203f11df7ef
2013-12-02 21:20:11 +00:00
tisane
8c7541da3b Add $robotPolicy parameter to SpecialPage::setHeaders()
Also fix docs for OutputPage::setRobotPolicy()

Bug: 57764
Change-Id: I8b780ca349a2f5d18e857ed707f682d19be0054c
2013-12-02 19:26:21 +00:00
umherirrender
0bc583af2c Move closing parenthesis from multi line if and function to own line
The Line continuation Coding conventions prefers the closing parenthesis
on the same line than the beginning curly braces. This is done for ifs
and functions.
Also move some boolean operator from the end of a line to the beginning
and changed some indentation to make the condition hopefully better
readable.

Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
2013-12-01 21:39:00 +01:00
jenkins-bot
b8a720c5e6 Merge "Use 'pagetitle' in content language" 2013-11-27 19:49:00 +00:00
Brad Jorsch
a04b5d5dcb Revert "Suppress section edit links with action=render"
This reverts commit 2248021997.

That revision caused section edit links to be shown on views of old
revisions. See comments there for suggestions on reimplementing it.

Change-Id: Ie65e3de84b44866e4ab1fc222a365cb3a9180ee1
2013-11-22 09:56:20 -05:00
Jack Phoenix
e501186d01 New getHTML() method for QuickTemplate to get the HTML of a template.
OutputPage's addTemplate() is now a wrapper around QuickTemplate.

This allows more flexible usage of templated HTML, as
required by some third-party extensions.

Change-Id: I943e8e50438c716b7b56d2f908da38a4bf73d9e2
2013-11-21 13:38:31 +02:00
Siebrand Mazeland
c142126fc7 Use 'pagetitle' in content language
It often happens that wiki sysops want to change it site wide, especially
when they want to change the format (eg, have {{SITENAME}} removed, or
replace the hyphen with a middot).

Bug: 48701
Change-Id: Iaf00fca1e89ae022c348c4fa0de32b998d7921a1
2013-11-12 09:36:57 +01:00
Bartosz Dziewoński
2248021997 Suppress section edit links with action=render
action=render is often used to pull the rendered HTML of an article
for inclusion in a different context. More often than not, the edit
links are not desired in that context.

Bug: 19415
Change-Id: Iab02cbd42f2f93f0f5264a74691ae1b84f296f12
2013-11-09 02:01:23 +01:00
umherirrender
7127c1792b Add "wgRelevantUserName" from skin to mw.config
A skin can have a relevant user, then some help links in the sidebar
are shown. When a user want extend this informationen with userjs, he
has to parse the existing items or the title param of the url to get the
name of the user for which this help links are shown. Having the name as
javascript variable makes it easier to add more links in the sidebar.

Change-Id: I17a75902b6e739d5149d332b6a94a6568b79501f
2013-11-05 17:59:05 +01:00
jenkins-bot
8cabb5f777 Merge "Make TOC hideable" 2013-10-24 19:22:32 +00:00
Tim Starling
d1bc243f65 Remove all instances of the word "iff"
It's elitist mathematical jargon. In all cases dealt with here, it adds
no additional meaning compared to "if", beyond what was already obvious
from context. Thus, its only purpose is to smugly demonstrate that the
author attended their second-year mathematics classes, at the expense of
causing confusion for everyone who doesn't have such a background.

If you really think you need to convey extra information beyond what
"if" gives you, the English language contains plenty of devices for doing
so, without resorting to neologisms.

Change-Id: Iae21095d02ec2935c10e94f532235c2671c115b1
2013-10-23 10:56:54 -07:00
Max Semenik
21c1c7d025 Make TOC hideable
Currently, if an extension doesn't want a TOC, it has to remove it manually.
This change wraps the TOC in markers that make it easy to remove it in ParserOutput
on demand without fragmenting the parser cache with stuff like "use/not use TOC".

Change-Id: I2889bcb9eb999c9049601e92440132118e1a8a41
2013-10-18 17:47:47 +04:00
Ori Livneh
8920372686 OutputPage->getJSVars: Maintain symmetry between JS & PHP vars
The function is more difficult to read than it need be by dint of some things
two names. I can't be the only one who finds 'wgCurRevisionId' => $latestRevID
ugly, right? Anyhow, lots of JS code depends on the JS variable names, whereas
the PHP variables exist only in the scope of that method, so it's clear that
it's the PHP names that should be brought in line.

Change-Id: Ibddd5d2fc8d75e0ade18ff3433714d52605f2911
2013-09-27 11:42:03 +02:00
jenkins-bot
123d4122c8 Merge "Add wgRevisionId variable to ResourceLoader" 2013-09-26 02:43:26 +00:00
csteipp
365137e704 Vary on forceHTTPS cookie
Varnish seems to be returning the cached version of pages for users
after they have logged in over https, but access an http page. This
seems to occure because only the forceHTTPS cookie is sent on the
request, but varnish doesn't vary the cache based on that cookie.

Bug: 54513
Change-Id: Ia97ed80622191669ee5ca37af809d307bbdb61ae
2013-09-25 15:42:02 -07:00
parent5446
7fa7b71eb3 Add wgRevisionId variable to ResourceLoader
mw.config provides wgCurRevisionId, which has the latest
revision number. This adds wgRevisionId, which indicates
the revision number currently being viewed. This is useful
when looking at old revisions.

Bug: 51594
Change-Id: Ie0d00f3a9a8af8533ab28204b5bb483a0092c710
2013-09-24 19:34:42 -04:00
MatmaRex
250caa19a0 Remove 'mediawiki.legacy.wikiprintable' module
It's a relic of simpler times, no longer used by any core skin. The
'mediawiki.legacy.commonPrint' module can be used instead.
(SkinTemplate-based skins do it automatically.)

* The 'mediawiki.legacy.wikiprintable' module has been removed.
* The skins/common/wikiprintable.css file has been deleted.
* Skin#commonPrintStylesheet has been deprecated; its return value is
  ignored.

Dependency: I96e66ff8905416bea906d40cdd72ba646399191b
Change-Id: Icbcebc8f539f7786d037b717d262684e9931aca6
2013-09-16 17:31:58 +00:00
jenkins-bot
edb4ed713c Merge "No spaces after (casts)" 2013-09-04 18:14:05 +00:00
MatmaRex
df8ec1e216 No spaces after (casts)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
2013-09-04 20:05:43 +02:00
Matthew Flaschen
ab44291204 Remove dead code
Accidentally left in dabbbc7d2a

Change-Id: I58e65ca7ad23d00992f66f3bcee879e662b62ef0
2013-08-31 01:57:33 -04:00
Timo Tijhof
7627cf6175 mw.config: Add wgIsRedirect
Change-Id: I6e365f20b513ded10ede51d4b34de0736653a3dc
2013-07-23 21:11:31 +02:00
Matthew Flaschen
0bbc358951 Add wgIsProbablyEditable for editability based on quickUserCan.
It uses quickUserCan like SkinTemplate, for performance reasons.

Bug: 43790
Change-Id: I2f77b69624cc1a4cd74c8178eea53681f3f2b107
2013-07-04 05:18:49 +00:00
Liangent
423f550009 Fix various language tags used in Html attribs to use wfBCP47()
Change-Id: I823ffacf5a55e53d6ab5383c1a42a9199d56f11d
2013-06-30 17:37:12 +00:00