diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
commit | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch) | |
tree | ec04cc15b867bc21eedca904cea9af0254531a11 /includes/specials/SpecialRevisiondelete.php | |
parent | a22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff) |
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook
* Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/specials/SpecialRevisiondelete.php')
-rw-r--r-- | includes/specials/SpecialRevisiondelete.php | 238 |
1 files changed, 114 insertions, 124 deletions
diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index f77fc347..3c643253 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -28,9 +28,6 @@ * @ingroup SpecialPage */ class SpecialRevisionDelete extends UnlistedSpecialPage { - /** Skin object */ - var $skin; - /** True if the submit button was clicked, and the form was posted */ var $submitClicked; @@ -64,39 +61,39 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { */ static $allowedTypes = array( 'revision' => array( - 'check-label' => 'revdelete-hide-text', + 'check-label' => 'revdelete-hide-text', 'deletion-bits' => Revision::DELETED_TEXT, - 'success' => 'revdelete-success', - 'failure' => 'revdelete-failure', - 'list-class' => 'RevDel_RevisionList', + 'success' => 'revdelete-success', + 'failure' => 'revdelete-failure', + 'list-class' => 'RevDel_RevisionList', ), 'archive' => array( - 'check-label' => 'revdelete-hide-text', + 'check-label' => 'revdelete-hide-text', 'deletion-bits' => Revision::DELETED_TEXT, - 'success' => 'revdelete-success', - 'failure' => 'revdelete-failure', - 'list-class' => 'RevDel_ArchiveList', + 'success' => 'revdelete-success', + 'failure' => 'revdelete-failure', + 'list-class' => 'RevDel_ArchiveList', ), 'oldimage'=> array( - 'check-label' => 'revdelete-hide-image', + 'check-label' => 'revdelete-hide-image', 'deletion-bits' => File::DELETED_FILE, - 'success' => 'revdelete-success', - 'failure' => 'revdelete-failure', - 'list-class' => 'RevDel_FileList', + 'success' => 'revdelete-success', + 'failure' => 'revdelete-failure', + 'list-class' => 'RevDel_FileList', ), 'filearchive' => array( - 'check-label' => 'revdelete-hide-image', + 'check-label' => 'revdelete-hide-image', 'deletion-bits' => File::DELETED_FILE, - 'success' => 'revdelete-success', - 'failure' => 'revdelete-failure', - 'list-class' => 'RevDel_ArchivedFileList', + 'success' => 'revdelete-success', + 'failure' => 'revdelete-failure', + 'list-class' => 'RevDel_ArchivedFileList', ), 'logging' => array( - 'check-label' => 'revdelete-hide-name', + 'check-label' => 'revdelete-hide-name', 'deletion-bits' => LogPage::DELETED_ACTION, - 'success' => 'logdelete-success', - 'failure' => 'logdelete-failure', - 'list-class' => 'RevDel_LogList', + 'success' => 'logdelete-success', + 'failure' => 'logdelete-failure', + 'list-class' => 'RevDel_LogList', ), ); @@ -114,43 +111,46 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { } public function execute( $par ) { - global $wgOut, $wgUser, $wgRequest; - if( !$wgUser->isAllowed( 'deletedhistory' ) ) { - $wgOut->permissionRequired( 'deletedhistory' ); + $output = $this->getOutput(); + $user = $this->getUser(); + if( !$user->isAllowed( 'deletedhistory' ) ) { + $output->permissionRequired( 'deletedhistory' ); return; - } else if( wfReadOnly() ) { - $wgOut->readOnlyPage(); + } elseif( wfReadOnly() ) { + $output->readOnlyPage(); return; } - $this->mIsAllowed = $wgUser->isAllowed('deleterevision'); // for changes - $this->skin = $wgUser->getSkin(); + $this->mIsAllowed = $user->isAllowed('deleterevision'); // for changes $this->setHeaders(); $this->outputHeader(); - $this->submitClicked = $wgRequest->wasPosted() && $wgRequest->getBool( 'wpSubmit' ); + $request = $this->getRequest(); + $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' ); # Handle our many different possible input types. - $ids = $wgRequest->getVal( 'ids' ); + $ids = $request->getVal( 'ids' ); if ( !is_null( $ids ) ) { # Allow CSV, for backwards compatibility, or a single ID for show/hide links $this->ids = explode( ',', $ids ); } else { # Array input - $this->ids = array_keys( $wgRequest->getArray('ids',array()) ); + $this->ids = array_keys( $request->getArray('ids',array()) ); } // $this->ids = array_map( 'intval', $this->ids ); $this->ids = array_unique( array_filter( $this->ids ) ); - if ( $wgRequest->getVal( 'action' ) == 'historysubmit' ) { - # For show/hide form submission from history page - $this->targetObj = $GLOBALS['wgTitle']; + if ( $request->getVal( 'action' ) == 'historysubmit' ) { + // For show/hide form submission from history page + // Since we are access through index.php?title=XXX&action=historysubmit + // getFullTitle() will contain the target title and not our title + $this->targetObj = $this->getFullTitle(); $this->typeName = 'revision'; } else { - $this->typeName = $wgRequest->getVal( 'type' ); - $this->targetObj = Title::newFromText( $wgRequest->getText( 'target' ) ); + $this->typeName = $request->getVal( 'type' ); + $this->targetObj = Title::newFromText( $request->getText( 'target' ) ); } # For reviewing deleted files... - $this->archiveName = $wgRequest->getVal( 'file' ); - $this->token = $wgRequest->getVal( 'token' ); + $this->archiveName = $request->getVal( 'file' ); + $this->token = $request->getVal( 'token' ); if ( $this->archiveName && $this->targetObj ) { $this->tryShowFile( $this->archiveName ); return; @@ -162,23 +162,23 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { # No targets? if( !isset( self::$allowedTypes[$this->typeName] ) || count( $this->ids ) == 0 ) { - $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); + $output->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); return; } $this->typeInfo = self::$allowedTypes[$this->typeName]; # If we have revisions, get the title from the first one - # since they should all be from the same page. This allows + # since they should all be from the same page. This allows # for more flexibility with page moves... if( $this->typeName == 'revision' ) { $rev = Revision::newFromId( $this->ids[0] ); $this->targetObj = $rev ? $rev->getTitle() : $this->targetObj; } - - $this->otherReason = $wgRequest->getVal( 'wpReason' ); + + $this->otherReason = $request->getVal( 'wpReason' ); # We need a target page! if( is_null($this->targetObj) ) { - $wgOut->addWikiMsg( 'undelete-header' ); + $output->addWikiMsg( 'undelete-header' ); return; } # Give a link to the logs/hist for this page @@ -190,27 +190,27 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ), array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER ) ); - if( $wgUser->isAllowed('suppressrevision') ) { + if( $user->isAllowed('suppressrevision') ) { $this->checks[] = array( 'revdelete-hide-restricted', 'wpHideRestricted', Revision::DELETED_RESTRICTED ); } # Either submit or create our form if( $this->mIsAllowed && $this->submitClicked ) { - $this->submit( $wgRequest ); + $this->submit( $request ); } else { $this->showForm(); } - + $qc = $this->getLogQueryCond(); # Show relevant lines from the deletion log - $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); - LogEventsList::showLogExtract( $wgOut, 'delete', + $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); + LogEventsList::showLogExtract( $output, 'delete', $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) ); # Show relevant lines from the suppression log - if( $wgUser->isAllowed( 'suppressionlog' ) ) { - $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" ); - LogEventsList::showLogExtract( $wgOut, 'suppress', + if( $user->isAllowed( 'suppressionlog' ) ) { + $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" ); + LogEventsList::showLogExtract( $output, 'suppress', $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) ); } } @@ -219,11 +219,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * Show some useful links in the subtitle */ protected function showConvenienceLinks() { - global $wgOut, $wgUser, $wgLang; # Give a link to the logs/hist for this page if( $this->targetObj ) { $links = array(); - $links[] = $this->skin->linkKnown( + $links[] = Linker::linkKnown( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'viewpagelogs' ), array(), @@ -231,16 +230,16 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { ); if ( $this->targetObj->getNamespace() != NS_SPECIAL ) { # Give a link to the page history - $links[] = $this->skin->linkKnown( + $links[] = Linker::linkKnown( $this->targetObj, wfMsgHtml( 'pagehist' ), array(), array( 'action' => 'history' ) ); # Link to deleted edits - if( $wgUser->isAllowed('undelete') ) { + if( $this->getUser()->isAllowed('undelete') ) { $undelete = SpecialPage::getTitleFor( 'Undelete' ); - $links[] = $this->skin->linkKnown( + $links[] = Linker::linkKnown( $undelete, wfMsgHtml( 'deletedhist' ), array(), @@ -249,7 +248,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { } } # Logs themselves don't have histories or archived revisions - $wgOut->setSubtitle( '<p>' . $wgLang->pipeList( $links ) . '</p>' ); + $this->getOutput()->setSubtitle( '<p>' . $this->getLang()->pipeList( $links ) . '</p>' ); } } @@ -259,7 +258,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { protected function getLogQueryCond() { $conds = array(); // Revision delete logs for these item - $conds['log_type'] = array('delete','suppress'); + $conds['log_type'] = array( 'delete', 'suppress' ); $conds['log_action'] = $this->getList()->getLogAction(); $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName ); $conds['ls_value'] = $this->ids; @@ -271,36 +270,34 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * TODO Mostly copied from Special:Undelete. Refactor. */ protected function tryShowFile( $archiveName ) { - global $wgOut, $wgRequest, $wgUser, $wgLang; - $repo = RepoGroup::singleton()->getLocalRepo(); $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName ); $oimage->load(); // Check if user is allowed to see this file if ( !$oimage->exists() ) { - $wgOut->addWikiMsg( 'revdelete-no-file' ); + $this->getOutput()->addWikiMsg( 'revdelete-no-file' ); return; } if( !$oimage->userCan(File::DELETED_FILE) ) { if( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) { - $wgOut->permissionRequired( 'suppressrevision' ); + $this->getOutput()->permissionRequired( 'suppressrevision' ); } else { - $wgOut->permissionRequired( 'deletedtext' ); + $this->getOutput()->permissionRequired( 'deletedtext' ); } return; } - if ( !$wgUser->matchEditToken( $this->token, $archiveName ) ) { - $wgOut->addWikiMsg( 'revdelete-show-file-confirm', + if ( !$this->getUser()->matchEditToken( $this->token, $archiveName ) ) { + $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm', $this->targetObj->getText(), - $wgLang->date( $oimage->getTimestamp() ), - $wgLang->time( $oimage->getTimestamp() ) ); - $wgOut->addHTML( + $this->getLang()->date( $oimage->getTimestamp() ), + $this->getLang()->time( $oimage->getTimestamp() ) ); + $this->getOutput()->addHTML( Xml::openElement( 'form', array( 'method' => 'POST', 'action' => $this->getTitle()->getLocalUrl( 'target=' . urlencode( $oimage->getName() ) . '&file=' . urlencode( $archiveName ) . - '&token=' . urlencode( $wgUser->editToken( $archiveName ) ) ) + '&token=' . urlencode( $this->getUser()->editToken( $archiveName ) ) ) ) ) . Xml::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) . @@ -308,14 +305,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { ); return; } - $wgOut->disable(); + $this->getOutput()->disable(); # We mustn't allow the output to be Squid cached, otherwise # if an admin previews a deleted image, and it's cached, then # a user without appropriate permissions can toddle off and # nab the image, and Squid will serve it - $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); - $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' ); - $wgRequest->response()->header( 'Pragma: no-cache' ); + $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); + $this->getRequest()->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' ); + $this->getRequest()->response()->header( 'Pragma: no-cache' ); # Stream the file to the client global $IP; @@ -331,27 +328,26 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { protected function getList() { if ( is_null( $this->list ) ) { $class = $this->typeInfo['list-class']; - $this->list = new $class( $this, $this->targetObj, $this->ids ); + $this->list = new $class( $this->getContext(), $this->targetObj, $this->ids ); } return $this->list; } /** - * Show a list of items that we will operate on, and show a form with checkboxes + * Show a list of items that we will operate on, and show a form with checkboxes * which will allow the user to choose new visibility settings. */ protected function showForm() { - global $wgOut, $wgUser, $wgLang; $UserAllowed = true; if ( $this->typeName == 'logging' ) { - $wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->ids) ) ); + $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLang()->formatNum( count($this->ids) ) ); } else { - $wgOut->addWikiMsg( 'revdelete-selected', + $this->getOutput()->addWikiMsg( 'revdelete-selected', $this->targetObj->getPrefixedText(), count( $this->ids ) ); } - $wgOut->addHTML( "<ul>" ); + $this->getOutput()->addHTML( "<ul>" ); $numRevisions = 0; // Live revisions... @@ -360,21 +356,21 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $item = $list->current(); if ( !$item->canView() ) { if( !$this->submitClicked ) { - $wgOut->permissionRequired( 'suppressrevision' ); + $this->getOutput()->permissionRequired( 'suppressrevision' ); return; } $UserAllowed = false; } $numRevisions++; - $wgOut->addHTML( $item->getHTML() ); + $this->getOutput()->addHTML( $item->getHTML() ); } if( !$numRevisions ) { - $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); + $this->getOutput()->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); return; } - - $wgOut->addHTML( "</ul>" ); + + $this->getOutput()->addHTML( "</ul>" ); // Explanation text $this->addUsageText(); @@ -384,7 +380,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { // Show form if the user can submit if( $this->mIsAllowed ) { $out = Xml::openElement( 'form', array( 'method' => 'post', - 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ), + 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ), 'id' => 'mw-revdel-form-revisions' ) ) . Xml::fieldset( wfMsg( 'revdelete-legend' ) ) . $this->buildCheckBoxes() . @@ -404,7 +400,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { Xml::label( wfMsg( 'revdelete-otherreason' ), 'wpReason' ) . '</td>' . '<td class="mw-input">' . - Xml::input( 'wpReason', 60, $this->otherReason, array( 'id' => 'wpReason' ) ) . + Xml::input( 'wpReason', 60, $this->otherReason, array( 'id' => 'wpReason', 'maxlength' => 100 ) ) . '</td>' . "</tr><tr>\n" . '<td></td>' . @@ -414,7 +410,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { '</td>' . "</tr>\n" . Xml::closeElement( 'table' ) . - Html::hidden( 'wpEditToken', $wgUser->editToken() ) . + Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) . Html::hidden( 'target', $this->targetObj->getPrefixedText() ) . Html::hidden( 'type', $this->typeName ) . Html::hidden( 'ids', implode( ',', $this->ids ) ) . @@ -425,9 +421,9 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { if( $this->mIsAllowed ) { $out .= Xml::closeElement( 'form' ) . "\n"; // Show link to edit the dropdown reasons - if( $wgUser->isAllowed( 'editinterface' ) ) { + if( $this->getUser()->isAllowed( 'editinterface' ) ) { $title = Title::makeTitle( NS_MEDIAWIKI, 'revdelete-reason-dropdown' ); - $link = $wgUser->getSkin()->link( + $link = Linker::link( $title, wfMsgHtml( 'revdelete-edit-reasonlist' ), array(), @@ -436,30 +432,27 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $out .= Xml::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n"; } } - $wgOut->addHTML( $out ); + $this->getOutput()->addHTML( $out ); } /** * Show some introductory text - * FIXME Wikimedia-specific policy text + * @todo FIXME: Wikimedia-specific policy text */ protected function addUsageText() { - global $wgOut, $wgUser; - $wgOut->addWikiMsg( 'revdelete-text' ); - if( $wgUser->isAllowed( 'suppressrevision' ) ) { - $wgOut->addWikiMsg( 'revdelete-suppress-text' ); + $this->getOutput()->addWikiMsg( 'revdelete-text' ); + if( $this->getUser()->isAllowed( 'suppressrevision' ) ) { + $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' ); } if( $this->mIsAllowed ) { - $wgOut->addWikiMsg( 'revdelete-confirm' ); + $this->getOutput()->addWikiMsg( 'revdelete-confirm' ); } } - + /** * @return String: HTML */ protected function buildCheckBoxes() { - global $wgRequest; - $html = '<table>'; // If there is just one item, use checkboxes $list = $this->getList(); @@ -467,7 +460,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $list->reset(); $bitfield = $list->current()->getBits(); // existing field if( $this->submitClicked ) { - $bitfield = $this->extractBitfield( $this->extractBitParams($wgRequest), $bitfield ); + $bitfield = $this->extractBitfield( $this->extractBitParams(), $bitfield ); } foreach( $this->checks as $item ) { list( $message, $name, $field ) = $item; @@ -488,7 +481,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { list( $message, $name, $field ) = $item; // If there are several items, use third state by default... if( $this->submitClicked ) { - $selected = $wgRequest->getInt( $name, 0 /* unchecked */ ); + $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ ); } else { $selected = -1; // use existing field } @@ -503,24 +496,23 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $html .= "<tr>$line</tr>\n"; } } - + $html .= '</table>'; return $html; } /** * UI entry point for form submission. - * @param $request WebRequest */ - protected function submit( $request ) { - global $wgUser, $wgOut; + protected function submit() { # Check edit token on submission - if( $this->submitClicked && !$wgUser->matchEditToken( $request->getVal('wpEditToken') ) ) { - $wgOut->addWikiMsg( 'sessionfailure' ); + $token = $this->getRequest()->getVal('wpEditToken'); + if( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) { + $this->getOutput()->addWikiMsg( 'sessionfailure' ); return false; } - $bitParams = $this->extractBitParams( $request ); - $listReason = $request->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown + $bitParams = $this->extractBitParams(); + $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown $comment = $listReason; if( $comment != 'other' && $this->otherReason != '' ) { // Entry from drop down menu + additional comment @@ -529,8 +521,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $comment = $this->otherReason; } # Can the user set this field? - if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$wgUser->isAllowed('suppressrevision') ) { - $wgOut->permissionRequired( 'suppressrevision' ); + if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$this->getUser()->isAllowed('suppressrevision') ) { + $this->getOutput()->permissionRequired( 'suppressrevision' ); return false; } # If the save went through, go to success message... @@ -549,9 +541,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * Report that the submit operation succeeded */ protected function success() { - global $wgOut; - $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); - $wgOut->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeInfo['success'] ); + $this->getOutput()->setPagetitle( wfMsg( 'actioncomplete' ) ); + $this->getOutput()->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeInfo['success'] ); $this->list->reloadFromMaster(); $this->showForm(); } @@ -560,22 +551,21 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * Report that the submit operation failed */ protected function failure( $status ) { - global $wgOut; - $wgOut->setPagetitle( wfMsg( 'actionfailed' ) ); - $wgOut->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) ); + $this->getOutput()->setPagetitle( wfMsg( 'actionfailed' ) ); + $this->getOutput()->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) ); $this->showForm(); } /** * Put together an array that contains -1, 0, or the *_deleted const for each bit - * @param $request WebRequest + * * @return array */ - protected function extractBitParams( $request ) { + protected function extractBitParams() { $bitfield = array(); foreach( $this->checks as $item ) { list( /* message */ , $name, $field ) = $item; - $val = $request->getInt( $name, 0 /* unchecked */ ); + $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ ); if( $val < -1 || $val > 1) { $val = -1; // -1 for existing value } @@ -586,7 +576,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { } return $bitfield; } - + /** * Put together a rev_deleted bitfield * @param $bitPars array extractBitParams() params @@ -599,7 +589,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { foreach( $bitPars as $const => $val ) { if( $val == 1 ) { $newBits |= $const; // $const is the *_deleted const - } else if( $val == -1 ) { + } elseif( $val == -1 ) { $newBits |= ($oldfield & $const); // use existing } } |