Aaron Schulz has submitted this change and it was merged.

Change subject: use $file->getName() instead of $title->getDBkey()
......................................................................


use $file->getName() instead of $title->getDBkey()

that way we always get the right capitalization
with shared repositories

(also consitently use getDBKey everywhere)

Change-Id: I094cd0f9570986ffdc3f661ca9beb1b489f50183
---
M TimedMediaTransformOutput.php
M TimedTextPage.php
M WebVideoTranscode/WebVideoTranscode.php
M WebVideoTranscode/WebVideoTranscodeJob.php
M handlers/TextHandler/TextHandler.php
5 files changed, 16 insertions(+), 16 deletions(-)

Approvals:
  Aaron Schulz: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php
index 729a69b..4a3002c 100644
--- a/TimedMediaTransformOutput.php
+++ b/TimedMediaTransformOutput.php
@@ -328,7 +328,7 @@
                        $mediaAttr += array(
                                'data-durationhint' => $length,
                                'data-startoffset' => $offset,
-                               'data-mwtitle' => 
$this->file->getTitle()->getDBKey()
+                               'data-mwtitle' => 
$this->file->getTitle()->getDBkey()
                        );
 
                        // Add api provider:
diff --git a/TimedTextPage.php b/TimedTextPage.php
index 865f46a..824997f 100644
--- a/TimedTextPage.php
+++ b/TimedTextPage.php
@@ -35,7 +35,7 @@
        public function renderOutput( $out ){
                wfProfileIn( __METHOD__ );
                // parse page title:
-               $titleParts = explode( '.', $this->getTitle()->getDBKey() );
+               $titleParts = explode( '.', $this->getTitle()->getDBkey() );
                $srt = array_pop( $titleParts );
                $languageKey = array_pop( $titleParts );
 
@@ -55,7 +55,7 @@
 
                // Check for File name without text extension:
                // i.e TimedText:myfile.ogg
-               $fileTitle = Title::newFromText( $this->getTitle()->getDBKey(), 
NS_FILE );
+               $fileTitle = Title::newFromText( $this->getTitle()->getDBkey(), 
NS_FILE );
                $file = wfFindFile( $fileTitle );
                // Check for a valid srt page, present redirect form for the 
full title match:
                if( $srt !== '.srt' && $file && $file->exists() ){
@@ -152,7 +152,7 @@
                                )
                        )
                );
-               $timedTextTile = Title::newFromText( 
$this->getTitle()->getDBKey() . '.'.
+               $timedTextTile = Title::newFromText( 
$this->getTitle()->getDBkey() . '.'.
                        'LANG' . '.srt', NS_TIMEDTEXT )->getFullText();
                $out->addScript(
                        Html::InlineScript(
diff --git a/WebVideoTranscode/WebVideoTranscode.php 
b/WebVideoTranscode/WebVideoTranscode.php
index 54675f9..b5f7dab 100644
--- a/WebVideoTranscode/WebVideoTranscode.php
+++ b/WebVideoTranscode/WebVideoTranscode.php
@@ -357,7 +357,7 @@
                        wfDebug("source cache miss\n");
                }
 
-               wfDebug("Get Video sources from remote api for " . 
$file->getTitle()->getDBKey() . "\n");
+               wfDebug("Get Video sources from remote api for " . 
$file->getName() . "\n");
                $query = array(
                        'action' => 'query',
                        'prop' => 'videoinfo',
@@ -539,7 +539,7 @@
         */
        public static function getTranscodeState( $file, $db = false ){
                global $wgTranscodeBackgroundTimeLimit;
-               $fileName = $file->getTitle()->getDbKey();
+               $fileName = $file->getName();
                if( ! isset( self::$transcodeState[$fileName] ) ){
                        wfProfileIn( __METHOD__ );
                        if ( $db === false ) {
@@ -608,7 +608,7 @@
                        // Remove any existing files ( regardless of their 
state )
                        $res = $file->repo->getMasterDB()->select( 'transcode',
                                array( 'transcode_key' ),
-                               array( 'transcode_image_name' => 
$file->getTitle()->getDBKey() )
+                               array( 'transcode_image_name' => 
$file->getName() )
                        );
                        $removeKeys = array();
                        foreach( $res as $transcodeRow ){
@@ -631,7 +631,7 @@
 
                // Build the sql query:
                $dbw = wfGetDB( DB_MASTER );
-               $deleteWhere = array( 'transcode_image_name' => 
$file->getTitle()->getDBkey() );
+               $deleteWhere = array( 'transcode_image_name' => 
$file->getName() );
                // Check if we are removing a specific transcode key
                if( $transcodeKey !== false ){
                        $deleteWhere['transcode_key'] = $transcodeKey;
@@ -644,14 +644,14 @@
                self::invalidatePagesWithFile( $titleObj );
 
                // Remove from local WebVideoTranscode cache:
-               self::clearTranscodeCache( $titleObj->getDBKey() );
+               self::clearTranscodeCache( $titleObj->getDBkey() );
        }
 
        /**
         * @param $titleObj Title
         */
        public static function invalidatePagesWithFile( &$titleObj ){
-               wfDebug("WebVideoTranscode:: Invalidate pages that include: " . 
$titleObj->getDBKey() . "\n" );
+               wfDebug("WebVideoTranscode:: Invalidate pages that include: " . 
$titleObj->getDBkey() . "\n" );
                // Purge the main image page:
                $titleObj->invalidateCache();
 
diff --git a/WebVideoTranscode/WebVideoTranscodeJob.php 
b/WebVideoTranscode/WebVideoTranscodeJob.php
index 094c8d9..62a4078 100644
--- a/WebVideoTranscode/WebVideoTranscodeJob.php
+++ b/WebVideoTranscode/WebVideoTranscodeJob.php
@@ -101,7 +101,7 @@
                                'transcode_error' => $error
                        ),
                        array(
-                                       'transcode_image_name' => 
$this->title->getDBkey(),
+                                       'transcode_image_name' => 
$this->getFile()->getName(),
                                        'transcode_key' => $transcodeKey
                        ),
                        __METHOD__,
@@ -155,7 +155,7 @@
                // Check if we have "already started" the transcode ( possible 
error )
                $dbStartTime = $dbw->selectField( 'transcode', 
'transcode_time_startwork',
                        array(
-                               'transcode_image_name' => 
$this->title->getDBKey(),
+                               'transcode_image_name' => 
$this->getFile()->getName(),
                                'transcode_key' => $transcodeKey
                        ),
                        __METHOD__,
@@ -174,7 +174,7 @@
                        'transcode',
                        array( 'transcode_time_startwork' => $jobStartTimeCache 
),
                        array(
-                               'transcode_image_name' => 
$this->title->getDBkey(),
+                               'transcode_image_name' => 
$this->getFile()->getName(),
                                'transcode_key' => $transcodeKey
                        ),
                        __METHOD__,
@@ -210,7 +210,7 @@
                // Confirm the in memory $jobStartTimeCache matches db start 
time
                $dbStartTime = $dbw->selectField( 'transcode', 
'transcode_time_startwork',
                        array(
-                               'transcode_image_name' => 
$this->title->getDBKey(),
+                               'transcode_image_name' => 
$this->getFile()->getName(),
                                'transcode_key' => $transcodeKey
                        )
                );
@@ -257,7 +257,7 @@
                                                'transcode_final_bitrate' => 
$bitrate
                                        ),
                                        array(
-                                               'transcode_image_name' => 
$this->title->getDBkey(),
+                                               'transcode_image_name' => 
$this->getFile()->getName(),
                                                'transcode_key' => 
$transcodeKey,
                                        ),
                                        __METHOD__,
diff --git a/handlers/TextHandler/TextHandler.php 
b/handlers/TextHandler/TextHandler.php
index 9af2d3b..405bb09 100644
--- a/handlers/TextHandler/TextHandler.php
+++ b/handlers/TextHandler/TextHandler.php
@@ -126,7 +126,7 @@
                        'list' => 'allpages',
                        'apnamespace' => $ns,
                        'aplimit' => 300,
-                       'apprefix' => $this->file->getTitle()->getDBKey()
+                       'apprefix' => $this->file->getTitle()->getDBkey()
                );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/70419
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I094cd0f9570986ffdc3f661ca9beb1b489f50183
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: J <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: J <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to