Commit graph

56 commits

Author SHA1 Message Date
jenkins-bot
e87a6ad62d Merge "Introduce ContentHandler::exportTransform()" 2014-05-27 18:31:05 +00:00
daniel
ee0ff556d4 Introduce ContentHandler::exportTransform()
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
2014-05-20 19:21:49 +02:00
daniel
5ca37ababd Introduce ContentHandler::importTransform.
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
2014-05-20 19:12:35 +02:00
Brion Vibber
0decf94d10 tyop fxi
Change-Id: I05cd37b3dab7d0eeffb4df81f906fd1e881b7f9f
2014-05-11 21:39:23 +02: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
Marius Hoch
7d016b5e3e Minor documentation fix for ContentHandler::makeParserOptions
Change-Id: I752edbf2f68d4f11bb24ccbce40f0618b4ac5e48
2014-02-01 17:13:15 +01:00
daniel
4cc9407fe9 (bug 47070) check content model namespace on import.
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
2013-12-17 16:58:57 +00:00
Siebrand Mazeland
b213de40ff Declare visibility of class property in ContentHandler
Make $handlers protected. It's only used in MediaHandler and
ContentHandler.

Change-Id: I2cfc9273d4cf710fbcf01a8e70a93ae64de73579
2013-11-20 06:09:49 +01:00
Siebrand Mazeland
5bec2e90d1 Update documentation and break long lines
Also remove some superfluous newlines.

Change-Id: I904d6ddeb976434708d5a22df9e8abd2e6f60a6c
2013-11-20 06:02:37 +01:00
Siebrand Mazeland
3bbe32d6e9 Update formatting
Change-Id: Ieee4747cf2401d0d89a497a7637d32348192f481
2013-11-19 22:26:16 +01:00
umherirrender
f1fb777c3b Fix function doc of ContentHandler::getLocalizedName
The funcion is about model, so the return value is also about model.

Change-Id: I18325eb33525a334a2a6db15f4381c627845c711
2013-11-16 12:16:06 +00:00
umherirrender
5ecaf91e77 Add used message keys to ContentHandler::getLocalizedName
Change-Id: Ide072627e87c94da5a180d8d00aa38683af44f4e
2013-11-16 11:56:09 +00:00
umherirrender
88ee6e03e6 Avoid fatal in ContentHandler::getUndoContent by null content
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
2013-11-05 20:37:45 +01:00
Reedy
4c3b64e05e Add $wgEnableParserLimitReporting to control whether the NewPP limit
report is included as a HTML comment.

Bug: 26792
Change-Id: I2b2b3c9d76487168243b733c1154c4c26c7de3d6
2013-10-17 23:13:34 +01:00
Jackmcbarn
528590ccec Allow appending text to redirects from moved pages
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
2013-10-04 10:40:47 -04:00
Mark A. Hershberger
ec14bd0c8e ContentHandler: Fix a typo
Change-Id: I3accd0605f62e73d5ea527da7b3c03e4bdda3fc7
2013-07-27 19:23:27 +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
umherirrender
6c278b6d7e fix some spacing
* 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
2013-03-25 22:22:46 +00: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
Yuri Astrakhan
27d83878c0 Lots of spelling mistakes and phpdoc attributes
@throw->@throws
@returns->@return
@seealso->@see
@cover->@covers
etc

Change-Id: I9ae6bc3034e9790e2d66cd96473b923fe9ee7953
2013-03-10 23:16:28 -04:00
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
Siebrand Mazeland
9b7889b84b Use American English spelling for behavior
Spotted in ipbreason-dropdown by Shirayuki.

Change-Id: I576ed4bc0abe5ab980aaee3fb9f9e4b43087311f
2013-03-04 10:24:57 +01:00
umherirrender
be90ce07b3 fix some spacing
Change-Id: I93f0a87ba7129bc336083e7289247d3150feb606
2013-02-04 19:54:07 +00:00
Antoine Musso
f6b92231fd style: normalize end of files
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
2013-02-03 15:04:39 +01:00
umherirrender
fac189e26a The abstract declaration must precede the visibility declaration
From phpcs

Change-Id: I169c80a911ba75d64ab8a503088903ce3b8a7cca
2013-01-26 20:00:09 +01:00
Alexandre Emsenhuber
105b52525a Correct method name in ContentHandler comment
Change-Id: Iffc5a975cd7ae311d33147c35e59ba674d5e687b
Article::getReason() does not exist, but Article::generateReason() does.
2013-01-18 13:46:36 +01:00
jenkins-bot
b39e1348cf Merge "(bug 42915) make MovePage aware of whether redirects are supported." 2013-01-03 01:35:54 +00:00
Alexandre Emsenhuber
ddf601f7d3 Improve documentation of content handler stuff
- Split file and class documentation
- Add some missing file/class descriptions
- Add missing @ingroup Content

Change-Id: I7f7e3056570ca13a92f36a408c9b961c938f09a1
2012-12-20 20:44:47 +01:00
daniel
277ca9ac4e (bug 42915) make MovePage aware of whether redirects are supported.
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
2012-12-20 19:00:35 +01:00
Daniel Kinzler
7869ebbc24 Merge "(bug 42089) meta=siteinfo should output the default content model" 2012-12-14 10:29:28 +00:00
umherirrender
bf9bd497f0 (bug 42089) meta=siteinfo should output the default content model
Adding MWNamespace::getNamespaceContentModel which returns the namespace
content model from the global, if set

Change-Id: Ie012fd0ff846d50cae8081fc32b76900dbcad209
2012-12-13 21:05:15 +01:00
Reedy
d537d96868 Add numerous missing @throws to method documentation
Change-Id: Iba868e82a75fef7c7d011bc5be192bf059d037c0
2012-12-09 03:09:48 +00:00
Platonides
84e1e6b5ae Removal of unused globals.
Change-Id: I870665d18f955a245222cfceca4665897277e7e4
2012-11-26 22:15:11 +01:00
daniel
5a583b295c (Bug 41658) Allow diffs across text based content.
This removes a misguided check and thereby allows diffs to be
created between different kinds of (text based) content.

Change-Id: I6b385fcdead22983edc089e1314151f9babdf7c9
2012-11-05 17:21:53 +01:00
daniel
d879e4227a (Bug 41493) Move PageContentLanguage hook to Content class
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
2012-10-29 18:08:04 +01:00
daniel
aeaa72ff8b (Bug 41370) protect aginst content-less revisions
getAutoDeletereason did not gracefully deal with revisions that would
return null as their content (e.g. for deleted revisions).

Change-Id: I4976f2d09b8666ca1bccebea346af37ee77b09f7
2012-10-25 09:51:23 +02:00
Antoine Musso
9362bb6c56 miscellaneous doxygen warnings
* @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
2012-10-22 14:00:08 +02:00
daniel
0ead7de6bf Add some debug logging to ContentHandler
Change-Id: I3f728999bc0576e4d225b49b5440a7fc5617d52d
2012-10-19 13:25:13 +00:00
IAlex
a1f1af7119 Merge "Added docu headers to content(handler) files" 2012-10-17 16:16:23 +00:00
jeroendedauw
bccf2755d4 Moved ContentHandler deriving classes into their own files for better discoverability and more manageable line count per file
Change-Id: I37db53e1d1420e61d3af4566322bcdba85ec778b
2012-10-16 20:20:43 +02:00
jeroendedauw
506456c138 Added docu headers to content(handler) files
Change-Id: I9981698a5e4d79db89892ce3f3e007dd5aee5fd1
2012-10-16 20:04:32 +02:00
daniel
41b0a79455 Support plain text content.
Made TextContent and TextContentHandler usable directly.
CONTENT_MODEL_TEXT is unused in core, but may be used by extensions.

Change-Id: I8963c968800b98e286cd917a1038a9905b3a0fef
2012-10-14 23:27:00 +00: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
daniel
25304cd1e1 Report legacy hook handlers.
ContentHandler::runLegacyHooks() now includes the list of handlers registered
for a legacy hook in the warning it produces.

Change-Id: I48032b62d4be791f1dc71889051dd6211541ac50
2012-10-09 14:20:03 +02:00
daniel
a138706729 Fix usage of deprecated ArticleSaveComplete hook in core
Change-Id: Ic01fd95d50a909470d6f0ffd93c972322789d49a
2012-10-08 14:13:59 +02:00
daniel
8bbd1de19e Merge "Use ContentHandler as a factory for recirects." into Wikidata 2012-10-08 11:11:16 +00:00
daniel
65bef41eaa Merge "Make runLegacyHooks work around bug in Hooks." into Wikidata 2012-10-08 11:10:41 +00:00
daniel
e6fb2cac0c Make runLegacyHooks work around bug in Hooks.
Hooks::isRegistered() doesn't consider hooks in $wgHooks.
Until that is fixed (see I39bd5de2), we need to check that explicitely.

Change-Id: I211c0c8bd0cd618151e56a11171ec8feef328d16
2012-10-05 19:11:50 +02:00
daniel
ab91faf877 For now, use the parser cache only for wikitext.
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
2012-10-05 19:05:21 +02:00
daniel
01e1b1a8e8 Use ContentHandler as a factory for recirects.
Redirects should not be constructed as wikitext, since other content models
may use other mechanisms to represent redirects.

Change-Id: Id85c3b3ada1924628e4e51757573d233e998f920
2012-10-05 16:50:32 +02:00