Example #1
0
function genDocsForLang($lang)
{
    chdir(PHP_DOC_DIR);
    if (!is_dir($lang)) {
        runCmd("svn checkout http://svn.php.net/repository/phpdoc/{$lang}/trunk ./{$lang}");
    }
    if (!is_file("doc-base/.manual.{$lang}.xml")) {
        chdir('doc-base');
        runCmd("php configure.php --with-lang={$lang} --output=.manual.{$lang}.xml");
        chdir('..');
    }
    if (!is_dir("phd/output-{$lang}")) {
        chdir('phd');
        runCmd("php render.php -d../doc-base/.manual.{$lang}.xml --package IDE --format json --output ./output-{$lang}/");
        chdir('..');
    }
    chdir('..');
}
Example #2
0
function addSystemFile()
{
    global $DMESG, $CPUINFO, $LSPCI;
    exec("mkdir -p bench/sys");
    $sysFile = fopen("bench/sys/system.html", "w") or die("Unable to open system file!");
    addSubHeader($sysFile, "System", array("Dmesg", "CPU Info", "lspci"));
    openChapter($sysFile, "System", "dmesg");
    runCmd($DMESG, $sysFile);
    closeChapter($sysFile);
    openChapter($sysFile, "System", "CPU Info");
    runCmd($CPUINFO, $sysFile);
    closeChapter($sysFile);
    openChapter($sysFile, "System", "lspci");
    runCmd($LSPCI, $sysFile);
    closeChapter($sysFile);
    addSubFooter($sysFile);
    fclose($sysFile);
}
Example #3
0
        $changes .= " " . $ip . "=" . $vpn;
    }
    echo '<div class="status saving">Saving Changes</div>';
    sflush();
    if (!$fishy) {
        $output = runCmd('sudo /config/detour/set-group-members.sh ' . $changes);
        echo '<div class="status saved">Changes Saved</div>';
    } else {
        echo '<div class="status error">ARGUMENT ERROR!</div>';
    }
    sflush();
}
echo "<div class='status reading'>Reading Config</div>";
sflush();
// Run our helper script to get a list of IPs currently in each VPN group
$output = runCmd('sudo /config/detour/get-group-members.sh');
$current_list = array();
foreach ($output as $value) {
    list($key, $value) = split('=', $value);
    $current_list[trim($key)] = trim($value) . " ";
}
?>
</div>

<?php 
if (count($ip_list) == 0) {
    ?>
	<div class="status error">Edit the /config/detour/ip_list.conf file to add your devices.</div>
<?php 
}
?>
 /**
  * Has to be performed after mediainfo, as lame strips id3 tags. 
  */
 public function lameAudioSample($lameinfo, $releaseguid)
 {
     $returnval = false;
     $minacceptableencodefilesize = 10000;
     $samplefile = $this->mp3SavePath . $releaseguid . '.mp3';
     $samplefileogg = $this->mp3SavePath . $releaseguid . '.ogg';
     $ffmpeginfo = $this->site->ffmpegpath;
     if (file_exists($samplefile)) {
         $outfile = $this->mp3SavePath . $releaseguid . '_l.mp3';
         $outfileogg = $this->mp3SavePath . $releaseguid . '_l.ogg';
         //
         // lame the sample down to 96kb and replace it. alternatives could be
         // V8 for low quality variable.
         //
         $execstring = '"' . $lameinfo . '" -b 96 "' . $samplefile . '" "' . $outfile . '"';
         $execstringogg = '"' . $ffmpeginfo . '" -i "' . $samplefile . '" -acodec libvorbis "' . $outfileogg . '"';
         $output = runCmd($execstring, false, true);
         $output = runCmd($execstringogg, false, true);
         //
         // lame can create bad/small files if the source was corrupt
         // if it creates a file thats surprisingly small, then ignore it and retain
         // original
         //
         if (file_exists($outfile)) {
             if (filesize($outfile) < $minacceptableencodefilesize) {
                 unlink($outfile);
             } else {
                 unlink($samplefile);
                 rename($outfile, $samplefile);
                 $returnval = true;
             }
         }
         if (file_exists($outfileogg)) {
             if (filesize($outfileogg) < $minacceptableencodefilesize) {
                 unlink($outfileogg);
             } else {
                 rename($outfileogg, $samplefileogg);
                 $returnval = true;
             }
         }
     }
     return $returnval;
 }
Example #5
0
 public function getSample($ramdrive, $ffmpeginfo, $releaseguid)
 {
     $ri = new ReleaseImage();
     $retval = false;
     $samplefiles = glob($ramdrive . '*.*');
     if (is_array($samplefiles)) {
         foreach ($samplefiles as $samplefile) {
             if (preg_match("/\\.(" . $this->mediafileregex . ")\$/i", $samplefile)) {
                 echo "Getting Sample for {$samplefile}\n";
                 $execstring = '"' . $ffmpeginfo . '" -loglevel quiet -vframes 300 -sameq -i "' . $samplefile . '" "' . $ramdrive . 'zzzz%03d.jpg"';
                 $output = runCmd($execstring);
                 $all_files = scandir($ramdrive, 1);
                 if (preg_match("/zzzz\\d{3}\\.jpg/", $all_files[1])) {
                     echo "-Using {$all_files[1]}\n";
                     $ri->saveImage($releaseguid . '_thumb', $ramdrive . $all_files[1], $ri->imgSavePath, 800, 600);
                     $retval = true;
                 } else {
                     echo "-Failed\n";
                 }
                 //clean up all files
                 foreach (glob($ramdrive . '*.jpg') as $v) {
                     unlink($v);
                 }
             }
         }
     } else {
         echo "Couldn't open temp drive " . $ramdrive;
     }
     return $retval;
 }
function daemon()
{
    global $argv, $title;
    $sphinx = new Sphinx();
    printf("%s", $title);
    if (isWindows()) {
        if (strpos($argv[2], "--stop") !== false) {
            runCmd("net stop sphinxsearch", true);
        } else {
            runCmd("net start sphinxsearch", true);
        }
    } else {
        $search = $sphinx->getSphinxBinPath("searchd");
        $cmd = sprintf("%s %s", $search, implode(' ', array_slice($argv, 2)));
        passthru($cmd);
    }
    return true;
}