Florianschmidtwelzow has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374337 )

Change subject: Do not escape read-only reason in WikiPage::doUpdateRestrictions
......................................................................

Do not escape read-only reason in WikiPage::doUpdateRestrictions

Before this commit, the reason set in the global $wgReadOnly was differently 
handled
on different special pages. While on most of them, like Special:Upload, the 
reason
is allowed to have HTML, which can be used in Wikitext, too, the protection form
always outputted an escaped version of this reason, if it would be displaced 
from
WikiPage::doUpdateRestrictions().

Most special pages uses the ReadOnlyError exception to print a read-only error,
however, WikiPage uses Status objects to communicate between the result back to 
the front-
end. Therefore the same message and parameters were wrapped in a Status object
and, in the frontend, directly outputted through OutputPage. Unfortunately,
Status::getMessage() escapes the parameters of a message, which is the reason, 
why the
wiki is read-only. To bypass this restriction, WikiPage now creates a Message 
object
directly, does not escape the reason, and uses the resulting object to create a 
Status
object from.

The read-only message on the protection form is, also before this commit, not 
escaped and
already displayed correctly, as the read-only is checked in the constructor of 
the
protection form already and, if the Wiki is read only, handled as a permission 
error and
already displayed correctly. This commit fixes the behavior of WikiPage in case 
of it's used
somewhere else, subclassed or if the check in the frontend will be removed and 
the Status of
WikiPage will be used.

Change-Id: I52707299e5e560398652bed3938e491b24913414
---
M includes/page/WikiPage.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/374337/1

diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index d5a2f3f..edccc66 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -2302,7 +2302,7 @@
                global $wgCascadingRestrictionLevels, $wgContLang;
 
                if ( wfReadOnly() ) {
-                       return Status::newFatal( 'readonlytext', 
wfReadOnlyReason() );
+                       return Status::newFatal( wfMessage( 'readonlytext', 
wfReadOnlyReason() ) );
                }
 
                $this->loadPageData( 'fromdbmaster' );

-- 
To view, visit https://gerrit.wikimedia.org/r/374337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52707299e5e560398652bed3938e491b24913414
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to