r89442 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89441‎ | r89442 | r89443 >
Date:20:43, 3 June 2011
Author:brion
Status:deferred
Tags:
Comment:
Fix fatal error in TimedMediaHandler when a file page is deleted and there's no matching file (anymore). Found while running phpunit tests.

I.I......................E................................... 1342 / 2357 ( 56%)
............................................................. 1403 / 2357 ( 59%)
............................................................. 1464 / 2357 ( 62%)
...S...IIIIIIIIIIIII...IIIIIIIIIIIIIII....................... 1525 / 2357 ( 64%)
.......................................FFPHP Fatal error: Call to a member function getHandler() on a non-object in /var/www/trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php on line 131
make: *** [safe] Error 255
Modified paths:
  • /trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php
@@ -128,10 +128,12 @@
129129 if( $article->getTitle()->getNamespace() == NS_FILE ) {
130130
131131 $file = wfFindFile( $article->getTitle() );
132 - $mediaType = $file->getHandler()->getMetadataType( $image = '' );
133 -
134 - if( $mediaType == 'webm' || $mediaType == 'ogg' ){
135 - WebVideoTranscode::removeTranscodeJobs( $file );
 132+ if ( $file ) {
 133+ $mediaType = $file->getHandler()->getMetadataType( $image = '' );
 134+
 135+ if( $mediaType == 'webm' || $mediaType == 'ogg' ){
 136+ WebVideoTranscode::removeTranscodeJobs( $file );
 137+ }
136138 }
137139
138140 }

Status & tagging log