public function main() { date_default_timezone_set('America/Los_Angeles'); if (!$assocVideoExts) { self::$assocVideoExts = Utils::arrToAssoArr(self::$videoExts); self::$assocImgExts = Utils::arrToAssoArr(self::$imgExts); } $opts = getopt('bcd:e:f:', array('backup', 'cleanup', 'staging-dir:', 'exclude-article-id:', 'force:')); // $doBackup = isset ( $opts ['b'] ) || isset ( $opts ['backup'] ); $doCleanup = isset($opts['c']) || isset($opts['cleanup']); self::$stagingDir = @$opts['d'] ? @$opts['d'] : @$opts['staging-dir']; if (empty(self::$stagingDir)) { self::$stagingDir = self::DEFAULT_STAGING_DIR; } self::$debugArticleID = @$opts['f'] ? @$opts['f'] : @$opts['force']; $skipID = @$opts['e'] ? $opts['e'] : @$opts['exclude-article-id']; if ($skipID) { self::$excludeArticles[] = $skipID; } if ($_ENV['USER'] != 'apache') { self::e("script must be run as part of wikivisual-process-media.sh"); exit; } Misc::loginAsUser(self::MEDIA_USER); // if ($doBackup) { // $this->doS3Backup (); // } else if ($doCleanup) { $this->doS3Cleanup(); } else { $this->mp4Transcoder = new Mp4Transcoder(); $this->imageTranscoder = new ImageTranscoder(); $this->processTranscodingArticles(); //1st take care of articles which are under processing. $this->processS3Media(); } }