diff options
author | Tim Starling <tstarling@wikimedia.org> | 2014-12-05 15:25:18 +1100 |
---|---|---|
committer | Tim Starling <tstarling@wikimedia.org> | 2014-12-05 17:10:20 +1100 |
commit | 09a5febb7b024c0b6585141bb05cba13a642f3eb (patch) | |
tree | 200143ced8988f80ea2d63dda0ff66c7fb8d73a7 /includes/Defines.php | |
parent | c393f874706ea4683762b37305401432e0473940 (diff) | |
download | mediawikicore-09a5febb7b024c0b6585141bb05cba13a642f3eb.tar.gz mediawikicore-09a5febb7b024c0b6585141bb05cba13a642f3eb.zip |
API edit: allow ConfirmEdit to use the merged parse
ConfirmEdit was tripling the amount of time it took to save a typical
page via the API, since it was assuming that the APIEditBeforeSave hook
was giving unmerged wikitext, requiring a full parse of the content
before and after the edit in order to check the addurl trigger.
Apparently nobody bothered to update it after Ia59fb6bb.
APIEditBeforeSave is unusable anyway, because it is given the serialized
content, without any information about the content model. It really
needs the Content object in order to do it properly. So instead, adapt
EditFilterMergedContent for the purpose. Incidentally, that avoids the
inelegant defined('MW_API') check in ConfirmEdit's
EditFilterMergedContent handler, since both API and normal edits are
handled by EditFilterMergedContent in the same way.
Unfortunately the interpretation of the 'value' member in the Status
object passed to EditFilterMergedContent is not extensible, being an
integer instead of an associative array. So we add a custom member in
order to get the result array back down the stack.
Another obstacle to this design was the lack of an EditPage object
passed to EditFilterMergedContent. ConfirmEdit was previously directly
calling EditPage::showEditForm() with a $formCallback which outputs the
necessary HTML. Instead, I hacked up runPostMergeFilters() a bit, to
allow the hook to request that the edit page be shown again even if
hookError is not set. Then a new EditPage::showEditForm:fields hook does
the necessary HTML output, instead of $formCallback.
Marked $formCallback as deprecated, since I think it is now unused.
Change-Id: I4b4270dd868a643512d4717927858b6ef0556d8a
Diffstat (limited to 'includes/Defines.php')
-rw-r--r-- | includes/Defines.php | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/includes/Defines.php b/includes/Defines.php index d0c2226c0e88..d63d5ca395d6 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -2,10 +2,6 @@ /** * A few constants that might be needed during LocalSettings.php. * - * Note: these constants must all be resolvable at compile time by HipHop, - * since this file will not be executed during request startup for a compiled - * MediaWiki. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -216,6 +212,7 @@ define( 'MW_SUPPORTS_EDITFILTERMERGED', 1 ); define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 ); define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 ); define( 'MW_SUPPORTS_CONTENTHANDLER', 1 ); +define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 ); /**@}*/ /** Support for $wgResourceModules */ |