Merge "Deprecate specialized file errors in OutputPage and fix escaping"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 12 Jul 2018 17:23:49 +0000 (17:23 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 12 Jul 2018 17:23:49 +0000 (17:23 +0000)
RELEASE-NOTES-1.32
includes/OutputPage.php
includes/specials/SpecialUpload.php

index e37e76e..878c841 100644 (file)
@@ -236,6 +236,11 @@ because of Phabricator reports.
 * ResourceLoaderStartUpModule::getStartupModules() and ::getLegacyModules()
   are deprecated. These concepts are obsolete and have no replacement.
 * String type for $lang of DifferenceEngine::setTextLanguage is deprecated.
+* The following methods of OutputPage are now deprecated in favour
+  of using showFatalError directly: OutputPage::showFileDeleteError()
+  OutputPage::showFileNotFoundError(), OutputPage::showFileRenameError()
+  OutputPage::showFileCopyError() and OutputPage::showUnexpectedValueError().
+
 
 === Other changes in 1.32 ===
 * (T198811) The following tables have had their UNIQUE indexes turned into proper
index 948e1eb..34de7c6 100644 (file)
@@ -2677,30 +2677,56 @@ class OutputPage extends ContextSource {
                }
        }
 
+       /**
+        * Output an error page
+        *
+        * @note FatalError exception class provides an alternative.
+        * @param string $message Error to output. Must be escaped for HTML.
+        */
        public function showFatalError( $message ) {
                $this->prepareErrorPage( $this->msg( 'internalerror' ) );
 
                $this->addHTML( $message );
        }
 
+       /**
+        * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+        */
        public function showUnexpectedValueError( $name, $val ) {
-               $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
+               wfDeprecated( __METHOD__, '1.32' );
+               $this->showFatalError( $this->msg( 'unexpected', $name, $val )->escaped() );
        }
 
+       /**
+        * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+        */
        public function showFileCopyError( $old, $new ) {
-               $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
+               wfDeprecated( __METHOD__, '1.32' );
+               $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->escaped() );
        }
 
+       /**
+        * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+        */
        public function showFileRenameError( $old, $new ) {
-               $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
+               wfDeprecated( __METHOD__, '1.32' );
+               $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->escpaed() );
        }
 
+       /**
+        * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+        */
        public function showFileDeleteError( $name ) {
-               $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
+               wfDeprecated( __METHOD__, '1.32' );
+               $this->showFatalError( $this->msg( 'filedeleteerror', $name )->escaped() );
        }
 
+       /**
+        * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+        */
        public function showFileNotFoundError( $name ) {
-               $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
+               wfDeprecated( __METHOD__, '1.32' );
+               $this->showFatalError( $this->msg( 'filenotfound', $name )->escaped() );
        }
 
        /**
index e52945a..c832f2d 100644 (file)
@@ -761,7 +761,11 @@ class SpecialUpload extends SpecialPage {
                }
                $success = $this->mUpload->unsaveUploadedFile();
                if ( !$success ) {
-                       $this->getOutput()->showFileDeleteError( $this->mUpload->getTempPath() );
+                       $this->getOutput()->showFatalError(
+                               $this->msg( 'filedeleteerror' )
+                                       ->params( $this->mUpload->getTempPath() )
+                                       ->escaped()
+                       );
 
                        return false;
                } else {