r102403 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102402‎ | r102403 | r102404 >
Date:15:45, 8 November 2011
Author:ialex
Status:ok
Tags:
Comment:
Replace two calls to OutputPage::readOnlyPage():
* in StaticWiki: if the user can't edit the page, let EditPage show the error message itself
* in SemanticForms: add the error message yourself since calling readOnlyPage() and continuing processing is not the best idea
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/StaticWiki/StaticWiki.php (modified) (history)

Diff [purge]

Index: trunk/extensions/StaticWiki/StaticWiki.php
@@ -39,12 +39,9 @@
4040 if ( !in_array ( $wgTitle->getNamespace() , $wgStaticWikiNamespaces ) ) return true ; # This article namespace is not imported => normal edit
4141
4242 if ( ! $a->mTitle->userCan( 'edit' ) ) { # Only users that can edit may import as well
43 - wfDebug( "$fname: user can't edit\n" );
44 - $wgOut->readOnlyPage( $this->mArticle->getContent( true ), true );
45 - wfProfileOut( $fname );
46 - return true;
47 - }
48 -
 43+ return true;
 44+ }
 45+
4946 $url_title = $wgTitle->getPrefixedDBkey() ;
5047 $title = $wgTitle->getText () ;
5148 $wgOut->setPageTitle ( 'Importing ' . $wgTitle->getPrefixedText() ) ;
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -399,7 +399,8 @@
400400 }
401401 } else {
402402 $form_is_disabled = true;
403 - $wgOut->readOnlyPage( null, false, $permissionErrors, 'edit' );
 403+ $wgOut->setPageTitle( wfMsg( 'badaccess' ) );
 404+ $wgOut->addWikiText( $wgOut->formatPermissionsErrorMessage( $permissionErrors, 'edit' ) );
404405 $wgOut->addHTML( "\n<hr />\n" );
405406 }
406407

Status & tagging log