Commit graph

50 commits

Author SHA1 Message Date
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
Sam Reed
16477dbb30 Add a getValue method... 2012-03-12 16:55:25 +00:00
Sam Reed
09a78c1368 More return documentation 2012-02-09 21:36:14 +00:00
Aaron Schulz
09732c2b12 Fixed comment typo 2011-12-02 07:45:20 +00:00
Mark A. Hershberger
c5a6747c1a w/s 2011-08-11 22:35:49 +00:00
Bryan Tong Minh
055f32616b Follow-up r81536: Fix misleading comment in Status and add a comment to LocalFileRestoreBatch::cleanupFailedBatch. 2011-05-26 18:41:06 +00:00
Sam Reed
36cb6833e4 More documentation updates and additions
Getting bored of this tonight now I think...
2011-05-21 20:06:57 +00:00
Bryan Tong Minh
128b544632 Fix bug in Status::getItemXML 2011-04-30 22:12:51 +00:00
Alexandre Emsenhuber
21dff18846 wfMsgReal() -> wfMsg() or wfMsgNoTrans() 2011-04-23 17:42:34 +00:00
Sam Reed
f326b59650 Remove some trailing whitespace
Add some documentation
2011-03-24 00:43:27 +00:00
Bryan Tong Minh
f9a36ee7bf (bug 27018) Added action=filerevert to revert files to an old version. Copied procedure from FileRevertForm, as most of the verification procedure is simple enough to not warrant the effort of writing a dedicated backend.
Further changes:
* Added Status::getErrorsByType() which returns the internal error array untouched
* Added ApiResult::convertStatusToArray() which converts a Status object to something useful for the Api
2011-03-05 17:23:35 +00:00
Tim Starling
0a21e2de12 * (bug 24230) Added JAR detection. ZIP archives containing a .class file will be rejected by default. Malformed ZIP archives will be rejected due to the danger of ambiguous parsing on the client side.
* Removed the ZIP subtypes from $wgMimeTypeBlacklist, they no longer need to be there.
* Added ZipDirectoryReader. Added some small ZIP files which are used to test its various error cases. Most were constructed with a hex editor.
* Fixed getStatusArray() to return a consistent type regardless of whether the error message has parameters. This allows error messages with no parameters to work with the Status object conversion code in UploadBase::verifyFile().
2011-02-25 04:51:17 +00:00
Sam Reed
7ebf2e5165 More function level documentation
Fixup some indenting
2011-02-19 00:44:38 +00:00
Bryan Tong Minh
4ffb09ba49 (bug 19751) Filesystem is now checked during image undeletion
* FSRepo::storeBatch() now does an sha1 check unless SKIP_VALIDATION flag is set
* Introduced Status::$success in addition to Status::$successcount
** FSRepo::storeBatch() now logs success/failure in this variable
* LocalFileRestoreBatch now aborts on failure in FSRepo::storeBatch() and cleans up the already copied files
** Introduced FSRepo::cleanupBatch() for this purpose
* SpecialUndelete now aborts if LocalFile::restore() gives a fatal
2011-02-04 20:54:11 +00:00
Tim Starling
31eae6a575 * Made the web upgrade process more friendly. Instead of saying "access denied, go away" when the user has a normal LocalSettings.php file, generate a random $wgUpgradeKey and instruct the user to insert it into their LocalSettings.php. The subsequent file modification then authenticates the session and allows the upgrade.
* When an upgrade key is entered, or a supplied upgrade key is edited into LocalSettings.php by the upgrader, fetch database settings from LocalSettings.php and AdminSettings.php for use during the upgrade. This allows the DBConnect page to be skipped, making web upgrade almost as easy to use as CLI upgrade.
* Made LocalSettingsGenerator add $wgUpgradeKey in non-commented form, for easier subsequent upgrades.
* Converted the $wgUpgradeKey check to a normal in-sequence page, called ExistingWiki. This allows the removal of related special cases from WebInstaller. The code for WebInstaller_ExistingWiki is loosely based on WebInstaller_Locked.
* Added Status::replaceMessage(), to support informative DB connection error messages from the ExistingWiki page.
* In WebInstaller::getInfoBox(), call parse() with $lineStart=true, so that line-start syntax like bullet points can work.
* Reduced the length of the generated $wgUpgradeKey from 64 to 16. This is ample for what it does, and makes it fit on the screen and not overlap with the right sidebar when when displayed by WebInstaller_ExistingWiki.
* Added $wgUpgradeKey to DefaultSettings.php.
2010-12-09 08:24:54 +00:00
Alexandre Emsenhuber
4d19be865b * Converted UserMailer stuff to return a Status object instead of true-or-WikiError
* Made WikiError::isError() compatible with Status objects
* Added Status::getMessage() for backward compatibility

Extensions using WikiError::isError() to detect a failure of UserMailer::send() and realted methods should still work like before
2010-12-04 13:27:05 +00:00
Chad Horohoe
e8bb37ae48 Cleanup r69128, getStatArray() -> getStatusArray(). It's two characters, c'mon 2010-07-10 09:26:42 +00:00
Mark A. Hershberger
bec7a947e7 * Add Status::getWarningsArray() to complement Status::getErrorsArray()
* Add Status::getWikiTextArray() to allow different ways of formating a bunch of status messages (e.g. CLI output)
* Clean up messages in CliInstaller, use more i18n
* Use warning messages from Status return object in CLI installer
* Make Installer::isCompiled static so we don't have to create an object just to see that we can't use it.
* Add Installer::addInstallStepFollowing so we don't have MySQLInstaller mucking in its parent's data
2010-07-07 02:53:19 +00:00
Alexandre Emsenhuber
203c3785f0 Fixed some doxygen warnings and documented a bit 2010-04-01 21:16:53 +00:00
Mark A. Hershberger
9b23a7b25d random EOL white space. 2010-02-09 08:39:37 +00:00
Tim Starling
bc35951c93 In Special:RevisionDelete:
* Refactored to remove massive duplication
* Removed page parameter and associated contextPage member variable, doesn't seem to do anything.
* Put ID lists into a single ids parameter and member variable instead of having one for each type.
* Fixed inappropriate call of Title::newFromUrl(), always wrong
* Don't pretend to use the return value from functions that don't return anything, this reduces readability.
* Use the table names for deleteKey/typeName values, they look more like English
* Use protected not private
* Remove requirement for log type to be specified in the target
* Use POST for RevisionDelete entry forms, to avoid URL size limits and issues with non-PATH_INFO URLs
* Don't purge all pages that use the given file
* LocalFile::purgeCache() already calls purgeHistory,() no need to do it again. But do call purgeDescription(). 
* Removed token from unhide=1 links, unnecessary
* Tokens are necessary on file streaming links, added them
* Fixed private data leakage due to incorrect use of LocalRepo::newFromArchiveName(). Non-existent placeholder file was returned which meant that $oimage->userCan(File::DELETED_FILE) was always true. Pass the archive name to tryShowFile() instead of the storage key.
* Using ls_field='oi_timestamp' is not correct, oi_timestamp refers to the timestamp of the revision in question, whereas the key that is stored is the timestamp of the previous revision (i.e. the timestamp in oi_archive_name). oi_archive_name would be more correct, although only half the field is used.

Elsewhere:
* Added missing message filehist-missing
* Fixed double asterisk in Status::getWikiText()
* Fixed escaping of the target parameter to Special:RevisionDelete from ImagePage
* Deleted FileStore.php. Deprecated in filerepo refactor except for get()/export() but somehow resurrected by RevisionDelete. Hopefully this will be the end of it. New interfaces will be added for wfStreamFile() in a later commit.
* Added convenience function File::getStorageKey(), factored out of Special:Undelete
* Added convenience function Revision::newFromArchiveRow(), factored out of Special:Undelete and Special:RevisionDelete
* Fixed notice in Special:Upload, uninitialised $pageText

FIXME: current revision can be suppressed on undeletion causing an unauthenticated unsuppress. Comments indicate this is a known issue. I fixed the parser cache pollution in this case but not the rest.
2009-06-01 11:37:06 +00:00
Tim Starling
cd367dabbd Sanitize cleanCallback on wakeup. Extra security check for APIs like SecurePoll/auth-api.php. 2009-04-30 05:21:27 +00:00
Victor Vasiliev
3eccb0169a Improve image moving error handling:
* Do image moving before page moving. That will allow to avoid situations when image page is moved, while image itself isn't.
* Add safeguard code that checks all files before moving them
* More debug logging
2009-03-29 13:42:29 +00:00
Tim Starling
bf51f6bb4b Forgot this, needed with r36153 2008-06-10 15:38:13 +00:00
Bryan Tong Minh
f8a7159e6c Always return an array if an error has occurred in Title::moveTo. 2008-05-30 19:59:47 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Tim Starling
54e2b71bd1 * Generalised FileRepoStatus, providing a very similar general Status object.
* Fixed external storage in LBFactory_Multi, was broken
* Useful debugging hack $wgAllDBsAreLocalhost
2008-04-05 18:11:23 +00:00