Index: trunk/extensions/TimedMediaHandler/tests/phpunit/TestVideoTranscode.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * @ingroup timedmedia |
5 | 5 | * @author michael dale |
6 | 6 | */ |
7 | | -class TesVideoTranscode extends ApiTestCaseVideoUpload{ |
| 7 | +class TesVideoTranscode extends ApiTestCaseVideoUpload { |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Once video files are uploaded test transcoding |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | |
38 | 38 | // Check if the transcode jobs were added: |
39 | 39 | // get results: query jobs table |
40 | | - $db = wfGetDB( DB_SLAVE ); |
| 40 | + $db = wfGetDB( DB_MASTER ); |
41 | 41 | $res = $db->select( 'transcode', '*', array( |
42 | 42 | 'transcode_image_name' => ucfirst( $fileName ) |
43 | 43 | ) ); |
— | — | @@ -59,23 +59,25 @@ |
60 | 60 | // Now run the transcode job queue |
61 | 61 | $status = $this->runTranscodeJobs(); |
62 | 62 | |
| 63 | + |
| 64 | + $res = $db->select( 'transcode', '*', array( |
| 65 | + 'transcode_image_name' => ucfirst( $fileName ) |
| 66 | + ) ); |
| 67 | + |
63 | 68 | // Now check if the derivatives were created: |
64 | | - list($result,,) = $this->doApiRequest( $params ); |
| 69 | + list($result,,) = $this->doApiRequest( $params ); |
65 | 70 | $derivatives = $this->getDerivativesFromResult( $result ); |
66 | 71 | |
67 | 72 | // Check that every requested encode was encoded: |
68 | 73 | foreach( $targetEncodes as $transcodeKey => $row ){ |
69 | 74 | $targetEncodeFound = false; |
70 | | - foreach( $derivatives as $derv ){ |
71 | | - // The transcode key is always the last part of the file name: |
| 75 | + foreach( $derivatives as $derv ){ |
| 76 | + // The transcode key is always the last part of the file name: |
72 | 77 | if( substr( $derv['src'], -1 * strlen( $transcodeKey ) ) == $transcodeKey ){ |
73 | | - // Check that the derivative matches our encode settings: |
74 | | - $this->assertEquals( $derv['width'], WebVideoTranscode::$derivativeSettings[ $row->transcode_key ]['width'] ); |
75 | | - // We can't really check "bandwith" since the bitrate does not always exactly match up with encode settings |
76 | 78 | $targetEncodeFound = true; |
77 | 79 | } |
78 | 80 | } |
79 | | - // Test that all target encodes are found: |
| 81 | + // Test that target encode was found: |
80 | 82 | $this->assertTrue( $targetEncodeFound ); |
81 | 83 | } |
82 | 84 | |
Index: trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php |
— | — | @@ -136,7 +136,10 @@ |
137 | 137 | * Invalidate the cache of all pages where the video is displayed |
138 | 138 | */ |
139 | 139 | function invalidateCache(){ |
140 | | - // the file page cache should be invalidated: |
| 140 | + // The static cache of webVideoTranscode should be cleared |
| 141 | + webVideoTranscode::clearTranscodeCache(); |
| 142 | + |
| 143 | + // The file page cache should be invalidated: |
141 | 144 | $this->title->invalidateCache(); |
142 | 145 | |
143 | 146 | // TODO if the video is used in over 500 pages add to 'job queue' |
Index: trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscode.php |
— | — | @@ -288,6 +288,12 @@ |
289 | 289 | // Else return the state: |
290 | 290 | return self::$transcodeStateCache[$fileName][$transcodeKey]['ready']; |
291 | 291 | } |
| 292 | + /** |
| 293 | + * Clear the transcode state cache: |
| 294 | + */ |
| 295 | + public static function clearTranscodeCache(){ |
| 296 | + self::$transcodeStateCache = null; |
| 297 | + } |
292 | 298 | |
293 | 299 | /** |
294 | 300 | * Populates the local transcoding state cache with the current DB state of transcodes |
— | — | @@ -324,7 +330,7 @@ |
325 | 331 | } |
326 | 332 | |
327 | 333 | /** |
328 | | - * Try to add a source to the sources param |
| 334 | + * Try to add a source to the sources list |
329 | 335 | * if the source is not found update the job queue |
330 | 336 | */ |
331 | 337 | public static function tryAddSource( &$file, &$sources, $transcodeKey, $dataPrefix = '' ){ |