J has uploaded a new change for review.
https://gerrit.wikimedia.org/r/68029
Change subject: Tune Special:TimedMediaHandler
......................................................................
Tune Special:TimedMediaHandler
- only cache expensive mimetype lookup
- return more transcodes per group(30->50)
Change-Id: Icb114bda850a123d02de8ebc9f5788f261f683a8
---
M SpecialTimedMediaHandler.php
1 file changed, 22 insertions(+), 21 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler
refs/changes/29/68029/1
diff --git a/SpecialTimedMediaHandler.php b/SpecialTimedMediaHandler.php
index b59680a..f555be7 100644
--- a/SpecialTimedMediaHandler.php
+++ b/SpecialTimedMediaHandler.php
@@ -25,18 +25,13 @@
}
public function execute( $par ) {
- global $wgMemc;
$this->setHeaders();
$out = $this->getOutput();
$out->addModuleStyles( 'mediawiki.special' );
- $key = wfMemcKey( 'TimedMediaHandler', 'stats' );
- $stats = $wgMemc->get( $key );
- if ( !$stats ) {
- $stats = $this->getStats();
- $wgMemc->add( $key, $stats, 3600 );
- }
+ $stats = $this->getStats();
+
$out->addHTML(
"<h2>"
. $this->msg( 'timedmedia-videos',
$stats['videos']['total'] )->escaped()
@@ -88,7 +83,7 @@
}
}
}
- private function getTranscodes ( $state, $limit = 30 ) {
+ private function getTranscodes ( $state, $limit = 50 ) {
$dbr = wfGetDB( DB_SLAVE );
$files = array();
$res = $dbr->select(
@@ -108,7 +103,7 @@
return $files;
}
- private function getTranscodesTable ( $state, $limit = 30 ) {
+ private function getTranscodesTable ( $state, $limit = 50 ) {
$table = '<table class="wikitable">' . "\n"
. '<tr>'
. '<th>' . $this->msg( 'timedmedia-transcodeinfo'
)->escaped() . '</th>'
@@ -129,9 +124,25 @@
}
private function getStats() {
- global $wgEnabledTranscodeSet;
- $stats = array();
+ global $wgEnabledTranscodeSet, $wgMemc;
$dbr = wfGetDB( DB_SLAVE );
+ $key = wfMemcKey( 'TimedMediaHandler', 'stats' );
+ $stats = $wgMemc->get( $key );
+ if ( !$stats ) {
+ $stats = array();
+ $stats[ 'videos' ] = array( 'total' => 0 );
+ foreach( $this->formats as $format => $condition ) {
+ $stats[ 'videos' ][ $format ] =
(int)$dbr->selectField(
+ 'image',
+ 'COUNT(*)',
+ 'img_media_type = "VIDEO" AND (' .
$condition . ')',
+ __METHOD__
+ );
+ $stats[ 'videos' ][ 'total' ] += $stats[
'videos' ][ $format ];
+ }
+ $wgMemc->add( $key, $stats, 3600 );
+ }
+
$stats[ 'transcodes' ] = array( 'total' => 0 );
foreach ( $this->transcodeStates as $state => $condition ) {
$stats[ $state ] = array( 'total' => 0 );
@@ -165,16 +176,6 @@
$stats[ 'transcodes' ][ 'total' ] += $stats[
'transcodes' ][ $key ];
}
- $stats[ 'videos' ] = array( 'total' => 0 );
- foreach( $this->formats as $format => $condition ) {
- $stats[ 'videos' ][ $format ] = (int)$dbr->selectField(
- 'image',
- 'COUNT(*)',
- 'img_media_type = "VIDEO" AND (' . $condition .
')',
- __METHOD__
- );
- $stats[ 'videos' ][ 'total' ] += $stats[ 'videos' ][
$format ];
- }
return $stats;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/68029
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb114bda850a123d02de8ebc9f5788f261f683a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: J <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits