summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialRevisiondelete.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
commit08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch)
tree577a29fb579188d16003a209ce2a2e9c5b0aa2bd /includes/specials/SpecialRevisiondelete.php
parentcacc939b34e315b85e2d72997811eb6677996cc1 (diff)
Update to MediaWiki 1.21.1
Diffstat (limited to 'includes/specials/SpecialRevisiondelete.php')
-rw-r--r--includes/specials/SpecialRevisiondelete.php45
1 files changed, 22 insertions, 23 deletions
diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php
index aba90cf8..5a5f8ffb 100644
--- a/includes/specials/SpecialRevisiondelete.php
+++ b/includes/specials/SpecialRevisiondelete.php
@@ -133,7 +133,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
$this->ids = explode( ',', $ids );
} else {
# Array input
- $this->ids = array_keys( $request->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 ) );
@@ -147,7 +147,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
} else {
$this->typeName = $request->getVal( 'type' );
$this->targetObj = Title::newFromText( $request->getText( 'target' ) );
- if ( $this->targetObj->isSpecial( 'Log' ) ) {
+ if ( $this->targetObj && $this->targetObj->isSpecial( 'Log' ) && count( $this->ids ) !== 0 ) {
$result = wfGetDB( DB_SLAVE )->select( 'logging',
'log_type',
array( 'log_id' => $this->ids ),
@@ -155,14 +155,9 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
array( 'DISTINCT' )
);
- $logTypes = array();
- foreach ( $result as $row ) {
- $logTypes[] = $row->log_type;
- }
-
- if ( count( $logTypes ) == 1 ) {
+ if ( $result->numRows() == 1 ) {
// If there's only one type, the target can be set to include it.
- $this->targetObj = SpecialPage::getTitleFor( 'Log', $logTypes[0] );
+ $this->targetObj = SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
}
}
}
@@ -196,7 +191,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
$this->otherReason = $request->getVal( 'wpReason' );
# We need a target page!
- if( is_null($this->targetObj) ) {
+ if( is_null( $this->targetObj ) ) {
$output->addWikiMsg( 'undelete-header' );
return;
}
@@ -209,7 +204,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ),
array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER )
);
- if( $user->isAllowed('suppressrevision') ) {
+ if( $user->isAllowed( 'suppressrevision' ) ) {
$this->checks[] = array( 'revdelete-hide-restricted',
'wpHideRestricted', Revision::DELETED_RESTRICTED );
}
@@ -230,7 +225,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
# Show relevant lines from the suppression log
if( $user->isAllowed( 'suppressionlog' ) ) {
$suppressLogPage = new LogPage( 'suppress' );
- $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
+ $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
LogEventsList::showLogExtract( $output, 'suppress',
$this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
}
@@ -258,7 +253,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
array( 'action' => 'history' )
);
# Link to deleted edits
- if( $this->getUser()->isAllowed('undelete') ) {
+ if( $this->getUser()->isAllowed( 'undelete' ) ) {
$undelete = SpecialPage::getTitleFor( 'Undelete' );
$links[] = Linker::linkKnown(
$undelete,
@@ -361,7 +356,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
$UserAllowed = true;
if ( $this->typeName == 'logging' ) {
- $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLanguage()->formatNum( count($this->ids) ) );
+ $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLanguage()->formatNum( count( $this->ids ) ) );
} else {
$this->getOutput()->addWikiMsg( 'revdelete-selected',
$this->targetObj->getPrefixedText(), count( $this->ids ) );
@@ -469,8 +464,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
}
/**
- * @return String: HTML
- */
+ * @return String: HTML
+ */
protected function buildCheckBoxes() {
$html = '<table>';
// If there is just one item, use checkboxes
@@ -522,11 +517,12 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
/**
* UI entry point for form submission.
+ * @throws PermissionsError
* @return bool
*/
protected function submit() {
# Check edit token on submission
- $token = $this->getRequest()->getVal('wpEditToken');
+ $token = $this->getRequest()->getVal( 'wpEditToken' );
if( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
$this->getOutput()->addWikiMsg( 'sessionfailure' );
return false;
@@ -541,7 +537,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
$comment = $this->otherReason;
}
# Can the user set this field?
- if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$this->getUser()->isAllowed('suppressrevision') ) {
+ if( $bitParams[Revision::DELETED_RESTRICTED] == 1 && !$this->getUser()->isAllowed( 'suppressrevision' ) ) {
throw new PermissionsError( 'suppressrevision' );
}
# If the save went through, go to success message...
@@ -583,14 +579,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
protected function extractBitParams() {
$bitfield = array();
foreach( $this->checks as $item ) {
- list( /* message */ , $name, $field ) = $item;
+ list( /* message */, $name, $field ) = $item;
$val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
if( $val < -1 || $val > 1) {
$val = -1; // -1 for existing value
}
$bitfield[$field] = $val;
}
- if( !isset($bitfield[Revision::DELETED_RESTRICTED]) ) {
+ if( !isset( $bitfield[Revision::DELETED_RESTRICTED] ) ) {
$bitfield[Revision::DELETED_RESTRICTED] = 0;
}
return $bitfield;
@@ -598,8 +594,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
/**
* Put together a rev_deleted bitfield
- * @param $bitPars array extractBitParams() params
- * @param $oldfield int current bitfield
+ * @param array $bitPars extractBitParams() params
+ * @param int $oldfield current bitfield
* @return array
*/
public static function extractBitfield( $bitPars, $oldfield ) {
@@ -627,5 +623,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
array( 'value' => $bitfield, 'comment' => $reason )
);
}
-}
+ protected function getGroupName() {
+ return 'pagetools';
+ }
+}