aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Status.php
Commit message (Collapse)AuthorAgeFilesLines
* Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-251-473/+0
| | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* Undeprecate Status::getErrorsArray and ::getWarningsArray()Tim Starling2023-05-221-2/+0
| | | | | | | | These were soft-deprecated in 1.25 with no rationale given, and without a reasonable alternative. They remain widely used. They seem pretty harmless to me. Change-Id: I23242c2ee48488c8a5330e6607b939c3af722eeb
* Status::getPsr3MessageAndContext: Special-case rawmessageGergő Tisza2023-04-051-0/+5
| | | | | | | | | Do not try to parametrize rawmessage, which is intended to be used like RawMessage (but avoids the latter's unexpected behavior when e.g. copying to another message). Bug: T334012 Change-Id: I6e6bf09bb7b7a599a52311965a5542be92e67fac
* Status: Add method for PSR-3 formatting of status objectsGergő Tisza2023-02-171-0/+49
| | | | Change-Id: Id76f55460ff10de9801f484d51fd8d504eaf9040
* docs: Add missing StubUserLang type to some @param/@returnUmherirrender2023-01-121-3/+3
| | | | Change-Id: Ic1f192c7a21e529113fd7d537a79b2e4f8983b9c
* Reorg: Move RawMessage to under language/Amir Sarabadani2022-12-161-0/+1
| | | | | | | | | | To follow Message. This is approved as part of RFC T166010. Also namespace it but doing it properly with PSR-4 would require namespacing every class under language/ and that will take some time. Bug: T321882 Change-Id: I195cf4c67bd51410556c2dd1e33cc9c1033d5d18
* Various doc fixes about false on method arguments/return typesUmherirrender2022-11-101-6/+6
| | | | | | Doc-only changes Change-Id: I5177f582ae7ee70c357e9389fed14819faf79463
* Reorg: Move StubObject classes in includes to its own directoryAmir Sarabadani2022-10-251-0/+1
| | | | | Bug: T166010 Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
* Use short array destructuring instead of list()Tim Starling2022-10-211-1/+1
| | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* Fixes for the phan upgrade, part 1Daimona Eaytoy2022-10-081-0/+2
| | | | | | | | | | | | | Mainly, document some parameters as non-empty-array so that phan knows the list of arguments won't be empty when unpacking. In EditPage, account for hooks potentially unsetting the copyright notice. Also rewrite some code in LogPager, so it's hopefully easier for phan to understand what's going on. Change-Id: Ic0638571554424098d0743db32dd46723a08e103
* ResourceLoader namespace (attempt 2)Tim Starling2022-05-241-1/+1
| | | | | | | | | | | | | | | | | | Move ResourceLoader classes to their own namespace. Strip the "ResourceLoader" prefix from all except ResourceLoader itself. Move the tests by analogy. I used a namespace alias "RL" in some callers since RL\Module is less ambiguous at the call site than just "Module". I did not address DependencyStore which continues to have a non-standard location and namespace. Revert of a241d83e0a6dabedf. Bug: T308718 Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
* Status: Ensure MessageLocalizer is used if providedBartosz Dziewoński2022-03-081-1/+2
| | | | Change-Id: I1eff51af271f7d6e4685a23360cd23c397593c53
* build: Updating dependencieslibraryupgrader2021-07-221-2/+2
| | | | | | | | | | | | | | composer: * mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0 The following sniffs now pass and were enabled: * Generic.ControlStructures.InlineControlStructure * MediaWiki.PHPUnit.AssertCount.NotUsed npm: * svgo: 2.3.0 → 2.3.1 * https://npmjs.com/advisories/1754 (CVE-2021-33587) Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
* Convert WikiPage to authority.Petr Pchelko2021-02-271-29/+0
| | | | Change-Id: Iba5e36e5a13c304be51b82a952b2a3044e122c8c
* Use static closures where safe to useUmherirrender2021-02-111-2/+2
| | | | | | | | | This is micro-optimization of closure code to avoid binding the closure to $this where it is not needed. Created by I25a17fb22b6b669e817317a0f45051ae9c608208 Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
* Fix typos related to repeated wordsUmherirrender2020-09-271-1/+1
| | | | Change-Id: Ibc187d95b003017255bc87adf56afae7a59bd3db
* Annotate newable classesdaniel2020-07-071-0/+2
| | | | | | | | This annotates classes that can safely be instantiated by extensions, per the Stable Interface Policy. Bug: T247862 Change-Id: Ia280f559874fc0750265ddeb7f831e65fd7d7d6a
* Fix param type for Status::msgInLangUmherirrender2020-05-251-1/+1
| | | | | | | Message params could be an array or another Message object Message class itself documented with mixed Change-Id: Ia675ba2d2f5faa73904f90cc26e4f0e2d1317da5
* Use MediaWikiServices::getMessageCacheUmherirrender2020-03-141-1/+4
| | | | Change-Id: I07fcc9529991adc634c10e5ed8498ac138a1c2b7
* Set method visibility in some classesUmherirrender2019-12-051-2/+2
| | | | Change-Id: I3c3d59d4b3edf2459efeac890721a43475e27198
* Do not run wfEscapeWikiText on array in Status classUmherirrender2019-12-021-4/+6
| | | | | | | | Message params could be more complex than a string For example by use of Message::numParam() Bug: T237559 Change-Id: I1be2ad3f73f189f69f955d1c4e1da75652e5e8ff
* Adjust doc of Status::getStatusArrayUmherirrender2019-11-071-3/+3
| | | | Change-Id: I28e248e02426a6414a7c9fbb895e7576b4b1f062
* Status: improve typehintsGergő Tisza2019-10-311-2/+2
| | | | | | Follow-up to I82a2e4a83743. Change-Id: I707a742d6446e0b4fd03b0375e93e106c7af214d
* Allow injecting a message localizer into StatusGergő Tisza2019-10-301-41/+74
| | | | | | | | | | | | The coupling of Status with the global request context for Message object creation is a common pain point in unit tests and in no-session code. As a short term solution (until Status is properly deprecated) allow injecting a different localizer. Also refactor the code a bit to get rid if the explicit need for the context language (which is already implicit in the localizer). Change-Id: I82a2e4a83743546a934fb938b94e877a2471a3d2
* Remove Language::factory and getParentLanguage useAryeh Gregor2019-10-271-1/+3
| | | | Change-Id: I11f8801ef47ec1a1f63d840116e69667e6f3ae3c
* Suppress PhanUndeclaredProperty for custom properties and phan bugsDaimona Eaytoy2019-09-141-0/+1
| | | | | | | And remove the issue from the exclusions list. Bug: T231636 Change-Id: Iee73ddb554e354abe52d13dcfc453f9a15bb8877
* Status: Make various improvements to the Status classDerick Alangi2019-03-041-18/+16
| | | | | | | | | | | | | | | These improvements touches areas such as; - strict comparison as count() returns in int. - use of single quotes for string literals. - use of RequestContext to get the user's Language object. - fix minor typo. The todo for using RequestContext was added in 7c543bb6c25. It used `$wgLang` at the time for consistency with Message.php, which was changed in 2016 with 0beb5ca992c. Hence, it's now fine here as well. Change-Id: I943dfd761a8fca7e8b6658e3c9510ddc6694f042
* Add missing `@return` PHPDoc to __sleep() functionDerick Alangi2019-01-241-0/+1
| | | | Change-Id: I97547938041264440af621694f08a067f1d0791f
* Update composer/spdx-licenses to 1.4.0 and mediawiki/mediawiki-codesniffer ↵Reedy2018-07-261-1/+1
| | | | | | | | to 21.0.0 https://github.com/composer/spdx-licenses/compare/1.3.0...1.4.0 Change-Id: I39f7a1310455159866bfed5224536e800befec0d
* Fix PhanTypeMismatchDeclaredParamUmherirrender2018-07-071-4/+4
| | | | | | Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
* Use ParserOutput stateless transformsBrad Jorsch2017-11-301-1/+3
| | | | | | | | 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
* Revert "Stop stubbing StubUserLang"Addshore2017-10-051-2/+5
| | | | | | | This reverts commit 7ab57ba290f670847f981d5fc2c79339f1d4844e. Bug: T177478 Change-Id: I28ac95ebcb64231a12c178165a0cb174e70f4e18
* Stop stubbing StubUserLangChad Horohoe2017-10-031-5/+2
| | | | | | | | | | | | | | | | | | 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
* Improve Status/StatusValue::splitByErrorType type hintGergő Tisza2016-10-241-1/+1
| | | | Change-Id: I6deb76f8906aa86481b84ce1aaebaddf3a52e31d
* Make Status extend StatusValue and start FileBackend updateAaron Schulz2016-09-171-227/+72
| | | | | | | | | | | | | | * 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
* Show warnings in HTMLForm and warnings as warnings on Login/Signup formFlorian2016-09-171-0/+21
| | | | | | | | | | | | | | | | | | | | | | 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
* Canonicalise '@deprecated since' doc commentsBartosz Dziewoński2016-08-021-2/+2
| | | | Change-Id: I440041512feb47a998efb45e76e3fd00e0655752
* Fix Status::getMessage for the multiple errors, $shortContext only caseGergő Tisza2016-06-071-9/+15
| | | | | | | | 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
* Add some missing MW version documentationGergő Tisza2016-05-231-0/+1
| | | | | | | * deprecate $wgAuth * add @since for Status::getStatusValue Change-Id: Ia11ef1e4788297ffea0a2beb4da731c7e771958c
* Add Status::getStatusValue()Gergő Tisza2016-05-161-0/+8
| | | | Change-Id: Id8c87373b560a462dcbffe74c9e7c4780c3147f3
* Improve getErrorsByType() docsAaron Schulz2016-04-181-1/+4
| | | | Change-Id: I235a82ee1036d59a0f4929fc2170f261280f9b4d
* Allow passing a language into Status::getWikiText() etc.Brad Jorsch2016-03-091-22/+53
| | | | | | | | | 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
* Fix use of RawMessage in Status::getMessage()Brad Jorsch2016-03-021-1/+1
| | | | | | | RawMessage::__construct() takes a single array of params, it's not varargs-style like wfMessage(). Change-Id: I63950ee16e359aa2627228350e27d9e94bb6e8ce
* Convert all array() syntax to []Kunal Mehta2016-02-171-12/+12
| | | | | | | | | | 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
* Cleanups to MigrateFileRepoLayoutAaron Schulz2015-10-041-1/+1
| | | | | | | | | | * 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
* Status: Correct documentationBartosz Dziewoński2015-08-061-3/+3
| | | | | | Most of the docs for this class look misleading or downright incorrect... Change-Id: I4c7397a5dfeca7447cb98611c4f3befaefaefaba
* Fixed some <code> tags for doxygenAaron Schulz2015-04-291-2/+2
| | | | Change-Id: I550b8760556e4916ee9b63ee244bbbcb4d926142
* Fix magic getter for $status->okMark Holmquist2015-02-141-1/+1
| | | | | | | | | __get called a non-existant function which caused errors in file deletion. Also adds tests for $status->ok and $status->errors Change-Id: I8f5a21eb8d795e5e3f5a58f2384ad0dcbad749a2
* Split StatusValue out of Status class and put it in /libsAaron Schulz2015-02-101-149/+129
| | | | | | * Deprecated useless FileRepoStatus class Change-Id: I015635a9bf080ef6d98b2cff49b949c4378a859f
* Fixed spacingumherirrender2014-12-051-4/+4
| | | | | | | | | | - 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