jenkins-bot has submitted this change and it was merged.
Change subject: Fix CodeSniffer errors and warnings in includes/specials (2)
......................................................................
Fix CodeSniffer errors and warnings in includes/specials (2)
Change-Id: I9787d2a1515b2a8d9310ea636650e20d041acc3d
---
M includes/specials/SpecialSpecialpages.php
M includes/specials/SpecialStatistics.php
M includes/specials/SpecialUncategorizedimages.php
M includes/specials/SpecialUncategorizedpages.php
M includes/specials/SpecialUndelete.php
M includes/specials/SpecialUnusedcategories.php
M includes/specials/SpecialUnusedtemplates.php
M includes/specials/SpecialUpload.php
M includes/specials/SpecialUploadStash.php
9 files changed, 210 insertions(+), 119 deletions(-)
Approvals:
Chad: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/specials/SpecialSpecialpages.php
b/includes/specials/SpecialSpecialpages.php
index 3ed3ac3..3ba50bb 100644
--- a/includes/specials/SpecialSpecialpages.php
+++ b/includes/specials/SpecialSpecialpages.php
@@ -103,9 +103,15 @@
$middle = ceil( $total / 2 );
$count = 0;
- $out->wrapWikiMsg( "<h2 class=\"mw-specialpagesgroup\"
id=\"mw-specialpagesgroup-$group\">$1</h2>\n", "specialpages-group-$group" );
+ $out->wrapWikiMsg(
+ "<h2 class=\"mw-specialpagesgroup\"
id=\"mw-specialpagesgroup-$group\">$1</h2>\n",
+ "specialpages-group-$group"
+ );
$out->addHTML(
- Html::openElement( 'table', array( 'style' =>
'width:100%;', 'class' => 'mw-specialpages-table' ) ) . "\n" .
+ Html::openElement(
+ 'table',
+ array( 'style' => 'width:100%;',
'class' => 'mw-specialpages-table' )
+ ) . "\n" .
Html::openElement( 'tr' ) . "\n" .
Html::openElement( 'td', array( 'style' =>
'width:30%;vertical-align:top' ) ) . "\n" .
Html::openElement( 'ul' ) . "\n"
@@ -124,7 +130,11 @@
}
$link = Linker::linkKnown( $title,
htmlspecialchars( $desc ) );
- $out->addHTML( Html::rawElement( 'li', array(
'class' => implode( ' ', $pageClasses ) ), $link ) . "\n" );
+ $out->addHTML( Html::rawElement(
+ 'li',
+ array( 'class' => implode( ' ',
$pageClasses ) ),
+ $link
+ ) . "\n" );
# Split up the larger groups
$count++;
diff --git a/includes/specials/SpecialStatistics.php
b/includes/specials/SpecialStatistics.php
index c3a11f3..371e5ea 100644
--- a/includes/specials/SpecialStatistics.php
+++ b/includes/specials/SpecialStatistics.php
@@ -28,7 +28,6 @@
* @ingroup SpecialPage
*/
class SpecialStatistics extends SpecialPage {
-
private $views, $edits, $good, $images, $total, $users,
$activeUsers = 0;
@@ -107,14 +106,16 @@
/**
* Format a row
- * @param $text String: description of the row
- * @param $number Float: a statistical number
- * @param $trExtraParams Array: params to table row, see Html::elememt
- * @param $descMsg String: message key
+ * @param string $text Description of the row
+ * @param float $number A statistical number
+ * @param array $trExtraParams Params to table row, see Html::elememt
+ * @param string $descMsg Message key
* @param array|string $descMsgParam Message parameters
- * @return string table row in HTML format
+ * @return string Table row in HTML format
*/
- private function formatRow( $text, $number, $trExtraParams = array(),
$descMsg = '', $descMsgParam = '' ) {
+ private function formatRow( $text, $number, $trExtraParams = array(),
+ $descMsg = '', $descMsgParam = ''
+ ) {
if ( $descMsg ) {
$msg = $this->msg( $descMsg, $descMsgParam );
if ( $msg->exists() ) {
@@ -140,29 +141,32 @@
Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg(
'statistics-header-pages' )->parse() ) .
Xml::closeElement( 'tr' ) .
$this->formatRow( Linker::linkKnown(
SpecialPage::getTitleFor( 'Allpages' ),
- $this->msg(
'statistics-articles' )->parse() ),
-
$this->getLanguage()->formatNum( $this->good ),
- array( 'class' =>
'mw-statistics-articles' ) ) .
+ $this->msg( 'statistics-articles'
)->parse() ),
+ $this->getLanguage()->formatNum(
$this->good ),
+ array( 'class' =>
'mw-statistics-articles' ) ) .
$this->formatRow( $this->msg(
'statistics-pages' )->parse(),
-
$this->getLanguage()->formatNum( $this->total ),
- array( 'class' =>
'mw-statistics-pages' ),
- 'statistics-pages-desc' ) .
+ $this->getLanguage()->formatNum(
$this->total ),
+ array( 'class' => 'mw-statistics-pages'
),
+ 'statistics-pages-desc' ) .
$this->formatRow( Linker::linkKnown(
SpecialPage::getTitleFor( 'Listfiles' ),
- $this->msg( 'statistics-files'
)->parse() ),
-
$this->getLanguage()->formatNum( $this->images ),
- array( 'class' =>
'mw-statistics-files' ) );
+ $this->msg( 'statistics-files'
)->parse() ),
+ $this->getLanguage()->formatNum(
$this->images ),
+ array( 'class' => 'mw-statistics-files'
) );
}
private function getEditStats() {
return Xml::openElement( 'tr' ) .
Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg(
'statistics-header-edits' )->parse() ) .
Xml::closeElement( 'tr' ) .
- $this->formatRow( $this->msg(
'statistics-edits' )->parse(),
-
$this->getLanguage()->formatNum( $this->edits ),
- array( 'class' =>
'mw-statistics-edits' ) ) .
- $this->formatRow( $this->msg(
'statistics-edits-average' )->parse(),
-
$this->getLanguage()->formatNum( sprintf( '%.2f', $this->total ? $this->edits /
$this->total : 0 ) ),
- array( 'class' =>
'mw-statistics-edits-average' ) );
+ $this->formatRow( $this->msg( 'statistics-edits'
)->parse(),
+ $this->getLanguage()->formatNum( $this->edits ),
+ array( 'class' => 'mw-statistics-edits' )
+ ) .
+ $this->formatRow( $this->msg(
'statistics-edits-average' )->parse(),
+ $this->getLanguage()
+ ->formatNum( sprintf( '%.2f',
$this->total ? $this->edits / $this->total : 0 ) ),
+ array( 'class' => 'mw-statistics-edits-average'
)
+ );
}
private function getUserStats() {
@@ -171,18 +175,20 @@
return Xml::openElement( 'tr' ) .
Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg(
'statistics-header-users' )->parse() ) .
Xml::closeElement( 'tr' ) .
- $this->formatRow( $this->msg(
'statistics-users' )->parse(),
-
$this->getLanguage()->formatNum( $this->users ),
- array( 'class' =>
'mw-statistics-users' ) ) .
- $this->formatRow( $this->msg(
'statistics-users-active' )->parse() . ' ' .
- Linker::linkKnown(
-
SpecialPage::getTitleFor( 'Activeusers' ),
- $this->msg(
'listgrouprights-members' )->escaped()
- ),
-
$this->getLanguage()->formatNum( $this->activeUsers ),
- array( 'class' =>
'mw-statistics-users-active' ),
- 'statistics-users-active-desc',
-
$this->getLanguage()->formatNum( $wgActiveUserDays ) );
+ $this->formatRow( $this->msg( 'statistics-users'
)->parse(),
+ $this->getLanguage()->formatNum( $this->users ),
+ array( 'class' => 'mw-statistics-users' )
+ ) .
+ $this->formatRow( $this->msg( 'statistics-users-active'
)->parse() . ' ' .
+ Linker::linkKnown(
+ SpecialPage::getTitleFor( 'Activeusers'
),
+ $this->msg( 'listgrouprights-members'
)->escaped()
+ ),
+ $this->getLanguage()->formatNum(
$this->activeUsers ),
+ array( 'class' => 'mw-statistics-users-active'
),
+ 'statistics-users-active-desc',
+ $this->getLanguage()->formatNum(
$wgActiveUserDays )
+ );
}
private function getGroupStats() {
@@ -267,7 +273,11 @@
if ( $res->numRows() > 0 ) {
$text .= Xml::openElement( 'tr' );
- $text .= Xml::tags( 'th', array( 'colspan' => '2' ),
$this->msg( 'statistics-mostpopular' )->parse() );
+ $text .= Xml::tags(
+ 'th',
+ array( 'colspan' => '2' ),
+ $this->msg( 'statistics-mostpopular' )->parse()
+ );
$text .= Xml::closeElement( 'tr' );
foreach ( $res as $row ) {
@@ -308,7 +318,11 @@
$name = $this->msg( $key )->parse();
$number = htmlspecialchars( $value );
- $return .= $this->formatRow( $name,
$this->getLanguage()->formatNum( $number ), array( 'class' =>
'mw-statistics-hook', 'id' => 'mw-' . $key ) );
+ $return .= $this->formatRow(
+ $name,
+
$this->getLanguage()->formatNum( $number ),
+ array( 'class' =>
'mw-statistics-hook', 'id' => 'mw-' . $key )
+ );
}
} else {
// Create the legacy header only once
@@ -317,7 +331,8 @@
}
// Recursively remap the legacy structure
- $return .= $this->getOtherStats( array(
'statistics-header-hooks' => array( $header => $items ) ) );
+ $return .= $this->getOtherStats( array(
'statistics-header-hooks' =>
+ array( $header => $items ) ) );
}
}
diff --git a/includes/specials/SpecialUncategorizedimages.php
b/includes/specials/SpecialUncategorizedimages.php
index 17de679..9060f53 100644
--- a/includes/specials/SpecialUncategorizedimages.php
+++ b/includes/specials/SpecialUncategorizedimages.php
@@ -26,10 +26,9 @@
* Special page lists images which haven't been categorised
*
* @ingroup SpecialPage
+ * @todo FIXME: Use an instance of UncategorizedPagesPage or something
*/
-// @todo FIXME: Use an instance of UncategorizedPagesPage or something
class UncategorizedImagesPage extends ImageQueryPage {
-
function __construct( $name = 'Uncategorizedimages' ) {
parent::__construct( $name );
}
diff --git a/includes/specials/SpecialUncategorizedpages.php
b/includes/specials/SpecialUncategorizedpages.php
index c6a4215..8251d5b 100644
--- a/includes/specials/SpecialUncategorizedpages.php
+++ b/includes/specials/SpecialUncategorizedpages.php
@@ -25,8 +25,8 @@
* A special page looking for page without any category.
*
* @ingroup SpecialPage
+ * @todo FIXME: Make $requestedNamespace selectable, unify all subclasses into
one
*/
-// @todo FIXME: Make $requestedNamespace selectable, unify all subclasses into
one
class UncategorizedPagesPage extends PageQueryPage {
protected $requestedNamespace = false;
@@ -58,7 +58,9 @@
// otherwise, page_namespace is requestedNamespace
'conds' => array(
'cl_from IS NULL',
- 'page_namespace' => ( $this->requestedNamespace
!== false ? $this->requestedNamespace : MWNamespace::getContentNamespaces() ),
+ 'page_namespace' => $this->requestedNamespace
!== false
+ ? $this->requestedNamespace
+ :
MWNamespace::getContentNamespaces(),
'page_is_redirect' => 0
),
'join_conds' => array(
diff --git a/includes/specials/SpecialUndelete.php
b/includes/specials/SpecialUndelete.php
index acfeb37..e8a45a7 100644
--- a/includes/specials/SpecialUndelete.php
+++ b/includes/specials/SpecialUndelete.php
@@ -27,19 +27,13 @@
* @ingroup SpecialPage
*/
class PageArchive {
- /**
- * @var Title
- */
+ /** @var Title */
protected $title;
- /**
- * @var Status
- */
+ /** @var Status */
protected $fileStatus;
- /**
- * @var Status
- */
+ /** @var Status */
protected $revisionStatus;
function __construct( $title ) {
@@ -355,16 +349,18 @@
* Once restored, the items will be removed from the archive tables.
* The deletion log will be updated with an undeletion notice.
*
- * @param array $timestamps Pass an empty array to restore all
revisions, otherwise list the ones to undelete.
+ * @param array $timestamps Pass an empty array to restore all
revisions,
+ * otherwise list the ones to undelete.
* @param string $comment
* @param array $fileVersions
* @param bool $unsuppress
* @param User $user User performing the action, or null to use $wgUser
- *
- * @return array(number of file revisions restored, number of image
revisions restored, log message)
- * on success, false on failure
+ * @return array(number of file revisions restored, number of image
revisions
+ * restored, log message) on success, false on failure.
*/
- function undelete( $timestamps, $comment = '', $fileVersions = array(),
$unsuppress = false, User $user = null ) {
+ function undelete( $timestamps, $comment = '', $fileVersions = array(),
+ $unsuppress = false, User $user = null
+ ) {
// If both the set of text revisions and file revisions are
empty,
// restore everything. Otherwise, just restore the requested
items.
$restoreAll = empty( $timestamps ) && empty( $fileVersions );
@@ -438,7 +434,8 @@
* to the cur/old tables. If the page currently exists, all revisions
will
* be stuffed into old, otherwise the most recent will go into cur.
*
- * @param array $timestamps Pass an empty array to restore all
revisions, otherwise list the ones to undelete.
+ * @param array $timestamps Pass an empty array to restore all
revisions,
+ * otherwise list the ones to undelete.
* @param bool $unsuppress Remove all ar_deleted/fa_deleted
restrictions of seletected revs
* @param string $comment
* @throws ReadOnlyError
@@ -638,7 +635,11 @@
if ( $created || $wasnew ) {
// Update site stats, link tables, etc
$user = User::newFromName( $revision->getRawUserText(),
false );
- $article->doEditUpdates( $revision, $user, array(
'created' => $created, 'oldcountable' => $oldcountable ) );
+ $article->doEditUpdates(
+ $revision,
+ $user,
+ array( 'created' => $created, 'oldcountable' =>
$oldcountable )
+ );
}
wfRunHooks( 'ArticleUndelete', array( &$this->title, $created,
$comment ) );
@@ -676,9 +677,7 @@
var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mFilename;
var $mTargetTimestamp, $mAllowed, $mCanView, $mComment, $mToken;
- /**
- * @var Title
- */
+ /** @var Title */
var $mTargetObj;
function __construct() {
@@ -1288,14 +1287,25 @@
Xml::label( $this->msg( 'undeletecomment'
)->text(), 'wpComment' ) .
"</td>
<td class='mw-input'>" .
- Xml::input( 'wpComment', 50, $this->mComment,
array( 'id' => 'wpComment', 'autofocus' => true ) ) .
+ Xml::input(
+ 'wpComment',
+ 50,
+ $this->mComment,
+ array( 'id' => 'wpComment', 'autofocus'
=> true )
+ ) .
"</td>
</tr>
<tr>
<td> </td>
<td class='mw-submit'>" .
- Xml::submitButton( $this->msg( 'undeletebtn'
)->text(), array( 'name' => 'restore', 'id' => 'mw-undelete-submit' ) ) . ' ' .
- Xml::submitButton( $this->msg( 'undeleteinvert'
)->text(), array( 'name' => 'invert', 'id' => 'mw-undelete-invert' ) ) .
+ Xml::submitButton(
+ $this->msg( 'undeletebtn' )->text(),
+ array( 'name' => 'restore', 'id' =>
'mw-undelete-submit' )
+ ) . ' ' .
+ Xml::submitButton(
+ $this->msg( 'undeleteinvert' )->text(),
+ array( 'name' => 'invert', 'id' =>
'mw-undelete-invert' )
+ ) .
"</td>
</tr>" .
$unsuppressBox .
@@ -1422,7 +1432,17 @@
$revdlink = Linker::getRevDeleteLink( $user, $rev,
$this->mTargetObj );
$revisionRow = $this->msg( 'undelete-revision-row' )
- ->rawParams( $checkBox, $revdlink, $last, $pageLink,
$userLink, $minor, $revTextSize, $comment, $tagSummary )
+ ->rawParams(
+ $checkBox,
+ $revdlink,
+ $last,
+ $pageLink,
+ $userLink,
+ $minor,
+ $revTextSize,
+ $comment,
+ $tagSummary
+ )
->escaped();
return Xml::tags( 'li', $attribs, $revisionRow ) . "\n";
@@ -1622,13 +1642,23 @@
// Show revision undeletion warnings and errors
$status = $archive->getRevisionStatus();
if ( $status && !$status->isGood() ) {
- $out->addWikiText( '<div class="error">' .
$status->getWikiText( 'cannotundelete', 'cannotundelete' ) . '</div>' );
+ $out->addWikiText( '<div class="error">' .
+ $status->getWikiText(
+ 'cannotundelete',
+ 'cannotundelete'
+ ) . '</div>'
+ );
}
// Show file undeletion warnings and errors
$status = $archive->getFileStatus();
if ( $status && !$status->isGood() ) {
- $out->addWikiText( '<div class="error">' .
$status->getWikiText( 'undelete-error-short', 'undelete-error-long' ) .
'</div>' );
+ $out->addWikiText( '<div class="error">' .
+ $status->getWikiText(
+ 'undelete-error-short',
+ 'undelete-error-long'
+ ) . '</div>'
+ );
}
}
diff --git a/includes/specials/SpecialUnusedcategories.php
b/includes/specials/SpecialUnusedcategories.php
index c897332..713823b 100644
--- a/includes/specials/SpecialUnusedcategories.php
+++ b/includes/specials/SpecialUnusedcategories.php
@@ -25,13 +25,12 @@
* @ingroup SpecialPage
*/
class UnusedCategoriesPage extends QueryPage {
+ function __construct( $name = 'Unusedcategories' ) {
+ parent::__construct( $name );
+ }
function isExpensive() {
return true;
- }
-
- function __construct( $name = 'Unusedcategories' ) {
- parent::__construct( $name );
}
function getPageHeader() {
diff --git a/includes/specials/SpecialUnusedtemplates.php
b/includes/specials/SpecialUnusedtemplates.php
index f7e7a31..0c2b870 100644
--- a/includes/specials/SpecialUnusedtemplates.php
+++ b/includes/specials/SpecialUnusedtemplates.php
@@ -30,7 +30,6 @@
* @ingroup SpecialPage
*/
class UnusedtemplatesPage extends QueryPage {
-
function __construct( $name = 'Unusedtemplates' ) {
parent::__construct( $name );
}
diff --git a/includes/specials/SpecialUpload.php
b/includes/specials/SpecialUpload.php
index 521b361..4887daf 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -39,37 +39,45 @@
}
/** Misc variables **/
- public $mRequest; // The WebRequest or FauxRequest this form is
supposed to handle
+
+ /** @var WebRequest|FauxRequest The request this form is supposed to
handle */
+ public $mRequest;
public $mSourceType;
- /**
- * @var UploadBase
- */
+ /** @var UploadBase */
public $mUpload;
- /**
- * @var LocalFile
- */
+ /** @var LocalFile */
public $mLocalFile;
public $mUploadClicked;
/** User input variables from the "description" section **/
- public $mDesiredDestName; // The requested target file name
+
+ /** @var string The requested target file name */
+ public $mDesiredDestName;
public $mComment;
public $mLicense;
/** User input variables from the root section **/
+
public $mIgnoreWarning;
public $mWatchthis;
public $mCopyrightStatus;
public $mCopyrightSource;
/** Hidden variables **/
+
public $mDestWarningAck;
- public $mForReUpload; // The user followed an "overwrite this file" link
- public $mCancelUpload; // The user clicked "Cancel and return to upload
form" button
+
+ /** @var bool The user followed an "overwrite this file" link */
+ public $mForReUpload;
+
+ /** @var bool The user clicked "Cancel and return to upload form"
button */
+ public $mCancelUpload;
public $mTokenOk;
- public $mUploadSuccessful = false; // Subclasses can use this to
determine whether a file was uploaded
+
+ /** @var bool Subclasses can use this to determine whether a file was
uploaded */
+ public $mUploadSuccessful = false;
/** Text injection points for hooks not using HTMLForm **/
public $uploadFormTextTop;
@@ -449,7 +457,14 @@
} else {
$pageText = false;
}
- $status = $this->mUpload->performUpload( $this->mComment,
$pageText, $this->mWatchthis, $this->getUser() );
+
+ $status = $this->mUpload->performUpload(
+ $this->mComment,
+ $pageText,
+ $this->mWatchthis,
+ $this->getUser()
+ );
+
if ( !$status->isGood() ) {
$this->showUploadError( $this->getOutput()->parse(
$status->getWikiText() ) );
@@ -464,13 +479,15 @@
/**
* Get the initial image page text based on a comment and optional file
status information
- * @param $comment string
- * @param $license string
- * @param $copyStatus string
- * @param $source string
+ * @param string $comment
+ * @param string $license
+ * @param string $copyStatus
+ * @param string $source
* @return string
*/
- public static function getInitialPageText( $comment = '', $license =
'', $copyStatus = '', $source = '' ) {
+ public static function getInitialPageText( $comment = '', $license = '',
+ $copyStatus = '', $source = ''
+ ) {
global $wgUseCopyrightUpload, $wgForceUIMsgAsContentMsg;
$msg = array();
@@ -890,23 +907,32 @@
# Print a list of allowed file extensions, if so configured.
We ignore
# MIME type here, it's incomprehensible to most people and too
long.
global $wgCheckFileExtensions, $wgStrictFileExtensions,
- $wgFileExtensions, $wgFileBlacklist;
+ $wgFileExtensions, $wgFileBlacklist;
if ( $wgCheckFileExtensions ) {
if ( $wgStrictFileExtensions ) {
# Everything not permitted is banned
$extensionsList =
'<div id="mw-upload-permitted">' .
- $this->msg( 'upload-permitted',
$this->getContext()->getLanguage()->commaList( array_unique( $wgFileExtensions
) ) )->parseAsBlock() .
+ $this->msg(
+ 'upload-permitted',
+
$this->getContext()->getLanguage()->commaList( array_unique( $wgFileExtensions
) )
+ )->parseAsBlock() .
"</div>\n";
} else {
# We have to list both preferred and prohibited
$extensionsList =
'<div id="mw-upload-preferred">' .
- $this->msg( 'upload-preferred',
$this->getContext()->getLanguage()->commaList( array_unique( $wgFileExtensions
) ) )->parseAsBlock() .
+ $this->msg(
+ 'upload-preferred',
+
$this->getContext()->getLanguage()->commaList( array_unique( $wgFileExtensions
) )
+ )->parseAsBlock() .
"</div>\n" .
'<div id="mw-upload-prohibited">' .
- $this->msg(
'upload-prohibited', $this->getContext()->getLanguage()->commaList(
array_unique( $wgFileBlacklist ) ) )->parseAsBlock() .
+ $this->msg(
+ 'upload-prohibited',
+
$this->getContext()->getLanguage()->commaList( array_unique( $wgFileBlacklist )
)
+ )->parseAsBlock() .
"</div>\n";
}
} else {
@@ -1072,7 +1098,8 @@
* Add upload JS to the OutputPage
*/
protected function addUploadJS() {
- global $wgUseAjax, $wgAjaxUploadDestCheck,
$wgAjaxLicensePreview, $wgEnableAPI, $wgStrictFileExtensions;
+ global $wgUseAjax, $wgAjaxUploadDestCheck,
$wgAjaxLicensePreview,
+ $wgEnableAPI, $wgStrictFileExtensions;
$useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
$useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview &&
$wgEnableAPI;
diff --git a/includes/specials/SpecialUploadStash.php
b/includes/specials/SpecialUploadStash.php
index 16c348f..964bea1 100644
--- a/includes/specials/SpecialUploadStash.php
+++ b/includes/specials/SpecialUploadStash.php
@@ -57,7 +57,8 @@
/**
* Execute page -- can output a file directly or show a listing of them.
*
- * @param string $subPage subpage, e.g. in
http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part
+ * @param string $subPage subpage, e.g. in
+ * http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg"
part
* @return Boolean: success
*/
public function execute( $subPage ) {
@@ -100,7 +101,8 @@
$message = $e->getMessage();
} catch ( SpecialUploadStashTooLargeException $e ) {
$code = 500;
- $message = 'Cannot serve a file larger than ' .
self::MAX_SERVE_BYTES . ' bytes. ' . $e->getMessage();
+ $message = 'Cannot serve a file larger than ' .
self::MAX_SERVE_BYTES .
+ ' bytes. ' . $e->getMessage();
} catch ( Exception $e ) {
$code = 500;
$message = $e->getMessage();
@@ -157,10 +159,11 @@
* @return boolean success
*/
private function outputThumbFromStash( $file, $params ) {
-
- // this global, if it exists, points to a "scaler", as you
might find in the Wikimedia Foundation cluster. See outputRemoteScaledThumb()
- // this is part of our horrible NFS-based system, we create a
file on a mount point here, but fetch the scaled file from somewhere else that
- // happens to share it over NFS
+ // this global, if it exists, points to a "scaler", as you
might find in
+ // the Wikimedia Foundation cluster. See
outputRemoteScaledThumb(). This
+ // is part of our horrible NFS-based system, we create a file
on a mount
+ // point here, but fetch the scaled file from somewhere else
that
+ // happens to share it over NFS.
global $wgUploadStashScalerBaseUrl;
$flags = 0;
@@ -172,16 +175,15 @@
}
/**
- * Scale a file (probably with a locally installed imagemagick, or
similar) and output it to STDOUT.
+ * Scale a file (probably with a locally installed imagemagick, or
similar)
+ * and output it to STDOUT.
* @param $file File
* @param array $params Scaling parameters ( e.g. array( width => '50'
) );
* @param int $flags Scaling flags ( see File:: constants )
- * @throws MWException
- * @throws UploadStashFileNotFoundException
+ * @throws MWException|UploadStashFileNotFoundException
* @return boolean success
*/
private function outputLocallyScaledThumb( $file, $params, $flags ) {
-
// n.b. this is stupid, we insist on re-transforming the file
every time we are invoked. We rely
// on HTTP caching to ensure this doesn't happen.
@@ -209,22 +211,28 @@
}
/**
- * Scale a file with a remote "scaler", as exists on the Wikimedia
Foundation cluster, and output it to STDOUT.
- * Note: unlike the usual thumbnail process, the web client never sees
the cluster URL; we do the whole HTTP transaction to the scaler ourselves
- * and cat the results out.
- * Note: We rely on NFS to have propagated the file contents to the
scaler. However, we do not rely on the thumbnail being created in NFS and then
- * propagated back to our filesystem. Instead we take the results of
the HTTP request instead.
- * Note: no caching is being done here, although we are instructing the
client to cache it forever.
+ * Scale a file with a remote "scaler", as exists on the Wikimedia
Foundation
+ * cluster, and output it to STDOUT.
+ * Note: Unlike the usual thumbnail process, the web client never sees
the
+ * cluster URL; we do the whole HTTP transaction to the scaler ourselves
+ * and cat the results out.
+ * Note: We rely on NFS to have propagated the file contents to the
scaler.
+ * However, we do not rely on the thumbnail being created in NFS and
then
+ * propagated back to our filesystem. Instead we take the results of the
+ * HTTP request instead.
+ * Note: No caching is being done here, although we are instructing the
+ * client to cache it forever.
+ *
* @param File $file
* @param array $params Scaling parameters ( e.g. array( width => '50'
) );
- * @param $flags Scaling flags ( see File:: constants )
+ * @param int $flags Scaling flags ( see File:: constants )
* @throws MWException
* @return boolean success
*/
private function outputRemoteScaledThumb( $file, $params, $flags ) {
-
- // this global probably looks something like
'http://upload.wikimedia.org/wikipedia/test/thumb/temp'
- // do not use trailing slash
+ // This global probably looks something like
+ // 'http://upload.wikimedia.org/wikipedia/test/thumb/temp'. Do
not use
+ // trailing slash.
global $wgUploadStashScalerBaseUrl;
$scalerBaseUrl = $wgUploadStashScalerBaseUrl;
@@ -267,7 +275,8 @@
* Output HTTP response for file
* Side effect: writes HTTP response to STDOUT.
*
- * @param $file File object with a local path (e.g.
UnregisteredLocalFile, LocalFile. Oddly these don't share an ancestor!)
+ * @param File $file File object with a local path (e.g.
UnregisteredLocalFile,
+ * LocalFile. Oddly these don't share an ancestor!)
* @throws SpecialUploadStashTooLargeException
* @return bool
*/
@@ -303,7 +312,9 @@
/**
* Output headers for streaming
- * XXX unsure about encoding as binary; if we received from HTTP
perhaps we should use that encoding, concatted with semicolon to mimeType as it
usually is.
+ * @todo Unsure about encoding as binary; if we received from HTTP
perhaps
+ * we should use that encoding, concatted with semicolon to mimeType as
it
+ * usually is.
* Side effect: preps PHP to write headers to STDOUT.
* @param string $contentType String suitable for content-type header
* @param string $size Length in bytes
@@ -398,4 +409,3 @@
class SpecialUploadStashTooLargeException extends MWException {
}
-
--
To view, visit https://gerrit.wikimedia.org/r/120330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9787d2a1515b2a8d9310ea636650e20d041acc3d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits