ContentHandler::exportTransform() allows content handlers to apply
transformations upon export, such as conversion of legacy formats or
filtering of internal data.
Note that the transformation is applied to serialized content, since
the exporter will generally not unserialize the content blob to an
intermediate form before writing it to the dump. Implementations
may choose to unserialy, then transform and re-serialize.
Bug: 65256
Change-Id: Ic55a8bd8bea13041000b176c7c02c7c5ced76f6d
ContentHandler::importTransform allows ContentHandler
implementations to apply transformations on page content
upon import. Such transformatiosn may by useful to update
from legacy formats, apply ID rewriting, etc.
Note that the transformation is done on the serialized content.
This allows for a "raw" import implementation that writes
improted blobs directly into a blob store without unserializing
them into an intermediary representation. Implementations may
choose to unserialize, transform, and then re-serialize.
Bug: 65256
Change-Id: I290fdf5589af43def8b3eddb68b5e1c23f6124e8
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
When importing, we need to check that the kind of content we are about to
import is actually allowed in the specified location on the local wiki.
This change does two things:
* Introduce the ContentModelCanBeUsedOn hook which provides control over
which kind of content can be used where.
* Introduce a check against ContentHandler::canBeUsedOn in the importer,
along with an appropriate error message.
Change-Id: Ia2ff0b0474f4727c9ebbba3c0a2a111495055f61
Revision::getContent can return null, which would here result in a fatal
error. Return false to indicate that this undo is not possible.
Change-Id: I6f6b4b59e86f9762f61c50dd65f81a7256c5255a
Add message move-redirect-text, which is appended to redirects created by
page moves (empty by default). This could be used on enwiki to automatically
add {{R from move}} while still allowing non-admins to revert the move, for
example.
Change-Id: Ic2158897ce46177b695a7fb90c8ed3349df18bde
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays
Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
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
By PSR2 PHP Standard, the files should ends with exactly one newline.
Some of our files have 2 or more and some other were missing a newline.
Fix almost all occurences of CodeSniffer sniff:
PSR2.Files.EndFileNewline.TooMany
I have not fixed the selenium files, I believe we will drop them.
Change-Id: I89fca8c1786fee94855b7b77bb0f364001ee84b6
Special:Movepage and ApiMovePage should be aware whether the present content
model supports redirects, and only offer to keep a redirect on moving
of it's supported.
Change-Id: I2d02b2668ea8ebe39387b79d165f6cf1037303b9
Adding MWNamespace::getNamespaceContentModel which returns the namespace
content model from the global, if set
Change-Id: Ie012fd0ff846d50cae8081fc32b76900dbcad209
This removes a misguided check and thereby allows diffs to be
created between different kinds of (text based) content.
Change-Id: I6b385fcdead22983edc089e1314151f9babdf7c9
This change moves the PageContentLanguage hook from Title::getPageLanguage
to Content::getPageLanguage, so the hook is no longer bypassed by
Content::getPageViewLanguage and consequently Title::getPageViewLanguage.
Change-Id: I51dabe9aee9d544483e7416a8fdf7721638d21bf
getAutoDeletereason did not gracefully deal with revisions that would
return null as their content (e.g. for deleted revisions).
Change-Id: I4976f2d09b8666ca1bccebea346af37ee77b09f7
* @licence -> @license
* Protects inline HTML by using double quotes, our inline comments uses
elements such as <h1> or <firstnameLastname@gmail.com>
* Commands in lowercase (@TODO -> @todo, @NOTE -> @note)
* removes @abstract and @static since doxygen detects them from PHP
code.
* various undocumented function parameters
* typos in parameters declarations
Change-Id: I62ad6fc124c355bf31acc780b9614a59cf79a421
Made TextContent and TextContentHandler usable directly.
CONTENT_MODEL_TEXT is unused in core, but may be used by extensions.
Change-Id: I8963c968800b98e286cd917a1038a9905b3a0fef
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
ContentHandler::runLegacyHooks() now includes the list of handlers registered
for a legacy hook in the warning it produces.
Change-Id: I48032b62d4be791f1dc71889051dd6211541ac50
Hooks::isRegistered() doesn't consider hooks in $wgHooks.
Until that is fixed (see I39bd5de2), we need to check that explicitely.
Change-Id: I211c0c8bd0cd618151e56a11171ec8feef328d16
Caching could be enabled for other content types, but for the moment,
JS and CSS pages rely on the fact that the ShowRawCssJs hooks is called
for every view - which is bypassed when the parser cache is used.
Change-Id: Icf603b9f2a685d9e705db3459fcd12dae1fdba57
Redirects should not be constructed as wikitext, since other content models
may use other mechanisms to represent redirects.
Change-Id: Id85c3b3ada1924628e4e51757573d233e998f920