Fix for r71961 (moved SpecialPage constructor from named to __construct()). Intercept...
[lhc/web/wiklou.git] / includes / Status.php
index ffb396c..f049980 100644 (file)
@@ -300,6 +300,23 @@ class Status {
                return false;
        }
 
+       /**
+        * If the specified source message exists, replace it with the specified 
+        * destination message, but keep the same parameters as in the original error.
+        *
+        * Return true if the replacement was done, false otherwise.
+        */
+       function replaceMessage( $source, $dest ) {
+               $replaced = false;
+               foreach ( $this->errors as $index => $error ) {
+                       if ( $error['message'] === $source ) {
+                               $this->errors[$index]['message'] = $dest;
+                               $replaced = true;
+                       }
+               }
+               return $replaced;
+       }
+
        /**
         * Backward compatibility function for WikiError -> Status migration
         *