本文整理汇总了PHP中TemplateManager::loadTemplateByRemote方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateManager::loadTemplateByRemote方法的具体用法?PHP TemplateManager::loadTemplateByRemote怎么用?PHP TemplateManager::loadTemplateByRemote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateManager
的用法示例。
在下文中一共展示了TemplateManager::loadTemplateByRemote方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$done = true;
if (!$this->_validate()) {
return $this->delete();
}
try {
switch ($this->getData("type")) {
case TASK_SERVER_INIT:
$err = $this->server->initializeForUse();
if (strlen($err) == 0) {
Core::addToTaskLog("Server " . $this->getData("serverID") . " has been initialized.");
} else {
Core::addToTaskLog("Server " . $this->getData("serverID") . " could not be initialized. Reason: {$err}.");
}
break;
case TASK_SERVER_UPDATE:
$server = new PhysicalServer($this->getData('serverID'));
$server->updateServer();
Core::addToTaskLog("Server " . $this->getData("serverID") . " has been updated");
break;
case TASK_SERVER_INSTALL_TEMPLATE:
if (!PhysicalServerManager::existsById($this->getData("serverID"))) {
$this->delete();
}
if (!TemplateManager::existsById($this->getData("addInfo"))) {
$this->delete();
}
$server = new PhysicalServer($this->getData("serverID"));
$template = new Template($this->getData("addInfo"));
$template->installOnServer($server);
Core::addToTaskLog("Template (" . $template->getData("id") . ", " . $template->getData("gameName") . ") installed on server " . $server->getData("id") . " (" . $server->getData("name") . ")");
break;
case TASK_TEMPLATES_INSTALL_FROM_REMOTE:
$template = TemplateManager::loadTemplateByRemote($this->getData("addInfo"));
Core::addToTaskLog("Gameserver templated downloaded. (" . $template->getData("gameName") . ")");
break;
case TASK_GAMESERVER_UPDATESETTINGS:
if (GameserverManager::existsById($this->getData("addInfo"))) {
echo "Updating Config.";
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->settingsUpdateOnServer();
$id = $gameserver->getData("id");
Core::addToTaskLog("Gameserver settings saved. (ID: {$id})");
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_INSTALL:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->install();
$id = $gameserver->getData("id");
Core::addToTaskLog("Gameserver installed. (ID: {$id})");
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_UNINSTALL:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$done = $gameserver->delete();
$id = $gameserver->getData("id");
if ($done) {
Core::addToTaskLog("Gameserver deleted. (ID: {$id})");
}
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_START:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->start();
$id = $gameserver->getData("id");
Core::addToTaskLog("Gameserver started. (ID: {$id})");
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_STOP:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->stop();
$id = $gameserver->getData("id");
Core::addToTaskLog("Gameserver stopped. (ID: {$id})");
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_DISABLE:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->disable();
$id = $gameserver->getData("id");
//.........这里部分代码省略.........