当前位置: 首页>>代码示例>>PHP>>正文


PHP OS::executeAndReturnOutput方法代码示例

本文整理汇总了PHP中OS::executeAndReturnOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP OS::executeAndReturnOutput方法的具体用法?PHP OS::executeAndReturnOutput怎么用?PHP OS::executeAndReturnOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OS的用法示例。


在下文中一共展示了OS::executeAndReturnOutput方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getRevisionAuthor

function getRevisionAuthor($rev)
{
    $xmlLines = OS::executeAndReturnOutput("svn log -c {$rev} --xml");
    $xmlString = implode('', $xmlLines);
    $xml = simplexml_load_string($xmlString);
    return (string) $xml->logentry->author;
}
开发者ID:florinp,项目名称:dexonline,代码行数:7,代码来源:svnAnnotate.php

示例2: ini_set

require_once "../phplib/util.php";
ini_set('max_execution_time', '3600');
define('DB_QUERY', 'select * from Lexem where isLoc order by formNoAccent');
$locVersion = util_getRequestParameter('locVersion');
$newLocVersion = util_getRequestParameter('newLocVersion');
if ($newLocVersion) {
    if ($locVersion == $newLocVersion) {
        FlashMessage::add('Ați selectat aceeași versiune LOC de două ori');
        util_redirect('scrabble-loc');
    }
    $file1 = tempnam('/tmp', 'loc_diff_');
    $file2 = tempnam('/tmp', 'loc_diff_');
    writeLexems($locVersion, $file1);
    writeLexems($newLocVersion, $file2);
    $diff = OS::executeAndReturnOutput("diff {$file1} {$file2} || true");
    print "<pre>\n";
    foreach ($diff as $line) {
        if (StringUtil::startsWith($line, '< ')) {
            print sprintf("<span style=\"color: red\">%s: %s</span>\n", $locVersion, substr($line, 2));
        } else {
            if (StringUtil::startsWith($line, '> ')) {
                print sprintf("<span style=\"color: green\">%s: %s</span>\n", $newLocVersion, substr($line, 2));
            }
        }
    }
    print "</pre>\n";
    util_deleteFile($file1);
    util_deleteFile($file2);
    exit;
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:30,代码来源:scrabble-loc.php

示例3: isImage

function isImage($fileName)
{
    // Check that the image exists
    $output = OS::executeAndReturnOutput("file \"{$fileName}\"");
    assert(count($output) == 1);
    if (strpos($output[0], 'JPEG image data') === false) {
        return IMG_NOT_JPEG;
    }
    $output = OS::executeAndReturnOutput("identify -verbose \"{$fileName}\" 2>&1 1>/dev/null");
    if (count($output)) {
        return IMG_CORRUPT;
        // because there are warnings
    }
    return IMG_NORMAL;
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:15,代码来源:importDivertaCsv.php

示例4: log_scriptLog

<?php

require_once "../phplib/util.php";
$PS_COMMAND = 'ps -eo user,pid,etime,args --no-headers --sort etime';
$APACHE_USER = 'www-data';
$PHP_EXECUTABLE = '/usr/lib/cgi-bin/php5';
$TIME_LIMIT = 3600;
/*seconds */
log_scriptLog('Running killOrphanPhpProcesses.php.');
$output = OS::executeAndReturnOutput($PS_COMMAND);
foreach ($output as $line) {
    $parts = preg_split('/ +/', $line, 4);
    $runningTime = getRunningTime($parts[2]);
    if ($parts[0] == $APACHE_USER && $runningTime > $TIME_LIMIT && $parts[3] == $PHP_EXECUTABLE) {
        log_scriptLog("killing process {$parts[1]}");
        OS::executeAndAssert("kill -9 {$parts[1]}");
    }
}
log_scriptLog('killOrphanPhpProcesses.php done.');
/****************************************************************************/
// ps gives us the running time in [[DD-]hh:]mm:ss format.
function getRunningTime($string)
{
    $matches = array();
    preg_match("/^(?:(?:(\\d+)-)?(\\d+):)?(\\d+):(\\d+)\$/", $string, $matches);
    return $matches[1] * 86400 + $matches[2] * 3600 + $matches[3] * 60 + $matches[4];
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:27,代码来源:killOrphanPhpProcesses.php


注:本文中的OS::executeAndReturnOutput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。