http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97922

Revision: 97922
Author:   ialex
Date:     2011-09-23 16:15:30 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
* Call Linker methods statically
* Moved wfReadOnly() check after permissions so that users don't think the 
error is temporary if they and don't have permissions and the database is locked
* Removed "unexpected value of 'oldimage'" message which seems to say there's 
an internal error somewhere instead that the oldimage parameter is not in 
correct format

Modified Paths:
--------------
    trunk/phase3/includes/FileDeleteForm.php

Modified: trunk/phase3/includes/FileDeleteForm.php
===================================================================
--- trunk/phase3/includes/FileDeleteForm.php    2011-09-23 14:52:51 UTC (rev 
97921)
+++ trunk/phase3/includes/FileDeleteForm.php    2011-09-23 16:15:30 UTC (rev 
97922)
@@ -32,27 +32,24 @@
                global $wgOut, $wgRequest, $wgUser;
                $this->setHeaders();
 
-               if( wfReadOnly() ) {
-                       $wgOut->readOnlyPage();
-                       return;
-               }
                $permission_errors = 
$this->title->getUserPermissionsErrors('delete', $wgUser);
                if ( count( $permission_errors ) > 0 ) {
                        $wgOut->showPermissionsErrorPage( $permission_errors );
                        return;
                }
 
+               if ( wfReadOnly() ) {
+                       throw new ReadOnlyError;
+               }
+
                $this->oldimage = $wgRequest->getText( 'oldimage', false );
                $token = $wgRequest->getText( 'wpEditToken' );
                # Flag to hide all contents of the archived revisions
                $suppress = $wgRequest->getVal( 'wpSuppress' ) && 
$wgUser->isAllowed('suppressrevision');
 
-               if( $this->oldimage && !self::isValidOldSpec($this->oldimage) ) 
{
-                       $wgOut->showUnexpectedValueError( 'oldimage', 
htmlspecialchars( $this->oldimage ) );
-                       return;
-               }
-               if( $this->oldimage )
+               if( $this->oldimage ) {
                        $this->oldfile = 
RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, 
$this->oldimage );
+               }
 
                if( !self::haveDeletableFile($this->file, $this->oldfile, 
$this->oldimage) ) {
                        $wgOut->addHTML( $this->prepareMessage( 
'filedelete-nofile' ) );
@@ -220,9 +217,8 @@
                        Xml::closeElement( 'form' );
 
                        if ( $wgUser->isAllowed( 'editinterface' ) ) {
-                               $skin = $wgUser->getSkin();
                                $title = Title::makeTitle( NS_MEDIAWIKI, 
'Filedelete-reason-dropdown' );
-                               $link = $skin->link(
+                               $link = Linker::link(
                                        $title,
                                        wfMsgHtml( 'filedelete-edit-reasonlist' 
),
                                        array(),
@@ -274,18 +270,12 @@
         * Set headers, titles and other bits
         */
        private function setHeaders() {
-               global $wgOut, $wgUser;
+               global $wgOut;
                $wgOut->setPageTitle( wfMsg( 'filedelete', 
$this->title->getText() ) );
                $wgOut->setRobotPolicy( 'noindex,nofollow' );
                $wgOut->setSubtitle( wfMsg(
                        'filedelete-backlink',
-                       $wgUser->getSkin()->link(
-                               $this->title,
-                               null,
-                               array(),
-                               array(),
-                               array( 'known', 'noclasses' )
-                       )
+                       Linker::linkKnown( $this->title )
                ) );
        }
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to