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


PHP printUsage函数代码示例

本文整理汇总了PHP中printUsage函数的典型用法代码示例。如果您正苦于以下问题:PHP printUsage函数的具体用法?PHP printUsage怎么用?PHP printUsage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getSources

/**
 * Récupère la liste de tous les sites à analyser.
 * 
 * @param array $listeSourcesSupportees La liste des sites déclarés comme analysables.
 * @return array Un tableau contenant tous les sites à analyser sous la forme :
 * <pre>
 * [
 *   'vgOrg' => 
 *     [
 *       0 => '59'
 *       1 => '62'
 *     ]
 *   'sbdCom' => 
 *     [
 *       0 => '59-nord/l/lille'
 *       1 => '62-pas-de-calais/l/le-touquet-paris-plage'
 *     ]
 * ]
 * </pre>
 */
function getSources($listeSourcesSupportees)
{
    $listeSources = array();
    // récupération des sources et des paramètres associés
    foreach ($_GET as $codeSrc => $paramsSrc) {
        // si le paramètre est présent dans la liste des sites supportés
        if (in_array($codeSrc, array_keys($listeSourcesSupportees))) {
            // alors on l'ajoute à la liste des sources à analyser
            $listeSources[$codeSrc] = $paramsSrc;
        }
    }
    // vérification de la présence d'au moins une source
    if (empty($listeSources)) {
        echo "Aucune source n'a été paramétrée. Les sources supportées sont [" . implode(', ', array_keys($listeSourcesSupportees)) . "].";
        printUsage();
        exit - 1;
    }
    $listeRetour = array();
    // validation des paramètres des sites à analyser
    foreach ($listeSources as $codeSrc => $paramsSrcText) {
        $paramsSrcArray = explode("|", $paramsSrcText);
        foreach ($paramsSrcArray as $param) {
            if (!preg_match($listeSourcesSupportees[$codeSrc]["pattern"], $param)) {
                echo "Le paramètre [" . $param . "] n'est pas au format attendu.";
                printUsage();
                exit - 1;
            } else {
                // ajout de la source à la liste des pages à analyser
                $listeRetour[$codeSrc] = $paramsSrcArray;
            }
        }
    }
    return $listeRetour;
}
开发者ID:nagromc,项目名称:braderies2iCalendar,代码行数:54,代码来源:getcal.php

示例2: printHelp

function printHelp()
{
    printUsage();
    print '  [params] can be one of the following:' . PHP_EOL;
    print '  create:app [[appName]]' . PHP_EOL;
    print '  create:module [moduleName] [[appName]]' . PHP_EOL;
    print '  create:action [actionType:actionName] [moduleName] [[appName]]' . PHP_EOL;
}
开发者ID:barcodex,项目名称:kashevar,代码行数:8,代码来源:generator.php

示例3: parseArguments

/**
 * Parses (and checks some) command line arguments
 */
function parseArguments()
{
    global $checkOptions, $cmdargs, $checksEnabled, $periods, $periodsEnabled, $argc, $argv;
    if ($argc == 1) {
        printUsage(true);
        exit(STATUS_UNKNOWN);
    }
    $i = 1;
    while ($i < $argc) {
        if ($argv[$i][0] != '-') {
            $i++;
            continue;
        }
        switch ($argv[$i][1]) {
            case 'V':
                printVersion();
                exit(STATUS_OK);
                break;
            case 'v':
                $cmdargs['log_level'] = LOG__VERBOSE;
                $i++;
                break;
            case 'd':
                $cmdargs['log_level'] = LOG__DEBUG;
                $i++;
                break;
            case 'c':
                $cmdargs['community'] = $argv[$i + 1];
                $i++;
                break;
            case 'h':
                $cmdargs['host'] = $argv[$i + 1];
                $i++;
                break;
            case 'p':
                $cmdargs['port'] = $argv[$i + 1];
                $i++;
                break;
            case '?':
                printHelp();
                exit(STATUS_OK);
                break;
            default:
                if (!isset($argv[$i + 1]) || substr($argv[$i + 1], 0, 1) == '-') {
                    $cmdargs[substr($argv[$i], 2)] = true;
                } else {
                    $cmdargs[substr($argv[$i], 2)] = $argv[$i + 1];
                }
                $i++;
                break;
        }
    }
}
开发者ID:sdouce,项目名称:nagios-plugins,代码行数:56,代码来源:check_chassis_brocade.php

示例4: T_

    print "-";
} else {
    print $forms;
}
?>
</td>
</tr>
<tr>
	<td valign="top"><strong><?php 
print T_("Word usage in this synset:");
?>
</strong></td>
	<td valign="top">
		<?php 
if ($auth->auth["uid"] == "nobody") {
    printUsage();
} else {
    buttons();
}
?>
	</td>
</tr>
<tr>
	<td valign="top"><strong><?php 
print T_("Antonym:");
?>
</strong></td>
	<td>
	<?php 
$antonym_array = getAntonym($db, uservar('wmid'));
$antonym_word = "";
开发者ID:BackupTheBerlios,项目名称:openthes-es-svn,代码行数:31,代码来源:word_detail.php

示例5: printUsage

                 $help = true;
                 break;
             case "--userstats":
                 $userstats = true;
                 break;
         }
     }
 }
 if ($style) {
     $storage->style_check = true;
 }
 if ($warnings) {
     $storage->warnings = true;
 }
 if ($help || $option_errors) {
     printUsage($argv);
 } else {
     $files = recursive_listdir($dir);
     $storage->processCode($files);
     if ($least_empty) {
         topTenEmpty($storage->codes);
     }
     if ($top_lines) {
         topTenLines($storage->codes);
     }
     if ($least_comments) {
         topTenComments($storage->codes);
     }
     if ($changes) {
         printChanges($storage->codes);
     }
开发者ID:rhinton,项目名称:tce,代码行数:31,代码来源:codeinfo.php

示例6: importAssets

/**
* Prints the supplied string to "standard error" (STDERR) instead of the "standard output" (STDOUT) stream
*
* @param string	$source_csv_filename		The CSV import file containing the asset attribute and metadata field specifications
* @param string	$asset_type_code			The Matrix asset type code or the assets which are to be created
* @param object	$parent_id					The asset ID of the parent asset under which the new assets are to reside
* @param int	$schema_id					The asset ID of the Metadata Schema to associate with the new assets
* @param array	$metadata_mapping			A structure containing Supplied Field Name to Metadata Field asset ID associations
* @param array	$attribute_mapping			A structure containing Supplied Field Name to Asset Attribute Name associations
* @param boolean$new_assets_live			When set to TRUE, assets created during the import will be set to 'Live'
* @param string $unique_record_field		The CSV field to be treated as a primary identifier for editing and deletion purposes
* @param string $record_modification_field	The CSV field to determine whether the associated record is to be (A)dded, (E)dited, or (D)eleted
* @param array	$ignore_fields				The fields for the ignoring
*
* @return array
* @access public
*/
function importAssets($source_csv_filename, $asset_type_code, $parent_id, $schema_id, array $metadata_mapping, array $attribute_mapping, $new_assets_live = FALSE, $unique_record_field = '', $record_modification_field = '', array $ignore_fields = array())
{
    $GLOBALS['SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
    $num_assets_imported = 0;
    $num_assets_modified = 0;
    $num_assets_deleted = 0;
    $csv_fd = fopen($source_csv_filename, 'r');
    if (!$csv_fd) {
        printUsage();
        printStdErr("* The supplied CSV import file was not found\n\n");
        fclose($csv_fd);
        exit(-6);
    }
    $parent_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($parent_id);
    if (!$parent_asset->id) {
        printUsage();
        printStdErr("* The specified parent asset was not found\n\n");
        exit(-7);
    }
    $header_line = TRUE;
    $headers = array();
    $trash = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('trash_folder');
    $root_folder = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_folder');
    // Set to true if temporary trash folder is created, where all the assets to be deleted are moved to
    $temp_trash_folder = FALSE;
    while (($data = fgetcsv($csv_fd, 0, ',')) !== FALSE) {
        $num_fields = count($data);
        $asset_spec = array();
        foreach ($data as $key => $val) {
            if ($header_line) {
                $headers[$key] = trim($val);
            } else {
                $asset_spec[$headers[$key]] = $val;
            }
        }
        if ($header_line) {
            $header_line = FALSE;
        } else {
            // If a Record Modification Field was specified, we also require that a Unique Field was specified for the import
            // These two fields must be present in the CSV file for us to Edit and Delete existing assets. Otherwise, we'll just add
            $record_handling = IMPORT_ADD_RECORD;
            if (!empty($unique_record_field) && !empty($record_modification_field) && isset($asset_spec[$unique_record_field]) && isset($asset_spec[$record_modification_field])) {
                $record_modification_state = strtoupper($asset_spec[$record_modification_field]);
                switch ($record_modification_state) {
                    case 'D':
                        $record_handling = IMPORT_DELETE_RECORD;
                        break;
                    case 'E':
                        $record_handling = IMPORT_EDIT_RECORD;
                        break;
                }
                // Okey dokey, let's find the existing asset as we are either performing an (E)dit or (D)elete operation...
                // Also try to find an existing asset as we may be unfortunately performing an (A)dd that matches the unique
                // identifier, in which case we are probably intending to (E)dit the existing matching asset
                $existing_asset_id = 0;
                // Our search is limited to the exact asset type used for the import, and the parent root node (and children) specified
                // The unique field may be either one to be assigned to an attribute or to a metadata field
                $search_field = '';
                $search_value = '';
                if (isset($metadata_mapping[$unique_record_field])) {
                    $search_type = 'metadata';
                    $search_field = $metadata_mapping[$unique_record_field];
                    $search_value = $asset_spec[$unique_record_field];
                }
                if (isset($attribute_mapping[$unique_record_field])) {
                    $search_type = 'attribute';
                    $search_field = $attribute_mapping[$unique_record_field];
                    $search_value = $asset_spec[$unique_record_field];
                }
                $search = array($search_type => array('field' => $search_field, 'value' => $search_value));
                $existing_assets = findAsset($parent_id, $asset_type_code, $search);
                if (count($existing_assets) > 1) {
                    // Multiple matching assets - skip
                    echo "\n*\t* The record for '" . $search_value . "' matched multiple existing assets. Cannot determine how to proceed - continuing to the next record.\n";
                    continue;
                }
                $existing_asset_id = reset($existing_assets);
                // If it is an (E)dit request and the asset was not found, then let's make it an (A)dd instead
                if (empty($existing_assets) && $record_handling == IMPORT_EDIT_RECORD) {
                    echo "\n*\t* The following 'Edit' request for '" . $search_value . "' has been changed to 'Add' as there is not an existing matching asset\n";
                    $record_handling = IMPORT_ADD_RECORD;
                }
                // If it's there and we wanted to (A)dd, then make it an (E)dit instead
//.........这里部分代码省略.........
开发者ID:joshgillies,项目名称:mysource-matrix,代码行数:101,代码来源:import_asset_csv_to_matrix.php

示例7: printUsage

    printUsage("ERROR: Path provided doesn't point to a Matrix installation's System Root. Please provide correct path and try again.");
}
//FROM PARENT ID
$FROM_PARENT_ID = isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : '';
if (empty($FROM_PARENT_ID)) {
    printUsage('ERROR: You need to provide the from-parent-id as the second argument');
}
//TO PARENT ID
$TO_PARENT_ID = isset($_SERVER['argv'][3]) ? $_SERVER['argv'][3] : '';
if (empty($TO_PARENT_ID)) {
    printUsage('ERROR: You need to provide the to-parent-id as the third argument');
}
//ASSET_TYPE
$ASSET_TYPE = isset($_SERVER['argv'][4]) ? $_SERVER['argv'][4] : '';
if (empty($ASSET_TYPE)) {
    printUsage('ERROR: You need to enter the asset_type as the fourth argument');
}
require_once $SYSTEM_ROOT . '/core/include/init.inc';
//LINK_TYPE
$LINK_TYPE = isset($_SERVER['argv'][5]) ? $_SERVER['argv'][5] : SQ_SC_LINK_SIGNIFICANT;
$root_user =& $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user');
// log in as root
if (!$GLOBALS['SQ_SYSTEM']->setCurrentUser($root_user)) {
    echo "ERROR: Failed login in as root user\n";
    exit;
}
moveAssets($FROM_PARENT_ID, $TO_PARENT_ID, $ASSET_TYPE, $LINK_TYPE);
$GLOBALS['SQ_SYSTEM']->restoreCurrentUser();
echo "Finish moving assets!\n";
/**
 * Move all assets under a parent asset to a new parent asset 
开发者ID:joshgillies,项目名称:mysource-matrix,代码行数:31,代码来源:move_assets.php

示例8: cliWatchDir

function cliWatchDir($tpath = "", $username = "")
{
    global $cfg;
    if (isset($tpath) && $tpath != "" && isset($username) && $username != "") {
        if (is_dir($tpath)) {
            $cfg['user'] = $username;
            $watchDir = checkDirPathString($tpath);
            if ($dirHandle = opendir($tpath)) {
                while (false !== ($file = readdir($dirHandle))) {
                    if (strtolower(substr($file, -8)) == ".torrent") {
                        $file_name = stripslashes($file);
                        $file_name = str_replace(array("'", ","), "", $file_name);
                        $file_name = cleanFileName($file_name);
                        echo "Injecting and Starting " . $watchDir . $file . " as " . $file_name . " for user " . $cfg['user'] . "...";
                        if (is_file($watchDir . $file) && copy($watchDir . $file, $cfg["torrent_file_path"] . $file_name)) {
                            @unlink($watchDir . $file);
                            chmod($cfg["torrent_file_path"] . $file_name, 0644);
                            AuditAction($cfg["constants"]["file_upload"], $file_name);
                            // init stat-file
                            injectTorrent($file_name);
                            // file-prio
                            if ($cfg["enable_file_priority"]) {
                                include_once "setpriority.php";
                                // Process setPriority Request.
                                setPriority($file_name);
                            }
                            // queue
                            if ($cfg["AllowQueing"]) {
                                $_REQUEST['queue'] = 'on';
                            } else {
                                $_REQUEST['queue'] = 'off';
                            }
                            // start
                            include_once "ClientHandler.php";
                            $clientHandler = ClientHandler::getClientHandlerInstance($cfg);
                            $clientHandler->startTorrentClient($file_name, 0);
                            // just 2 secs..
                            sleep(2);
                            if ($clientHandler->status == 3) {
                                // hooray
                                echo " done\n";
                            } else {
                                // start failed
                                echo "\n ERROR : " . $clientHandler->messages . "\n";
                            }
                        } else {
                            echo "\n ERROR: File could not be found or could not be copied: " . $watchDir . $file . "\n";
                        }
                    }
                }
                closedir($dirHandle);
            }
        } else {
            echo "ERROR: " . $tpath . " is not a dir.\n";
            exit;
        }
    } else {
        printUsage();
    }
    exit;
}
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:61,代码来源:fluxcli.php

示例9: printUsage

 * Prepare the PHP completions/docs for TextMate
 *
 * Usage: php generate.php <lang>
 * Example: php generate.php en
 *
 * This script will produce/modify the following files:
 *  - Support/functions.plist
 *  - Support/function-docs/<lang>.txt
 *  - Preferences/Completions.tmPreferences
 *  - Syntaxes/PHP.plist
 */
if (2 !== $argc) {
    printUsage('Must specify a two-letter language code (e.g., "en")');
} else {
    if (2 !== strlen($argv[1])) {
        printUsage('Language must be a two-letter code (e.g., "en")');
    }
}
$lang = strtolower($argv[1]);
$excludeSections = array('basic.other.geoip', 'basic.other.judy', 'basic.other.parsekit', 'basic.other.yaml', 'basic.php.apd', 'basic.php.bcompiler', 'basic.php.inclued', 'basic.php.runkit', 'basic.php.wincache', 'basic.session.msession', 'basic.session.session-pgsql', 'basic.text.bbcode', 'basic.text.ssdeep', 'basic.vartype.classkit', 'compression.lzf', 'compression.rar', 'creditcard.mcve', 'creditcard.spplus', 'crypto.crack', 'database.vendors.cubrid', 'database.vendors.dbase', 'database.vendors.dbplus', 'database.vendors.fbsql', 'database.vendors.filepro', 'database.vendors.ibm-db2', 'database.vendors.ifx', 'database.vendors.ingres', 'database.vendors.maxdb', 'database.vendors.msql', 'database.vendors.ovrimos', 'database.vendors.paradox', 'fileprocess.file.dio', 'fileprocess.file.inotify', 'fileprocess.file.xattr', 'fileprocess.file.xdiff', 'fileprocess.process.expect', 'fileprocess.process.libevent', 'international.fribidi', 'remote.auth.kadm5', 'remote.auth.radius', 'remote.mail.cyrus', 'remote.mail.mailparse', 'remote.mail.vpopmail', 'remote.other.chdb', 'remote.other.fam', 'remote.other.gearman', 'remote.other.gupnp', 'remote.other.hw', 'remote.other.hwapi', 'remote.other.java', 'remote.other.mqseries', 'remote.other.net-gopher', 'remote.other.nis', 'remote.other.notes', 'remote.other.ssh2', 'remote.other.stomp', 'remote.other.svn', 'remote.other.tcpwrap', 'remote.other.yaz', 'search.mnogosearch', 'search.solr', 'utilspec.audio.id3', 'utilspec.audio.openal', 'utilspec.cmdline.ncurses', 'utilspec.cmdline.newt', 'utilspec.image.cairo', 'utilspec.nontext.fdf', 'utilspec.nontext.gnupg', 'utilspec.nontext.ming', 'utilspec.nontext.pdf', 'utilspec.nontext.ps', 'utilspec.nontext.rpmreader', 'utilspec.nontext.swf', 'utilspec.windows.printer', 'utilspec.windows.w32api', 'utilspec.windows.win32ps', 'utilspec.windows.win32service', 'webservice.oauth', 'xml.qtdom');
/**
 * List of new->old sections, to ease with transition
 */
$sectionEquivalents = array('basic.other.misc' => 'basic_functions', 'basic.other.spl' => 'php_spl', 'basic.other.stream' => 'streamsfuncs', 'basic.php.outcontrol' => 'output', 'basic.text.pcre' => 'php_pcre', 'basic.text.regex' => 'ereg', 'basic.text.strings' => 'string', 'compression.bzip2' => 'bz2', 'compression.zip' => 'php_zip', 'database.abstract.uodbc' => 'php_odbc', 'database.vendors.ibase' => 'interbase', 'database.vendors.mssql' => 'php_mssql', 'fileprocess.file.filesystem' => 'file', 'math.bc' => 'bcmath', 'remote.mail.imap' => 'php_imap', 'remote.other.ftp' => 'php_ftp', 'utilspec.server.apache' => 'php_apache', 'xml.dom' => 'php_dom');
define('PHP_DOC_DIR', __DIR__ . '/.phpdoc');
if (!is_dir(PHP_DOC_DIR)) {
    mkdir(PHP_DOC_DIR);
}
chdir(PHP_DOC_DIR);
if (!is_dir('doc-base')) {
    runCmd('svn checkout http://svn.php.net/repository/phpdoc/doc-base/trunk ./doc-base');
开发者ID:joshvarner,项目名称:php.tmbundle,代码行数:31,代码来源:generate.php

示例10: Zend_Console_Getopt

try {
    $opts = new Zend_Console_Getopt(array('help|h' => 'Displays usage information.', 'overwrite|o' => 'Overwrite any existing config files.', 'preserve|p' => 'Keep any existing config files.', 'no-db|n' => 'Turn off database install.', 'reinstall|r' => 'Force a fresh install of this Airtime Version'));
    $opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    print $e->getMessage() . PHP_EOL;
    printUsage($opts);
    exit(1);
}
if (isset($opts->h)) {
    printUsage($opts);
    exit(1);
}
// The current version is already installed.
if (isset($version) && $version != false && $version == AIRTIME_VERSION && !isset($opts->r)) {
    echo "Airtime {$version} is already installed." . PHP_EOL;
    printUsage($opts);
    exit(1);
}
// A previous version exists - if so, upgrade.
if (isset($version) && $version != false && $version < AIRTIME_VERSION && !isset($opts->r)) {
    echo "Airtime version {$version} found." . PHP_EOL;
    require_once "airtime-upgrade.php";
    //Make sure to exit with non-zero error code so that airtime-install
    //shell script does not continue with installing pypo, show-recorder,
    //media-monitor etc.
    exit(2);
}
if ($version === false) {
    echo "A version of Airtime older than 1.7.0 detected, please upgrade to 1.7.0 first.\n";
    echo "You will then be able to upgrade to 1.9.0 using this installer.\n";
    exit(3);
开发者ID:romansavrulin,项目名称:Airtime,代码行数:31,代码来源:airtime-install.php

示例11: printUsage

function printUsage($error = null)
{
    echo "PoC Migration tool (ivasilchev) \n";
    echo $error;
    echo "Usage : migrate < up | down > <migration name> \n";
    echo "Example: migrate up special-days \n";
    echo "\n";
    exit;
}
if ($argc < 3) {
    printUsage("Not enough paramteres");
}
if (in_array($argv[1], ['up', 'down']) == false) {
    echo "------{$argv[2]}-----";
    printUsage("Error: Invalid parameter - migration step must be 'up' or 'down'");
}
if (in_array($argv[2], array_keys($aliases)) == false) {
    printUsage("Error: Unknown migration alias " . $argv[3] . "\n" . "Available migrations: " . implode(',', array_keys($aliases)));
}
$migration = new $aliases[$argv[2]]['class']();
$executor = new Executor(include_once 'dbconfig.php');
switch ($argv[1]) {
    case 'up':
        $executor->executeUp($migration);
        break;
    case 'down':
        $executor->executeDown($migration);
        break;
    default:
        exit('Unexpected input for migration type :' . $argv[1]);
}
开发者ID:ivasilchev,项目名称:foodora-test,代码行数:31,代码来源:migrate.php

示例12: tailSpecificLog

function tailSpecificLog($key)
{
    global $log_files;
    if (isKeyValid($key)) {
        echo "Tail {$key} log";
        pcntl_exec(exec("which tail"), array("-F", $log_files[$key]));
        pcntl_wait($status);
    } else {
        printUsage();
    }
}
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:11,代码来源:airtime-log.php

示例13: parseArguments

/**
 * Parses (and checks some) command line arguments
 */
function parseArguments()
{
    global $checkOptions, $cmdargs, $checksEnabled, $periods, $periodsEnabled, $argc, $argv;
    if ($argc == 1) {
        printUsage(true);
        exit(STATUS_UNKNOWN);
    }
    $i = 1;
    while ($i < $argc) {
        if ($argv[$i][0] != '-') {
            $i++;
            continue;
        }
        //disabling or enabling checks
        if (substr($argv[$i], 2, 8) == 'disable-' || substr($argv[$i], 2, 7) == 'enable-') {
            $op = substr($argv[$i], 2, 7) == "disable" ? 0 : 1;
            $check = $op ? substr($argv[$i], 9) : substr($argv[$i], 10);
            if ($check == "all") {
                foreach ($checkOptions as $key => $check) {
                    $checksEnabled[$key] = $op;
                }
            } else {
                if (in_array($check, $checkOptions)) {
                    $checksEnabled[$checkOptions[$check]] = $op;
                } else {
                    _log(sprintf("ERR: Unknown option %s. Use help for more details.", $argv[$i]), LOG__ERROR);
                    exit(STATUS_UNKNOWN);
                }
            }
            $i++;
            continue;
        }
        if (substr($argv[$i], 2) == "help") {
            $argv[$i] = '-h';
        }
        switch ($argv[$i][1]) {
            case 'V':
                printVersion();
                exit(STATUS_OK);
                break;
            case 'v':
                $cmdargs['log_level'] = LOG__VERBOSE;
                $i++;
                break;
            case 'd':
                $cmdargs['log_level'] = LOG__DEBUG;
                $i++;
                break;
            case 'c':
                $cmdargs['configFile'] = $argv[$i + 1];
                if (isset($argv[$i + 2])) {
                    $periodsEnabled = array();
                    while (isset($argv[$i + 2])) {
                        if (in_array($argv[$i + 2], $periods)) {
                            $periodsEnabled[] = $argv[$i + 2];
                            $i++;
                        } else {
                            if ($argv[$i + 2][0] != "-") {
                                _log("Bad period provided. Use help for more details.", LOG__ERROR);
                                exit(STATUS_UNKNOWN);
                            } else {
                                break;
                            }
                        }
                    }
                }
                $i++;
                break;
            case 'h':
            case '?':
                printHelp();
                exit(STATUS_OK);
                break;
            default:
                $i++;
        }
    }
    //check the configuration file
    if (!file_exists($cmdargs['configFile']) || !is_readable($cmdargs['configFile'])) {
        _log(sprintf("Configuration file [%s] does not exist or cannot be read.", $cmdargs['configFile']), LOG__ERROR);
        exit(STATUS_UNKNOWN);
    }
}
开发者ID:sdouce,项目名称:nagios-plugins,代码行数:86,代码来源:check_rsnapshot.php

示例14: getClassesStats

     * @return array
     */
    public function getClassesStats()
    {
        return $this->_aStats;
    }
}
function printUsage($arg)
{
    echo 'Usage: php ' . basename($arg) . ' MetricsXml' . PHP_EOL;
    echo '    MetricsXml    - Metrics in PDepend xml format' . PHP_EOL;
    echo PHP_EOL;
    die("");
}
if (!isset($argv["1"]) || !$argv["1"]) {
    printUsage($argv["0"]);
}
$sMetricsXml = $argv["1"];
try {
    $oMetrics = new Metrics($sMetricsXml);
    if ($oMetrics->isExistingMetricsFile()) {
        $oMetrics->read();
        echo "Total Avg ccn\t= " . round($oMetrics->getTotalAverageCCN(), 3) . " (max: " . $oMetrics->getMaxCCN() . ")" . PHP_EOL;
        echo "Total Avg crap\t= " . round($oMetrics->getTotalAverageCrapIndex(), 3) . " (max: " . $oMetrics->getMaxCrapIndex() . ")" . PHP_EOL;
        echo "Total Avg NPath\t= " . round($oMetrics->getTotalAverageNPath(), 3) . " (max: " . $oMetrics->getMaxNPath() . ")" . PHP_EOL;
        echo "Total LLOC\t= " . $oMetrics->getTotalLLOC() . " (max: " . $oMetrics->getMaxLLOC() . ")" . PHP_EOL . PHP_EOL;
        $aStats = $oMetrics->getClassesStats();
        foreach ($aStats as $sClass => $aClass) {
            echo "Total for {$sClass}" . PHP_EOL;
            echo "\tAvg ccn \t= " . round($aClass['stat']['cnn'], 3) . " (max: " . $aClass['max']['cnn'] . ")" . PHP_EOL;
            echo "\tAvg crap\t= " . round($aClass['stat']['crap'], 3) . " (max: " . $aClass['max']['crap'] . ")" . PHP_EOL;
开发者ID:suabo,项目名称:oxid_modules_config,代码行数:31,代码来源:MC_Metrics.php


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