function execute() { $argv = $_SERVER['argv']; $model = new connectionUserVideoModel(); $video = $model->where(array('id' => (int) $argv[4]))->fetchOne(); $converter = new ConnectionVideo(); $converter->convertToFlv($video['file'], $video['user'], (int) $argv[4]); $model->where(array('id' => (int) $argv[4]))->update(array('status' => 'moderate')); }
function execute() { $video = new ConnectionVideo(); if (!Request::files('Filedata')) { return array('status' => 'error'); } $result = $video->download('Filedata'); if (!$result) { return array('status' => 'error'); } $file = Request::files('Filedata'); $model = new connectionUserVideoModel(); $user = ConnectionHelper::userLogin(); $userModel = new connectionUserModel(); $videoID = $model->insert(array('file' => $result, 'status' => 'upload', 'user' => (int) $user['id'], 'date' => strtotime('now'), 'title' => htmlspecialchars($file[0]['name']))); $userModel->addHistory($user['id'], connectionUserModel::HISTORY_ADD_VIDEO, '', array('video' => (int) $videoID)); Route::exec('php ' . MAIN_DIR . DS . 'cli.php connection ConvertVideo cli ' . $videoID); return array('status' => 'success'); }