* * USER-FILES/2-Test-Nottingham/media/something.flv * USER-FILES/2-Test-Nottingham/media/something.mp4 * * When the script runs it looks to see if a .mp4 variant of the file already exists, and if it does, it does nothing. * * Note, depending on your media files, running this may consume quite a lot of CPU / disk resource. * No 'intelligence' is included to cope with duplicated source media files - to reduce resource usage. * * * You'll need to have something like 'avconv' or 'ffmpeg' installed. See comments inline below. * It'll probably work best with ffmpeg. Perhaps. * */ require_once dirname(__FILE__) . '/../config.php'; if (!is_file('/usr/bin/avconv') && !is_File('/usr/bin/ffmpeg')) { die("Cannot run; /usr/bin/avconv or /usr/bin/ffmpeg does not appear to be present"); } $finfo = new finfo(FILEINFO_MIME_TYPE); $files = glob($xerte_toolkits_site->users_file_area_full . '*/media/*'); foreach ($files as $filename) { $mimeType = $finfo->file($filename); $extension = pathinfo($filename, PATHINFO_EXTENSION); if ($extension !== 'mp4' && preg_match('!video!', $mimeType)) { // have a video that may need transcoding // has video already been transcoded? $mp4Filename = preg_replace('!' . preg_quote($extension, "!") . '$!', 'mp4', $filename, 1); // replace the extension with "mp4" if (file_exists($mp4Filename)) { // have a mp4 version. continue;
function upload(&$out) { set_time_limit(0); global $restore; global $file; global $file_name; global $folder; if (!$folder) { if (substr(php_uname(), 0, 7) == "Windows") { $folder = '/.'; } else { $folder = '/'; } } else { $folder = '/' . $folder; } if ($restore != '') { $file = $restore; } elseif ($file != '') { copy($file, ROOT . 'saverestore/' . $file_name); $file = $file_name; } umask(0); @mkdir(ROOT . 'saverestore/temp', 0777); if ($file != '') { // && mkdir(ROOT.'saverestore/temp', 0777) chdir(ROOT . 'saverestore/temp'); if (substr(php_uname(), 0, 7) == "Windows") { // for windows only exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res); //echo DOC_ROOT.'/tar xvf ../'.str_replace('.tgz', '.tar', $file);exit; exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res); } else { exec('tar xzvf ../' . $file, $output, $res); } $x = 0; $dir = opendir('./'); while (($filec = readdir($dir)) !== false) { if ($filec == '.' || $filec == '..') { continue; } if (is_Dir($filec)) { $latest_dir = $filec; } elseif (is_File($filec)) { $latest_file = $filec; } $x++; } if ($x == 1 && $latest_dir) { $folder = '/' . $latest_dir; } @unlink(ROOT . 'saverestore/temp' . $folder . '/config.php'); @unlink(ROOT . 'saverestore/temp' . $folder . '/README.md'); chdir('../../'); // UPDATING FILES DIRECTLY $this->copyTree(ROOT . 'saverestore/temp' . $folder, ROOT, 1); // restore all files $source = ROOT . 'modules'; if ($dir = @opendir($source)) { while (($file = readdir($dir)) !== false) { if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..') { // && !file_exists($source."/".$file."/installed") @unlink(ROOT . "modules/" . $file . "/installed"); } } } @unlink(ROOT . "modules/control_modules/installed"); @SaveFile(ROOT . 'reboot', 'updated'); global $name; global $version; $rec = SQLSelectOne("SELECT * FROM plugins WHERE MODULE_NAME LIKE '" . DBSafe($name) . "'"); $rec['MODULE_NAME'] = $name; $rec['CURRENT_VERSION'] = $version; $rec['IS_INSTALLED'] = 1; $rec['LATEST_UPDATE'] = date('Y-m-d H:i:s'); if ($rec['ID']) { SQLUpdate('plugins', $rec); } else { SQLInsert('plugins', $rec); } $this->redirect("?mode=clear&ok_msg=" . urlencode("Updates Installed!")); } }
function setLocalLang($text) { $langFile = DOKU_PLUGIN . "formular/lang/{$text}/lang.php"; if (is_File($langFile)) { include $langFile; $this->localLang = $lang; } }