X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Frevisiondelete%2FRevisionDeleter.php;h=b834c153676e65c96595c893397e734bb461b8cc;hb=7e350ba150404509d764c96a5ea4dbc9aa51d3ac;hp=d68ef458343d71b2720e3d7a5040e747c943b52e;hpb=b24a0048185fe7c4d86f8b55872ad749c6ab52e6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/revisiondelete/RevisionDeleter.php b/includes/revisiondelete/RevisionDeleter.php index d68ef45834..b834c15367 100644 --- a/includes/revisiondelete/RevisionDeleter.php +++ b/includes/revisiondelete/RevisionDeleter.php @@ -28,22 +28,22 @@ */ class RevisionDeleter { /** List of known revdel types, with their corresponding list classes */ - private static $allowedTypes = array( + private static $allowedTypes = [ 'revision' => 'RevDelRevisionList', 'archive' => 'RevDelArchiveList', 'oldimage' => 'RevDelFileList', 'filearchive' => 'RevDelArchivedFileList', 'logging' => 'RevDelLogList', - ); + ]; /** Type map to support old log entries */ - private static $deprecatedTypeMap = array( + private static $deprecatedTypeMap = [ 'oldid' => 'revision', 'artimestamp' => 'archive', 'oldimage' => 'oldimage', 'fileid' => 'filearchive', 'logid' => 'logging', - ); + ]; /** * Lists the valid possible types for revision deletion. @@ -126,7 +126,7 @@ class RevisionDeleter { */ public static function getChanges( $n, $o ) { $diff = $n ^ $o; - $ret = array( 0 => array(), 1 => array(), 2 => array() ); + $ret = [ 0 => [], 1 => [], 2 => [] ]; // Build bitfield changes in language self::checkItem( 'revdelete-content', Revision::DELETED_TEXT, $diff, $n, $ret ); @@ -156,7 +156,7 @@ class RevisionDeleter { if ( !$typeName ) { return null; } - return call_user_func( array( self::$allowedTypes[$typeName], 'getRelationType' ) ); + return call_user_func( [ self::$allowedTypes[$typeName], 'getRelationType' ] ); } /** @@ -170,7 +170,7 @@ class RevisionDeleter { if ( !$typeName ) { return null; } - return call_user_func( array( self::$allowedTypes[$typeName], 'getRestriction' ) ); + return call_user_func( [ self::$allowedTypes[$typeName], 'getRestriction' ] ); } /** @@ -184,7 +184,7 @@ class RevisionDeleter { if ( !$typeName ) { return null; } - return call_user_func( array( self::$allowedTypes[$typeName], 'getRevdelConstant' ) ); + return call_user_func( [ self::$allowedTypes[$typeName], 'getRevdelConstant' ] ); } /** @@ -200,7 +200,7 @@ class RevisionDeleter { if ( !$typeName ) { return $target; } - return call_user_func( array( self::$allowedTypes[$typeName], 'suggestTarget' ), $target, $ids ); + return call_user_func( [ self::$allowedTypes[$typeName], 'suggestTarget' ], $target, $ids ); } /** @@ -213,18 +213,18 @@ class RevisionDeleter { * @return bool|mixed */ public static function checkRevisionExistence( $title, $revid ) { - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $exists = $dbr->selectField( 'revision', '1', - array( 'rev_id' => $revid ), __METHOD__ ); + [ 'rev_id' => $revid ], __METHOD__ ); if ( $exists ) { return true; } $timestamp = $dbr->selectField( 'archive', 'ar_timestamp', - array( 'ar_namespace' => $title->getNamespace(), + [ 'ar_namespace' => $title->getNamespace(), 'ar_title' => $title->getDBkey(), - 'ar_rev_id' => $revid ), __METHOD__ ); + 'ar_rev_id' => $revid ], __METHOD__ ); return $timestamp; }