Commit graph

142 commits

Author SHA1 Message Date
Brad Jorsch
0abb9338f8 Mostly drop old comment schemas
This removes most of the pre-CommentStore text columns, and the
$wgCommentTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_comment remains in the code, as on Wikimedia wikis the revision
table is too large to alter at this time. A future change will combine
that with the removal of rev_user_text, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

CommentStore's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process.

Bug: T166733
Change-Id: I1479c73774e01ead1490adf6128f820c09bce9d4
2019-02-07 16:59:27 +11:00
Thiemo Kreuz
4b71077646 Remove a few obscure "done" and "empty" comments
These don't add any knowledge to what is already obvious from the
code, I find.

Change-Id: Ia613b6a059f78dbeefdfd020899bd1a6e239a731
2019-01-30 20:35:14 +00:00
C. Scott Ananian
ade27ecba3 Use OutputPage::wrapWikiTextAsInterface() to add safe <div> wrappers
This ensures that broken messages can't break the <div> wrapper and
that the output is tidy.

Bug: T205624
Change-Id: I2511adf593a13528e205a82d9fcdc8a524d0a95f
2018-10-17 11:08:16 -04:00
C. Scott Ananian
c0ed262053 Use OutputPage::addWikiTextAsInterface() instead of untidy addWikiText()
This change ensures that the output is tidy, and is necessary to support
future parsers which will not be able to produce untidy output.

Bug: T198214
Change-Id: I743f4185a03403f8d9b9db010ff1ee4e9342e062
2018-10-17 10:35:28 -04:00
jenkins-bot
695d7c28fe Merge "Convert file delete to use OOUI" 2018-08-01 17:23:24 +00:00
Jayprakash12345
65a8e68ec0 Convert file delete to use OOUI
Also make a few changes for consistency with normal delete form:
* Add `autofocus` attribute on the "Other/additional reason" text field
* Remove bold styling from "Suppress …" checkbox label
* Remove `class="wpReasonDropDown"` from the "Reason" dropdown
* Remove `id="wpDeleteSuppressRow"` from the "Suppress …" form row

Bug: T173997
Change-Id: Ia5a0412c959c6149b01afe7fc6cbf5e8591673ac
2018-08-01 17:02:37 +00:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Aaron Schulz
c8085ad43f rdbms: make IDatabase::onTransaction* methods pass the DB handle for convenience
Change-Id: Ia45a26830d62326b103593268fbf34c907783c90
2018-04-24 16:45:11 -07:00
Brad Jorsch
ccc1c08089 Update more forms to limit comments by codepoints rather than bytes
This updates the deletion forms, Special:Block, Special:EditTags,
Special:MovePage, Special:RevisionDelete, Special:Undelete, and
Special:UserRights to limit by code point count rather than by byte (or,
in some cases, by UTF-16 code unit).

Bug: T185948
Change-Id: I20d11d7cc4f58902cbcb6dda70af533bce6dd170
2018-02-26 13:16:19 -05:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
Thiemo Mättig
91a920fd85 Remove auto-generated "Constructor" documentation on constructors
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.

This is similar to I994d11e. Even more trivial, because this here is
about comments that don't say anything but "constructor".

Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
2017-07-21 12:19:30 +02:00
Brad Jorsch
35f428a2a7 FileDeleteForm: Create log entry even if the page didn't exist
Deleting a file with no description page should still produce a log
entry.

Bug: T167712
Change-Id: Icc7d9d12365d38faa502689ceefb4d1ee5f60210
2017-06-12 18:04:46 +00:00
WMDE-Fisch
ae3419f532 Replace some of the deprecated wfGetLBFactory() calls
Change-Id: I87aa0ebe273706438f1634167de8c60f51432878
2017-02-07 14:41:09 +01:00
Yuriy Shnitkovskiy
55667f024d Replaced all deprecated Linker methods with proper ones in core(1)
Change-Id: Ie3a718dc1eae1507f8829fcf419c64c6846d2cb6
2017-01-20 11:46:13 +02:00
Brad Jorsch
4e6810e4a2 API: i18n for warnings and errors
API warnings and error messages are currently hard-coded English
strings. This patch changes that.

With a few exceptions, this patch should be compatible with non-updated
extensions:
* The change to ApiBase::$messageMap will blow up anything trying to
  mess with it.
* The changes to the 'ApiCheckCanExecute' hook will cause a wrong
  (probably unparsed) error message to be emitted for extensions not
  already using an ApiMessage. Unless they're currently broken like
  Wikibase.

Bug: T37074
Bug: T47843
Depends-On: Ia2b66b57cd4eaddc30b3ffdd7b97d6ca3e02d898
Depends-On: I2e1bb975bb0045476c03ebe6cdec00259bae22ec
Depends-On: I53987bf87c48f6c00deec17a8e957d24fcc3eaa6
Depends-On: Ibf93a459eb62d30f7c70d20e91ec9faeb80d10ed
Depends-On: I3cf889811f44a15935e454dd42f081164d4a098c
Depends-On: Ieae527de86735ddcba34724730e8730fb277b99b
Depends-On: I535344c29d51521147c2a26c341dae38cec3e931
Change-Id: Iae0e2ce3bd42dd4776a9779664086119ac188412
2016-12-06 10:20:48 -05:00
cenarium
e1509f0caa Move tagging of API deletions to RC save
Since the recent change save of logged actions is now deferred, we need
to move tagging of API deletions to the RC save, like other API actions
do already. Otherwise, only the log gets tagged, not the RC.

Bug: T108564
Change-Id: I4e6e18e7f8fb7a6b0932e7579bafddcc1b0a9758
2016-09-21 19:18:28 +02:00
Aaron Schulz
a5f3559511 Use Status::isOK() method in FileDeleteForm
Change-Id: I3c21ee1f0ecc4077772ddba6e740a67ed143ece0
2016-09-20 15:57:35 -07:00
Aaron Schulz
1f313389e2 Remove direct rollback() calls from some places
Rely on the mass-rollback logic in MWExceptionHandler instead.
This results in a better chance of atomicity.

Change-Id: I2eb5661d4acc105a1323d69c5463268c234bd745
2016-08-23 01:19:21 +00:00
Aaron Schulz
6bbbb27446 Make non-exception rollback() calls safer
Use rollbackMasterChanges() instead so that all DBs get reverted.
Otherwise, external DB updates may get committed while related local
DB changes are rolled back.

Change-Id: I74de77f4b12dc15c0473c272d090caeeb97d6983
2016-07-21 18:10:43 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
c2a52446e2 Convert doDeleteArticleReal to startAtomic()/endAtomic()
* They no longer commit the update, but just make sure
  it is part of a transaction. The BEGIN/COMMIT will
  happen at request start/end given DBO_TRX or in this
  method otherwise (like when in CLI mode). This avoids
  premature committing of other transactions.
* FileDeleteForm was the only caller using $commit=false
  for WikiPage::doDeleteArticleReal() and its proxies
  WikiPage::doDeleteArticle() and Article::doDeleteArticle().
  The ugly $commit flag is now removed.
* No caller was using $id for WikiPage::doDeleteArticleReal()
  and its proxies WikiPage::doDeleteArticle() and
  Article::doDeleteArticle(). It is now removed and we can
  be sure the lock() and CAS logic always hit in the method.
  The rollback() calls are not needed given the page row lock
  and having them there could break outer transactions.
* Updated FileDeleteForm to use startAtomic()/endAtomic() so
  the article and file delete are still wrapped in a
  transaction. Note that LocalFile::delete() does reference
  counting and trxLevel() checks so it will not try to begin()
  and break FileDeleteForm's transaction via startAtomic().
* Moved less important 'page-recent-delete' key update down
  for sanity in case it blows up.

Change-Id: Idb98510506c0edd02236c30badaec97d86e07696
2015-10-26 12:08:53 -07:00
Brad Jorsch
88f6576c08 Return log id for file deletions
WikiPage::doDeleteArticleReal returns the log id as the value of the
returned Status object, and ApiDelete depends on this. ApiDelete is also
expecting FileDeleteForm::doDelete to do the same, so let's make it
happen.

Bug: T114893
Change-Id: Ia887d88f16378134924d122dad6c17c8a981f0e6
2015-10-07 10:19:36 -04:00
Aaron Schulz
193145f813 Revert "Remove mismatched COMMIT from FileDeleteForm"
The doDeleteArticleReal() call does BEGIN but not COMMIT
and the LocalFile::delete() does no trx commands because
trxLevel() > 0, so the COMMIT here is needed as things are.

This reverts commit 985a8f7214.

Change-Id: I72529965ae9fe41641f22af12a40ec13ff65a2c1
2015-10-06 19:06:26 +00:00
Aaron Schulz
985a8f7214 Remove mismatched COMMIT from FileDeleteForm
* Rely on the main DBO_TRX to commit at request end

Change-Id: Iad545db3603335baddc4156128f1dd756dbe99b4
2015-10-05 19:35:16 +00:00
umherirrender
f32e0cdd3a Use Linker::linkKnown for some links to MediaWiki pages from navigation
The title used for Linker::link in all places are mediawiki pages, which
are known to be exists (and blue), because there are definied in en.json

Change-Id: Ib3b6e4f4f6cef059a502aaabfcfc17730b4445a6
2015-06-19 18:55:30 +02:00
umherirrender
e51eaf619f Fix edit link for messages in $wgForceUIMsgAsContentMsg
Some special pages or actions have a link for users with editinterface
rights to edit the message used in scroll down menu.
When the message is parsed for the scroll down menu the config
$wgForceUIMsgAsContentMsg is used, but that was not used for the edit
link.

Add a new function Message::getTitle and use it in all places in core.

Most benefit will have the edit link for MediaWiki:Licenses on
Special:Upload, because commons.wikimedia.org has that message in
$wgForceUIMsgAsContentMsg.

Change-Id: Ib800b9adcc9ae88ef53228b66838bf61d2065f0f
2015-05-15 20:38:32 +02:00
Aaron Schulz
6921770414 Updated some try-catch statements: MWException -> Exception
Change-Id: I76601a86e30f4984e3b1a8c8ec5ef5a0f652433a
2015-01-09 17:20:22 -08:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
Siebrand Mazeland
e9eb00b203 Make phpcs-strict pass on includes/ (1/~10)
Change-Id: Ib51381a2261d064988ba2f39b71c0252f2458faf
2014-05-11 19:14:17 +00:00
umherirrender
2d11016ecd Pass $user to LocalFileDeleteBatch
This avoids the use of $wgUser

Change-Id: I60cab27e0708a818c77791cc89194b6dd726da0b
2014-05-06 21:31:29 +02:00
umherirrender
8ad1c92441 Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
2014-04-20 21:16:57 +02:00
umherirrender
725d9d125d Removed unneeded spaces and colons in @param and friends
Also swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: Ic36c8c7820a6c2d603f1138130670c6bf6a1ca59
2014-04-08 16:02:49 +00:00
Brad Jorsch
18062eb3b0 Add user rights 'viewmywatchlist', 'editmywatchlist'
These are needed for OAuth grants.

Note that, even if 'editmywatchlist' is not granted, various actions
will still allow for adding but not removing of pages.

Change-Id: Ie33446a228dd6ed0114730935c1bf65667f5ce01
2013-06-26 10:20:40 -04:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00:00
Alexandre Emsenhuber
df5265e14d Fix case of some Title methods
Change-Id: I37ce7fe392f4941c500fa0a88007664501d7e338
2013-03-27 14:36:05 +01:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
jeroendedauw
dc8f3e6c78 Added a pile of missing brackets
Change-Id: Id7b331e1b12875736c8e7e93660e71630360a723
2012-09-27 21:46:22 +02:00
Siebrand Mazeland
6fe1f0509b Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains reviewable.

Change-Id: Ib15e670badd3f6aecae8b60e2f9129a31341ce16
2012-08-21 18:38:44 +02:00
Dereckson
8d68833208 (bug 37638) Remove calls to deprecated LogPage::logName method.
The LogPage::logName method has been deprecated in 1.19,
warnings being planned in 1.21.

This change removes any call in the MediaWiki core to this
deprecated method.

Removing extra whitespaces/tabs in includes/ProtectionForm.php.

Change-Id: I1907f17341ecb6448967a5283e3c913778dcb1a9
2012-08-15 07:50:01 +00:00
Alexandre Emsenhuber
4ea5e0340c Use ManualLogEntry instead of LogPage to add a new log entry of old file version deletion.
* For consistency with WikiPage::doDeleteArticleReal().
* Also log suppressed deletions in suppression log instead of normal log.

Change-Id: Ie63bac5ebd77d0269ba2075d66cf3ba31668e595
2012-07-01 22:11:25 +02:00
Siebrand
5fb8b96195 Merge "Expose the log_id of the deletion log entry in the action=delete API" 2012-07-01 15:55:29 +00: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
Alexandre Emsenhuber
15e9fcca01 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Iaebd4e253ff3b35b568e9b394231a5691445ac95
2012-05-14 19:59:58 +02:00
Catrope
3068742546 Expose the log_id of the deletion log entry in the action=delete API
This entails some refactoring to actually surface the log_id all the way
up:

* Made doDeleteArticleReal() return a Status object rather than a
  constant, and put the log_id in $status->value. This Status object is
  also passed to the ArticleDelete hook.
* Kept doDeleteArticle() the same for extension compatibility.
* Switched all core callers of doDeleteArticle() to
  doDeleteArticleReal() and surfaced the error message from the Status
  if appropriate, rather than hardcoding 'cannotdelete' all over the
  place.
* Exposed the log_id in ApiDelete
* Add 'delete-hook-aborted' message for when a hook aborts the deletion
  but does not provide an error message. Previously this just caused the
  'cannotdelete' message to appear.

Change-Id: Ia6415b390d5d4172ce96667f46ccdba2be02461f
2012-05-13 18:20:05 -07:00
Siebrand Mazeland
7521a3ffa4 Follow-up r113939: Add divs to addWikiText(). 2012-03-17 21:19:31 +00:00
Aaron Schulz
701152e10f * r113886: use <div> instead of span to wrap element that has p tags.
* Also fixed an older instance of the same problem.
2012-03-15 17:50:55 +00:00
Sam Reed
60081e9852 More __METHOD__ into db related methods 2012-02-24 17:00:52 +00:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00