Commit graph

156 commits

Author SHA1 Message Date
James D. Forrester ada58df361 build: Bump file copyright notices for 2016
Change-Id: I3c618c196e504a80ca297a4132a17f1977a24fb7
2016-01-03 14:57:25 -08:00
Bartosz Dziewoński 8afae11a1c ApiVisualEditor: Return the correct notice when user is not allowed to create page
'nocreatetext' is only the right error message when anonymous users
are generally not allowed to create pages on the wiki. But there are
other situations, for example a title might be blacklisted.

Change-Id: I7b8e83fa0bf98449e63e67705b709d227d9a379f
2015-11-05 04:02:42 +01:00
Alex Monk 85b745666f Allow switching from wikitext to VE
Just by pressing the VE tab for now

Requires a relatively new version of restbase

Bug: T49779
Change-Id: I2a5294345f5e0f469c1dd1bdd29dbce211571a4e
2015-11-02 20:55:19 +00:00
James D. Forrester 5732bd26fb ApiVisualEditor: Switch RESTbase config from 'scrubWikitext' to 'scrub_wikitext'
Change-Id: I08ca5eab1423232b96faf39f12b25b679a0d77bd
2015-10-17 00:07:34 +00:00
jenkins-bot e14c8e11cf Merge "Change a bunch of parsoid references to acknowledge that RESTBase is sometimes in the middle" 2015-10-01 16:14:29 +00:00
C. Scott Ananian 0ec26ef23b Rename RESTBase1/Parsoid3 bodyOnly parameter to body_only
The old `bodyOnly` name was deprecated on 2015-09-09.

Bug: T114185
Change-Id: Ic7b71acdbf56366cd4bd0172f06f75babf45edb7
2015-09-30 10:31:05 -04:00
Alex Monk 82b62896e1 Change a bunch of parsoid references to acknowledge that RESTBase is sometimes in the middle
Bug: T112339
Change-Id: I0eac521a89fc399de168408ef55c9143c0db742a
2015-09-14 21:18:01 +01:00
C. Scott Ananian 96e330650d Use RESTBase v1 API
This requires https://gerrit.wikimedia.org/r/214351 in core, which adds
support for emulating the RESTBase v1 API to the
ParsoidVirtualRESTService.

$wgVisualEditorPrefix is now deprecated.  Parsoid is configured using
VRS (preferred) or $wgVisualEditorDomain, which defaults to
$wgCanonicalServer.

This bumps our MW-core dependency to 1.26wmf21.

Bug: T110780
Change-Id: I9175ac8db8310f0c9574c8272b5e39932557d57e
2015-08-29 02:12:29 +00:00
Alex Monk ea34d938c8 Revert "Revert "Replace wgVisualEditorNamespaces with an associative array""
This reverts commit 7ca1afbbd2.

Bug: T104898
Change-Id: I061c1fd9ab8ec6b2afac92feef888ba207e1a9b1
2015-08-02 23:13:24 +01:00
Alex Monk 7ca1afbbd2 Revert "Replace wgVisualEditorNamespaces with an associative array"
This reverts commit 647a5597bb.

Change-Id: Idaf4960f5df2fbb426162830a15383ecfc96118e
2015-07-31 04:41:28 +01:00
Alex Monk 647a5597bb Replace wgVisualEditorNamespaces with an associative array
Bug: T104898
Change-Id: Ibf4812caeaa9290959bc757fc49a151854bff337
2015-07-23 18:49:21 +00:00
Ed Sanders 5ee35e2c6a ApiVisualEditor: Ask Parsoid to 'scrubWikitext' on save
Bug: T105239
Change-Id: I9e39dc2c12a3262431d15629c89fa90ba0fd73bc
2015-07-09 11:39:43 +01:00
Ed Sanders 8971edb480 Check if links are 'known' rather than 'exist' locally
This data is used for marking links red, but links which are known
but don't exist (e.g. interwikis) are not red.

Also fix bug in API caused by trying to return a value of (bool)true which is
apparently not allowed. Use (number)1 instead.

Bug: T104604
Change-Id: I599a513a27b31f7167e688d73bc3685141249971
2015-07-08 20:26:04 +01:00
Esanders b2ff7aaa17 Revert "Show <newarticletext> as surface placeholder, not an edit notice"
This reverts commit 5ac5c7a05b.

Bug: T104227
Change-Id: Id86dd228c2c671758acc6d2d3314c92da8917472
2015-07-02 15:20:24 +00:00
Alex Monk 5ac5c7a05b Show <newarticletext> as surface placeholder, not an edit notice
Bug: T104227
Change-Id: If0e1df48c1b3818235f7e02220144d467fb78fe9
2015-07-01 15:46:09 +00:00
Timo Tijhof c3b837e6b5 api: Expand helppage url before passing to 'newarticletext'
By default 'helppage' is set to a full url (using Special:MyLanguage
on www.mediawiki.org). When it is set to a page name, we expand
to a url. However that url is relative (e.g. "/wiki/..") which
is not a valid external link in the "[$1 ..]" syntax MediaWiki
uses in the 'newarticletext' message.

In MediaWiki's EditPage.php this is handled by wrapping the return
value in wfExpandUrl(), we should do the same here.

Without this, on wiki's like pl.wikipedia.org that set 'helppage'
to a local wiki page, "[/wiki/Project:Help Help]" shows up literally
in the message shown to the user instead of a clickable link.

Change-Id: I2ffc35a1b255269d5b489c68eace9edafb42d8ff
2015-05-06 21:01:59 +01:00
Brad Jorsch ccd2091f5d Further cleanup for core API change
PS25 and later changed things around a fair bit, meaning the previous update
needs some further updating. In some cases additional cleanup is also necessary
for future core API changes.

Bug: T96595
Change-Id: Iaac674f77079d29d42813fd69620bdce8905730f
2015-04-20 14:41:29 -04:00
Alex Monk 4779f83cfe Avoid undefined index warning for oldid if it's not set in serializeforcache
Official VE client always sets this.

Bug: T95015
Change-Id: Ibcef5e4360e2f9d882e9441ff8d3bdbf7179f2f6
2015-04-03 19:58:11 +01:00
Alex Monk 54071c2187 Check whether html parameter is valid rather than allow warnings to be raised if it is not
Bug: T95015
Change-Id: Iece859db0b67c906ac1f6f3e2e948815b455626c
2015-04-03 19:20:09 +01:00
Matthew Flaschen be9847c24f Allow parsefragment even if VE is not enabled for that title
Fixes T94282

Bug: T94282
Change-Id: Id3ee4dfba669b3119b8b4cbdfab20f70061856fb
2015-04-01 20:47:19 -04:00
jenkins-bot aa3f8b9eb9 Merge "Stash edits alongside the html -> wikitext stashing step" 2015-03-31 18:52:39 +00:00
Aaron Schulz 24c9f45816 Stash edits alongside the html -> wikitext stashing step
* The standard core method for page saving already checks the cache.
  By stashing the parser output as the user types, the final save step
  will be faster, just as with the wikitext editor.

Bug: T90040
Change-Id: If10a79381c6301d52f4a68ca91d0e1d7fbc79bb5
2015-03-31 18:19:59 +00:00
ecotg 175e60edaf Strip X-Parsoid Performance Headers from Visual Editor
Stripped out X-Parsoid Performance Headers, previously used to gather and
forward Parsoid's performance information, from ApiVisualEditor.php,
ve.init.mw.Target.js and ve.init.mw.TargetLoader.js. Change I936ada7b1 strips
out the corresponding X-Parsoid Performance Headers from Parsoid. Parsoid's
current performance instrumentation is achieved using Graphite and txstatsd.

Change-Id: I57d6f866a7d8287a5115e6236b0fb25bc4d0eabd
2015-03-27 12:03:15 -06:00
Roan Kattouw b19104ed04 Send requests to RESTbase directly when so configured
Also introduces paction=metadata in ApiVisualEditor which
doesn't hit Parsoid but gets all the other information we need.

Bug: T90374
Change-Id: I71edbc0f8dc15a6f8d3672c10ca3c641cc172be7
2015-03-26 16:00:54 -07:00
Roan Kattouw 9538d4c0f3 ApiVisualEditor: Rename $page to $title, since it's a Title, not a WikiPage
Change-Id: I45b23158b87e49c90375ea73635285fdb63a0c1c
2015-03-26 15:45:52 -07:00
Matthew Flaschen 77a5a6cdd5 Ensure wikitext is treated as such in PST
Fixes T92934

Bug: T92934
Change-Id: I9cc75b18ae65ab0a986e9916d0c685fc1bf8b31e
2015-03-17 16:43:03 -04:00
Roan Kattouw 25afae342a Move parseWikitext from ApiVisualEditor.php to ApiVisualEditorEdit.php
It's only actually being called in the latter.

Change-Id: Ifbf568738f38aa52878197813ec458c34bee5d5b
2015-03-14 00:27:11 +01:00
Roan Kattouw b52cbc443f Remove basetimestamp/starttimestamp from ApiVisualEditor
These were only used in ApiVisualEditorEdit.php, seem to have
been missed when the split was done.

Change-Id: I60a9152d244100526cef755cf578d7dfd38a96b9
2015-03-14 00:27:03 +01:00
Alex Monk 28a293ebaf Don't try to access x-parsoid-performance on restbase cache hits
It doesn't get set

Change-Id: I6695ab0e7d461b7541dd56e392f8d1479998f2b5
2015-03-13 00:53:19 +00:00
Marko Obrovac b46a2bd105 Use the RESTBase back-end if available
Change I4d4043e5052327bbd789331f1c05b607c45fe7cb introduces RESTBase's
virtual REST service in the MW core, as well as $wgVirtualRestConfig,
which represents the first step towards central VRS configuration.
This patch modifies VE to use RESTBase instead of Parsoid, if
available. RESTBase's virtual REST service transparently maps Parsoid
URIs to RESTBase's, so there is no need to change them in VE for now.

Note that the patch keeps full compatibility with systems/domains that
do not have $wgVirtualRestConfig declared (or even with those that do
not include the RESTBase virtual REST service class). This allows us
to use RESTBase as the back-end only on selected domains.

Bug: T89066
Change-Id: Ie7488f64868a41f28ec24ab1217c12c6249b5523
2015-03-10 21:41:39 +01:00
Roan Kattouw 6642e4f0bc Don't claim all links exist when ParserCache misses
On a ParserCache miss when viewing the current version of a
page, we'd output {missing: [], extant: true} which means
all links are marked blue. That's wrong, instead output
that we don't know anything.

Bug: T91299
Change-Id: Icf66735141a8d2a6579dce0ffd847dd099437029
2015-03-02 21:14:38 +01:00
Alex Monk 7475141a2c Don't try to get X-Cache header if it's not set
It's set if Parsoid is behind Varnish, and this was fine until I2342fa5b

Change-Id: I4480506bf1393c4c02a10377a5269a5c85cbf23d
2015-02-16 01:13:54 +00:00
jenkins-bot b43e798bb4 Merge "Make API module's LinkCache data transmission format more efficient" 2015-02-04 01:18:21 +00:00
Roan Kattouw e367ecc948 Make API module's LinkCache data transmission format more efficient
We used to send data like { title: { missing: true|false } }
With this change, we send data like { missing: [titles], existing: true|[titles] }
where 'existing' is set to true (assume all non-missing titles exist)
for current revisions and to an array of existing titles for
old revisions.

This is because we always output this data for links in the current
revision, even when loading an old revision: in that case we rely
on the client to request the omitted information, so there we can't
assume that all pages we don't have information about exist.

Bug: T88259
Change-Id: I7b58b3f669cc78fd81b60859cf76928a9087066f
2015-02-03 11:30:40 -08:00
James D. Forrester c3f716add8 ApiVisualEditor: Default format is jsonfm not json, so note this
Bug: T87582
Change-Id: I15952626c50690708d7cff8cc5a2983d8e4fb6bb
2015-02-03 10:24:51 -08:00
Alex Monk 9841d1012c Update "Watch this page" option when necessary
On load and change the user presses the button

Bug: T78694
Change-Id: I1df2836f8ba4ae647bfb142513e5de9f32ecd0fe
2015-01-31 02:43:59 +00:00
James D. Forrester 2f8b3e0d96 build: Bump copyright notices to 2015
Change-Id: Ie92dab7411116d3410195c3fb0a3513c664c0c30
2015-01-12 20:34:19 -08:00
Brad Jorsch c891a8e8b4 Update ApiResult handling for mediawiki/core change I7b37295e
Change I7b37295e for mediawiki/core deprecates several methods, and more
importantly changes the format of the data returned from
ApiResult::getData(). This change should handle these differences in a
backwards-compatible manner.

Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678e
2015-01-08 12:47:56 -05:00
Alex Monk 63b41a65ba Fix Parsoid transformation calls
Bug: T86046
Change-Id: I659cc1fe4138856116aee63e3ef8840d8c5d262b
2015-01-07 22:01:51 +00:00
James D. Forrester 152a507e11 Follow-up I2342fa5b: Bump wfUseMW to 1.25wmf14 for ParsoidVirtualRESTService
I2342fa5b added a dependency on Id658d925 in MediaWiki core which will first
be available in 1.25wmf14.

Also fix a spelling error.

Change-Id: I20a850f5da58b377b3c208d86b7f5c56f518fdb8
2015-01-07 02:25:45 +00:00
jenkins-bot 9b11db5f18 Merge "Use ParsoidVirtualRESTService" 2015-01-07 01:51:06 +00:00
Alex Monk f8e09abdc8 Use ParsoidVirtualRESTService
Breaking change: Introduces new dependency on php5-curl package.

Relies on Id658d925 which introduces this class into core.

Bug: T1218
Change-Id: I2342fa5b0a185f3e8d46d1ba8fa08278970cafb0
2015-01-07 01:43:46 +00:00
jenkins-bot 6b800c31f8 Merge "Pre-populate LinkCache for page we're editing" 2014-12-18 00:05:11 +00:00
Kunal Mehta 5999490065 Avoid GlobalTitleFail in ApiVisualEditor::diffWikitext()
Change-Id: I93e352d4e1cfef38f9f75f973933c8247d304e2a
2014-12-17 15:41:15 -08:00
Alex Monk 3007270645 Pre-populate LinkCache for page we're editing
Bug: T78642
Change-Id: I2293903f9e131f3ea8c31302f86a138208ae57e3
2014-12-17 01:07:57 +00:00
Tim Starling 4c50307cd5 Fix duplicate wikitext parse for displaytitle
Instead of doing a whole new parse for displaytitle, just get it from
the same API action=parse internal request that is used for returning
the content HTML.

Also escape entities as in OutputPage::setPageTitle(). The format of
OutputPage::setPageTitle()/getPageTitle() is a bit confused -- it's
mostly treated as HTML, but Article::view() sets it to the unescaped
title text -- a historical error which was unfortunately wallpapered
over.

Change-Id: I387c1ccd9a75f9c6c6a006d83235c6c1c3d1ecb5
2014-12-10 09:50:59 +11:00
Brad Jorsch 7d4ecc09c8 Add i18n for API module help
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.

Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.

Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
2014-10-29 13:59:41 -07:00
Roan Kattouw 36060a2782 Apply pre-save transform to template previews
Because autoValues often involve {{subst:}}

Bug: 71157
Change-Id: I2787f2595f8c4b8838a3e9ac9ba898af0b43b58e
2014-10-22 15:47:51 -07:00
James D. Forrester dc99a82eac Mark action=visualeditor as an internal API
This will reduce the level to which the VisualEditor API looks like a
tempting target for third parties, given it is undocumented and isn't
supported.

Bug: 62452
Change-Id: Ib34e526fcee46ea4ffe76261012c706233461dad
2014-10-14 00:26:27 +00:00
jenkins-bot 2d92bdb9d1 Merge "Update anoneditwarning message per core change" 2014-09-02 19:05:03 +00:00