Commit graph

998 commits

Author SHA1 Message Date
jeroendedauw
dc8f3e6c78 Added a pile of missing brackets
Change-Id: Id7b331e1b12875736c8e7e93660e71630360a723
2012-09-27 21:46:22 +02:00
Trevor Parscal
8016a0d162 Merge "mediawiki.action.edit.preview: New module replacing preview.js" 2012-09-25 18:49:23 +00:00
Timo Tijhof
4d4bfc27a1 mediawiki.action.edit.preview: New module replacing preview.js
With all the recent improvements, it's time this module got
promoted away from legacy. Its no longer just an old script to
that provides preview functionality and is minimally
maintained within "legacy", its reborn!

Minor clean up follows-up:
* e75054174c
* b12dc64a11

Change-Id: I85ca97a1d8df25a09baad78030d6da379a06c0f1
2012-09-21 16:47:30 +02:00
Alexandre Emsenhuber
18c2ec2651 Don't parse the section summary when creating a page by adding a new section.
Related to I9a56b7c6 (9e6aba6). Fix for Ifa80db1d (8d4913e).

Change-Id: I8772461451a4239c16a5450cccaf1e7696a3f740
2012-09-19 21:29:11 +02:00
Siebrand
1a9b7b2238 Merge "(bug 40098) Don't parse the section's name in the summary when creating a new section" 2012-09-19 06:56:46 +00:00
Aaron Schulz
850373ba9c Merge "Use WikiPage::makeParserOptions() where possible." 2012-09-16 18:02:56 +00:00
Demon
2c6646c7f6 Merge "Make userWasLastToEdit reusable." 2012-09-12 20:02:54 +00:00
IAlex
8634014e86 Merge "Replace some occurrences of wfMsg* by alternatives. Undeprecated wfMsgReplaceArgs." 2012-09-10 17:33:37 +00:00
Alexandre Emsenhuber
9e6aba6fd2 (bug 40098) Don't parse the section's name in the summary when creating a new section
Fix for Ifa80db1d (8d4913e)

Change-Id: I9a56b7c6d2e7d0997f92578cbfabbf532bfb07de
2012-09-09 15:37:17 +02:00
Alex Monk
c9805ddced (bug 40058) Parse newwindow message.
Change-Id: Ibd24a2cbadecd0dbfeaa06d86d55dd2bcaeefa7d
2012-09-07 21:30:31 +01:00
daniel
c4ff922e64 Make userWasLastToEdit reusable.
Make userWasLastToEdit a static method in the Revision class, so it can be
reused by extensions, etc.

Change-Id: Ib44423c3544dabab3be7fe6eb675315f2480838e
2012-09-03 12:22:52 +02:00
Siebrand Mazeland
475a1daa03 Replace some occurrences of wfMsg* by alternatives. Undeprecated wfMsgReplaceArgs.
* wfMsgReplaceArgs isn't really i18n related. It just replaces text parts.
* Updated language.txt. Now refers to mediawiki.org.
* Removed deprecated Block::formatExpiry(). Merge Id7d057a4 first.
* Reformatted weirdly formatted array in ApiBase.php.
* Removed wfMsg() in RandomTest.php.

Change-Id: Ied5cfda8fa5d9283dfeebdcb0e1af8453d47e7a9
2012-09-03 11:49:58 +02:00
Alexandre Emsenhuber
be0878fd3a Use WikiPage::makeParserOptions() where possible.
- This is needed to for I90965346 ((bug 37453) Move
  $wgDisable(Lang|Title)Conversion to ParserOptions)
  because that change sets an option based on the Title,
  and I don't want to duplicate that to all ParserOptions
  that need it.
- Refactored ApiParse to have a WikiPage object available
  and changed some part to take advantage of having this
  object available. Also used ApiBase::getTitleOrPageId()
  to reduce code duplication.

Change-Id: Iec98e472af9c43d940f77261367a796b0d7b4b54
2012-08-31 23:16:03 +02:00
Rob Moen
d2d67fe0b2 Move cancel link out of editHelp span and wrap in 'cancelLink' span.
Change-Id: I203a3eaf2f171bba81e11806e3632c2bc012458c
2012-08-29 14:20:02 -07:00
Rob Moen
e404ff7108 Move copyright warning to directly above buttons.
Please see:
http://www.mediawiki.org/wiki/Micro_Design_Improvements

Change-Id: Ida02149880aae00f790cb414ae3d632aac351651
2012-08-28 19:06:19 -07:00
Rob Moen
4a5163d876 Added new mw message 'editpage-head-copy-warn' to EditPage header.
New copyright warning is to be just above the edit box.
This message is intended to be optional and locally customized.
Similar to editpage-tos-summary.

See Micro Improvements for more information.
http://www.mediawiki.org/wiki/Micro_Design_Improvements

Change-Id: Ifbd842ebef8775630d97491a3c735e046df5d0df
2012-08-28 14:13:11 -07:00
Liangent
382ee2b741 Fix double braceSubstitution of some preview messages
They will fail if sysops write "{{((}}" stuff in it
(where [[Template:((]] contains "{{").

Change-Id: Ie1c3b4a128d9eff23da724b17a729fac9561668e
2012-08-24 01:02:25 +08:00
Alexandre Emsenhuber
e3fb463eec Fix double parsing of "previewnote" message
Change-Id: I2144f026d3b301edb521bf83e1b089de5f35ad64
2012-08-23 12:17:48 +02:00
Siebrand Mazeland
8d4913ec4d Replace deprecated wfMsg* calls with Message class calls.
Change-Id: Ifa80db1d81b9b9d1a5adfcac06a9ed14203c100e
2012-08-19 22:08:08 +02:00
Alexandre Emsenhuber
d24a4d7f10 Use a better message when a revision is not found.
This comes from
https://translatewiki.net/wiki/Thread:Support/MediaWiki:Missing-article
that asks for a link to the deletion log in the
'missing-article' message.

Instead of simply changing that message I replaced
it with two news messages 'missing-revision' when trying
to view an old revision and 'difference-missing-revision'
when showing a difference. This removes the "lego"
construction of 'missing-article' with 'missingarticle-rev'
and 'missingarticle-diff' submessages.

I had to keep current messages since they are still
used in extensions.

Change-Id: Ibe60c84cfea922a78b3ad22cc48185a109cd617d
2012-08-06 10:53:53 +02:00
Aaron Schulz
a8002c6623 Reverted "FOR UPDATE" in 61f246aa78.
* Previously, this code would select FOR UPDATE unless ALF_NO_LINK_LOCK
was set in $wgAntiLockFlags (which in fact was set for wmf sites for ages
to reduce contention). In this case, it was just loading from the master,
without locking, and relying on the page_latest check. Now, it just never
selects FOR UPDATE, regardless of the lock flags, relying on page_latest.

Change-Id: Ie6301de4415f56e6be3899cf4ab37924963ce8c4
2012-07-21 11:39:30 -07:00
Alexandre Emsenhuber
c5727b55a5 Use WebRequest instead of $_SERVER in EditPage.
Change-Id: I30cdcffe8c520f9a4031c31e3e08db9b699da597
2012-07-20 20:47:00 +02:00
Andrew Garrett
d9d67b3572 Undo feature: Add a wpUndidRevision field that can be used to distinguish (undo) edits from other edits
Change-Id: I85d485d89ab87c9478552183ffdb10b0bfaad648
2012-07-18 12:26:42 -07:00
umherirrender
a16288e7ea Increase length of edit summary by 5 bytes
Language::truncate subtracts the length of ellipses from the whole
length since 1.18, that means, there is no need for a buffer for the
ellipses.

Change-Id: I5c39a6c4160f16156c8928dd954f065f9e3c7a5c
2012-07-13 20:07:34 +02:00
Antoine Musso
d5737f8f17 update @param @return doc in several files
Change-Id: I0e23227330f90dc4121fd2a313d2e9a33c3c97a7
2012-07-10 17:08:52 +02:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
Alexandre Emsenhuber
58852d8827 Deprecated Title::userIsWatching(); use User::isWatched() instead.
* The problem is that Title::userIsWatching() relies on $wgUser,
  which is not suitable on every case. Instead User::isWatched()
  requires both an User and a Title object.
* Replaced all core calls from the former to the latter
* Added a cache in User for the WatchedItem instances so we do not
  need to do a database request every time something want to know
  whether a page is watched or not, which can happen several times
  per request.

Change-Id: Ifa9c55b7ffb487ce6893c74df233eedc7654dc5e
2012-06-29 23:22:35 +02:00
Catrope
b225e05079 Rename getCopyWarn() to getCopyrightWarning() and make it public and static
This way other code will be able to obtain the copyright warning without
duplicating the logic. Kept getCopyWarn() around for backwards
compatibility

Change-Id: I439d2b8a19c35716b208ae7f9926cd92ab482777
2012-06-22 15:36:35 -07:00
Reedy
0597984bd8 Fixup some wrong documentation
Don't try and return the result of void functions

Change-Id: I7a4db738b3e3052aebcf43742d31753f8cc1f47a
2012-06-15 15:05:49 +01:00
Alexandre Emsenhuber
3bbda787b8 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ic1ba00472ef62fa4fd746f8f590fe694d490ecd9
2012-05-20 17:56:43 +02:00
Catrope
b1e0daa428 Make errors from ArticleSave hooks propagate to the interface
Aborting a save from the ArticleSave hook and putting an error in
$status didn't actually propagate the error message to the user, but
instead displayed the edit conflict page (!). Fix this so that if we get
an unrecognized error from ArticleSave, we treat it as an extension
error and render it rather than going into conflict mode.

Similarly, make the API attempt to render the error through
dieUsageMsg() like it already does for AS_END

Change-Id: Iccf78480240d0c7ed321438c8190472805957099
2012-05-10 12:10:25 -07:00
Alexandre Emsenhuber
61f246aa78 Made WikiPage recall the source of the data used to load its state.
In WikiPage.php:
* Added WikiPage::$mDataLoadedFrom to store the source of the data used to load the state of the object and four new WikiPage::DATA_* constants for its possible values.
* Added WikiPage::convertSelectType() to convert 'fromdb', 'fromdbmaster' and 'forupdate' to the new WikiPage::DATA_* constants.
* Added $options to WikiPage::pageData(), WikiPage::pageDataFromTitle() and WikiPage::pageDataFromId() so that the "FOR UPDATE" option can be passed to DatabaseBase::select().
* Added new possibility "forupdate" to WikiPage::loadPageData() load the data from the master database using SELECT FOR UPDATE; this avoids to have to do this by LinkCache (via Title::getArticleID( Title::GAID_FOR_UPDATE ) )).
* Changed WikiPage::doDeleteArticleReal() to use this new feature so that all the data stored in WikiPage is up-to-date.

My point is also to deprecate the loading using SELECT FOR UPDATE in Title and remove LinkCache::forUpdate() at some point (there are still one usage in Title::moveTo(), two other in UploadFromUrlTest plus some in extensions).

In EditPage.php:
* Don't call WikiPage::clear() after fetching informations from master, this destroys all we work we did to get the correct data.
* Reload the whole data from master using SELECT FOR UPDATE directly in WikiPage and not only in Title. The problem was that before, the up-to-date information was only available in Title and not in WikiPage.
  Consider the following sequence from a MySQL prompt (where both revision 1 and 2 belong to page one, revision #2 being the current one):

mysql> UPDATE page SET page_latest=1 WHERE page_id=1;
mysql> COMMIT;
// Now grad the edit form for page #1 from the web and do some changes
mysql> BEGIN;
mysql> SELECT page_latest FROM page WHERE page_id=1 FOR UPDATE;
// Now submit the web form
mysql> UPDATE page SET page_latest=2 WHERE page_id=1;
mysql> COMMIT;

Before you ended-up with a "edit conflict" form with revision #1's text being displayed as current text (even if the texts are mergeable), due to the fact that
in the submit request the WikiPage object was loaded at the moment where page_latest was 1 (certainly due to MySQL's "consistent read" feature) making the
"UPDATE page SET ... WHERE page_id=1 AND page_latest=1" query of WikiPage::updateRevisionOn() return zero row, and thus WikiPage::doEdit returing a fatal Status object with message "edit-conflict".
Now the SELECT FOR UPDATE is done in the WikiPage, meaning that the object has the correct data and EditPage will correctly try to merge the revisions (and show the correct edit conflict if needed).

Change-Id: Ic4878ddb4dd96432b7ecaf43f9f359458d966999
2012-05-07 09:17:14 +02:00
Reedy
72e354b0b9 Fatal error: Call to a member function getId() on a non-object in /usr/local/apache/common-local/php-1.20wmf1/includes/EditPage.php on line 822
getNext() can return null!

Change-Id: I76a8e50076165d89c90796c6e925913c64722a3a
2012-04-28 22:39:00 +01:00
Brion VIBBER
e47802e7d4 Merge "(bug 30410) Remove deprecated $wgFilterCallback. The 'filtered' API error was also removed, along with EditPage::AS_FILTERING." 2012-04-26 23:15:16 +00:00
robin
5951d05e2b Edit notices can now be translated.
Change editnotice from content language to user language. I see no
need to disable possible translations (for multilingual wikis). As
there is no default content, it'll always default to the editnotice
in the content language anyway. Slashes in page titles are converted
to hyphens, so there are no collisions.

Patch set 3, 4: Rebase against master

Patch set 5: wrap commit msg

Change-Id: I3d7ccec0bf407324821c3c853a60c27db5e5c519
2012-04-26 15:59:18 -07:00
Alex Monk
de9354fd3a (bug 30410) Remove deprecated $wgFilterCallback. The 'filtered' API error was also removed, along with EditPage::AS_FILTERING.
Change-Id: Ic0b7b2f22ab61c9d760d280e5ab4e24af1160b7a
2012-04-24 22:08:41 +01:00
Max Semenik
a4ab934512 Fixed undefined defines warnings introduced in change 5131
https://gerrit.wikimedia.org/r/#change,5131

Change-Id: Ib338fd8cb5032b1468598ecedf537a75850acd62
2012-04-24 21:54:08 +04:00
Demon
0477dc9473 Merge "Refactoring previewnote." 2012-04-24 12:19:06 +00:00
Tim Starling
fdb9a6b64a Fix notices from r94259 due to undefined variables
Fix notices from r94259 due to undefined variables
$previewtext and $class in the isWikitextPage()==true case.

Change-Id: I6ae2486d8860d2c28d656cdbd594ebc3a1263537
2012-04-23 09:56:09 +10:00
Amir E. Aharoni
aacf4d29f9 Refactoring previewnote.
This is a followup to https://gerrit.wikimedia.org/r/#change,3978 .

Splitting the message previewnote to two messages: one is the note
itself, as it was before change 3978, and the other is the link text.

This change relieves the translators from the need to type wiki code
in the translated message and to wonder whether they should translate
"editform" or not.

Change-Id: I50aaf6dd48aaeee86cacf5c8fc06594869b38fd9
2012-04-16 22:48:55 +03:00
umherirrender
0dba8923e9 "Show Changes" on default messages shows now diff against default
message text

This is useful, because the textbox is already preloaded with the
default message text and than it is nice to get the diff against that
text.

Change-Id: Icbfb0090c32ea09e34ec3ccba26863189854f8a6
2012-04-05 21:58:00 +02:00
umherirrender
84b10a3fb5 (bug 17615) nosummary option should be reassigned on preview/captcha
Change-Id: I12f1cf37b7a093ca9f5b949e41fc482c6b7fb5fc
2012-04-03 10:46:53 -07:00
umherirrender
903b3c47ef (bug 22870) Separate interface message when creating a page
Add new message 'creating' and use it for the page title of the edit
page.

Change-Id: I8435d21a3674b48ec5a14481cdacf0a52662fa1f
2012-04-01 09:40:54 +02:00
umherirrender
55d592bc2b (bug 18062) new message when edit or create the local page of a shared
file

Change-Id: I2b7f76bd759b815a87b306fd97a97097b4731f8d
2012-03-31 16:17:10 +02:00
jarry1250
bec4460373 First half of fix for bug #30332 ("API spamblocklist error should provide *all* blocked URLs, not just one").
Allow spamPageWithContent() to accept an array of matches, rather than just one.

Not dependent on other half of fix.

Change-Id: I75faac51f24bbb2569b36bc2e44f3cd5c43b1bd7
2012-03-26 22:50:34 +01:00
Max Semenik
632c6281c7 Bug 35051 - [Regression] If heading has a trailing space after == then its name is not preloaded into edit summary on section edit. Regression from r105380. 2012-03-15 15:21:46 +00:00
Sam Reed
2d25a902e3 More of r113580 2012-03-11 22:05:54 +00:00
Tim Starling
4565aac9f0 (bug 34929) Show the correct diff when a section edit is rejected by the spam filter. Use EditPage::showDiff() so that the same kind of diff is shown as when you click the "show changes" button. I considered changing the source text to be the original section text, but if you do that, the line numbers are wrong and section=new doesn't show you the headline which may have matched the spam filter. 2012-03-08 00:49:50 +00:00
Alexandre Emsenhuber
c2a85328bc Per happy-melon, fix for r107653: don't add the error class on success message 2012-03-02 19:35:06 +00:00
Alexandre Emsenhuber
79ce8812b6 * (bug 34849) Diff when editing an old version show the comparison with the current text again 2012-03-01 17:29:12 +00:00