X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRevisiondelete.php;h=dcaff4d9f1dcf306e7b44af6cd89eab7696e9a05;hp=44e44baf9ebd516bab85a7fb7eb9de87c3c33ca1;hb=9964ca1a390c446397dcd466916ffed356cdc3c9;hpb=4162645505f826208495721a326c11a59180f396 diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 44e44baf9e..dcaff4d9f1 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -67,46 +67,46 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { /** * UI labels for each type. */ - private static $UILabels = array( - 'revision' => array( + private static $UILabels = [ + 'revision' => [ 'check-label' => 'revdelete-hide-text', 'success' => 'revdelete-success', 'failure' => 'revdelete-failure', 'text' => 'revdelete-text-text', 'selected'=> 'revdelete-selected-text', - ), - 'archive' => array( + ], + 'archive' => [ 'check-label' => 'revdelete-hide-text', 'success' => 'revdelete-success', 'failure' => 'revdelete-failure', 'text' => 'revdelete-text-text', 'selected'=> 'revdelete-selected-text', - ), - 'oldimage' => array( + ], + 'oldimage' => [ 'check-label' => 'revdelete-hide-image', 'success' => 'revdelete-success', 'failure' => 'revdelete-failure', 'text' => 'revdelete-text-file', 'selected'=> 'revdelete-selected-file', - ), - 'filearchive' => array( + ], + 'filearchive' => [ 'check-label' => 'revdelete-hide-image', 'success' => 'revdelete-success', 'failure' => 'revdelete-failure', 'text' => 'revdelete-text-file', 'selected'=> 'revdelete-selected-file', - ), - 'logging' => array( + ], + 'logging' => [ 'check-label' => 'revdelete-hide-name', 'success' => 'logdelete-success', 'failure' => 'logdelete-failure', 'text' => 'logdelete-text', 'selected' => 'logdelete-selected', - ), - ); + ], + ]; public function __construct() { - parent::__construct( 'Revisiondelete', 'deletedhistory' ); + parent::__construct( 'Revisiondelete', 'deleterevision' ); } public function doesWrites() { @@ -138,7 +138,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', [] ) ); } // $this->ids = array_map( 'intval', $this->ids ); $this->ids = array_unique( array_filter( $this->ids ) ); @@ -190,17 +190,17 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $this->showConvenienceLinks(); # Initialise checkboxes - $this->checks = array( + $this->checks = [ # Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name - array( $this->typeLabels['check-label'], 'wpHidePrimary', + [ $this->typeLabels['check-label'], 'wpHidePrimary', RevisionDeleter::getRevdelConstant( $this->typeName ) - ), - array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ), - array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER ) - ); + ], + [ 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ], + [ 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER ] + ]; if ( $user->isAllowed( 'suppressrevision' ) ) { - $this->checks[] = array( 'revdelete-hide-restricted', - 'wpHideRestricted', Revision::DELETED_RESTRICTED ); + $this->checks[] = [ 'revdelete-hide-restricted', + 'wpHideRestricted', Revision::DELETED_RESTRICTED ]; } # Either submit or create our form @@ -210,17 +210,19 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $this->showForm(); } - $qc = $this->getLogQueryCond(); - # Show relevant lines from the deletion log - $deleteLogPage = new LogPage( 'delete' ); - $output->addHTML( "

" . $deleteLogPage->getName()->escaped() . "

\n" ); - LogEventsList::showLogExtract( - $output, - 'delete', - $this->targetObj, - '', /* user */ - array( 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ) - ); + if ( $user->isAllowed( 'deletedhistory' ) ) { + $qc = $this->getLogQueryCond(); + # Show relevant lines from the deletion log + $deleteLogPage = new LogPage( 'delete' ); + $output->addHTML( "

" . $deleteLogPage->getName()->escaped() . "

\n" ); + LogEventsList::showLogExtract( + $output, + 'delete', + $this->targetObj, + '', /* user */ + [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ] + ); + } # Show relevant lines from the suppression log if ( $user->isAllowed( 'suppressionlog' ) ) { $suppressLogPage = new LogPage( 'suppress' ); @@ -230,7 +232,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { 'suppress', $this->targetObj, '', - array( 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ) + [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ] ); } } @@ -244,20 +246,20 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { // Also set header tabs to be for the target. $this->getSkin()->setRelevantTitle( $this->targetObj ); - $links = array(); + $links = []; $links[] = Linker::linkKnown( SpecialPage::getTitleFor( 'Log' ), $this->msg( 'viewpagelogs' )->escaped(), - array(), - array( 'page' => $this->targetObj->getPrefixedText() ) + [], + [ 'page' => $this->targetObj->getPrefixedText() ] ); if ( !$this->targetObj->isSpecialPage() ) { # Give a link to the page history $links[] = Linker::linkKnown( $this->targetObj, $this->msg( 'pagehist' )->escaped(), - array(), - array( 'action' => 'history' ) + [], + [ 'action' => 'history' ] ); # Link to deleted edits if ( $this->getUser()->isAllowed( 'undelete' ) ) { @@ -265,8 +267,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $links[] = Linker::linkKnown( $undelete, $this->msg( 'deletedhist' )->escaped(), - array(), - array( 'target' => $this->targetObj->getPrefixedDBkey() ) + [], + [ 'target' => $this->targetObj->getPrefixedDBkey() ] ); } } @@ -280,9 +282,9 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * @return array */ protected function getLogQueryCond() { - $conds = array(); + $conds = []; // Revision delete logs for these item - $conds['log_type'] = array( 'delete', 'suppress' ); + $conds['log_type'] = [ 'delete', 'suppress' ]; $conds['log_action'] = $this->getList()->getLogAction(); $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName ); $conds['ls_value'] = $this->ids; @@ -322,14 +324,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $lang->userDate( $oimage->getTimestamp(), $user ), $lang->userTime( $oimage->getTimestamp(), $user ) ); $this->getOutput()->addHTML( - Xml::openElement( 'form', array( + Xml::openElement( 'form', [ 'method' => 'POST', - 'action' => $this->getPageTitle()->getLocalURL( array( + 'action' => $this->getPageTitle()->getLocalURL( [ 'target' => $this->targetObj->getPrefixedDBkey(), 'file' => $archiveName, 'token' => $user->getEditToken( $archiveName ), - ) ) - ) + ] ) + ] ) . Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) . '' @@ -376,8 +378,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { // Messages: revdelete-selected-text, revdelete-selected-file, logdelete-selected $out = $this->getOutput(); - $out->wrapWikiMsg( "$1", array( $this->typeLabels['selected'], - $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ) ); + $out->wrapWikiMsg( "$1", [ $this->typeLabels['selected'], + $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ] ); $this->addHelpLink( 'Help:RevisionDelete' ); $out->addHTML( "