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


PHP mnet_peer::commit方法代码示例

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


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

示例1: elseif

                    exit;
                }
            }
        } else {
            $credentials = $mnet_peer->check_credentials($mnet_peer->public_key);
        }
        // PREVENT DUPLICATE RECORDS ///////////////////////////////////////////
        if ('input' == $form->step) {
            if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
                print_error("hostexists", 'mnet', 'peers.php?step=update&hostid=' . $mnet_peer->id, $mnet_peer->id);
            }
        }
        if ('input' == $form->step) {
            include './mnet_review.html';
        } elseif ('commit' == $form->step) {
            $bool = $mnet_peer->commit();
            if ($bool) {
                redirect('peers.php?step=update&hostid=' . $mnet_peer->id, get_string('changessaved'));
            } else {
                print_error('invalidaction', 'error', 'index.php');
            }
        }
    }
} elseif (is_int($hostid)) {
    $mnet_peer = new mnet_peer();
    $mnet_peer->set_id($hostid);
    $currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
    if ($currentkey == $mnet_peer->public_key) {
        unset($currentkey);
    }
    $form = new stdClass();
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:peers.php

示例2: array

         if ($peer->id == $CFG->mnet_all_hosts_id || $peer->id == $CFG->mnet_localhost_id) {
             continue;
         }
         $application = $DB->get_record('mnet_application', array('id' => $peer->applicationid));
         $mnet_peer = new mnet_peer();
         $mnet_peer->set_wwwroot($peer->wwwroot);
         // get the sessions for each vmoodle that have same ID Number
         // we use a force parameter to force fetching the key remotely anyway
         $currentkey = mnet_get_public_key($mnet_peer->wwwroot, $application, 1);
         if ($currentkey) {
             $mnet_peer->public_key = clean_param($currentkey, PARAM_PEM);
             $mnet_peer->updateparams = new StdClass();
             $mnet_peer->updateparams->public_key = clean_param($currentkey, PARAM_PEM);
             $mnet_peer->public_key_expires = $mnet_peer->check_common_name($currentkey);
             $mnet_peer->updateparams->public_key_expires = $mnet_peer->check_common_name($currentkey);
             $mnet_peer->commit();
             mtrace('My key renewed at ' . $peer->wwwroot . ' till ' . userdate($mnet_peer->public_key_expires));
             $trace .= userdate(time()) . ' KEY RENEW from ' . $CFG->wwwroot . ' to ' . $peer->wwwroot . " suceeded\n";
         } else {
             mtrace('Failed renewing key with ' . $peer->wwwroot . "\n");
             $trace .= userdate(time()) . ' KEY RENEW from ' . $CFG->wwwroot . ' to ' . $peer->wwwroot . " failed\n";
         }
     }
 }
 set_config('mnet_autorenew_haveto', 0);
 $trace .= userdate(time()) . ' RESET KEY RENEW on ' . $CFG->wwwroot . "\n";
 /// record trace in trace file
 if ($CFG->tracevmoodlekeyrenew) {
     if ($TRACE = fopen($CFG->dataroot . '/vmoodle_renew.log', 'w+')) {
         fputs($TRACE, $trace);
         fclose($TRACE);
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:31,代码来源:mnetcron.php

示例3: mnet_keyswap

/**
 * Accepts a public key from a new remote host and returns the public key for
 * this host. If 'register all hosts' is turned on, it will bootstrap a record
 * for the remote host in the mnet_host table (if it's not already there)
 *
 * @param  string  $function      XML-RPC requires this but we don't... discard!
 * @param  array   $params        Array of parameters
 *                                $params[0] is the remote wwwroot
 *                                $params[1] is the remote public key
 * @return string                 The XML-RPC response
 */
function mnet_keyswap($function, $params) {
    global $CFG;
    $return = array();
    $mnet = get_mnet_environment();

    if (!empty($CFG->mnet_register_allhosts)) {
        $mnet_peer = new mnet_peer();
        @list($wwwroot, $pubkey, $application) = each($params);
        $keyok = $mnet_peer->bootstrap($wwwroot, $pubkey, $application);
        if ($keyok) {
            $mnet_peer->commit();
        }
    }
    return $mnet->public_key;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:26,代码来源:serverlib.php

示例4: array

$strpreview = get_string("preview");
$strchoose = get_string("choose");
$strinfo = get_string("info");
$strtheme = get_string("theme");
$strthemesaved = get_string("themesaved");
$strscreenshot = get_string("screenshot");
$stroldtheme = get_string("oldtheme");
$report = array();
$unlikely_name = 'ZoqZoqZ';
// Something unlikely to ever be a theme name
if ($choose) {
    if (confirm_sesskey()) {
        if ($choose == $unlikely_name) {
            $mnet_peer->force_theme = 1;
            $mnet_peer->theme = '';
            if ($mnet_peer->commit()) {
                $report = array(get_string('themesaved'), 'informationbox');
            } else {
                $report = array(get_string('themesavederror', 'mnet'), 'errorbox');
            }
        } elseif (!is_dir($CFG->themedir . '/' . $choose) || !file_exists($CFG->themedir . '/' . $choose . '/config.php')) {
            echo 'CHOOSE -' . $choose . ' ' . $CFG->themedir . '/' . $choose . '/config.php';
            $report = array('This theme is not installed!' . '3', 'errorbox');
        } else {
            $mnet_peer->force_theme = 1;
            $mnet_peer->theme = $choose;
            if ($mnet_peer->commit()) {
                $report = array(get_string('themesaved') . '1', 'informationbox');
            } else {
                $report = array(get_string('themesavederror', 'mnet') . '2', 'errorbox');
            }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:mnet_themes.php

示例5: mnet_keyswap

/**
 * Accepts a public key from a new remote host and returns the public key for
 * this host. If 'register all hosts' is turned on, it will bootstrap a record
 * for the remote host in the mnet_host table (if it's not already there)
 * 
 * @param  string  $function      XML-RPC requires this but we don't... discard!
 * @param  array   $params        Array of parameters
 *                                $params[0] is the remote wwwroot
 *                                $params[1] is the remote public key
 * @return string                 The XML-RPC response
 */
function mnet_keyswap($function, $params)
{
    global $CFG, $MNET;
    $return = array();
    if (!empty($CFG->mnet_register_allhosts)) {
        $mnet_peer = new mnet_peer();
        $keyok = $mnet_peer->bootstrap($params[0], $params[1]);
        if ($keyok) {
            $mnet_peer->commit();
        }
    }
    return $MNET->public_key;
}
开发者ID:veritech,项目名称:pare-project,代码行数:24,代码来源:server.php

示例6: mnetadmin_keyswap

/**
 * NOT WORKING
 * reimplementation of system.keyswapcall with capability of forcing the local renew
 *
 */
function mnetadmin_keyswap($function, $params)
{
    global $CFG, $MNET;
    $return = array();
    $wwwroot = $params[0];
    $pubkey = $params[1];
    $application = $params[2];
    $forcerenew = $params[3];
    if ($forcerenew == 0) {
        // standard keyswap for first key recording
        if (!empty($CFG->mnet_register_allhosts)) {
            $mnet_peer = new mnet_peer();
            $keyok = $mnet_peer->bootstrap($wwwroot, $pubkey, $application);
            if ($keyok) {
                $mnet_peer->commit();
            }
        }
    } else {
        $mnet_peer = new mnet_peer();
        // we can only renew hosts that we know something about.
        if ($mnet_peer->set_wwwroot($wwwroot)) {
            $mnet_peer->public_key = clean_param($pubkey, PARAM_PEM);
            $mnet_peer->public_key_expires = $mnet_peer->check_common_name($pubkey);
            $mnet_peer->updateparams->public_key = clean_param($pubkey, PARAM_PEM);
            $mnet_peer->updateparams->public_key_expires = $mnet_peer->check_common_name($pubkey);
            $mnet_peer->commit();
        } else {
            return false;
            // avoid giving our key to unkown hosts.
        }
    }
    return $MNET->public_key;
}
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:38,代码来源:rpclib.php


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