We never assign to the variable, only call some (mutating) methods on
the object. With PHP 5 we don't need to pass this by reference.
The functions that evolved into this family were originally added in
r12337, back then we probably still ran on PHP 4 or something.
Change-Id: Ib4ab141ca6d803f9df0351b1f65c7e9955c37d57
Also don't cast $model to int in LinkCache::addGoodLinkObj(); content
model IDs are non-numeric strings, not integers, so that field was
always populated with the value 0. Because 0 is a falsy value, this
caused subsequent calls to Title::getContentModel() to return the
default model rather than the correct one.
Also (hopefully) fixed every single query that could cause a
LinkCache entry to be added without the content model.
Bug: 69789
Change-Id: I94f06baf406afa538cd2b10139598442f9fc6759
We currently have a few legacy requests to the load.php end point
that bypass the ResourceLoader client by coding a request to
load.php via a "<script src>" directly. Most prominently the
request for the 'site' wiki module (aka MediaWiki:Common.js).
Remove the manual wrapping of embedded private modules as this
is now taken are of by ResourceLoader::makeModuleResponse itself.
Misc:
* Mark "jquery" and "mediawiki" as Raw modules. While the startup
module had this already, these didn't. Without this, they'd
get the conditional wrap – which would be a problem since mediawiki.js
can't be conditional on 'window.mw' for that file defines that
namespace itself.
* Strip the cache-key comment in the unit tests because the hash
no longer matches and using the generic 'wiki' dbname was breaking
DB queries.
* Relates to bug 63587.
* See also 05d0f6fefd which expands the reach of the non-JS
environment to IE6 and helped expose this bug.
Change-Id: Icf6ede09b51ce212aa70ff6be4b341762ec75b4d
Special page transclusion returns an OutputPage, whose metadata is
copied into the ParserOutput, and then later back into an OutputPage.
The "preventClickjacking" flag should be part of that metadata.
Bug: 65778
Change-Id: I17d2720fb94bb383a92059e5adbf6c16ee3e9ef4
With the introduction of the OutputPageScriptsForBottomQueue hook,
modules loaded through it are TYPE_COMBINED, which
OutputPage::makeResourceLoaderLink was not checking on whether
or not it was safe to include them.
Change-Id: I33f39a5643b3d05db5a89e62fa6c86d437dea143
After some discussion with Roan, it turns out this
hook is unnecessary. The proper solution is to use
addModuleScripts/addModuleStyles instead of a
plain addModules.
This reverts commit e7361de181.
Bug: 68712
Change-Id: Iadbff5f7fbbc5a08d6336674b12315967f45591d
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling
Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
- Removed spaces after not operator (!)
- Removed spaces inside array index
- use tab as indent instead of spaces
- Add newline at end of file
- Removed spaces after casts
Change-Id: I9ba17c4385fcb43d38998d45f89cf42952bc791b
To do so, created ResourceLoader::createLoaderURL(), which takes a
ResourceLoaderContext object. ResourceLoader::makeLoaderURL() was
deprecated.
While reviewing usage of the old function, many of the callers only
differed by one or two parameters from their respective
ResourceLoaderContext object. To simplify that use case, I created
DerivativeResourceLoaderContext, based of off DerivativeContext for
IContextSource.
Change-Id: I961c641ab953153057be3e3b8cf6c07435e9a0b0
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
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
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
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
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
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
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
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
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
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
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
- 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
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
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