From f742b27dd3044370af9af49c1af3d9d6a77e944a Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 23 Nov 2013 21:54:48 +0100 Subject: [PATCH] Break long lines in file repo files Change-Id: I6d95c1b3e14a947a92127efa681007baaeab89ba --- includes/filerepo/FileRepo.php | 12 +++++--- includes/filerepo/ForeignAPIRepo.php | 6 ++-- includes/filerepo/file/File.php | 4 ++- includes/filerepo/file/LocalFile.php | 29 ++++++++++++++----- .../filerepo/file/UnregisteredLocalFile.php | 3 +- 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 963a2520cc..55fa39d2ed 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -72,7 +72,8 @@ class FileRepo { || !array_key_exists( 'name', $info ) || !array_key_exists( 'backend', $info ) ) { - throw new MWException( __CLASS__ . " requires an array of options having both 'name' and 'backend' keys.\n" ); + throw new MWException( __CLASS__ . + " requires an array of options having both 'name' and 'backend' keys.\n" ); } // Required settings @@ -206,11 +207,14 @@ class FileRepo { * @return String or false */ public function getZoneUrl( $zone, $ext = null ) { - if ( in_array( $zone, array( 'public', 'temp', 'thumb', 'transcoded' ) ) ) { // standard public zones + if ( in_array( $zone, array( 'public', 'temp', 'thumb', 'transcoded' ) ) ) { + // standard public zones if ( $ext !== null && isset( $this->zones[$zone]['urlsByExt'][$ext] ) ) { - return $this->zones[$zone]['urlsByExt'][$ext]; // custom URL for extension/zone + // custom URL for extension/zone + return $this->zones[$zone]['urlsByExt'][$ext]; } elseif ( isset( $this->zones[$zone]['url'] ) ) { - return $this->zones[$zone]['url']; // custom URL for zone + // custom URL for zone + return $this->zones[$zone]['url']; } } switch ( $zone ) { diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index b4db65369e..616f881f71 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -316,7 +316,8 @@ class ForeignAPIRepo extends FileRepo { * @param string $name is a dbkey form of a title * @param $width * @param $height - * @param string $params Other rendering parameters (page number, etc) from handler's makeParamString. + * @param string $params Other rendering parameters (page number, etc) + * from handler's makeParamString. * @return bool|string */ function getThumbUrlFromCache( $name, $width, $height, $params = "" ) { @@ -365,7 +366,8 @@ class ForeignAPIRepo extends FileRepo { } $localPath = $this->getZonePath( 'thumb' ) . "/" . $this->getHashPath( $name ) . $name; $localFilename = $localPath . "/" . $fileName; - $localUrl = $this->getZoneUrl( 'thumb' ) . "/" . $this->getHashPath( $name ) . rawurlencode( $name ) . "/" . rawurlencode( $fileName ); + $localUrl = $this->getZoneUrl( 'thumb' ) . "/" . $this->getHashPath( $name ) . + rawurlencode( $name ) . "/" . rawurlencode( $fileName ); if ( $backend->fileExists( array( 'src' => $localFilename ) ) && isset( $metadata['timestamp'] ) diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index b7a504aa65..8e6dc8d035 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -1473,7 +1473,9 @@ abstract class File { * @return bool * @throws MWException */ - function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '', $watch = false, $timestamp = false, User $user = null ) { + function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '', + $watch = false, $timestamp = false, User $user = null + ) { $this->readOnlyError(); } diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index d94bbada96..3c15449984 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -291,7 +291,8 @@ class LocalFile extends File { */ function getCacheFields( $prefix = 'img_' ) { static $fields = array( 'size', 'width', 'height', 'bits', 'media_type', - 'major_mime', 'minor_mime', 'metadata', 'timestamp', 'sha1', 'user', 'user_text', 'description' ); + 'major_mime', 'minor_mime', 'metadata', 'timestamp', 'sha1', 'user', + 'user_text', 'description' ); static $results = array(); if ( $prefix == '' ) { @@ -1090,7 +1091,9 @@ class LocalFile extends File { * @return FileRepoStatus object. On success, the value member contains the * archive name, or an empty string if it was a new file. */ - function upload( $srcPath, $comment, $pageText, $flags = 0, $props = false, $timestamp = false, $user = null ) { + function upload( $srcPath, $comment, $pageText, $flags = 0, $props = false, + $timestamp = false, $user = null + ) { global $wgContLang; if ( $this->getRepo()->getReadOnlyReason() !== false ) { @@ -1369,7 +1372,13 @@ class LocalFile extends File { # There's already a log entry, so don't make a second RC entry # Squid and file cache for the description page are purged by doEditContent. $content = ContentHandler::makeContent( $pageText, $descTitle ); - $status = $wikiPage->doEditContent( $content, $comment, EDIT_NEW | EDIT_SUPPRESS_RC, false, $user ); + $status = $wikiPage->doEditContent( + $content, + $comment, + EDIT_NEW | EDIT_SUPPRESS_RC, + false, + $user + ); $dbw->begin( __METHOD__ ); // XXX; doEdit() uses a transaction // Now that the page exists, make an RC entry. @@ -2291,7 +2300,8 @@ class LocalFileRestoreBatch { continue; } - $deletedRel = $this->file->repo->getDeletedHashPath( $row->fa_storage_key ) . $row->fa_storage_key; + $deletedRel = $this->file->repo->getDeletedHashPath( $row->fa_storage_key ) . + $row->fa_storage_key; $deletedUrl = $this->file->repo->getVirtualUrl() . '/deleted/' . $deletedRel; if ( isset( $row->fa_sha1 ) ) { @@ -2671,13 +2681,15 @@ class LocalFileMoveBatch { return $statusDb; } - wfDebugLog( 'imagemove', "Renamed {$this->file->getName()} in database: {$statusDb->successCount} successes, {$statusDb->failCount} failures" ); + wfDebugLog( 'imagemove', "Renamed {$this->file->getName()} in database: " . + "{$statusDb->successCount} successes, {$statusDb->failCount} failures" ); // Copy the files into their new location. // If a prior process fataled copying or cleaning up files we tolerate any // of the existing files if they are identical to the ones being stored. $statusMove = $repo->storeBatch( $triplets, FileRepo::OVERWRITE_SAME ); - wfDebugLog( 'imagemove', "Moved files for {$this->file->getName()}: {$statusMove->successCount} successes, {$statusMove->failCount} failures" ); + wfDebugLog( 'imagemove', "Moved files for {$this->file->getName()}: " . + "{$statusMove->successCount} successes, {$statusMove->failCount} failures" ); if ( !$statusMove->isGood() ) { // Delete any files copied over (while the destination is still locked) $this->cleanupTarget( $triplets ); @@ -2764,7 +2776,10 @@ class LocalFileMoveBatch { // $move: (oldRelativePath, newRelativePath) $srcUrl = $this->file->repo->getVirtualUrl() . '/public/' . rawurlencode( $move[0] ); $triplets[] = array( $srcUrl, 'public', $move[1] ); - wfDebugLog( 'imagemove', "Generated move triplet for {$this->file->getName()}: {$srcUrl} :: public :: {$move[1]}" ); + wfDebugLog( + 'imagemove', + "Generated move triplet for {$this->file->getName()}: {$srcUrl} :: public :: {$move[1]}" + ); } return $triplets; diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php index 0d9a830a88..e7fa46e241 100644 --- a/includes/filerepo/file/UnregisteredLocalFile.php +++ b/includes/filerepo/file/UnregisteredLocalFile.php @@ -71,7 +71,8 @@ class UnregisteredLocalFile extends File { */ function __construct( $title = false, $repo = false, $path = false, $mime = false ) { if ( !( $title && $repo ) && !$path ) { - throw new MWException( __METHOD__ . ': not enough parameters, must specify title and repo, or a full path' ); + throw new MWException( __METHOD__ . + ': not enough parameters, must specify title and repo, or a full path' ); } if ( $title instanceof Title ) { $this->title = File::normalizeTitle( $title, 'exception' ); -- 2.20.1