Finish implementation of the 'redirect' edit API parameter. This flag
should only be used as a convenience when adding a new section, appending,
or prepending. Any other usage must be done using the long-cut (fetch page,
determine if it is a redirect, follow redirects and edit the target page's
content).
This patch takes apart the "EditConflict_redirect" test, because it no
longer makes sense--unless you dear reader can figure out how to force an
edit conflict when only adding a section?
Bug: 24330
Change-Id: Ie3f7273c18e156da1e50e1a36aac2e5341710982
Fixed a little documentation issue, removed a line of unreachable code
and fixed up two formatting issues in the process.
Change-Id: If29391ee1a0daf19973437f36c3216b8716debd0
nosuchsection is currently checked only in the appendtext/prependtext
code path. Add a check for out of range section numbers in the main code
path too.
Bug: 53884
Change-Id: I5bafe8625122ca66415602c37cbca7d7f4c17742
If the page doesn't exist, $articleObject->replaceSectionContent will return null
Fixes a regression introduced in be97167ab6.
Bug: 52830
Change-Id: Icdc0f130eeb40fff5c656c396b2a2af294015b98
While it doesn't make a whole lot of sense to prepend or append with
section=new, the user certainly doesn't intend to be copying the
contents of section 0. In the spirit of "do what I mean", we should
probably prepend/append to empty text in this situation.
Bug: 52538
Change-Id: I9b03635906ca665a4f68b3bd35d05ae9108e2356
rather then just the current section. This
makes the hook behave as documented in
docs/hooks.txt.
Bug: 52077
Change-Id: Ia59fb6bbcbf2ae4119aa9dc316af8130e0235e78
In addition to constructing a fake request using the data the caller
gave us, also pass through any other request variables that might have
been set. This is a bit of an evil hack, but it's the only thing we can
do to make random things like wpReviewEdit in FlaggedRevs work through
the API.
Change-Id: Idab5b524b0e3daae58ab4f26466c0f6d9d8d3044
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !
Fixed windows newline style
Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
Also fix the condition in getPossibleErrors to avoid reporting of:
<error code="nosectiontitle" info="The sectiontitle parameter must be
set" />
Change-Id: Ifd808a040590ddffc0527da5ef0cc8cacdd008d9
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments
Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
See bug 44341 for action=parse, but the problem with interwiki
processing can also be happen in other modules.
This gives clearer error message on some modules
For example action=move:
Bad title "*title*"
instead of:
Unknown error: "immobile-target-namespace-iw"
Change-Id: I86524533dfd778a169b39968999918a1f531efeb
- Changed the creation of the Article object in ApiEditPage::execute() to
use Article::newFromWikiPage(), this allows to re-use the already-existing
WikiPage object in that method instead of having to create a new one.
Article::newFromTitle() was used before, but for some reason this got
reverted back to "new Article" with the merge of the Wikidata branch.
- Removed the call to WikiPage::clear() added in I1d28164d (2c27926); no
longer needed since the WikiPage object is now already up to date after
the edit.
- Added WikiPage and User objects to the context passed to the created
Article object; follow-up to I74394282 (078334f).
Change-Id: I53088a42ef7592aaba7449ef3f84f77f2e07b2f5
After I99a19c93, the $context argument of EditFilterMergedContent hook
is just $editPage->mArticle->getContext() which has a title of [[API]]
when it's created in ApiEditPage called internally (like what WikiLove
does). Now a new context is created for it which simulates a real edit
(title is the title being edited, and request is the derivated one with
a few more fake parameters added).
Change-Id: I743942822eb5097d9d98c11088a91395d9e6d47f
For historical reasons, all our API class had a dummy __construct which
simply calls their parent constructor. This patch removes all such
occurences to save out some bytes.
Change-Id: I667955d7821f780fc5ce23823d74dedb1729b9fa
API was using SVN's version keyword which GIT does not support.
All related methods were either removed, or for those that
could have been used from extensions, emptied out.
api.php?version now shows unrecognized param warning.
Change-Id: I910ca1448ed2ed697ac19b17c486d130aa1d7e03
Before ContentHandler, an API edit passing a redirect for title and
redirect=true and omitting basetimestamp would use the last revision
timestamp of the target page. When ContentHandler was merged, this was
accidentally changed to use the last revision timestamp of the redirect
page, which was likely much earlier than the target page's last revision
and so causes an edit conflict in almost all cases.
Some scripts took advantage of this along with appendtext to add notices
to users' talk pages, so restore that old behavior. We'll also adjust
the contentmodel/contentformat detection added by ContentHandler to use
the model and format of the target page rather than the redirect in this
case, as that seems more likely to be less wrong.
Change-Id: If0c674e26a4deb54ec14f0bf45418d666a397347
This is so that Echo can detect when a revision is undone via the
API. wpUndidRevision is the same param used by the 'undo' button in
in the History view.
Change-Id: I82440eb442759335800cee49fd53528fcfd92ed6
Before the ContentHandler merge, using action=edit&appendtext=... on a
non-existent page would treat the page as if it existed but had no
content. After the merge, it throws an error incorrectly claiming that
appending is not supported for wikitext.
The fix is to create a new, empty content object when appending and
there is no existing content.
Change-Id: I61f2cf3911a7d9d8553fc3f745e545cb1bcfd270
Also passed some $wgUser direct (when already there), so it is seen by
someone, that the user should be passed to that method.
Change-Id: Id4d5504a05ea34d80d59262ad3aef28f09c807a6
action=block/action=unblock can not have the token required because when
using the gettoken param, the token param can not set.
Change-Id: I15317f16c06f150d29c1b17de76f41a6cfa84820
Doxygen choke on text enclosed by '<' and '>' since it tries to
interpret them as HTML or XML elements. This patch adds double quotes
in includes/api/*.php files around the two following strings:
<Firstname>.<Lastname>@gmail.com
<Firstname><Lastname>@gmail.com
Which becomes:
"<Firstname>.<Lastname>@gmail.com"
"<Firstname><Lastname>@gmail.com"
Tested locally, it prevents doxygen 1.8.0 related warnings.
Change-Id: I36d82eb3fd4989ee3ffc65b0b527b83711d1ba69
The content model is stored as a varbinary(32), the format
as varbinary(64).
If the standard model resp. format is used, null is written
to the database instead of the actual id, saving space.
Change-Id: I32659b49a9ad3cb8ecae9019562cff7de42b65f9