Вход Регистрация
Файл: adultscript-2.0.3-pro/files/cron/scripts/video_queue.php
Строк: 27
<?php
defined
('_VALID') or die('Restricted Access!');
function 
cron_video_queue()
{
    
update_script('video_queue'TRUEFALSE);

    
$time        time();
    
$run        true;
    
    
$limit        VF::cfg_item('module.video.queue_limit');
    
$cmd_conv    VF::cfg_item('php_cli_path').' '.BASE_DIR.'/modules/video/scripts/convert.php';
    
$cmd_check    "ps ax | grep '".$cmd_conv."' | grep -v grep";
    
exec($cmd_check$output);
    if (
count($output) >= $limit) {
        
VLog::write('QUEUE: conversion limit reached ('.$limit.' conversion(s) already running. Delaying...');
        
update_script('video_queue'FALSETRUE);
        
        return;
    }
    
    
$db     VF::factory('database');
    
$db->query("SELECT q.video_id, q.status, o.ext
                FROM #__video_queue AS q
                INNER JOIN #__video_orig AS o ON (o.video_id = q.video_id)
                WHERE q.conv_time = 0
                ORDER BY q.add_time ASC
                LIMIT 1"
);
    if (
$db->affected_rows()) {
        
$video        $db->fetch_assoc();
        
$video_id    = (int) $video['video_id'];
        
$ext        $video['ext'];
        
$status        = (VF::cfg_item('module.video.approve') == '1') ? 1;
        
        
$db->query("UPDATE #__video
                    SET status = 4
                    WHERE video_id = "
.$video_id."
                    LIMIT 1"
);
        
        
$cmd        $cmd_conv.' '.$video_id.' '.$ext.' '.$status;
        
VLog::write('QUEUE: executing '.$cmd);
        
exec(escapeshellcmd($cmd). ' >/dev/null &');
        
        
$db->query("UPDATE #__video_queue
                    SET conv_time = "
.time()."
                    WHERE video_id = "
.$video_id."
                    LIMIT 1"
);
    } else {
        
VLog::write('QUEUE: no videos in queue.');
    }
    
    
update_script('video_queue'FALSETRUE);
}
?>
Онлайн: 0
Реклама