Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
RebuildPlaylists
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 processFile
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2/**
3 * Rebuild HLS .m3u8 video playlists
4 */
5$IP = getenv( 'MW_INSTALL_PATH' );
6if ( $IP === false ) {
7        $IP = __DIR__ . '/../../..';
8}
9require_once "$IP/maintenance/Maintenance.php";
10require_once __DIR__ . "/TimedMediaMaintenance.php";
11
12use MediaWiki\TimedMediaHandler\WebVideoTranscode\WebVideoTranscode;
13
14class RebuildPlaylists extends TimedMediaMaintenance {
15
16    public function __construct() {
17        parent::__construct();
18        $this->addOption( "dry-run", "don't actually change anything; for testing params" );
19        $this->addDescription( "rebuild HTTP Live Streaming .m3u8 playlists of audio/video transcodes." );
20    }
21
22    public function execute() {
23        $this->output( "Rebuild HLS .m3u8 playlists:\n" );
24        parent::execute();
25        $this->output( "Finished!\n" );
26    }
27
28    /**
29     * @param File $file
30     */
31    public function processFile( File $file ) {
32        $this->output( $file->getName() . "\n" );
33        if ( !$this->hasOption( 'dry-run' ) ) {
34            WebVideoTranscode::updateStreamingManifests( $file );
35        }
36    }
37}
38
39// Tells it to run the class
40$maintClass = RebuildPlaylists::class;
41require_once RUN_MAINTENANCE_IF_MAIN;