Commit graph

250 commits

Author SHA1 Message Date
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
Daniel Kinzler
e790288252 Merge "(Bug 42616) Remove extra newline from redirect wikitext" 2012-12-12 13:25:48 +00:00
Reedy
d537d96868 Add numerous missing @throws to method documentation
Change-Id: Iba868e82a75fef7c7d011bc5be192bf059d037c0
2012-12-09 03:09:48 +00:00
Platonides
2e518fb0bf Add missing wfProfileOut()
Change-Id: Id9c4958aa6659d66bb3486d17186424fbd9b5758
2012-12-06 23:03:25 +01:00
Ori Livneh
e33f496905 (Bug 42616) Remove extra newline from redirect wikitext
Change-Id: I706d75afc4ff869d4ec0a7f99b51b737edb0d2ea
2012-12-03 20:29:25 -08:00
Platonides
84e1e6b5ae Removal of unused globals.
Change-Id: I870665d18f955a245222cfceca4665897277e7e4
2012-11-26 22:15:11 +01:00
Ori Livneh
71cdd2a9eb JavaScriptContentHandler: Fix typo in comment block (actual: 'CSS'; intended: 'JS')
Change-Id: Iaef21f0c864222aee7c970012e8163741d6310ca
2012-11-20 00:57:44 +01:00
Antoine Musso
42a8daaf5a (bug 26280) all files should have GPL header
MediaWiki is licensed under GPL so we should really add the header to
our PHP code unless reusing code licensed differently.

Tested using:
  ack-grep --php -L 'This program is free software' \
    includes/ maintenance/ mw-config/ resources/ skins/

Output the following files:
 includes/ExternalEdit.php (public domain)

Various other licenses:
 includes/json/Services_JSON.php
 includes/libs/CSSMin.php
 includes/libs/IEContentAnalyzer.php
 includes/libs/JavaScriptMinifier.php
 includes/libs/jsminplus.php
 includes/normal/Utf8Case.php
 includes/objectcache/MemcachedClient.php

File autogenerated from a GPL file and Unicode data:
 includes/ZhConversion.php

A few lines coming from stack overflow:
 maintenance/mwdoc-filter.php

Message files do not have any license :-/

Change-Id: I214a988edfa9e2dfcc762612a0f7d47eee8bcb74
2012-11-18 15:34:00 +01:00
Aaron Schulz
a8644b99bb Merge "Content::convert() for conv. betw. content models." 2012-11-07 20:39:09 +00:00
daniel
ea4473037d Content::convert() for conv. betw. content models.
This is needed to fix bug 41706 and similar, watch for follow-ups.

Automatic, implicit conversion may be handy in several cases, especially
for converting between different text based content models. E.g. it should
be possible to create a diff between a JavaScript and a wikitext page. This
change lais the foundations for this ability.

Change-Id: Ie7d87b67b24ac9897cb5696220a7785b228d3c79
2012-11-06 17:39:10 +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
IAlex
5fe5f5e9be Merge "minor style improvements" 2012-11-02 13:21:29 +00:00
jeroendedauw
664884900d minor style improvements
Change-Id: Iae617e8967e98b4aad596fa2de784b3b6c36a11d
2012-11-02 13:09:42 +01:00
SPQRobin
ec81140f9b Merge "(Bug 41493) Move PageContentLanguage hook to Content class" 2012-11-01 23:55:20 +00: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
ee5527aa47 Warn when creating TextContent around false/null.
Instantiating a TextContent instance around a null or false value
instead of a string may indicate an error and should thus trigger
a warning and thereby make tests fail.

Change-Id: I0864bbf31040d0c5db96a90ff427dc9dd3ccbd67
2012-10-29 16:26:06 +01:00
Siebrand
6b305fcf55 Merge "revert gerrit change 29597 for TextContent constructor" 2012-10-28 22:30:53 +00: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
aude
1024fb7e69 revert gerrit change 29597 for TextContent constructor
https://gerrit.wikimedia.org/r/#/c/29597/

use cases that pass non-strings to TextContent need to be handled differently
and handle the exceptions

Change-Id: Id3f88b0fb867fff0d16abcf570178cbbe86e89a1
2012-10-24 21:30:14 +00:00
aude
a17660fbd0 per bug 41244 and 41303, handle null or false params in TextContent constructor
Instead of throwing exception in these cases (which there are use cases for),
create an empty TextContent object.

Change-Id: Ice30ea78428d95805aa56cd3a35405aa67ad10ab
2012-10-23 15:42:20 +00: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
Demon
6d11551ea1 Merge "(Bug 41169) Apply rtrim on on preSaveTransfrom." 2012-10-18 18:45:36 +00:00
daniel
f4a1242db8 (Bug 41169) Apply rtrim on on preSaveTransfrom.
Wikitext should not have trailing whitespace.

Change-Id: I75eb1c4bef7217ec2b7440594e3fc4b68dc3c022
2012-10-18 19:40:29 +01:00
daniel
8b568be5e2 [Bug 41155] Record links on CSS/JS pages in the DB.
ContentHandler removed wikitext parsing for CSS and JS pages.
However, people seem to rely on links and categories embedded
in script comments.

Change-Id: I0736f15878fbd3292e75854bf16f04df656ce363
2012-10-18 20:21:04 +02:00
IAlex
a1f1af7119 Merge "Added docu headers to content(handler) files" 2012-10-17 16:16:23 +00:00
Daniel Kinzler
8f86684e0f Merge "Moved ContentHandler deriving classes into their own files for better discoverability and more manageable line count per file" 2012-10-16 19:49:16 +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
bc7a28810f Added a pile of missing docs and fixed a few incorrect ones
Change-Id: Ie134684e2bac9de25e13ead8c2e1a107b5b32168
2012-10-16 20:16:11 +02:00
jeroendedauw
506456c138 Added docu headers to content(handler) files
Change-Id: I9981698a5e4d79db89892ce3f3e007dd5aee5fd1
2012-10-16 20:04:32 +02:00
Tim Starling
16f25691ea Fix WikitextContent::getSection() for missing sections
Make WikitextContent::getSection() return false when the section is
missing, as per the documented behaviour for Content::getSection(). Fix
a test so that it doesn't generate a PHP fatal error if getSection()
returns false.

Should fix the current Jenkins build failure:

https://integration.mediawiki.org/ci/job/MediaWiki-Tests-Misc/6989/testReport/junit/%28root%29/WikitextContentTest__testGetSection/testGetSection_with_data_set__2/

Change-Id: Ifa85f8eed50943d8ece32555d06b3e989077da46
2012-10-15 11:49:28 +11: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
Tim Starling
a62af2daef Merge "Fix creation of pages in the MediaWiki namespace." 2012-10-11 05:51:18 +00:00
daniel
0e507f630a Fix creation of pages in the MediaWiki namespace.
Creation of pages in the MediaWiki namespace failed with a "no such section"
error if the corresponding system message did not exist. Fixed now.

Change-Id: Ia6e879c66a6330ea2a63246b3aed51c9c6e1d49d
2012-10-09 14:58:25 +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
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
a138706729 Fix usage of deprecated ArticleSaveComplete hook in core
Change-Id: Ic01fd95d50a909470d6f0ffd93c972322789d49a
2012-10-08 14:13:59 +02:00
daniel
c546fae8ed merge latest master into Wikidata branch
Change-Id: Id4e0f40c03679c13d8934a6add99b5cd86d0437d
2012-10-08 13:58:54 +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
daniel
0f5242d629 Merge "Remove left-over use of wfMsg" into Wikidata 2012-10-05 13:20:26 +00:00
daniel
6564781c2a Remove left-over use of wfMsg
Change-Id: If80d7bf69393a6c95797e1fe0732df7270d5184c
2012-10-05 15:15:11 +02:00
daniel
7db9491d89 set mediawiki version number
Change-Id: I3479776bd3bb25c4d75d07e62ede2ad989025c5b
2012-10-05 15:03:24 +02:00
daniel
d087dd0f88 added architecture documentation
Change-Id: I60f1d0b710802b2076fff94e535cd4534b6c9a30
2012-10-05 14:33:51 +02:00
daniel
fe27182d64 Use canonical parser options per default
Change-Id: I2cbfaab2e15d9a1c1061f9ea31c7a8ebbeffdbd0
2012-10-04 13:00:05 +02:00
daniel
2b1016eb9d Split Content.php into one file per class.
Change-Id: Ib49d9ec729613dcc43d38d46cb133ff9df459d79
2012-09-24 22:51:53 +02:00