From a5878dabe99d6e2c80ac37646249b6e9d9ea7983 Mon Sep 17 00:00:00 2001 From: Saqib Razzaq Date: Thu, 30 Jun 2016 05:36:31 -0700 Subject: [PATCH] Fixed "Use Cron" issue --- upload/actions/video_convert.php | 5 ++++- upload/includes/functions_video.php | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/upload/actions/video_convert.php b/upload/actions/video_convert.php index e12458dc..e726535d 100644 --- a/upload/actions/video_convert.php +++ b/upload/actions/video_convert.php @@ -12,9 +12,12 @@ getting the aguments $argv[1] => first argument, in our case its the path of the file */ - + if (config('use_crons') == 'yes') { + $argv = convertWithCron(); + } //error_reporting(E_ALL); + #file_put_contents('__argv__', $argv[1]."\n".$argv[2]."\n".$argv[3]."\n".$argv[4]."\n"); logData(json_encode($argv),"argvs"); $fileName = (isset($argv[1])) ? $argv[1] : false; //This is exact file name of a video e.g 132456789 diff --git a/upload/includes/functions_video.php b/upload/includes/functions_video.php index 0d3bc3aa..900c0f5e 100644 --- a/upload/includes/functions_video.php +++ b/upload/includes/functions_video.php @@ -1923,4 +1923,18 @@ } return array_filter($vid_dets); + } + + function convertWithCron() { + global $db; + $toConvert = $db->select(tbl("conversion_queue"),"*","cqueue_conversion ='no' ORDER BY cqueue_id ASC LIMIT 0,1"); + $filedata = $toConvert[0]; + $dateDir = str_replace('-', '/', $filedata['date_added']); + $dateDir = substr($dateDir, 0, strpos($dateDir, ' ')); + $returnData = array(); + $returnData[1] = $filedata['cqueue_name'].'.'.$filedata['cqueue_ext']; + $returnData[2] = $filedata['cqueue_name']; + $returnData[3] = $dateDir; + $returnData[4] = FILES_DIR.'/logs/'.$dateDir.'/'.$filedata['cqueue_name'].'.log'; + return $returnData; } \ No newline at end of file