Commit graph

44 commits

Author SHA1 Message Date
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
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
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
Frédéric Bolduc 0ce3baf66d mw.Target: Add jsconfigvars and modules to the save mechanism
* On save, VE will now fetch and append modules and jsconfigvars to the save
  event, which respectively contains necessary JS config module data and the
  list of required modules to be added on the page.
* The jsconfigvars are now properly added to mw.config on edit save.
* If any new modules are now required by the page after an edit, they will be
  loaded by ResourceLoader through mw.loader.load.

Change-Id: Ib3990078a22ad9e46debf3ce174e7cf27b86d944
2015-08-04 19:00:09 -07: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
jenkins-bot 4d95b6ea45 Merge "Replace wgVisualEditorNamespaces with an associative array" 2015-07-23 23:59:51 +00:00
Alex Monk 82fb5f609a Parse SpamBlacklist error on the server-side
The client won't be able to deal with templates etc.

Bug: T99830
Change-Id: I78611a3f061b1afd73de052aa9ddff48dc368f2d
2015-07-23 18:49:42 +00:00
Alex Monk 647a5597bb Replace wgVisualEditorNamespaces with an associative array
Bug: T104898
Change-Id: Ibf4812caeaa9290959bc757fc49a151854bff337
2015-07-23 18:49:21 +00:00
James D. Forrester 2b3dfdfe13 Set file permissions correctly for *.php files
Non-executable files should have permissions set to 644 – touching:

	ApiVisualEditorEdit.php
	VisualEditor.hooks.php
	VisualEditor.php

Bug: T104044
Change-Id: I73fcee410fa1d538e05a7f494871f20531665701
2015-06-26 18:41:01 -07:00
Aaron Schulz a948624dda Use more appropriate RecentChange_save hook for tagging
* At this point the IDs are all known so there is no need
  to re-query what was written in the transaction
* This works when recent change insertion is deferred
* Also deferred tagging in ApiVisualEditorEdit to after
  the RC row is saved

Bug: T100439
Change-Id: Ic4c7d8d89b8cfeee57eda867c0ff74fa9682ffc8
2015-05-27 13:28:01 -07: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
Roan Kattouw 25c718bc96 Explicitly pass oldid to ApiParse after saving
If we don't explicitly pass the revid of the new revision we
just created, ApiParse will be lazy and get the latest revid
from the slave DB, which will probably be out of date.

Bug: T95466
Bug: T94367
Change-Id: I2149c7a710075eff9292d0c25ca40d10b325ad44
2015-04-08 13:48:30 -07: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 237bb053d6 Remove the sanity check
It's slow, especially on large pages, and it's triggered
very infrequently these days, and only for known bugs.

In the future we should replace this with a debugging
interface that displays the DOM diff between the original
DOM and the round-tripped DOM, as opposed to the boolean
interface we have now.

By extension, this also means the visualeditor-needcheck
tag won't be applied to new edits any more, although
its registration and messages are kept around because
edits with this tag still exist in page histories.

Bug: T87161
Change-Id: I909153492a5786b4b69fccd42ce3c1d4bdb3a059
2015-02-17 17:14:34 -08: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
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
jenkins-bot e85550c350 Merge "Don't try to get newtimestamp from edit if no change was made" 2014-11-17 17:48:44 +00:00
Alex Monk a7294b34c0 Stop warnings about calling FlaggablePageView::setPageContent with no parameters
We don't care.

Bug: 73469
Change-Id: I2ff0ec2fd1b0d34c1168f83d808c1cb498b17511
2014-11-17 01:28:30 +00:00
Alex Monk ff3d76f488 Don't try to get newtimestamp from edit if no change was made
ApiEditPage can give us 'nochange' instead of the
'oldrevid'/'newrevid'/'newtimestamp' keys if we gave it a null edit.

Bug: 73463
Change-Id: Ic22597dfed11de3823471673404090a9bce12928
2014-11-17 01:03:00 +00:00
Alex Monk 581d1350e6 When saving, return the full contentSub to the client
And introduce code to make FlaggedRevs add its notices to contentSub.

Bug: 60718
Change-Id: Ibb91dc563ccf73d3b4bd1994134ccf02634fccb5
2014-11-12 17:36:59 +00:00
Alex Monk b2af92870a Update "page was last modified on date, at time" footer line when saving
Bug: 52403
Change-Id: I11e00066000e927f0551691d05fe11fe2ae125b0
2014-10-31 01:00:04 +00: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
jenkins-bot 14e4a915d7 Merge "Use Config instead of globals" 2014-08-15 22:55:02 +00:00
Kunal Mehta 5575bed67c Use Config instead of globals
Change-Id: Iecf6358fcd15fe578b3e0dcdfa6022e0a1a763c8
2014-08-15 15:50:26 -07:00
Brad Jorsch 6dd98b5f3b Update token handling for MediaWiki API change
MediaWiki change I2793a3f2 changes API handling in a way that needs
updates to extensions for proper operation:
* needsToken() now returns a string
* Most custom token types are being replaced with a 'csrf' token (the
  former 'edit' token); any others need a new hook.
* All tokens must use a static salt. Compat with web UI using non-static
  tokens is supported and also serves to handle the now-deprecated token
  fetching.
* Documentation in getParamDescription() should return a string (not
  array) for 'token', as the signal to core that it should be replaced
  with a standardized message.

When compatibility with earlier versions of MediaWiki is no longer
maintained, the entry for 'token' from getAllowedParams() and
getParamDescription() may be removed, as may getTokenSalt(). This patch
leaves them in place.

Note this is intended to be compatible with earlier versions of
MediaWiki, and so should be safe to merge before the core change.

Change-Id: Ia6e512aae366996de4e73a8d7f4f03fcddd77286
2014-08-13 16:19:42 +00:00
jenkins-bot 01348dc05f Merge "Update displaytitle on save (try #3)" 2014-07-01 21:18:54 +00:00
Ed Sanders 288da5b704 Compress HTML data with deflate before POSTing
Bug: 66914
Change-Id: I7b0a9cfd4d4c10986769a868884688ffca833cb6
2014-06-24 17:39:03 +01:00
Alex Monk dc6840c3a0 Update displaytitle on save (try #3)
Parse the wikitext we already have.

This is mostly a revert of commit f84b880a54.

Bug: 50341
Change-Id: I312bafb0e7d61b0abd42d6ca7ea2e4b5dcdc61be
2014-06-23 15:32:15 +00:00
Alex Monk f84b880a54 Revert "Update displaytitle on save (try #2)"
This reverts commit b7401f838b.

Didn't break everything, but we should probably avoid this getting deployed until I can work out wtf is going wrong with it.

Change-Id: I048143239e998b30aba79fa395a0af1cb06c6a9b
2014-06-19 00:34:26 +00:00
Alex Monk b7401f838b Update displaytitle on save (try #2)
This reverts commit 5565ccca54.

I have no idea what is going wrong on deployment-prep to cause
the error in bug 66792. Let's try to find out.

Bug: 50341
Change-Id: I5041de838128bb55c57baddae01cdcb263626537
2014-06-19 00:04:51 +01:00
Catrope 5565ccca54 Revert "Update displaytitle on save"
Causing HTTP 500 errors in ApiVisualEditorEdit.php (calling
getDisplayTitle() on a non-object).

This reverts commit dedc89b5ff.

Bug: 66792
Change-Id: Iaf438660f0623dc05f76294ad847b2fc5e25bed6
2014-06-18 20:21:10 +00:00
Krenair dedc89b5ff Update displaytitle on save
Also fix a couple of missing param docs

Bug: 50341
Change-Id: I1e73153dca5eb9343bbcda1fc2f9799e72f6f03c
2014-06-12 22:21:35 +01:00
Krenair c18fb662aa mw.ViewPageTarget: When saving a page as a redirect, update contentSub text
Or vice versa. Per my comment on bug 65621.

Change-Id: Ic51745103446dda8ea8ff901c4f211c30c39e45c
2014-06-10 17:34:52 +00:00
Niklas Laxström 4c0221c09c Remove useless isset
The exact same thing is access two lines above without isset

Change-Id: I242b9f402908c7d40c0dc026c6c5d99ac1e2bf4a
2014-04-17 08:17:16 +00:00
James D. Forrester 0ffd654bed Bump copyright like it's 2014
Change-Id: Ic469ebda2c061dc7da0b4c1625f43a7be55da4fa
2014-01-05 20:06:50 +08:00
Roan Kattouw 0f21329770 Implement serialization cache in VisualEditor API
Add paction=serializeforcache, which serializes the given HTML, stores
the resulting wikitext in memcached, and returns a cache key. This
cache key can then be passed instead of HTML to paction=diff or
action=visualeditoredit for quick diff/save operations using the
cached wikitext, or to paction=serialize to just retrieve the wikitext.

This lays the groundwork for front-loading serialization in the editor,
and for avoiding the double serialization that occurs when the user
first views the diff, then saves.


Bug: 55979
Bug: 56011
Change-Id: I223b1717890632c39e2509967149551f807119f8
2013-11-20 10:26:47 +00:00
Ed Sanders 78ec5e84d9 Set 'notminor' if minor edit box not checked
In order to properly override the minor-edit-by-default setting
if it is used.

Bug: 51515
Change-Id: Ic49d47971a795c7efd860a962cfe13b89d2bb95a
2013-07-24 15:07:05 +01:00
Roan Kattouw 393807462e Render check boxes from EditPage
EditPage has a lovely getCheckboxes() function which includes the
minor and watch checkboxes as rendered by MW core, as well as any
checkboxes extensions like FlaggedRevs might have added. Output
these in the API, render them, and send their values back.

ApiVisualEditor.php:
* Build a fake EditPage, get its checkboxes, and return them

ApiVisualEditorEdit.php:
* Pass through posted request data to ApiEdit, which passes it
  through to EditPage thanks to Idab5b524b0e3 in core

ve.init.mw.ViewPageTarget.js:
* Remove minor and watch checkboxes from the save dialog template
  and replace them with a generic checkbox container
* Have getSaveOptions() pull the state of all checkboxes in
** Special-case minor and watch, and pass the rest straight through
** Move normalization from true/false to presence/absence here, from
   ve.init.mw.Target.prototype.save(), because here we know which ones
   are checkboxes and we don't know that in save() without
   special-casing
* Remove getSaveDialogHtml(), we don't need to hide checkboxes based on
  rights anymore because in that case the API just won't send them to us.
** Moved logic for checking the watch checkbox down to where the same
   logic for the minor checkbox already is
* Unwrap getSaveDialogHtml() in setupSaveDialog()
* Access minor and watch by their new IDs throughout

ve.init.mw.Target.js:
* Get and store checkboxes from the API
* Pass all keys straight through to the API

Bug: 49699
Change-Id: I09d02a42b05146bc9b7080ab38338ae869bf15e3
2013-07-24 00:02:14 -07:00
Timo Tijhof 114011bf95 API: Remove loading of unused globals
* non-edit doesn't use $wgVisualEditorUseChangeTagging.
* edit doesn't use $wgVisualEditorEditNotices.

Change-Id: I4ebbf855ca92ca1541013ce68a58e019b405137f
2013-07-12 18:37:22 +02:00
Timo Tijhof 46f40dc696 api: Split save action into separate API module
This allows us to make the token no longer a requirement
for non-save actions while still using the built-in system
for token verification.

Update documentation for "oldid" since it is not required even
outside (paction=save). In fact, if we require it VE loading
fails because it doesn't pass oldid unless it has to when
restoring a specific version.

Bug: 50424
Change-Id: I7b1b50a43648b1cc40a984340846efdb0ba2ecc9
2013-07-11 15:37:23 -07:00