Commit graph

184 commits

Author SHA1 Message Date
Ed Sanders f1482627fa Factor out API deflation and change storeInSerializationCache API
Change-Id: I7e2e15a8ba5088e6c370cb035c71f7af18c13b61
2016-08-09 20:08:34 -07:00
Aaron Schulz e2d7eea8a7 Use debug() for spammy edit stash log messages
Change-Id: I154d6ff867f8b85b91a83f7351dd1f455d308690
2016-07-07 17:00:59 -07:00
jenkins-bot 6f05edcd72 Merge "Revert "Use debug() for stash messages to match core"" 2016-07-07 22:09:23 +00:00
Jforrester 660cae8514 Revert "Use debug() for stash messages to match core"
This reverts commit 693b28a4bb.

Bug: T139469
Change-Id: I54ae58a113977ffa31f0a82b2ca93938b35e842b
2016-07-07 21:59:02 +00:00
Alex Monk e639525a9c Follow-up I9202066d: array_unique leaves gaps in keys, we need to run array_values on it afterwards
While that commit fixed the issue it was intended to address, it also
completely broke VE everywhere else. Basically you'd end up with a result
like this:

array(5) {
  [0]=>
  int(14)
  [1]=>
  int(6)
  [2]=>
  int(2)
  [5]=>
  int(0)
  [6]=>
  int(250)
}

With the lack of 3 and 4 keys making the JSON formatter think we've got an
object.

Bug: T139094
Change-Id: Ia21fd4bd352afc9170357576a3e0eb17b4528326
2016-06-30 20:35:45 +01:00
Alex Monk ea1a621c47 Fix preference namespace list to handle duplicates
Change-Id: I9202066d23eca527571ac817cf3ae64bc2d57bea
2016-06-29 23:24:34 +01:00
David Lynch 3c5695e87d Don't use array_merge for namespace configs
array_merge renumbers numeric keys. The namespace configs can be either
numeric or names. If they're numeric, they shouldn't be renumbered. So just
add them.

Bug: T138980
Change-Id: I3e3ecb3e9e65443ba0d44f8eeb67d6b390eca0bd
2016-06-29 16:13:21 -05:00
Alex Monk bf0953b07b Remove consideration of extension registry configured namespaces until we can find the correct way to merge them
This will disable ProofreadPage's addition of the Page namespaces (e.g. on
wikisources), but this is more important right now.

Bug: T138980
Change-Id: I23ee26fa95a01b3e0881a4ca16e70247839d9cd9
2016-06-29 21:48:33 +01:00
Tpt 9efd96cced Execute the EditFormPreloadText hook on load for non-existent pages
Note that this does not add support of the preload GET parameter,
which is in T51622.

Bug: T138588
Change-Id: I46ade4de02f15444c1ca5731a475ed89b31960d9
2016-06-25 08:50:22 +00:00
jenkins-bot 63f15d310f Merge "Use debug() for stash messages to match core" 2016-06-22 08:04:03 +00:00
jenkins-bot c2281a2a8c Merge "Make namespace and content model lists extensible" 2016-06-21 15:20:30 +00:00
Aaron Schulz 693b28a4bb Use debug() for stash messages to match core
Change-Id: I366d14d41143d55740e178a16b0af84c5a8ea272
2016-06-20 14:50:26 -07:00
Aaron Schulz eee86a9873 Pass empty summary to parseAndStash() to avoid warnings
Since the summary is not known yet, using "" is fine.

Bug: T137995
Change-Id: I0ef2a6cbe3ffc9be249bfea5e4172159c57698a2
2016-06-16 13:24:11 -07:00
Ed Sanders 6ee6ac7bdf Make namespace and content model lists extensible
This should really be done automatically by resource loader,
but merging only works on globals. We use this same hack
for plugin modules.

Change-Id: I5f729ddb6146565dc839f60353ac8fa5b2a29ca8
2016-06-01 09:29:34 -07:00
Ed Sanders 796da84576 Allow extensions to support extra namespaces and content models
Change-Id: If67bab93da355da609b6df274514b5c72a6ed91a
2016-06-01 01:55:03 +01:00
Aaron Schulz 838d5bc7e4 Send edit stash metrics for cache attempts
Change-Id: Ic5ffcb20ca9062748c2cde232d6aa4ee1522aa55
2016-05-26 21:27:33 +00:00
Alex Monk c40070b5cf Debug log strange-looking ETags being sent to RB
Bug: T135171
Change-Id: Ie127cfbd515cd217abd272cb7a81566b91e13f4d
2016-05-19 03:33:40 +01:00
Ed Sanders 216ef78cb0 [DEPRECATING CHANGE] Use canonical namespace names for enabling VE
These are more meaningful and the actual namespace IDs used can
vary, especially for extensions.

Change-Id: I781d484d7525ff09b5d348e79b63b161a7a26997
2016-05-04 18:56:00 +01:00
Bartosz Dziewoński 2ff4195772 Simplify GlobalBlocking code
Depends-On: I2893b9e24173d21fe518c360f6c6add363cc7b23
Change-Id: I242e5daaeda4e981099228ffa860b274a9794127
2016-04-25 23:55:22 +02:00
jenkins-bot 5dc1257507 Merge "More minor/watch checkbox state computation server-side" 2016-04-11 14:18:56 +00:00
Alex Monk 149dab8fc5 Add ?redirect=false to VE's RB /page/html/ requests
Untested.

Bug: T130757
Change-Id: I27570d3212bd41bf7da93608302dae04c364783f
2016-04-09 03:34:34 +01:00
Roan Kattouw 12eb41acff More minor/watch checkbox state computation server-side
Following through on my threat from 72b0d2a19c (November 2013).

Change-Id: I0daeef2a0373bbdb06627053e9d726d6fc20a3f6
2016-04-08 18:02:01 -07:00
Alex Monk 1c455a5fb8 Set User-Agent in server-side VRS requests to RESTBase/Parsoid
Bug: T131171
Change-Id: I385ef1f3efb674c4ad3ffb334c0ff5b830f89a37
2016-03-30 01:05:50 +01:00
Alex Monk d2a9aefba7 Better handling of read-only mode
* Don't just fail to load, action=visualeditor itself should not write to the DB
  (we have action=visualeditoredit for that)
* Send notice to the client in the usual way
* Handle read only errors on save, log as unknown

This won't let you review changes because that uses visualeditoredit

Bug: T129501
Change-Id: Id78c06b031423e47a7ddf94ec615b6d6975309d3
2016-03-10 21:02:52 +00:00
Alex Monk 4ed6fd4010 Change Accept header a bit
Per post-merge commit on I77af4b58 by Subbu

Bug: T128233
Change-Id: I30c4c1ad5b68e5b8a006d7a6c7bcbaac7e2eb164
2016-03-02 15:37:37 +00:00
Alex Monk 2f135e9590 API: Send Accept: header to RESTbase
Bug: T128233
Change-Id: I77af4b58e5469a898063a3f838802e4f5769514b
2016-03-01 01:14:02 +00:00
James D. Forrester e7a3ec43bf build: Update mediawiki-codesniffer to 0.6.0, add "composer fix"
Change-Id: Ic96081539c2ae98b5b239b59ca9b0362b337e522
2016-02-17 08:18:02 -08:00
James D. Forrester 8063603ca5 [BREAKING CHANGE] Drop MW pre-1.25 PHP API documentation compatibility
getDescription() and getParamDescription() have been replaced by a proper i18n-based
API documentation system since MediaWiki 1.25. Retaining these does not help us with
backwards-compatibility given that the repo already requires MediaWiki 1.27.0-alpha,
so just drop them before they become out of date.

Change-Id: Ic8b87235aeb7e1bcd7b24d5609c7d002658a66ba
2016-02-06 17:43:37 -08:00
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