本文整理汇总了PHP中rXMLRPCRequest::getCommandsCount方法的典型用法代码示例。如果您正苦于以下问题:PHP rXMLRPCRequest::getCommandsCount方法的具体用法?PHP rXMLRPCRequest::getCommandsCount怎么用?PHP rXMLRPCRequest::getCommandsCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rXMLRPCRequest
的用法示例。
在下文中一共展示了rXMLRPCRequest::getCommandsCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: correct
public function correct()
{
$toCorrect = array();
$req = new rXMLRPCRequest(new rXMLRPCCommand("d.multicall", array("", getCmd("d.get_hash="), getCmd("d.get_throttle_name="), getCmd('cat') . '=$' . getCmd("get_throttle_up_max") . '=$' . getCmd("d.get_throttle_name="), getCmd('cat') . '=$' . getCmd("get_throttle_down_max") . '=$' . getCmd("d.get_throttle_name="))));
if ($req->run() && !$req->fault) {
for ($i = 0; $i < count($req->val); $i += 4) {
if (substr($req->val[$i + 1], 0, 4) == "thr_") {
$no = intval(substr($req->val[$i + 1], 4));
if ($req->val[$i + 2] === "-1" && $req->val[$i + 3] === "-1" && $this->isThrottled($no)) {
$toCorrect[$req->val[$i]] = $req->val[$i + 1];
}
}
}
if ($this->init()) {
$req = new rXMLRPCRequest();
foreach ($toCorrect as $hash => $name) {
$req->addCommand(new rXMLRPCCommand("branch", array($hash, getCmd("d.is_active="), getCmd('cat') . '=$' . getCmd("d.stop") . '=,$' . getCmd("d.set_throttle_name=") . $name . ',$' . getCmd('d.start='), getCmd('d.set_throttle_name=') . $name)));
}
if ($req->getCommandsCount()) {
return $req->run() && !$req->fault;
}
return true;
}
}
return false;
}
示例2: rXMLRPCRequest
$req = new rXMLRPCRequest();
foreach ($vs as $ndx => $v) {
if ($ss[$ndx][0] == 'n') {
$v = floatval($v);
}
if ($ss[$ndx] == "sdirectory" && !rTorrentSettings::get()->correctDirectory($v)) {
continue;
}
if ($ss[$ndx] == "ndht") {
$cmd = new rXMLRPCCommand('dht', $v == 0 ? "disable" : "auto");
} else {
$cmd = new rXMLRPCCommand('set_' . substr($ss[$ndx], 1), $v);
}
$req->addCommand($cmd);
}
if ($req->getCommandsCount()) {
if ($req->success()) {
$result = $req->val;
}
} else {
$result = array();
}
break;
case "setprops":
$req = new rXMLRPCRequest();
foreach ($ss as $ndx => $s) {
if ($s == "superseed") {
$conn = $vs[$ndx] != 0 ? "initial_seed" : "seed";
$cmd = new rXMLRPCCommand("branch", array($hash[0], getCmd("d.is_active="), getCmd("cat") . '=$' . getCmd("d.stop=") . ',$' . getCmd("d.close=") . ',$' . getCmd("d.set_connection_seed=") . $conn . ',$' . getCmd("d.open=") . ',$' . getCmd("d.start="), getCmd("d.set_connection_seed=") . $conn));
} else {
if ($s == "ulslots") {
示例3: checkLabels
public function checkLabels($hashes)
{
$req = new rXMLRPCRequest();
foreach ($hashes as $hash) {
$req->addCommand(new rXMLRPCCommand("d.get_custom1", $hash));
$req->addCommand(new rXMLRPCCommand("d.get_state", $hash));
$req->addCommand(new rXMLRPCCommand("d.views", $hash));
$req->addCommand(new rXMLRPCCommand("d.get_throttle_name", $hash));
}
if ($req->getCommandsCount() && $req->success()) {
$out = new rXMLRPCRequest();
foreach ($hashes as $ndx => $hash) {
$label = rawurldecode($req->val[$ndx * 4]);
$state = !empty($req->val[$ndx * 4 + 1]);
$ratio = null;
if (preg_match('`rat_(\\d+)`', $req->val[$ndx * 4 + 2], $matches)) {
$ratio = 'rat_' . $matches[1];
}
$throttle = $req->val[$ndx * 4 + 3];
$trackers = '';
$req1 = new rXMLRPCRequest(array(new rXMLRPCCommand("t.multicall", array($hash, "", getCmd("t.get_url=")))));
if ($req1->success()) {
$trackers = implode('#', $req1->val);
}
$rule = $this->getRule($label, $trackers);
if ($rule) {
if (!empty($rule->channel) && $rule->channel != $throttle) {
if ($state) {
$out->addCommand(new rXMLRPCCommand('d.stop', $hash));
}
$out->addCommand(new rXMLRPCCommand('d.set_throttle_name', array($hash, $rule->channel)));
if ($state) {
$out->addCommand(new rXMLRPCCommand('d.start', $hash));
}
}
if (!empty($rule->ratio) && $rule->ratio != $ratio) {
if (!is_null($ratio)) {
$out->addCommand(new rXMLRPCCommand('view.set_not_visible', array($hash, $ratio)));
$out->addCommand(new rXMLRPCCommand('d.views.remove', array($hash, $ratio)));
}
$out->addCommand(new rXMLRPCCommand('d.views.push_back_unique', array($hash, $rule->ratio)));
$out->addCommand(new rXMLRPCCommand('view.set_visible', array($hash, $rule->ratio)));
}
}
}
if ($out->getCommandsCount()) {
$out->run();
}
}
}
示例4: correct
public function correct()
{
$cmd = new rXMLRPCCommand("d.multicall", array("default", getCmd("d.get_hash=")));
for ($i = 0; $i < MAX_RATIO; $i++) {
$cmd->addParameters(array(getCmd("d.views.has") . "=rat_" . $i, getCmd("view.set_not_visible") . "=rat_" . $i));
}
$req = new rXMLRPCRequest($cmd);
$req->setParseByTypes();
if ($req->success()) {
$req1 = new rXMLRPCRequest();
foreach ($req->strings as $no => $hash) {
for ($i = 0; $i < MAX_RATIO; $i++) {
if ($req->i8s[$no * MAX_RATIO * 2 + $i * 2] == 1) {
$req1->addCommand(new rXMLRPCCommand("view.set_visible", array($hash, "rat_" . $i)));
}
}
}
return $req1->getCommandsCount() == 0 || $req1->success();
}
return false;
}