本文整理汇总了PHP中print_msg函数的典型用法代码示例。如果您正苦于以下问题:PHP print_msg函数的具体用法?PHP print_msg怎么用?PHP print_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_args
/**
* returns a BenchmarkArchiver object based on command line arguments
* @return BenchmarkArchiver
*/
public static function &getArchiver()
{
$archiver = NULL;
$options = parse_args(array('store:', 'store_container:', 'store_endpoint:', 'store_insecure', 'store_key:', 'store_prefix:', 'store_public', 'store_region:', 'store_secret:', 'v' => 'verbose'), NULL, 'save_');
merge_options_with_config($options, BenchmarkDb::BENCHMARK_DB_CONFIG_FILE);
$impl = 'BenchmarkArchiver';
switch ($options['store']) {
case 'azure':
$impl .= 'Azure';
break;
case 'google':
$impl .= 'Google';
break;
case 's3':
$impl .= 'S3';
break;
default:
$err = '--store ' . $options['store'] . ' is not valid';
break;
}
// invalid --store argument
if (isset($err)) {
print_msg($err, isset($options['verbose']), __FILE__, __LINE__, TRUE);
return $archiver;
}
require_once sprintf('%s/%s.php', dirname(__FILE__), $impl);
$archiver = new $impl($options);
$archiver->options = $options;
if (!$archiver->validate()) {
$archiver = NULL;
}
return $archiver;
}
示例2: print_deck_select_table
function print_deck_select_table($table, $attributes, $constraints)
{
array_push($attributes, "id");
#array_push($attributes, "delete");
#var_dump($constraints);
$attr_list_str = implode(', ', $attributes);
$query = "SELECT {$attr_list_str} FROM {$table}";
if (!empty($constraints)) {
$cons_str = mysql_where_str($constraints);
$query .= " WHERE {$cons_str}";
}
#$query .= ";";
$query .= " ORDER BY name;";
#print_msg($query);
$result = mysql_query($query);
$num = @mysql_numrows($result);
print_msg("total = {$num}");
if ($num == 0) {
return;
}
echo "<table>";
echo "<tr>";
array_push($attributes, "delete");
foreach ($attributes as $attr) {
if ($attr != "id") {
echo "<th>";
echo $attr;
echo "</th>";
}
}
echo "</tr>";
$i = 0;
while ($i < $num) {
$id = mysql_result($result, $i, "id");
echo "<tr id=\"{$id}\">";
foreach ($attributes as $attr) {
if ($attr == "delete") {
echo "<td>";
echo "<button name=\"{$id}\">delete</button>";
echo "</td>";
} else {
if ($attr != "id") {
$value = mysql_result($result, $i, $attr);
echo "<td>";
if ($attr == "link") {
echo "<a href=\"{$value}\">";
echo $value;
echo "</a>";
} else {
echo mysql_result($result, $i, $attr);
}
echo "</td>";
}
}
}
echo "</tr>";
$i++;
}
echo "</table>";
}
示例3: insert_deck_data
function insert_deck_data($dir)
{
global $DECK_TABLE_NAME;
$files = scandir($dir);
$data = array();
$card = array();
foreach ($files as $file_name) {
if ($file_name == "." || $file_name == "..") {
continue;
}
$data["id"] = $file_name;
$deck_file = read_file("{$dir}/{$file_name}");
$deck_file_line_arr = explode("\n", $deck_file);
$deck_head_arr = array_slice($deck_file_line_arr, 0, 3);
$deck_card_arr = array_slice($deck_file_line_arr, 4);
$result = deck_get_name_and_creator($deck_head_arr[0]);
$data["name"] = $result[0];
$data["creator"] = $result[1];
$data["link"] = $deck_head_arr[1];
$data["class"] = deck_get_class($deck_head_arr[2]);
$card = deck_get_cards($deck_card_arr);
$data["num"] = deck_count_card($card);
$new_table_name = create_new_deck($data, $card);
print_msg("create {$new_table_name}");
}
}
示例4: login
function login($id, $passwd, $url)
{
$dbh = dbconnect();
$query = "select mem_id,mem_pw from member_data where mem_id='{$id}'";
$sth = dbquery($dbh, $query);
if (!$sth) {
print_msg(mysql_error());
}
list($mem_id, $mem_pw) = dbselect($sth);
dbclose($dbh);
if (!$mem_id) {
print_alert("해당 ID가 없습니다. ", 'back');
} elseif ($mem_pw != $passwd) {
print_alert("비밀번호가 틀립니다. ", 'back');
} else {
setcookie("MemberID", $mem_id);
header("Location: {$url}");
}
return;
}
示例5: check_idnum
function check_idnum($idnum)
{
if (!check_idnum_syntax($idnum)) {
print_msg("주민등록가 잘못되었습니다.<br>정확히 입력하세요.", 'check_idnum', -1);
}
$dbh = dbconnect();
$idnum2 = substr($idnum, 0, 6) . "-" . substr($idnum, 6, 7);
$query = "select mem_idnum from member_data where mem_idnum='{$idnum2}'";
$sth = dbquery($dbh, $query);
if (!$sth) {
print_msg(mysql_error());
}
list($mem_idnum) = dbselect($sth);
dbclose($dbh);
if ($mem_idnum == $idnum2) {
return false;
} else {
return true;
}
}
示例6: print_card_select_table
function print_card_select_table($table, $attributes, $constraints)
{
#var_dump($constraints);
$attr_list_str = implode(', ', $attributes);
$query = "SELECT {$attr_list_str} FROM {$table}";
if (!empty($constraints)) {
$cons_str = mysql_where_str($constraints);
$query .= " WHERE {$cons_str}";
}
$query .= ";";
#print_msg($query);
$result = mysql_query($query);
$num = @mysql_numrows($result);
print_msg("total = {$num}");
if ($num == 0) {
return;
}
echo "<table>";
echo "<tr>";
foreach ($attributes as $attr) {
echo "<th>";
echo $attr;
echo "</th>";
}
echo "</tr>";
$i = 0;
while ($i < $num) {
echo "<tr>";
foreach ($attributes as $attr) {
echo "<td>";
echo mysql_result($result, $i, $attr);
echo "</td>";
}
echo "</tr>";
$i++;
}
echo "</table>";
}
示例7: validate
/**
* validation method - may be overriden by sub-classes, but parent method
* should still be invoked. returns TRUE if db options are valid, FALSE
* otherwise
* @return boolean
*/
protected function validate()
{
if ($valid = parent::validate()) {
if (!isset($this->options['db_name'])) {
$valid = FALSE;
print_msg('--db_name argument is required for --db bigquery', isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
} else {
if ($this->bq() !== NULL) {
$valid = TRUE;
print_msg('BigQuery connection successful', isset($this->options['verbose']), __FILE__, __LINE__);
} else {
print_msg('BigQuery connection failed', isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
}
}
return $valid;
}
示例8: validate
/**
* validation method - may be overriden by sub-classes, but parent method
* should still be invoked. returns TRUE if db options are valid, FALSE
* otherwise
* @return boolean
*/
protected function validate()
{
if (!isset($this->valid) && parent::validate()) {
$this->valid = TRUE;
$validate = array('db_librato_color' => array('color' => TRUE), 'db_librato_display_max' => array('min' => 0), 'db_librato_display_min' => array('min' => 0), 'db_librato_period' => array('min' => 0), 'db_librato_type' => array('option' => array('counter', 'gauge')), 'db_user' => array('required' => TRUE), 'db_pswd' => array('required' => TRUE));
if ($validated = validate_options($this->options, $validate)) {
$this->valid = FALSE;
foreach ($validated as $param => $err) {
print_msg(sprintf('--%s is not valid: %s', $param, $err), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
} else {
$valueCol = 'db_librato_value';
if (!isset($this->options['db_librato_value'])) {
$valueCol = 'db_librato_count';
if (!isset($this->options['db_librato_count']) || !isset($this->options['db_librato_sum'])) {
$this->valid = FALSE;
print_msg(sprintf('If --db_librato_value is not set, both --db_librato_count and --db_librato_sum MUST be specified'), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
} else {
if (count($this->options['db_librato_count']) != count($this->options['db_librato_sum'])) {
$this->valid = FALSE;
print_msg(sprintf('--db_librato_count and --db_librato_sum must be repeated the same number of times'), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
} else {
if (isset($this->options['db_librato_name']) && count($this->options['db_librato_name']) != count($this->options['db_librato_count'])) {
$this->valid = FALSE;
print_msg(sprintf('--db_librato_name and --db_librato_count must be repeated the same number of times'), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
}
}
} else {
if (isset($this->options['db_librato_name']) && count($this->options['db_librato_name']) != count($this->options['db_librato_value'])) {
$this->valid = FALSE;
print_msg(sprintf('--db_librato_name and --db_librato_value must be repeated the same number of times'), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
} else {
if (isset($this->options['db_librato_count']) || isset($this->options['db_librato_sum']) || isset($this->options['db_librato_max']) || isset($this->options['db_librato_min']) || isset($this->options['db_librato_sum_squares'])) {
$this->valid = FALSE;
print_msg(sprintf('--db_librato_value cannot be set with --db_librato_count, --db_librato_sum, --db_librato_max, --db_librato_min or --db_librato_sum_squares because these parameters are mutually exclusive'), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
}
}
if ($this->valid) {
foreach (array('db_librato_aggregate', 'db_librato_color', 'db_librato_count', 'db_librato_description', 'db_librato_display_max', 'db_librato_display_min', 'db_librato_display_name', 'db_librato_display_units_long', 'db_librato_display_units_short', 'db_librato_display_stacked', 'db_librato_display_transform', 'db_librato_max', 'db_librato_min', 'db_librato_measure_time', 'db_librato_period', 'db_librato_source', 'db_librato_sum', 'db_librato_summarize_function', 'db_librato_sum_squares', 'db_librato_type') as $param) {
if (isset($this->options[$param]) && count($this->options[$param]) != count($this->options[$valueCol]) && count($this->options[$param]) != 1) {
$this->valid = FALSE;
print_msg(sprintf('--%s can only be set once or %d times (once for each --%s)', $param, count($this->options[$valueCol]), $valueCol), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
}
}
}
if ($this->valid) {
// validate credentials using GET request
$curl = ch_curl(self::LIBRATO_METRICS_API_URL, 'GET', NULL, NULL, sprintf('%s:%s', $this->options['db_user'], $this->options['db_pswd']), '200-299', TRUE);
$this->valid = ($response = json_decode($curl, TRUE)) ? TRUE : FALSE;
if ($curl === NULL) {
print_msg(sprintf('Librato API GET request to %s failed', self::LIBRATO_METRICS_API_URL), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
} else {
if ($curl === FALSE) {
print_msg(sprintf('Librato API GET request to %s resulted in non 200 response code - API credentials may be invalid', self::LIBRATO_METRICS_API_URL), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
} else {
if ($curl && !$response) {
print_msg(sprintf('Librato API GET request to %s successful, but body did not contain valid JSON', self::LIBRATO_METRICS_API_URL), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
} else {
print_msg(sprintf('Librato API GET request to %s successful. There are %d existing metrics', self::LIBRATO_METRICS_API_URL, count($response['metrics'])), isset($this->options['verbose']), __FILE__, __LINE__);
}
}
}
}
}
return $this->valid;
}
示例9: meusdados_entries
function meusdados_entries()
{
$name = FrontUser::name();
$theme_opts = get_option('marisa_options');
$site_url = site_url();
$change_passord = FrontUser::uid() ? '' : <<<HTML
<p class='bold'>Alterar Senha</p>
<label for="senhaatual">Senha atual: <input id="senha_atual" name="senha_atual" type="password" class="half" /></label>
<label for="senha">Nova senha: <input id="senha" name="user_senha" type="password" class="half" /></label>
<label for="repetirsenha">Repita a senha: <input id="repetirsenha" name="repetirsenha" type="password" class="half" /></label>
HTML;
$html = "";
$html .= "<p>" . $theme_opts['marisa_cadastrese_descricao'] . "</p>";
$html .= "<div class='col1'>";
$html .= print_msg();
$html .= <<<HTML
<form id="signup-form" class="edit-info-form" name="cadastro" action="" method="post"/>
<label for="name">Nome: <input name="user_name" value="{$name}" type="text" required/></label>
{$change_passord}
<input name="update_info" type="hidden" value="1"/>
<button type="submit"><ico class="sprite-cadastrese"></ico>SALVAR ALTERAÇÕES</button>
<a class="button" href="{$site_url}/?front_user_logout=true"><ico class="sprite-logoff"></ico>FAZER LOGOFF</a>
</form>
</div>
<div class='col2'>
HTML;
if (isset($theme_opts[marisa_call_sign_fd]) && strlen($theme_opts[marisa_call_sign_fd]) > 0) {
$html .= "<img src='" . $theme_opts[marisa_call_sign_fd] . "' title=''/>";
}
$html .= "</div>";
return $html;
}
示例10: array
$table2_attr = array();
$table1_attr["id"] = "id";
$table1_attr["num"] = "num1";
$table2_attr["num"] = "num2";
$join_attr["id"] = "id";
$sub_query_1 = mysql_join_str($join_attr, $table1, $table1_attr, $table2, $table2_attr, "LEFT");
$table1_attr = array();
$table2_attr = array();
$table1_attr["num"] = "num1";
$table2_attr["id"] = "id";
$table2_attr["num"] = "num2";
$join_attr["id"] = "id";
$sub_query_2 = mysql_join_str($join_attr, $table1, $table1_attr, $table2, $table2_attr, "RIGHT");
$sub_query = "{$sub_query_1} UNION {$sub_query_2}";
#$sub_query = "SELECT Deck_mage_1.id AS id, Deck_mage_1.num AS num1, Deck_mage_2.num AS num2 FROM Deck_mage_1 LEFT JOIN Deck_mage_2 ON Deck_mage_1.id = Deck_mage_2.id UNION SELECT Deck_mage_2.id AS id, Deck_mage_1.num AS num1, Deck_mage_2.num AS num2 FROM Deck_mage_1 RIGHT JOIN Deck_mage_2 ON Deck_mage_1.id = Deck_mage_2.id";
print_msg($sub_query);
$show_attr = array("num1", "num2");
$show_attr = array_merge($show_attr, $CARD_TABLE_SHOW_ATTR);
$show_str = implode(', ', $show_attr);
#$show_str = implode(', ', $CARD_TABLE_SHOW_ATTR);
#$sub_query = "SELECT $table1.id AS id, $table1.num AS num1, $table2.num AS num2 FROM $table1 INNER JOIN $table2 ON $table1.id = $table2.id";
$query = "SELECT {$show_str} FROM {$CARD_TABLE_NAME} INNER JOIN ({$sub_query}) sub ON {$CARD_TABLE_NAME}.id = sub.id;";
#$query = "SELECT * FROM $table1 NATURAL JOIN SELECT * FROM $table2;";
#print_msg($sub_query);
#print_msg($query);
$result = mysql_query($query);
#print_relation($result, array("id", "num"));
#print_relation($result, $CARD_TABLE_SHOW_ATTR);
print_relation($result, $show_attr);
#$query = "SELECT * FROM $table1 WHERE id NOT IN (SELECT id FROM $table2);";
#echo $query;
示例11: validate
/**
* validation method - may be overriden by sub-classes, but parent method
* should still be invoked. returns TRUE if db options are valid, FALSE
* otherwise
* @return boolean
*/
protected function validate()
{
if ($valid = parent::validate()) {
if (isset($this->options['db_host'])) {
if ($valid = ch_curl($this->getUrl(), 'HEAD', $this->getHeaders(), NULL, $this->getAuth())) {
print_msg('Successfully validated callback using HEAD request', isset($this->options['verbose']), __FILE__, __LINE__);
} else {
print_msg('Unable to validate callback using HEAD request', isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
} else {
$valid = FALSE;
print_msg('--db_host argument is required for --db callback', isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
}
return $valid;
}
示例12: validate
/**
* validation method - must be implemented by subclasses. Returns TRUE if
* archiver options are valid, FALSE otherwise
* @return boolean
*/
protected function validate()
{
if ($valid = isset($this->options['store_key']) && isset($this->options['store_secret']) && isset($this->options['store_container'])) {
$valid = FALSE;
print_msg(sprintf('Validating GCS connection using --store_key %s, --store_container %s', $this->options['store_key'], $this->options['store_container']), isset($this->options['verbose']), __FILE__, __LINE__);
$curl = ch_curl($this->getUrl(), 'HEAD', $this->getHeaders(), NULL, NULL, '200,404');
if ($curl === 200) {
$valid = TRUE;
print_msg(sprintf('GCS authentication and bucket validation successful'), __FILE__, __LINE__);
} else {
if ($curl === 404) {
print_msg(sprintf('GCS authentication successful but bucket %s does not exist', $this->options['store_container']), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
} else {
print_msg(sprintf('GCS authentication failed'), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
}
} else {
print_msg(sprintf('--store_key, --store_secret and --store_container are required'), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
return $valid;
}
示例13: merge_options_with_config
/**
* merges config options into $options
* @param array $options the options to merge into
* @param string $config the config file to merge with
* @return void
*/
function merge_options_with_config(&$options, $config)
{
foreach (explode("\n", shell_exec('cat ' . $config . ' 2>/dev/null')) as $line) {
if (substr(trim($line), 0, 1) == '#') {
continue;
}
if (preg_match('/([A-Za-z_]+)\\s*=?\\s*(.*)$/', $line, $m) && !isset($options[$key = strtolower($m[1])])) {
print_msg(sprintf('Added option %s=%s from config %s', $key, preg_match('/pswd/', $key) || preg_match('/key/', $key) ? '***' : $m[2], $config), isset($options['verbose']), __FILE__, __LINE__);
$options[$key] = $m[2] ? trim($m[2]) : TRUE;
}
}
}
示例14: wdpc
/**
* Performs workload dependent preconditioning - this method must be
* implemented by sub-classes. It should return one of the following
* values:
* TRUE: preconditioning successful and steady state achieved
* FALSE: preconditioning successful but steady state not achieved
* NULL: preconditioning failed
* @return boolean
*/
public function wdpc()
{
$status = NULL;
if ($this->bs !== NULL) {
$bs = $this->bs;
$status = NULL;
if ($this->purgeAndPrecondition) {
print_msg(sprintf('Repeating purge and workload independent preconditioning'), $this->verbose, __FILE__, __LINE__);
$this->purge();
$this->wipc($bs);
}
print_msg(sprintf('Initiating %s workload dependent preconditioning and steady state for THROUGHPUT test', $this->bs), $this->verbose, __FILE__, __LINE__);
$max = $this->options['ss_max_rounds'];
$workloads = $this->filterWorkloads(array('100/0', '0/100'));
$ssMetrics = array();
for ($x = 1; $x <= $max; $x++) {
foreach ($workloads as $rw) {
$name = sprintf('x%d-%s-%s-seq', $x, str_replace('/', '_', $rw), $bs);
print_msg(sprintf('Executing sequential THROUGHPUT test iteration for round %d of %d, workload %s and block size %s', $x, $max, $rw, $bs), $this->verbose, __FILE__, __LINE__);
if ($fio = $this->fio(array('blocksize' => $bs, 'name' => $name, 'runtime' => $this->options['wd_test_duration'], 'rw' => $rw == '100/0' ? 'read' : 'write', 'time_based' => FALSE), 'wdpc')) {
print_msg(sprintf('Sequential THROUGHPUT test iteration for round %d of %d, workload %s and block size %s was successful', $x, $max, $rw, $bs), $this->verbose, __FILE__, __LINE__);
$results = $this->fio['wdpc'][count($this->fio['wdpc']) - 1];
} else {
print_msg(sprintf('Random IO test iteration for round %d of %d, rw ratio %s and block size %s failed', $x, $max, $rw, $bs), $this->verbose, __FILE__, __LINE__, TRUE);
break;
}
if ($rw == '0/100') {
$bw = round($results['jobs'][0]['write']['bw'] / 1024, 2);
print_msg(sprintf('Added BW metric %s MB/s for steady state verification', $bw), $this->verbose, __FILE__, __LINE__);
$ssMetrics[$x] = $bw;
// check for steady state
if ($x >= 5) {
$metrics = array();
for ($i = 4; $i >= 0; $i--) {
$metrics[$x - $i] = $ssMetrics[$x - $i];
}
print_msg(sprintf('Test iteration for round %d of %d complete and >= 5 rounds finished - checking if steady state has been achieved using %s THROUGHPUT metrics [%s],[%s]', $x, $max, count($metrics), implode(',', array_keys($metrics)), implode(',', $metrics)), $this->verbose, __FILE__, __LINE__);
if ($this->isSteadyState($metrics, $x)) {
print_msg(sprintf('Steady state achieved - %s testing will stop', $bs), $this->verbose, __FILE__, __LINE__);
$status = TRUE;
} else {
print_msg(sprintf('Steady state NOT achieved'), $this->verbose, __FILE__, __LINE__);
}
// end of the line => last test round and steady state not achieved
if ($x == $max && $status === NULL) {
$status = FALSE;
}
}
}
if (!$fio || $status !== NULL) {
break;
}
}
if (!$fio || $status !== NULL) {
break;
}
}
// set wdpc attributes
$this->wdpc = $status;
$this->wdpcComplete = $x;
$this->wdpcIntervals = count($workloads);
} else {
foreach (array_keys($this->subtests) as $i => $bs) {
print_msg(sprintf('Starting workload dependent preconditioning for throughput block size %s (%d of %d)', $bs, $i + 1, count($this->subtests)), $this->verbose, __FILE__, __LINE__);
$status = $this->subtests[$bs]->wdpc();
foreach (array_keys($this->subtests[$bs]->fio) as $step) {
if (!isset($this->fio[$step])) {
$this->fio[$step] = array();
}
foreach ($this->subtests[$bs]->fio as $job) {
$this->fio[$step][] = $job;
}
}
if ($status === NULL) {
break;
}
}
}
return $status;
}
示例15: validateDependencies
/**
* validates dependencies for the chosen benchmark db. returns TRUE if
* present, FALSE otherwise
* @return boolean
*/
private final function validateDependencies()
{
$dependencies = array();
if (isset($this->options['db'])) {
switch ($this->options['db']) {
case 'bigquery':
$dependencies['bq'] = 'Google Cloud SDK';
break;
case 'callback':
case 'librato':
$dependencies['curl'] = 'curl';
break;
case 'mysql':
$dependencies['mysql'] = 'mysql';
break;
case 'postgresql':
$dependencies['psql'] = 'postgresql';
break;
default:
$err = '--db ' . $options['db'] . ' is not valid';
break;
}
}
if ($this->archiver) {
$dependencies['curl'] = 'curl';
}
if ($dependencies = validate_dependencies($dependencies)) {
foreach ($dependencies as $dependency) {
print_msg(sprintf('Missing dependence %s', $dependency), isset($this->options['verbose']), __FILE__, __LINE__, TRUE);
}
}
return count($dependencies) > 0 ? FALSE : TRUE;
}