TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/247833
Change subject: [WIP] Don't show empty transcode table ...................................................................... [WIP] Don't show empty transcode table This isn't tested yet. Bug: T115998 Change-Id: I1a5315366c94dca119c6395e896d043d071052fb --- M TranscodeStatusTable.php 1 file changed, 22 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler refs/changes/33/247833/1 diff --git a/TranscodeStatusTable.php b/TranscodeStatusTable.php index 2220fc7..df009d0 100644 --- a/TranscodeStatusTable.php +++ b/TranscodeStatusTable.php @@ -26,23 +26,8 @@ array( 'action'=> 'purge' ) ); - $o.= Xml::openElement( 'table', array( 'class' => 'wikitable mw-filepage-transcodestatus' ) ) . "\n" - . '<tr>' - . '<th>' . wfMessage( 'timedmedia-transcodeinfo' )->escaped() . '</th>' - . '<th>' . wfMessage( 'timedmedia-transcodebitrate' )->escaped() . '</th>' - . '<th>' . wfMessage( 'timedmedia-direct-link' )->escaped() . '</th>'; + $o.= self::getTranscodesTable( $file ); - if( $wgUser->isAllowed( 'transcode-reset' ) ) { - $o.= '<th>' . wfMessage( 'timedmedia-actions' )->escaped() . '</th>'; - } - - $o.= '<th>' . wfMessage( 'timedmedia-status' )->escaped() . '</th>'; - $o.= '<th>' . wfMessage( 'timedmedia-transcodeduration' )->escaped() . '</th>'; - $o.= "</tr>\n"; - - $o.= self::getTranscodeRows( $file ); - - $o.= Xml::closeElement( 'table' ); return $o; } @@ -72,11 +57,15 @@ * @param $file File * @return string */ - public static function getTranscodeRows( $file ){ + public static function getTranscodesTable( $file ){ global $wgUser, $wgLang; $o=''; $transcodeRows = WebVideoTranscode::getTranscodeState( $file ); + + if ( !$transcodeRows ) { + return $o; + } uksort( $transcodeRows, function( $a, $b ) { $formatOrder = array( 'vp9', 'vp8', 'h264', 'theora', 'opus', 'vorbis', 'aac' ); @@ -98,6 +87,20 @@ return ( $aIndex - $bIndex ); } } ); + + $o.= Xml::openElement( 'table', array( 'class' => 'wikitable mw-filepage-transcodestatus' ) ) . "\n" + . '<tr>' + . '<th>' . wfMessage( 'timedmedia-transcodeinfo' )->escaped() . '</th>' + . '<th>' . wfMessage( 'timedmedia-transcodebitrate' )->escaped() . '</th>' + . '<th>' . wfMessage( 'timedmedia-direct-link' )->escaped() . '</th>'; + + if( $wgUser->isAllowed( 'transcode-reset' ) ) { + $o.= '<th>' . wfMessage( 'timedmedia-actions' )->escaped() . '</th>'; + } + + $o.= '<th>' . wfMessage( 'timedmedia-status' )->escaped() . '</th>'; + $o.= '<th>' . wfMessage( 'timedmedia-transcodeduration' )->escaped() . '</th>'; + $o.= "</tr>\n"; foreach( $transcodeRows as $transcodeKey => $state ){ $o.='<tr>'; @@ -128,6 +131,8 @@ $o.='</tr>'; } + $o.= Xml::closeElement( 'table' ); + return $o; } -- To view, visit https://gerrit.wikimedia.org/r/247833 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1a5315366c94dca119c6395e896d043d071052fb Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TimedMediaHandler Gerrit-Branch: master Gerrit-Owner: TheDJ <hartman.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits