本文整理汇总了PHP中PMA_Replication_Slave_control函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Replication_Slave_control函数的具体用法?PHP PMA_Replication_Slave_control怎么用?PHP PMA_Replication_Slave_control使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_Replication_Slave_control函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_Replication_Slave_changeMaster
/**
* Changes master for replication slave
*
* @param string $user replication user on master
* @param string $password password for the user
* @param string $host master's hostname or IP
* @param int $port port, where mysql is running
* @param array $pos position of mysql replication,
* array should contain fields File and Position
* @param bool $stop shall we stop slave?
* @param bool $start shall we start slave?
* @param mixed $link mysql link
*
* @return string output of CHANGE MASTER mysql command
*/
function PMA_Replication_Slave_changeMaster($user, $password, $host, $port, $pos, $stop = true, $start = true, $link = null)
{
if ($stop) {
PMA_Replication_Slave_control("STOP", null, $link);
}
$out = $GLOBALS['dbi']->tryQuery('CHANGE MASTER TO ' . 'MASTER_HOST=\'' . $host . '\',' . 'MASTER_PORT=' . $port * 1 . ',' . 'MASTER_USER=\'' . $user . '\',' . 'MASTER_PASSWORD=\'' . $password . '\',' . 'MASTER_LOG_FILE=\'' . $pos["File"] . '\',' . 'MASTER_LOG_POS=' . $pos["Position"] . ';', $link);
if ($start) {
PMA_Replication_Slave_control("START", null, $link);
}
return $out;
}
示例2: PMA_handleRequestForSlaveSkipError
/**
* handle control requests for Slave Skip Error
*
* @return boolean
*/
function PMA_handleRequestForSlaveSkipError()
{
$count = 1;
if (isset($_REQUEST['sr_skip_errors_count'])) {
$count = $_REQUEST['sr_skip_errors_count'] * 1;
}
$qStop = PMA_Replication_Slave_control("STOP");
$qSkip = $GLOBALS['dbi']->tryQuery("SET GLOBAL SQL_SLAVE_SKIP_COUNTER = " . $count . ";");
$qStart = PMA_Replication_Slave_control("START");
$result = $qStop !== false && $qStop !== -1 && $qSkip !== false && $qSkip !== -1 && $qStart !== false && $qStart !== -1;
return $result;
}
示例3: PMA_handleRequestForSlaveSkipError
/**
* handle control requests for Slave Skip Error
*
* @return NULL
*/
function PMA_handleRequestForSlaveSkipError()
{
$count = 1;
if (isset($_REQUEST['sr_skip_errors_count'])) {
$count = $_REQUEST['sr_skip_errors_count'] * 1;
}
PMA_Replication_Slave_control("STOP");
$GLOBALS['dbi']->tryQuery("SET GLOBAL SQL_SLAVE_SKIP_COUNTER = " . $count . ";");
PMA_Replication_Slave_control("START");
}