Merge "(bug 38556) Add header and footer messages to MediaWiki's info action"
[lhc/web/wiklou.git] / includes / Exception.php
index 0fc5cd7..a131cca 100644 (file)
@@ -45,7 +45,7 @@ class MWException extends Exception {
        }
 
        /**
-        * Can the extension use wfMsg() to get i18n messages?
+        * Can the extension use the Message class/wfMessage to get i18n-ed messages?
         *
         * @return bool
         */
@@ -109,7 +109,7 @@ class MWException extends Exception {
                $args = array_slice( func_get_args(), 2 );
 
                if ( $this->useMessageCache() ) {
-                       return wfMsgNoTrans( $key, $args );
+                       return wfMessage( $key, $args )->plain();
                } else {
                        return wfMsgReplaceArgs( $fallback, $args );
                }
@@ -185,7 +185,7 @@ class MWException extends Exception {
 
        /**
         * Return the requested URL and point to file and line number from which the
-        * exception occured
+        * exception occurred
         *
         * @return string
         */
@@ -289,6 +289,7 @@ class MWException extends Exception {
  * Exception class which takes an HTML error message, and does not
  * produce a backtrace. Replacement for OutputPage::fatalError().
  *
+ * @since 1.7
  * @ingroup Exception
  */
 class FatalError extends MWException {
@@ -311,19 +312,18 @@ class FatalError extends MWException {
 /**
  * An error page which can definitely be safely rendered using the OutputPage.
  *
+ * @since 1.7
  * @ingroup Exception
  */
 class ErrorPageError extends MWException {
        public $title, $msg, $params;
 
        /**
-        * @todo document
+        * Note: these arguments are keys into wfMessage(), not text!
         *
-        * Note: these arguments are keys into wfMsg(), not text!
-        *
-        * @param $title A title
-        * @param $msg String|Message . In string form, should be a message key
-        * @param $params Array Array to wfMsg()
+        * @param $title string|Message Message key (string) for page title, or a Message object
+        * @param $msg string|Message Message key (string) for error text, or a Message object
+        * @param $params array with parameters to wfMessage()
         */
        function __construct( $title, $msg, $params = null ) {
                $this->title = $title;
@@ -333,7 +333,7 @@ class ErrorPageError extends MWException {
                if( $msg instanceof Message ){
                        parent::__construct( $msg );
                } else {
-                       parent::__construct( wfMsg( $msg ) );
+                       parent::__construct( wfMessage( $msg )->text() );
                }
        }
 
@@ -350,13 +350,13 @@ class ErrorPageError extends MWException {
  * Similar to ErrorPage, but emit a 400 HTTP error code to let mobile
  * browser it is not really a valid content.
  *
+ * @since 1.19
  * @ingroup Exception
  */
 class BadTitleError extends ErrorPageError {
-
        /**
-        * @param $msg string A message key (default: 'badtitletext')
-        * @param $params Array parameter to wfMsg()
+        * @param $msg string|Message A message key (default: 'badtitletext')
+        * @param $params Array parameter to wfMessage()
         */
        function __construct( $msg = 'badtitletext', $params = null ) {
                parent::__construct( 'badtitle', $msg, $params );
@@ -381,6 +381,7 @@ class BadTitleError extends ErrorPageError {
  * Show an error when a user tries to do something they do not have the necessary
  * permissions for.
  *
+ * @since 1.18
  * @ingroup Exception
  */
 class PermissionsError extends ErrorPageError {
@@ -419,6 +420,7 @@ class PermissionsError extends ErrorPageError {
  * Show an error when the wiki is locked/read-only and the user tries to do
  * something that requires write access.
  *
+ * @since 1.18
  * @ingroup Exception
  */
 class ReadOnlyError extends ErrorPageError {
@@ -434,6 +436,7 @@ class ReadOnlyError extends ErrorPageError {
 /**
  * Show an error when the user hits a rate limit.
  *
+ * @since 1.18
  * @ingroup Exception
  */
 class ThrottledError extends ErrorPageError {
@@ -454,6 +457,7 @@ class ThrottledError extends ErrorPageError {
 /**
  * Show an error when the user tries to do something whilst blocked.
  *
+ * @since 1.18
  * @ingroup Exception
  */
 class UserBlockedError extends ErrorPageError {
@@ -470,7 +474,7 @@ class UserBlockedError extends ErrorPageError {
 
                $reason = $block->mReason;
                if( $reason == '' ) {
-                       $reason = wfMsg( 'blockednoreason' );
+                       $reason = wfMessage( 'blockednoreason' )->text();
                }
 
                /* $ip returns who *is* being blocked, $intended contains who was meant to be blocked.
@@ -500,6 +504,7 @@ class UserBlockedError extends ErrorPageError {
  * This is essentially an ErrorPageError exception which by default use the
  * 'exception-nologin' as a title and 'exception-nologin-text' for the message.
  * @see bug 37627
+ * @since 1.20
  *
  * @par Example:
  * @code
@@ -528,7 +533,7 @@ class UserNotLoggedIn extends ErrorPageError {
         *        Optional, default: 'exception-nologin-text'
         * @param $titleMsg A message key to set the page title.
         *        Optional, default: 'exception-nologin'
-        * @param $params Parameters to wfMsg().
+        * @param $params Parameters to wfMessage().
         *        Optiona, default: null
         */
        public function __construct(
@@ -544,6 +549,7 @@ class UserNotLoggedIn extends ErrorPageError {
  * Show an error that looks like an HTTP server error.
  * Replacement for wfHttpError().
  *
+ * @since 1.19
  * @ingroup Exception
  */
 class HttpError extends MWException {