From af7da3194c0465e9b49f784175d0db62bf25ad92 Mon Sep 17 00:00:00 2001 From: Nick Jenkins Date: Wed, 21 Mar 2007 07:41:13 +0000 Subject: [PATCH] Reverting SpecialRevisiondelete.php back to r17880, to fix bug 9336 ( "Special:Revisiondelete broken in SVN head" ) The problem is that includes/SpecialRevisiondelete.php was in an inconsistent state - it was updated in r20446 (merge of rev_deleted branch), and then partially reverted in r20525 (i.e. there was some unintentional cruft left over, including the change in the constructor params), and as a result stuff like http://Hostname-Of-Wiki/wiki/index.php?title=Special:Revisiondelete&target=Main_Page&oldid=X would die with fatal errors. (The diff between the before and after is shown here: http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/SpecialRevisiondelete.php?r1=17880&r2=20525 , or from the command line, try: svn diff --revision 17880:20525 includes/SpecialRevisiondelete.php | less ) I'm unsure whether I should be updating RELEASE-NOTES, but I'm leaning towards 'no', on the basis that no end-user encountered this (cluster is on r20145), and that (hopefully) there should be are no user-visible changes as a result of this revert. --- includes/SpecialRevisiondelete.php | 245 +++-------------------------- 1 file changed, 19 insertions(+), 226 deletions(-) diff --git a/includes/SpecialRevisiondelete.php b/includes/SpecialRevisiondelete.php index 2f459d0f2e..fb5e9ec8c4 100644 --- a/includes/SpecialRevisiondelete.php +++ b/includes/SpecialRevisiondelete.php @@ -40,259 +40,52 @@ class RevisionDeleteForm { * @param Title $page * @param int $oldid */ - function __construct( $request, $oldid, $logid, $arid, $fileid ) { + function __construct( $request ) { global $wgUser; - $target = $request->getText( 'target' ); - $this->page = Title::newFromUrl( $target, false ); + $target = $request->getVal( 'target' ); + $this->page = Title::newFromUrl( $target ); $this->revisions = $request->getIntArray( 'oldid', array() ); - $this->events = $request->getIntArray( 'logid', array() ); - $this->archrevs = $request->getIntArray( 'arid', array() ); - $this->files = $request->getIntArray( 'fileid', array() ); $this->skin = $wgUser->getSkin(); - - // log events don't have text to hide, but hiding the page name is useful - if ( $fileid ) { - $hide_text_name = array( 'revdelete-hide-image', 'wpHideImage', Image::DELETED_FILE ); - $this->deletetype='file'; - } else if ( $logid ) { - $hide_text_name = array( 'revdelete-hide-name', 'wpHideName', LogViewer::DELETED_ACTION ); - $this->deletetype='log'; - } else { - $hide_text_name = array( 'revdelete-hide-text', 'wpHideText', Revision::DELETED_TEXT ); - if ( $arid ) $this->deletetype='ar'; - else $this->deletetype='old'; - } $this->checks = array( - $hide_text_name, + array( 'revdelete-hide-text', 'wpHideText', Revision::DELETED_TEXT ), array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ), array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER ), array( 'revdelete-hide-restricted', 'wpHideRestricted', Revision::DELETED_RESTRICTED ) ); } /** - * This sets any fields that are true to a bitfield to true on a given bitfield - * @param $bitfield, running bitfield - * @param $nbitfield, new bitfiled - */ - function setBitfield( $bitfield, $nbitfield ) { - if ( $nbitfield & Revision::DELETED_TEXT) $bitfield |= Revision::DELETED_TEXT; - if ( $nbitfield & LogViewer::DELETED_ACTION) $bitfield |= LogViewer::DELETED_ACTION; - if ( $nbitfield & Image::DELETED_FILE) $bitfield |= Image::DELETED_FILE; - if ( $nbitfield & Revision::DELETED_COMMENT) $bitfield |= Revision::DELETED_COMMENT; - if ( $nbitfield & Revision::DELETED_USER) $bitfield |= Revision::DELETED_USER; - if ( $nbitfield & Revision::DELETED_RESTRICTED) $bitfield |= Revision::DELETED_RESTRICTED; - return $bitfield; - } - - /** - * This lets a user set restrictions for live and archived revisions - * @param WebRequest $request - */ - function showRevs( $request ) { - global $wgOut, $wgUser, $action; - - $UserAllowed = true; - $wgOut->addWikiText( wfMsgExt( 'revdelete-selected', 'parseinline', $this->page->getPrefixedText(), count( $this->revisions) ) ); - - $bitfields = 0; - $wgOut->addHtml( "" ); - - $wgOut->addWikiText( wfMsgHtml( 'revdelete-text' ) ); - //Normal sysops can always see what they did, but can't always change it - if ( !$UserAllowed ) return; - - $items = array( - wfInputLabel( wfMsgHtml( 'revdelete-log' ), 'wpReason', 'wpReason', 60 ), - wfSubmitButton( wfMsgHtml( 'revdelete-submit' ) ) ); - $hidden = array( - wfHidden( 'wpEditToken', $wgUser->editToken() ), - wfHidden( 'target', $this->page->getPrefixedText() ), - wfHidden( 'type', $this->deletetype ) ); - if( $this->deletetype=='old' ) { - foreach( $this->revisions as $revid ) { - $hidden[] = wfHidden( 'oldid[]', $revid ); - } - } else if( $this->deletetype=='ar' ) { - foreach( $this->archrevs as $revid ) { - $hidden[] = wfHidden( 'arid[]', $revid ); - } - } - $special = SpecialPage::getTitleFor( 'Revisiondelete' ); - $wgOut->addHtml( wfElement( 'form', array( - 'method' => 'post', - 'action' => $special->getLocalUrl( 'action=submit' ) ), - null ) ); - - $wgOut->addHtml( '
' . wfMsgHtml( 'revdelete-legend' ) . '' ); - // FIXME: all items checked for just one rev are checked, even if not set for the others - foreach( $this->checks as $item ) { - list( $message, $name, $field ) = $item; - $wgOut->addHtml( '
' . - wfCheckLabel( wfMsgHtml( $message), $name, $name, $bitfields & $field ) . - '
' ); - } - $wgOut->addHtml( '
' ); - foreach( $items as $item ) { - $wgOut->addHtml( '

' . $item . '

' ); - } - foreach( $hidden as $item ) { - $wgOut->addHtml( $item ); - } - - $wgOut->addHtml( '' ); - } - - /** - * This lets a user set restrictions for archived images - * @param WebRequest $request - */ - function showImages( $request ) { - global $wgOut, $wgUser, $action; - - $UserAllowed = true; - $wgOut->addWikiText( wfMsgExt( 'revdelete-selected', 'parseline', $this->page->getPrefixedText(), count( $this->files ) ) ); - - $bitfields = 0; - $wgOut->addHtml( "" ); - - $wgOut->addWikiText( wfMsgHtml( 'revdelete-text' ) ); - //Normal sysops can always see what they did, but can't always change it - if ( !$UserAllowed ) return; - - $items = array( - wfInputLabel( wfMsgHtml( 'revdelete-log' ), 'wpReason', 'wpReason', 60 ), - wfSubmitButton( wfMsgHtml( 'revdelete-submit' ) ) ); - $hidden = array( - wfHidden( 'wpEditToken', $wgUser->editToken() ), - wfHidden( 'target', $this->page->getPrefixedText() ), - wfHidden( 'type', $this->deletetype ) ); - foreach( $this->files as $fileid ) { - $hidden[] = wfHidden( 'fileid[]', $fileid ); - } - $special = SpecialPage::getTitleFor( 'Revisiondelete' ); - $wgOut->addHtml( wfElement( 'form', array( - 'method' => 'post', - 'action' => $special->getLocalUrl( 'action=submit' ) ), - null ) ); - - $wgOut->addHtml( '
' . wfMsgHtml( 'revdelete-legend' ) . '' ); - // FIXME: all items checked for just one file are checked, even if not set for the others - foreach( $this->checks as $item ) { - list( $message, $name, $field ) = $item; - $wgOut->addHtml( '
' . - wfCheckLabel( wfMsgHtml( $message), $name, $name, $bitfields & $field ) . - '
' ); - } - $wgOut->addHtml( '
' ); - foreach( $items as $item ) { - $wgOut->addHtml( '

' . $item . '

' ); - } - foreach( $hidden as $item ) { - $wgOut->addHtml( $item ); - } - - $wgOut->addHtml( '' ); - } - - /** - * This lets a user set restrictions for log items * @param WebRequest $request */ - function showEvents( $request ) { - global $wgOut, $wgUser, $action; + function show( $request ) { + global $wgOut, $wgUser; - $UserAllowed = true; - $wgOut->addWikiText( wfMsgExt( 'logdelete-selected', 'parseinline', $this->page->getPrefixedText(), count( $this->events ) ) ); + $wgOut->addWikiText( wfMsg( 'revdelete-selected', $this->page->getPrefixedText() ) ); - $bitfields = 0; $wgOut->addHtml( "" ); - - $wgOut->addWikiText( wfMsgHtml( 'revdelete-text' ) ); - //Normal sysops can always see what they did, but can't always change it - if ( !$UserAllowed ) return; + + $wgOut->addWikiText( wfMsg( 'revdelete-text' ) ); $items = array( - wfInputLabel( wfMsgHtml( 'revdelete-log' ), 'wpReason', 'wpReason', 60 ), - wfSubmitButton( wfMsgHtml( 'revdelete-submit' ) ) ); + wfInputLabel( wfMsg( 'revdelete-log' ), 'wpReason', 'wpReason', 60 ), + wfSubmitButton( wfMsg( 'revdelete-submit' ) ) ); $hidden = array( wfHidden( 'wpEditToken', $wgUser->editToken() ), - wfHidden( 'target', $this->page->getPrefixedText() ), - wfHidden( 'type', $this->deletetype ) ); - foreach( $this->events as $logid ) { - $hidden[] = wfHidden( 'logid[]', $logid ); + wfHidden( 'target', $this->page->getPrefixedText() ) ); + foreach( $this->revisions as $revid ) { + $hidden[] = wfHidden( 'oldid[]', $revid ); } $special = SpecialPage::getTitleFor( 'Revisiondelete' ); -- 2.20.1