Beispiel #1
0
function chatMessage($rawString)
{
    //global $artist;
    //global $title;
    global $find;
    global $replace;
    $string = str_replace($find, $replace, $rawString);
    execCommand("sendtextmessage targetmode=2 msg=" . $string);
}
Beispiel #2
0
             if (!$srcHandle || !$dstHandle) {
                 header('HTTP/1.x 500 Internal Server Error', true, 500);
                 print 'Unable to open file for gz-compression.';
                 chdir($oldcwd);
                 removeDirectory($tempDir);
                 exit(0);
             }
             while (!feof($srcHandle)) {
                 gzwrite($dstHandle, fread($srcHandle, 1024 * 512));
             }
             fclose($srcHandle);
             gzclose($dstHandle);
         } else {
             $cmd = $config->gzip . ' ' . quote($tarArchive);
             $retcode = 0;
             execCommand($cmd, $retcode);
             if ($retcode != 0) {
                 header('HTTP/1.x 500 Internal Server Error', true, 500);
                 error_log('Unable to call gzip command: ' . $cmd);
                 print 'Unable to call gzip command. See webserver error log for details.';
                 chdir($oldcwd);
                 removeDirectory($tempDir);
                 exit(0);
             }
         }
     }
 }
 // Give the file to the browser
 if (is_readable($downloadArchive)) {
     if ($downloadMode == 'plain') {
         $downloadFilename = $plainfilename;
$storage->setDatabase($dbName);
do {
    $toTranscode = $storage->get("_design/files/_view/get_media_status?limit=1&startkey=[\"WAITING\"]&endkey=[\"WAITING\",{}]")->body->rows;
    if (!empty($toTranscode)) {
        $t = $toTranscode[0];
        $id = $t->id;
        $info = $storage->get($id)->body;
        $info->transcodeStatus = 'PROGRESS';
        $storage->put($id, $info);
        $fileOwner = $info->fileOwner;
        $fileName = getConfig($config, 'file_storage_dir', TRUE) . DIRECTORY_SEPARATOR . base64_encode($fileOwner) . DIRECTORY_SEPARATOR . $info->fileName;
        if (isset($info->video)) {
            $transcodeFileName = getConfig($config, 'cache_dir', TRUE) . DIRECTORY_SEPARATOR . $info->video->transcode->{$videoHeight}->file;
            $newSize = $info->video->transcode->{$videoHeight}->width . "x" . $info->video->transcode->{$videoHeight}->height;
            // -vf transpose=1   (for rotating clockwise 90 degrees)
            $cmd = "ffmpeg -i \"{$fileName}\" -threads 2 -f webm -acodec libvorbis -vcodec libvpx -s {$newSize} -b 524288 -y {$transcodeFileName}";
        } elseif (isset($info->audio)) {
            $transcodeFileName = getConfig($config, 'cache_dir', TRUE) . DIRECTORY_SEPARATOR . $info->audio->transcode->file;
            $cmd = "ffmpeg -i \"{$fileName}\" -threads 2 -f ogg -acodec libvorbis -ab 96000 -y {$transcodeFileName}";
        }
        $returnValue = execCommand($cmd, 'data' . DIRECTORY_SEPARATOR . basename($transcodeFileName) . ".log", "Transcoding {$fileName}");
        $info = $storage->get($id)->body;
        if ($returnValue != 0) {
            $info->transcodeStatus = 'FAILED';
        } else {
            $info->transcodeStatus = 'DONE';
        }
        $storage->put($id, $info);
    }
    sleep(10);
} while (TRUE);
Beispiel #4
0
// ##############################################
// execute menu commands
foreach ($_REQUEST as $key => $val) {
    if (isset($_SERVER['SOLAR_CONFIG']['MENU'][$key]) && $val == 1) {
        $label = ucfirst(strtolower($key));
        $command = $_SERVER['SOLAR_CONFIG']['MENU'][$key];
        echo <<<EOC
\t\t<div class="menu-command">
\t\t\t<h2>{$label}</h2>
\t\t\t<p>
\t\t\t\t<label>executing <code>{$command}</code> ...</label>
\t\t\t</p>
EOC;
        try {
            $rc = NULL;
            $res = execCommand($command, $rc);
            if ($rc == 0) {
                $label = "command completed successfully:";
            } else {
                $label = "command failed:";
            }
            echo "<p><label>{$label}</label></p>";
            echo "<pre>{$res}</pre>";
        } catch (InvalidCommandException $e) {
            displayException($e);
        }
        echo "</div></body></html>";
        exit;
    }
}
?>
Beispiel #5
0
 function exportRepositoryPath($path, $filename, $rev = 0, $peg = '')
 {
     global $config;
     $path = encodepath($this->getSvnPath($path));
     $pegrev = $peg ? '@' . $peg : '';
     $cmd = $config->getSvnCommand() . ' export -r ' . $rev . ' ' . $this->repConfig->svnParams() . quote($path . $pegrev) . ' ' . quote($filename);
     $retcode = 0;
     execCommand($cmd, $retcode);
     if ($retcode != 0) {
         global $lang;
         error_log($lang['BADCMD'] . ': ' . $cmd);
     }
     return $retcode;
 }
Beispiel #6
0
        $cmd = getScriptCmd($script);
        if ($DEBUG) {
            jsonDebug("SCRIPT-COMMAND", $cmd);
        }
        $rc = -1;
        $output = execScript($script, $rc);
        $res['result'][] = array($cmd, $rc, $output);
        $res['duration'] = durationStop($start);
        echo json_encode($res);
    } elseif (isset($probeConf['CMD'])) {
        $cmds = expandCommand($probeConf['CMD']);
        if ($DEBUG) {
            jsonDebug("EXPANDED COMMAND", $cmds);
        }
        foreach ($cmds as $cmd) {
            $rc = -1;
            $output = execCommand($cmd, $rc);
            $res['result'][] = array($cmd, $rc, $output);
        }
        $res['duration'] = durationStop($start);
        echo json_encode($res);
    } else {
        jsonError('CONF', "invalid probe-config", array('probe' => $probeID));
    }
} catch (InvalidCommandException $e) {
    $details = array('probe' => $probeID, 'cmd' => $e->cmd);
    jsonError('EXEC', $e->getMessage(), $details);
} catch (Exception $e) {
    $details = array('probe' => $probeID);
    jsonError('EXEC', $e->getMessage(), $details);
}
Beispiel #7
0
<title>git update</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />
<meta name="mobile-web-app-capable" content="yes" />
<?php 
require_once "../include/includes.php";
addCssFromConfig("lib.bootstrap");
?>
</head>
<body class="container">
<br/>
<pre><?php 
$gitPath = getExePath($exe = "GIT", $key = "_GIT");
if (!$gitPath || !file_exists($gitPath)) {
    echo "git disabled.";
} else {
    echo "\nstatus:\n";
    echo execCommand(makeCommand("[0] status", $gitPath));
    echo "\npull:\n";
    echo execCommand(makeCommand("[0] pull --rebase", $gitPath));
}
?>
</pre>
<a href="<?php 
echo $APP_DIR;
?>
">return to application</a>
</body>
</html>
/**
 * 部署webserver
 *
 * @param string $project 项目
 * @return mixed
 */
function deployWebServer($project)
{
    if (execCommand("ssh", $project, "'docker ps -a | grep webserver'")) {
        execCommand("ssh", $project, "'docker restart webserver'");
    } else {
        //组装命令
        $command = "'docker run -d --restart=always ";
        $volumns[] = CODE_DIR . ":/home/www";
        $volumns[] = NGINX_SERVERS_DIR . ":/etc/nginx/conf.d";
        $command .= " -v " . implode(" -v ", $volumns);
        $command .= " -p " . VIR_PORT . ":" . CONTAINER_PORT . " --name webserver 192.168.1.254:5000/library/webserver:devel '";
        //启动webserver
        execCommand("ssh", $project, $command);
    }
}