Commit graph

76 commits

Author SHA1 Message Date
Reedy
a075271157 Update composer/spdx-licenses to 1.4.0 and mediawiki/mediawiki-codesniffer to 21.0.0
https://github.com/composer/spdx-licenses/compare/1.3.0...1.4.0

Change-Id: I39f7a1310455159866bfed5224536e800befec0d
2018-07-26 17:44:28 +00:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Brad Jorsch
e74ba29aa6 Use ParserOutput stateless transforms
We still set the state in many cases for benefit of extensions, but all
calls within core should no longer be using non-default state.

Change-Id: I78b62ec33fcb8273acb9b3b4e9012215442be94c
Depends-On: I140ff32373430b61b92226689ef9b58cca317450
2017-11-30 14:27:49 -05:00
Addshore
c02d643d86 Revert "Stop stubbing StubUserLang"
This reverts commit 7ab57ba290.

Bug: T177478
Change-Id: I28ac95ebcb64231a12c178165a0cb174e70f4e18
2017-10-05 16:52:49 +00:00
Chad Horohoe
7ab57ba290 Stop stubbing StubUserLang
Stub objects are confusing as heck and are a performance optimization
that really aren't fit for the modern era. They were designed to avoid
loading the actual code from the disk back in the days when bytecode
caching wasn't always gonna be there.

It's 2017. If you're using HHVM, you've got a bytecode cache. If you're
using any reasonably recent version of PHP then you've got the opcode
caching enabled by default in basically every distro-related build.

Nothing actually relies on this object being a stub (that'd be silly),
so only references are basically things force unstubbing (also kind of
silly) the object. Once remaining code referencing this in extensions
are all cleaned up then we can remove the class itself.

Change-Id: I15df24aeeb729e8e764792daa933377f35042fab
2017-10-03 21:54:34 +00:00
Gergő Tisza
223aa1e97e Improve Status/StatusValue::splitByErrorType type hint
Change-Id: I6deb76f8906aa86481b84ce1aaebaddf3a52e31d
2016-10-24 00:50:40 +00:00
Aaron Schulz
c64c3ef9a8 Make Status extend StatusValue and start FileBackend update
* This avoids code duplication.
* Callers can safely start type-hinting StatusValue as well.
* Also moved the wrap() logic out of Status::__construct(), which
  only wrap() was (and should have been) using. Use "static" as
  well, so subclass behave properly.
* The docs and type-hints in /filebackend are updated as an example.
* A migration pattern is to inject a StatusValue wrapper
  into the backend and use it on all returned statuses, so MediaWiki
  will still get Status for message methods.

Change-Id: Iff9255f34870ea6b0c4b91f6ddc69eea95186aba
2016-09-17 15:45:40 -07:00
Florian
3706dcb5c7 Show warnings in HTMLForm and warnings as warnings on Login/Signup form
This commit changes the way how HTMLForm handles a Status object
when executed from a request. It now handles, beside the errors,
also the warnings of a Status object and prints them out, wrapped
in a warning box.

The LoginSignupPage uses this feature to show informative warnings
actually as warnings and not as more disturbing error messages.
Error messages should be reserved for errors and only for erros. An
AuthenticationProvider, which returns an UI AuthenticationResponse
can choose, if the given message is an error or a warning message.

This commit also addds a new function to Status, which allows a
developer to split the object into two new Status objects, where one only
contains the errors and the other only the warnings of the origin
Status object (splitByErrorType). StatusValue also has a new function,
splitByErrorType(), to support this.

Bug: T139179
Change-Id: I9a27911613e62b5c4cb86bea40696cb37c4f49c2
2016-09-17 16:33:39 +02:00
Bartosz Dziewoński
a49b3216fc Canonicalise '@deprecated since' doc comments
Change-Id: I440041512feb47a998efb45e76e3fd00e0655752
2016-08-02 22:21:57 +00:00
Gergő Tisza
4d294bceab Fix Status::getMessage for the multiple errors, $shortContext only case
Remove $msgCount++ which does not seem to have any non-harmful purpose.

Also try to explain what the hell the method does.

Change-Id: Ibdf40ff13a4a9d294a6bc6f778a14fb2633c2f70
2016-06-07 20:39:01 +00:00
Gergő Tisza
9d4abcb025 Add some missing MW version documentation
* deprecate $wgAuth
* add @since for Status::getStatusValue

Change-Id: Ia11ef1e4788297ffea0a2beb4da731c7e771958c
2016-05-23 19:46:35 +02:00
Gergő Tisza
8a3819be84 Add Status::getStatusValue()
Change-Id: Id8c87373b560a462dcbffe74c9e7c4780c3147f3
2016-05-16 09:57:53 +00:00
Aaron Schulz
75752d58ee Improve getErrorsByType() docs
Change-Id: I235a82ee1036d59a0f4929fc2170f261280f9b4d
2016-04-18 09:08:26 -07:00
Brad Jorsch
7c543bb6c2 Allow passing a language into Status::getWikiText() etc.
This also corrects a bug in MessageCache::parse() where it takes a
language code string but the Parser expects a Language object in
ParserOptions.

Bug: T128809
Change-Id: I3508c9e515e505890b3c62bc4a0982aa2a313782
2016-03-09 22:35:19 +00:00
Brad Jorsch
ca4bba6a98 Fix use of RawMessage in Status::getMessage()
RawMessage::__construct() takes a single array of params, it's not
varargs-style like wfMessage().

Change-Id: I63950ee16e359aa2627228350e27d9e94bb6e8ce
2016-03-02 12:36:22 -05: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
b4ff14f730 Cleanups to MigrateFileRepoLayout
* Use "bypassReadOnly" as other file backend maintenance
  scripts do.  One may want to run this while site traffic
  is off via $wgReadOnly.
* Fixed handling for when img_sha1 is not set.
* Fixed some IDEA errors.

Change-Id: I95c426c5f2082576fc9ea40282d2869750a9f3d8
2015-10-04 21:45:25 -07:00
Bartosz Dziewoński
63b96dcdd9 Status: Correct documentation
Most of the docs for this class look misleading or downright incorrect...

Change-Id: I4c7397a5dfeca7447cb98611c4f3befaefaefaba
2015-08-06 13:50:47 +02:00
Aaron Schulz
a2ea6116af Fixed some <code> tags for doxygen
Change-Id: I550b8760556e4916ee9b63ee244bbbcb4d926142
2015-04-29 06:01:59 +01:00
Mark Holmquist
7a84402108 Fix magic getter for $status->ok
__get called a non-existant function which caused errors
in file deletion.

Also adds tests for $status->ok and $status->errors

Change-Id: I8f5a21eb8d795e5e3f5a58f2384ad0dcbad749a2
2015-02-14 00:05:41 +00:00
Aaron Schulz
c15caa6d53 Split StatusValue out of Status class and put it in /libs
* Deprecated useless FileRepoStatus class

Change-Id: I015635a9bf080ef6d98b2cff49b949c4378a859f
2015-02-10 00:39:05 +00:00
umherirrender
489d793882 Fixed spacing
- Added/removed spaces around parenthesis
- Added newline in empty blocks
- Added space after switch/foreach/function
- Use tabs at begin of line
- Add newline at end of file

Change-Id: I244cdb2c333489e1020931bf4ac5266a87439f0d
2014-12-05 22:28:07 +01:00
saper
110d5ccea0 Provide Status::__toString()
maintenance/eval.php is much easier to use now,
you can just print $statusInstance;

Change-Id: I068b0f54b16d618a1f6115133632885e8e45e897
2014-11-11 23:16:34 +01:00
Brad Jorsch
2120bda6f2 Fix Status serialization with cleanupCallback as Closure
We already have Status objects throw away the cleanupCallback in
__wakeup. Why not also implement __sleep to not save it in the first
place?

The immediate motivation here is that cleanupCallback could be a
Closure, which causes an exception when serialization is attempted (e.g.
when trying to save the Status if an AssembleUploadChunks job fails
verification).

Note this leaves __wakeup intact, in case of old objects where
cleanupCallback is still present in the serialized representation.

Change-Id: I3aa756cd4eb5553ce0b95e7088b929b2f529abfe
2014-10-03 12:02:20 -04:00
Yuri Astrakhan
89ac348b77 Minor code cleanup and a doc type cleanup
Change-Id: Ib89226a83738d1205405eac3926bfaa578966133
2014-09-24 22:13:19 -04:00
umherirrender
1c68a1ee86 Cleanup some docs (includes/*.php)
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
2014-07-24 19:42:24 +02:00
daniel
8145672cd4 Allow Status::hasMessage to work with Message objects.
Change-Id: I52a468bc33f6c25630665ee8f987a25dc87659ee
2014-04-22 20:19:04 +02:00
umherirrender
a3983418d5 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: I0056b4a8df243cfc0c5f25378de48f7a35170aca
2014-04-22 13:07:02 +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
Thiemo Mättig
2dd32c82ff Fix Status::getMessage accidentially returning string instead of Message
This mistake was introduced in commit
92e284d3fa and the reason for the two
disabled tests. I did not enabled the second test because of an
unrelated problem. The first enabled test already covers the fix.

The method should return Message objects only but did return a
string in that special case (multiple warnings set but no context
message key).

Unfortunatelly Status::getMessage does have many, many more
problems but I understand it's not a good idea to address them all
in a single confusing patch.

Change-Id: I0dc37e248f407019d5921aaaca3eabba338b0fd3
2014-03-17 18:46:00 +01:00
Brad Jorsch
58a161fa35 Status::getHTML should actually return HTML
Currently it only returns wikitext with templates expanded (like
Message's text() method).

Bug: 45844
Change-Id: I24b5b098f15d0a4194817f31f63e37be1179aae6
2013-12-09 12:14:06 -05:00
Siebrand Mazeland
216b90b497 Update documentation of Status
Change-Id: Ib50321b36c0e9595945037ecfd8bb1e7fe0e86b0
2013-11-23 18:51:16 +00:00
aude
9a2bf6a280 Add visibility to Status functions and variables
Change-Id: I829a7503693318586e33605d2ac8e2ca63f3c886
2013-11-19 07:02:24 +01:00
Siebrand Mazeland
e61cb8218b Update docs and declare visibility on class props
Change-Id: Ib0f02202d075d4a56dc4e37b08d7ac9399e8c86c
2013-11-01 12:35:27 +01:00
aude
92e284d3fa Fix undefined variable in Status::getMessage()
If $shortContext and $longContext are false, and there
are errors, then $s is undefined.

Change-Id: Ie07f80b43a48a6fc4ed28b2c519f51fd32690bc8
2013-10-24 19:29:05 +00:00
Tyler Anthony Romeo
96a9a3e101 Fix double-parsing of account creation messages.
Account creation messages don't need to be parsed. This is
a temporary fix to follow up when double-parsing was accidentally
added in 69ea440003 (I402c6bebcfe).

Bug: 44718
Bug: 52191
Change-Id: I333d5468820994625348316ebf6c57d4df025284
2013-10-24 10:16:19 +00:00
Bryan Davis
bf4c2b6aff Add doc comment to Status explaining use
Tim posted a nice explanation of the recommended pattern for using the
Status object to wikitech-l. This change copies that explanation into
the phpdoc comment block of the Status class in an attempt to propagate
the meme.

Change-Id: Ia98543caaa829cad443abf0f0f5038b3de943ef8
2013-10-08 11:51:32 -06:00
daniel
b8c3140723 Return messages in a consistent form from Status objects
Also fixes Message::getKey() to always return a string.

Rationale:

Some code, like RollbackAction, assumes that Status::getErrorArray will 
return an array of the form ( messagekey, param... ), but this was not
the case when a Message object was passed to the Status.

This change makes sure Status::getErrorArray will always return arrays
of the expected form. This is especially important since the messages in
the Status object may be provided by extensions.

In order to convert Message objects to arrays of message keys and parameters,
Message::getKey() needed to be fixed to return a single key always.

Bug: 49338
Change-Id: I0deaa9888e9d86726a8e41ca606c571f56190c91
2013-07-30 02:11:48 +00:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
Most were this way already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html

Ran a find/replace on the odd ones. Also made them all
lower case.

Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
2013-05-15 06:23:40 +00: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
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02: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
daniel
c0f47c445a Add getters to Message object.
Being able to get the message key and parameters from a Message object
is needed to be able to report errors from the API in an abstract,
language neutral way.

Change-Id: I8ee9da4005db7cb0a487457127f1e24fb11dbd66
2013-02-19 20:30:36 +01:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
Tyler Anthony Romeo
444dc79034 Changed Status class to allow passing of Message objects.
Adjusted internal Status functions so that a Message
object can be passed as an error message instead of just
a string. Also removed deprecated message functions in
the process.

Change-Id: Icb4b5edeb25190f0aba4f3096a9ea94f22c27bda
Signed-off-by: Tyler Romeo <tylerromeo@gmail.com>
2012-11-27 23:15:47 +00:00
umherirrender
9d19d7342a Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I7db616db8c969567d420c0161fa207b366e292b6
2012-10-19 22:03:05 +02:00
Tim Starling
a9f02d4022 (bug 16020) Fix race condition in User::addToDatabase()
Fix the DB error which comes from User::addToDatabase() if it is called
when the user already exists. This is the most common DB error we log at
WMF in normal operation, perhaps because of double clicks on the "create
account" button, or perhaps due to CentralAuth autocreation when
multiple pages on another wiki are opened in the browser simultaneously,
as the bug reporter suggests.

See the doc comment for the interface rationale. Patched
Special:Userlogin to be aware of the new return value. Most extension
callers will continue to work, I will patch a couple that need it in
subsequent commits.

Change-Id: I1f6ef5e6319bfe692fb82a3fa50dc66c9fde8f15
2012-10-09 10:20:45 +11:00
Tyler Anthony Romeo
cb3ff28cf1 Removing unused method Status::getXML.
Removed Status::getXML and its single usage in one of the
phpunit maintenance scripts. It is not used anywhere
in any known extension.

Change-Id: I676446647681059449c46c2ff109570a060e0e20
Signed-off-by: Tyler Anthony Romeo <tylerromeo@gmail.com>
2012-08-19 11:17:57 +02:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
Alexandre Emsenhuber
bc9d9f1f9c Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent and removed a duplicate comment from SpecialPageFactory.php in SpecialPage.php.

Change-Id: I99dd2de7fe461f2fad4e0bd315ebc2899958a90f
2012-05-10 17:51:44 +02:00